Esempio n. 1
0
 /// <summary>
 /// 警告メッセージを処理する。
 /// </summary>
 /// <param name="message">[Nullable] メッセージ</param>
 public void DoWarning(string message)
 {
     WarningAction?.Invoke(message);
 }
Esempio n. 2
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <returns></returns>
    private async void Start()
    {
        _actions = new List <ActionBase>();
        Naukri.IO.GetStage(out _actions, GameArgs.CurrentStage);
        Stack <int> currentLoops = new Stack <int>();

        for (int i = 0; i < _actions.Count; i++)
        {
            switch (_actions[i].Type)
            {
            case ActionType.Train:
            {
                await _actions[i].As <TrainAction>().DoActionAsync(transform.GetComponent <CoreBase>());
                break;
            }

            case ActionType.Delay:
            {
                await _actions[i].DoActionAsync();
                break;
            }

            case ActionType.Loop:
            {
                _actions[i].As <LoopAction>().currentLoopTime = _actions[i].As <LoopAction>().LoopTimes;
                currentLoops.Push(i);
                break;
            }

            case ActionType.EndLoop:
            {
                int j = currentLoops.Peek();
                _actions[j].As <LoopAction>().currentLoopTime--;
                if (_actions[j].As <LoopAction>().currentLoopTime > 0)
                {
                    i = j;
                }
                else
                {
                    currentLoops.Pop();
                }
                break;
            }

            case ActionType.LevelUp:
            {
                var war = new WarningAction();
                war.WarningType = WarningType.LevelUp;
                war.DoAction();
                _actions[i].As <LevelUpAction>().DoAction(transform.GetComponent <CoreBase>());
                break;
            }

            case ActionType.Warning:
            {
                _actions[i].As <WarningAction>().DoAction();
                break;
            }

            case ActionType.BossWave:
            {
                var war = new WarningAction();
                var obj = Prefabs.Instantiate(_actions[i].As <BossWaveAction>().Identify);
                war.CustomText = obj.GetComponent <CoreBase>().Details.Name;
                Destroy(obj);
                war.WarningType = WarningType.BossWave;
                war.DoAction();
                await _actions[i].As <BossWaveAction>().DoActionAsync(transform.GetComponent <CoreBase>());
                break;
            }

            case ActionType.ChickenRain:
            {
                var war = new WarningAction();
                var obj = Prefabs.Instantiate(_actions[i].As <ChickenRainAction>().Identify);
                war.CustomText = obj.GetComponent <CoreBase>().Details.Name;
                Destroy(obj);
                war.WarningType = WarningType.ChickenRain;
                war.DoAction();
                await _actions[i].As <ChickenRainAction>().DoActionAsync();
                break;
            }
            }
        }
    }
Esempio n. 3
0
 public Button(string buttonName, WarningAction action)
 {
     this.buttonName           = buttonName;
     this.buttonPressedAction += action;
 }