Exemplo n.º 1
0
        public void MouseButtonPressed(object sender, MouseButtonEventArgs e)
        {
            // szukanie najechanego juz kursorem przycisku
            var hoveredButton = Buttons.Where(b => b.State == CursorState.HOVERED)
                                .FirstOrDefault();

            if (hoveredButton != null)
            {
                view.ExitAnimation();
                Assets.Sounds[(int)GameSound.SOUNDTRACK].Stop();

                switch (hoveredButton.Action)
                {
                case "PLAY":
                    ControllerManager.ChangeController(new GameController());
                    break;

                case "HELP":
                    ControllerManager.ChangeController(new HelpController());
                    break;

                case "ABOUT":
                    ControllerManager.ChangeController(new AboutController());
                    break;

                case "EXIT":
                    Exit();
                    break;
                }
            }
        }
Exemplo n.º 2
0
 protected void OnEnable()
 {
     if (controllerManager == null)
     {
         if (type == ControllerManagers.ControllerType.DEFAULT)
         {
             Debug.LogError("Controllerの派生クラスでtypeが正しく設定されていません");
         }
         if (!ControllerManagers.initiallized)
         {
             ControllerManagers.Init();
         }
         controllerManager = ControllerManagers.controllerManagerDict[type];
     }
     //previousController = controllerManager.nowController;
     controllerManager.ChangeController(this);
 }
Exemplo n.º 3
0
        public void MouseButtonPressed(object sender, MouseButtonEventArgs e)
        {
            var hoveredButton = Buttons.Where(b => b.State == CursorState.HOVERED).FirstOrDefault();

            if (hoveredButton != null)
            {
                view.ExitAnimation();

                switch (hoveredButton.Action)
                {
                case "BACK":
                    ControllerManager.ChangeController(new MainController());
                    break;
                }
            }
        }
Exemplo n.º 4
0
        public void Begin(RenderWindow _window)
        {
            window  = _window;
            Player1 = new Player(this, 166, 16, 0);
            Player2 = new Player(this, 598, 448, 1);
            Board   = new Board(this);

            view = new GameView(this, _window);
            view.StartAnimation();

            while (isPlaying && window.IsOpen())
            {
                if (GameEndedTimestamp != -1 && Utils.TimeElapsed(GameEndedTimestamp, 3000))
                {
                    isPlaying = false;
                }

                window.DispatchEvents();
                view.Update();
            }

            view.ExitAnimation(Player1, Player2);
            ControllerManager.ChangeController(new MainController());
        }