public void UpdateForChangedVoxel(VoxelCell changedVoxel) { SolutionState state = FirstState.GetWithChangedCell(changedVoxel); StateHistory.Clear(); StateHistory.Add(state); }
private FirstState() { if (_instance != null) { return; } _instance = this; }
public DetectorFocus() { _stateOut = new OutState(this, this); _stateFirst = new FirstState(this, this); _stateEquals = new EqualsState(this, this); _stateChange = new ChangeState(this, this); _stateCurrent = _stateOut; }
public TurnStateManager(TurnManager owner) : base(owner) { firstState = new FirstState(this); playerStartState = new PlayerStartState(this); playerTurnState = new PlayerTurnState(this); playerEndState = new PlayerEndState(this); enemyStartState = new EnemyStartState(this); enemyEndState = new EnemyEndState(this); resultState = new ResultState(this); current = firstState; }
public static void UseState() { var firstState = new FirstState(); var context = new Context(firstState); context.FirstAction(); context.SecondAction(); context.ThirdAction(); context.SecondAction(); context.FirstAction(); context.ThirdAction(); }
public void Work() { IState firstState = new FirstState(); IContext context = new Context(firstState); for (int i = 0; i < 4; i++) { context.DoSomething(); context.DoSomething1(); Console.WriteLine(); } IState secondState = new SecondState(); context.SetState(secondState); context.DoSomething(); context.DoSomething1(); }
public BusyContainerStackViewModel(ILogger logger) { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); Content = new StackBusyState(); FirstStateCommands = new List <IUICommand> { new RelayUICommand(() => FirstState = Content.Push("First state title", "First state description"), () => FirstState == null) { Title = "Initialize" }, new RelayUICommand(() => { FirstState.Dispose(); FirstState = null; }, () => FirstState != null) { Title = "Reset" }, new RelayUICommand(async() => await PayloadBackgroundOperation(FirstState), () => FirstState != null) { Title = "Payload" } }; SecondStateCommands = new List <IUICommand> { new RelayUICommand(() => SecondState = Content.Push("Second state title", "Second state description"), () => SecondState == null) { Title = "Initialize" }, new RelayUICommand(() => { SecondState.Dispose(); SecondState = null; }, () => SecondState != null) { Title = "Reset" } }; ThirdStateCommands = new List <IUICommand> { new RelayUICommand(() => ThirdState = Content.Push("Third state title", "Third state description"), () => ThirdState == null) { Title = "Initialize" }, new RelayUICommand(() => { ThirdState.Dispose(); ThirdState = null; }, () => ThirdState != null) { Title = "Reset" } }; }
internal void ChangeState(FirstState instance) { throw new NotImplementedException(); }