Exemple #1
0
        private Navigation _playTick(UserAction userAction)
        {
            switch (userAction)
            {
            case UserAction.Enter:
                _board.SelectCursorPosition(_currentPlayer);
                break;

            case UserAction.Start:
                var command = new SaveMatchCommand(this);
                return(new Navigation(NavigationAction.Push, new MatchStartMenu(command)));

            case UserAction.ToggleTheme:
                _board.ToggleTheme();
                break;

            case UserAction.FlipBoard:
                _board.FlipBoard();
                break;

            case UserAction.Undo:
                _history.Back(_board);
                break;

            case UserAction.Redo:
                _history.Forward(_board);
                break;

            default:
                _board.MoveCursor(userAction);
                break;
            }

            return(new Navigation(NavigationAction.Null, NullGameComponent.GetInstance()));
        }
        public static NullGameComponent GetInstance()
        {
            if (_instance == null)
            {
                _instance = new NullGameComponent();
            }

            return(_instance);
        }
Exemple #3
0
        private Navigation _handleEnter()
        {
            var option = Options[OptionsIndex];

            switch (option)
            {
            case "Save":
                _saveMatchCommand.Execute();
                return(new Navigation(NavigationAction.Close, NullGameComponent.GetInstance()));

            case "Close":
                return(new Navigation(NavigationAction.Close, NullGameComponent.GetInstance()));

            default:
                return(new Navigation(NavigationAction.Null, NullGameComponent.GetInstance()));
            }
        }
Exemple #4
0
        public override Navigation HandleUserAction(UserAction userAction)
        {
            switch (userAction)
            {
            case UserAction.Enter:
                return(_handleEnter());

            case UserAction.Up:
                OptionsIndex = OptionsIndex == 0 ? Options.Length - 1 : OptionsIndex - 1;
                return(new Navigation(NavigationAction.Null, NullGameComponent.GetInstance()));

            case UserAction.Down:
                OptionsIndex = (OptionsIndex + 1) % Options.Length;
                return(new Navigation(NavigationAction.Null, NullGameComponent.GetInstance()));

            default:
                return(new Navigation(NavigationAction.Null, NullGameComponent.GetInstance()));
            }
        }