减少我的故事功能,并允许参数推进故事

时间:2015-06-01 17:07:18

标签: javascript

我目前的职能:

function storyAdvance(){
    document.getElementById("story").innerHTML="";
    story="";
    if (storyStage==0){
        story="<<Get Time>> SYSTEM TIME 3Y;345D;4x10^3AD || EARTH TIME : N/A <<END>>";
        printLetterByLetter("story", story, 20);
        storyStage=1;
    }
    else if (storyStage==1){
        story="<<Send || Class : Report || Priority : 0>> $?Begin? Resources : Present // Surface // SubSurface // Deep || Water : Present // Surface // SubSurface || Life : Present // Class2 // DangerToLife || Assesment : Disengage // ## Reason: Following protocol 23-60-555 automatic disengage in progress, full distruction of presence of colony waiting confirmation. ##$ <<END>> ";
        printLetterByLetter("story", story, 1);
    storyStage=2;
    }
    else if (storyStage==2){
    story= "<<Reply || Class : Orders || Priority : 14 || ##EXECUTE IMMIDIATLY## ||EstTravelTime : 1.23x10^6 Y>>$?Begin? Operation : ##Last Hope## || Override : Active || Orders : ##Prepare for sustained population in excess of 1 million persons, adequet materials must be present, disregard life readings.##$<END>>";
    printLetterByLetter("story", story, 1);
    storyStage = 3;
    }
    else if (storyStage==3){
    document.getElementById("push").style.display="none";
    document.getElementById("resourceGrid").style.display="table";
    document.getElementById("mineTitle").style.display="block";
    fadeIn("mineTitle", 20);
    fadeIn("teirIresources", 20);
    document.getElementById("story").style.opacity=0;
    storyStage = 4;
    }
}

我的功能目前有效,因为当你点击它调用该功能的屏幕时。但是,我希望能够在不必更改所有if语句的情况下更改故事。因此,最好,我希望top只需更改函数中的消息,而不必更改整个订单。

0 个答案:

没有答案