Пример #1
0
 protected virtual void OnPhase(CommandPhase phase, string tag, object parameter)
 {
     if (Phase == null)
     {
         return;
     }
     Phase(this, new CommandPhaseEventArgs(phase, tag, parameter));
 }
Пример #2
0
            static int AfterExecuteCallback(CommandRef incommand, CommandPhase inphase, void *inrefcon)
            {
                if (_commandCache.TryGetValue(incommand, out var command) && command != null)
                {
                    var args = new CommandAfterExecuteEventArgs(inphase);
                    command._afterExecute?.Invoke(command, in args);
                }

                return(1);
            }
Пример #3
0
            static int BeforeExecuteCallback(CommandRef incommand, CommandPhase inphase, void *inrefcon)
            {
                if (_commandCache.TryGetValue(incommand, out var command) && command != null)
                {
                    var args = new CommandBeforeExecuteEventArgs(inphase);
                    command._beforeExecute?.Invoke(command, ref args);
                    return(args.Handled ? 0 : 1);
                }

                return(1);
            }
        public CommandSelectFSM(PlayerBattleController controller)
        {
            data.commandStack     = new Stack <EventSelectionPanel>();
            data.playerController = controller;
            data.battleManager    = BattleManager.instance;
            data.battleHUD        = BattleManager.BattleHUD;

            typeToState.Add(CommandPhase.WaitingForInput, new WaitingForInputCommandState(data));
            typeToState.Add(CommandPhase.SelectingCommand, new SelectingCommandState(data));
            typeToState.Add(CommandPhase.SelectingTarget, new SelectingTargetCommandState(data));

            currentState = CommandPhase.WaitingForInput;
            currentStateImplementation = typeToState[currentState];
        }
        public void UpdateState(LinkedList <UIActionType> uiInputQueue)
        {
            var input = uiInputQueue.First;

            while (input != null)
            {
                var nextState = currentStateImplementation.OnUpdate(input);
                if (nextState != currentState)
                {
                    currentStateImplementation = typeToState[nextState];
                    currentStateImplementation.OnEnter();
                    currentState = nextState;
                    return;
                }

                input = input.Next;
            }
        }
Пример #6
0
 public static void SetPhase(CommandDecorator source, CommandPhase value)
 {
     source.SetValue(PhaseProperty, value);
 }
Пример #7
0
 public CommandPhaseEventArgs(CommandPhase phase, string tag, object parameter)
 {
     this.Phase     = phase;
     this.Tag       = tag;
     this.Parameter = parameter;
 }
Пример #8
0
 public CommandAfterExecuteEventArgs(CommandPhase commandPhase)
 {
     CommandPhase = commandPhase;
 }
Пример #9
0
 public CommandBeforeExecuteEventArgs(CommandPhase commandPhase)
 {
     CommandPhase = commandPhase;
     Handled      = false;
 }