Exemplo n.º 1
0
        public override void Tick(float dt)
        {
            base.Tick(dt);


            if (Input2.GamePad0.Cross.Press)
            {
                acceptChoice();
            }



            if (Input2.GamePad0.Left.Press)
            {
                if (menuSelection == 0)
                {
                    menuSelection = 2;
                }
                else
                {
                    menuSelection--;
                }
            }

            if (Input2.GamePad0.Right.Press)
            {
                if (menuSelection == 2)
                {
                    menuSelection = 0;
                }
                else
                {
                    menuSelection++;
                }
            }

            if (Input2.Touch00.Down)
            {
                if (sprite_button_newgame.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
                {
                    menuSelection = 0;
                }
                else if (sprite_button_tutorial.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
                {
                    menuSelection = 1;
                }
                else if (sprite_button_autoaim.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
                {
                    menuSelection = 2;
                }
            }

            if (Input2.Touch00.Release)
            {
                if (sprite_button_newgame.IsWorldPointInsideContentLocalBounds(GetTouchPos()) ||
                    sprite_button_tutorial.IsWorldPointInsideContentLocalBounds(GetTouchPos()) ||
                    sprite_button_autoaim.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
                {
                    acceptChoice();
                }
            }



            switch (menuSelection)
            {
            case 0:
                sprite_button_newgame.Color  = Colors.Orange;
                sprite_button_autoaim.Color  = Colors.White;
                sprite_button_tutorial.Color = Colors.White;
                sprite_button_newgame.Scale  = sprite_button_newgame.TextureInfo.TextureSizef * 1.3f;
                sprite_button_autoaim.Scale  = sprite_button_autoaim.TextureInfo.TextureSizef * 1.2f;
                sprite_button_tutorial.Scale = sprite_button_tutorial.TextureInfo.TextureSizef * 1.2f;
                break;

            case 1:
                sprite_button_newgame.Color  = Colors.White;
                sprite_button_autoaim.Color  = Colors.White;
                sprite_button_tutorial.Color = Colors.Orange;
                sprite_button_newgame.Scale  = sprite_button_newgame.TextureInfo.TextureSizef * 1.2f;
                sprite_button_autoaim.Scale  = sprite_button_autoaim.TextureInfo.TextureSizef * 1.2f;
                sprite_button_tutorial.Scale = sprite_button_tutorial.TextureInfo.TextureSizef * 1.3f;
                break;

            case 2:
                sprite_button_newgame.Color  = Colors.White;
                sprite_button_autoaim.Color  = Colors.Orange;
                sprite_button_tutorial.Color = Colors.White;
                sprite_button_newgame.Scale  = sprite_button_newgame.TextureInfo.TextureSizef * 1.2f;
                sprite_button_autoaim.Scale  = sprite_button_autoaim.TextureInfo.TextureSizef * 1.3f;
                sprite_button_tutorial.Scale = sprite_button_tutorial.TextureInfo.TextureSizef * 1.2f;
                break;
            }
        }
Exemplo n.º 2
0
        public override void Tick(float dt)
        {
            base.Tick(dt);

            if (Input2.GamePad0.Up.Press)
            {
                menuSelection = (menuSelection + 1) % 2;
            }
            if (Input2.GamePad0.Down.Press)
            {
                menuSelection = (int)FMath.Abs((menuSelection - 1) % 2);
            }

            if (Input2.GamePad0.Cross.Press)
            {
                switch (menuSelection)
                {
                case 0:
                    SceneManager.Instance.popScene();
                    break;

                case 1:
                    SceneManager.Instance.popScene();

                    Game.Instance.paused = false;
                    Game.Instance.OnExit();
                    SceneManager.Instance.changeSceneTo(MainMenu.Instance);
                    break;
                }
            }

            if (Input2.Touch00.Down && sprite_button_returntogame.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
            {
                menuSelection = 0;
            }
            else if (Input2.Touch00.Down && sprite_button_returntomenu.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
            {
                menuSelection = 1;
            }


            switch (menuSelection)
            {
            case 0:
                sprite_button_returntogame.Scale = sprite_button_returntogame.TextureInfo.TextureSizef * 1.7f;
                sprite_button_returntogame.Color = new Vector4(1.0f, 1.0f, 0.0f, 1.0f);
                sprite_button_returntomenu.Scale = sprite_button_returntomenu.TextureInfo.TextureSizef * 1.5f;
                sprite_button_returntomenu.Color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
                break;

            case 1:
                sprite_button_returntogame.Scale = sprite_button_returntogame.TextureInfo.TextureSizef * 1.5f;
                sprite_button_returntogame.Color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
                sprite_button_returntomenu.Scale = sprite_button_returntomenu.TextureInfo.TextureSizef * 1.7f;
                sprite_button_returntomenu.Color = new Vector4(1.0f, 1.0f, 0.0f, 1.0f);
                break;
            }

            if (Input2.Touch00.Release && sprite_button_returntogame.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
            {
                SceneManager.Instance.popScene();
            }
            else if (Input2.Touch00.Release && sprite_button_returntomenu.IsWorldPointInsideContentLocalBounds(GetTouchPos()))
            {
                Game.Instance.paused = false;
                Game.Instance.OnExit();
                SceneManager.Instance.changeSceneTo(MainMenu.Instance);
            }
        }