Exemplo n.º 1
0
            public void UpdateForChangedVoxel(VoxelCell changedVoxel)
            {
                SolutionState state = FirstState.GetWithChangedCell(changedVoxel);

                StateHistory.Clear();
                StateHistory.Add(state);
            }
Exemplo n.º 2
0
 private FirstState()
 {
     if (_instance != null)
     {
         return;
     }
     _instance = this;
 }
Exemplo n.º 3
0
        public DetectorFocus()
        {
            _stateOut    = new OutState(this, this);
            _stateFirst  = new FirstState(this, this);
            _stateEquals = new EqualsState(this, this);
            _stateChange = new ChangeState(this, this);

            _stateCurrent = _stateOut;
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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"
                }
            };
        }
Exemplo n.º 8
0
 internal void ChangeState(FirstState instance)
 {
     throw new NotImplementedException();
 }