protected virtual void OnPhase(CommandPhase phase, string tag, object parameter) { if (Phase == null) { return; } Phase(this, new CommandPhaseEventArgs(phase, tag, parameter)); }
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); }
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; } }
public static void SetPhase(CommandDecorator source, CommandPhase value) { source.SetValue(PhaseProperty, value); }
public CommandPhaseEventArgs(CommandPhase phase, string tag, object parameter) { this.Phase = phase; this.Tag = tag; this.Parameter = parameter; }
public CommandAfterExecuteEventArgs(CommandPhase commandPhase) { CommandPhase = commandPhase; }
public CommandBeforeExecuteEventArgs(CommandPhase commandPhase) { CommandPhase = commandPhase; Handled = false; }