public UserCustomizationPresenter()
     : base()
 {
     BrowserPathForHead = new DorCommand((param) => ChangeHead(), (() => true));
     BrowsePathForApple = new DorCommand((param) => ChangeApple(), (() => true));
     BrowsePathForGrass = new DorCommand((param) => ChangeGrass(), (() => true));
 }
Exemple #2
0
 public TickTacToePresenter()
     : base()
 {
     RestartGame = new DorCommand((o) => CreateNewGame(), new Func<bool>(() => true));
     TheGameManager = new GameManger();
     ArrayOfRows = new ObservableCollection<Row>();
     CreateNewGame();
 }
Exemple #3
0
        public SnakesPresenter()
            : base()
        {
            startNewGame();

            RestartGame = new DorCommand((m) => restartGame(), (() => true));
            IsGamePaused = false;
        }
Exemple #4
0
 public GameItem(WpfApplication19.Presenters.GameManger gamingManager, int XPosition, int YPosition)
     : base(gamingManager, XPosition, YPosition)
 {
     Value = values.Empty;
     setValueCommand = new DorCommand((param) => DoSomething(), (() => true));
     _isPartOfWinner = false;
     IsEnabled = true;
 }
Exemple #5
0
        public void startNewGame()
        {
            currentIntervalCounter = 100;
            ImageHelper.changeToDefaults();
            TheGameManager = new NewSnakesGameManager(this);
            ArrayOfItems = new ObservableCollection<BasePresenterItem>();
            TheGameManager.CreateNewGame(ArrayOfItems);
            TheGameManager.CreateFoodItemsInSnakeList(ArrayOfItems);
            TheGameManager.CreateHeadOfSnake(ArrayOfItems);

            StopWatch = new System.Diagnostics.Stopwatch();
            StopWatch.Start();
            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 0, 0, currentIntervalCounter);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();

            MoveSnakeDown = new DorCommand((param) =>
                {
                    var direction = TheGameManager.GetCurrentHeadDirection();
                    if (direction == Direction.Down)
                    {
                        //need to spees things up.
                        SpeedOrSlowUpCurrentIntervalRate(RunningSpeedState.Faster);

                    }
                    else
                    {
                        TheGameManager.setNewGameDirection(Direction.Down, ArrayOfItems);
                    }
                },
                (() => true));
            MoveSnakeLeft = new DorCommand((param) =>
            {
                var direction = TheGameManager.GetCurrentHeadDirection();
                if (direction == Direction.Left)
                {
                    //need to spees things up.
                    SpeedOrSlowUpCurrentIntervalRate(RunningSpeedState.Faster);

                }
                else
                {
                    TheGameManager.setNewGameDirection(Direction.Left, ArrayOfItems);
                }
            },
                (() => true));
            MoveSnakeRight = new DorCommand((param) =>
            {
                var direction = TheGameManager.GetCurrentHeadDirection();
                if (direction == Direction.Right)
                {
                    //need to spees things up.
                    SpeedOrSlowUpCurrentIntervalRate(RunningSpeedState.Faster);

                }
                else
                {
                    TheGameManager.setNewGameDirection(Direction.Right, ArrayOfItems);
                }
            },
                (() => true));
            MoveSnakeUp = new DorCommand((param) =>
            {
                var direction = TheGameManager.GetCurrentHeadDirection();
                if (direction == Direction.Up)
                {
                    //need to spees things up.
                    SpeedOrSlowUpCurrentIntervalRate(RunningSpeedState.Faster);

                }
                else
                {
                    TheGameManager.setNewGameDirection(Direction.Up, ArrayOfItems);
                }
            },
                (() => true));
            SlowDownStuff = new DorCommand((o) => SpeedOrSlowUpCurrentIntervalRate(RunningSpeedState.Slower), (() => true));
            PauseResumeGame = new DorCommand((o) => PauseRestartGame(), (() => true));
        }