Esempio n. 1
0
    private void script2ui(int next)
    {
        if (0 <= next && next < cmdList.Count)
        {
            ScriptCmd scriptCmd = cmdList[next];
            switch (scriptCmd.GetName())
            {
            case "EnableScript":
                break;

            case "ShowDialog":
                break;

            case "PlaySound":
                break;

            case "Exit":
                break;

            case "ShowScript":
                break;

            case "SetMission":
                break;

            case "Sleep":
                floatTmp = ((Sleep)scriptCmd).Howlong.ToString("0.##");
                break;
            }
        }
    }
Esempio n. 2
0
    private bool ui2script(int prev)
    {
        bool result = true;

        if (0 <= prev && prev < cmdList.Count)
        {
            ScriptCmd scriptCmd = cmdList[prev];
            switch (scriptCmd.GetName())
            {
            case "Sleep":
                try
                {
                    if (floatTmp.Length <= 0)
                    {
                        floatTmp = "0";
                    }
                    ((Sleep)scriptCmd).Howlong = float.Parse(floatTmp);
                    return(result);
                }
                catch (Exception ex)
                {
                    MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("FLOAT_PARSE_FAIL"));
                    Debug.LogError(ex.Message.ToString());
                    return(false);
                }
            }
        }
        return(result);
    }
Esempio n. 3
0
    private void ExecuteCommand(ScriptCmd cmd)
    {
        if (cmd != null)
        {
            if (GlobalVars.Instance.tutorFirstScriptOn)
            {
                TutorHelpDialog tutorHelpDialog = (TutorHelpDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TUTORHELP, exclusive: true);
                if (tutorHelpDialog != null)
                {
                    tutorHelpDialog.InitDialog();
                    GlobalVars.Instance.tutorFirstScriptOn = false;
                }
            }
            switch (cmd.GetName())
            {
            case "EnableScript":
                EnableScript(((EnableScript)cmd).Id, ((EnableScript)cmd).Enable);
                break;

            case "ShowDialog":
                ShowDialog(((ShowDialog)cmd).Speaker, ((ShowDialog)cmd).Dialog);
                break;

            case "PlaySound":
                PlaySound(((PlaySound)cmd).Index);
                break;

            case "Sleep":
                Sleep(((Sleep)cmd).Howlong);
                break;

            case "Exit":
                Exit();
                break;

            case "ShowScript":
                ShowScript(((ShowScript)cmd).Id, ((ShowScript)cmd).Visible);
                break;

            case "GiveWeapon":
                GiveWeapon(((GiveWeapon)cmd).WeaponCode);
                break;

            case "TakeAwayAll":
                TakeAwayAll();
                break;

            case "SetMission":
                SetMission(((SetMission)cmd).Progress, ((SetMission)cmd).Title, ((SetMission)cmd).SubTitle, ((SetMission)cmd).Tag);
                break;
            }
        }
    }
Esempio n. 4
0
    private void DoParameters()
    {
        if (0 <= selected && selected < cmdList.Count)
        {
            ScriptCmd scriptCmd = cmdList[selected];
            switch (scriptCmd.GetName())
            {
            case "EnableScript":
                DoEnableScript((EnableScript)scriptCmd);
                break;

            case "ShowDialog":
                DoShowDialog((ShowDialog)scriptCmd);
                break;

            case "PlaySound":
                DoPlaySound((PlaySound)scriptCmd);
                break;

            case "Sleep":
                DoSleep((Sleep)scriptCmd);
                break;

            case "Exit":
                DoExit((Exit)scriptCmd);
                break;

            case "ShowScript":
                DoShowScript((ShowScript)scriptCmd);
                break;

            case "GiveWeapon":
                DoGiveWeapon((GiveWeapon)scriptCmd);
                break;

            case "TakeAwayAll":
                DoTakeAwayAll((TakeAwayAll)scriptCmd);
                break;

            case "SetMission":
                DoSetMission((SetMission)scriptCmd);
                break;
            }
        }
    }