Exemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="cmd"></param>
    /// <param name="args"></param>
    public void Execute(int cmd, object data)
    {
        switch (cmd)
        {
        case CommandConsts.StartDialog:
            _timeSinceStarted = 0;
            break;

        case CommandConsts.CreateDialogCG:
        {
            List <object> datas = data as List <object>;
            CharacterItem item  = new CharacterItem(_containerTf);
            item.Init(datas[0] as string, datas[1] as string, (float)datas[2], (float)datas[3]);
            AddItem(item);
            break;
        }

        case CommandConsts.HighlightDialogCG:
        {
            List <object> datas = data as List <object>;
            CharacterItem item  = GetCGItemByName(datas[0] as string);
            if (item != null)
            {
                item.Highlight((bool)datas[1]);
            }
            break;
        }

        case CommandConsts.FadeOutDialogCG:
        {
            CharacterItem item = GetCGItemByName(data as string);
            if (item != null)
            {
                item.FadeOut();
            }
            break;
        }

        case CommandConsts.CreateDialogBox:
        {
            List <object> datas = data as List <object>;
            DialogItem    item  = new DialogItem(_containerTf);
            item.Init((int)datas[0], datas[1] as string, (float)datas[2], (float)datas[3], (int)datas[4], (float)datas[5]);
            AddItem(item);
            break;
        }

        case CommandConsts.DelDialogBox:
            DelDialogItem();
            break;

        case CommandConsts.UpdateDialog:
        {
            int dTime = data == null ? 1 : (int)data;
            UpdateDialog(dTime);
            break;
        }

        case CommandConsts.PauseGame:
            OnSTGPause();
            break;

        case CommandConsts.ContinueGame:
            OnSTGContinue();
            break;

        case CommandConsts.ContinueGameAfterGameOver:
            OnSTGContinue();
            break;

        case CommandConsts.RetryGame:
            OnRetry();
            break;

        case CommandConsts.RetryStage:
            OnRetry();
            break;

        case CommandConsts.BackToTitle:
            OnRetry();
            break;
        }
    }