Exemplo n.º 1
0
        public override bool Load()
        {
            myGame = GameHost as MyGame;

            this.AddChild((allSlideSprite = new SpriteObject(device)));

            firstSprite = new SlideSprite(device, ResourceManager, Sound)
            {
                FirstSlide = true
            };

            firstSprite.AddSelection(Utility.Language["Exit"]);
            firstSprite.AddSelection(Utility.Language["Back"]);
            firstSprite.AddSelection(Utility.Language["KeyAndButtonSetting"]);
            firstSprite.AddSelection(Utility.Language["VolumeSetting"]);
            firstSprite.AddSelection(Utility.Language["GoHome"]);

            allSlideSprite.AddChild(firstSprite);

            focusManager = new FocusManager();
            focusManager.Focus(firstSprite);

            firstSprite.Selected += slideSprite_Selected;
            this.MouseRightClick += CloseOverlay_MouseRightClick;

            this.AddChild(new RectangleComponent(device, ResourceManager, PPDColors.Black)
            {
                Alpha           = 0.65f,
                RectangleHeight = 450,
                RectangleWidth  = 800
            });
            return(true);
        }
Exemplo n.º 2
0
        void keyButtonSprite_Selected(object sender, EventArgs e)
        {
            currentIndex++;
            RemoveNext();

            var keyButtonSprite = sender as SlideSprite;

            switch (keyButtonSprite.CurrentSelection)
            {
            case 0:
                var changeControllerSprite = new SlideSprite(device, ResourceManager, Sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                changeControllerSprite.Selected    += changeControllerSprite_Selected;
                changeControllerSprite.LostFocused += slideSprite_LostFocused;
                myGame.Input.Load();

                for (int i = 0; i < myGame.Input.JoyStickCount; i++)
                {
                    changeControllerSprite.AddSelection(myGame.Input.JoyStickNames[i]);
                }

                if (myGame.Input.JoyStickCount == 0)
                {
                    changeControllerSprite.AddChild(new TextureString(device, Utility.Language["NoController"], 18, true, PPDColors.White)
                    {
                        Position = new Vector2(400, 220)
                    });
                }
                else
                {
                    changeControllerSprite.CurrentSelection = myGame.Input.CurrentJoyStickIndex;
                }

                allSlideSprite.AddChild(changeControllerSprite);
                focusManager.Focus(changeControllerSprite);
                break;

            case 1:
                var changeProfileSprite = new SlideSprite(device, ResourceManager, Sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                changeProfileSprite.Selected    += changeProfileSprite_Selected;
                changeProfileSprite.LostFocused += slideSprite_LostFocused;

                for (int i = 0; i < myGame.KeyConfigManager.Configs.Length; i++)
                {
                    changeProfileSprite.AddSelection(myGame.KeyConfigManager.Configs[i].Name);
                }
                changeProfileSprite.CurrentSelection = myGame.KeyConfigManager.CurrentConfigIndex;

                allSlideSprite.AddChild(changeProfileSprite);
                focusManager.Focus(changeProfileSprite);

                break;
            }
        }
Exemplo n.º 3
0
        void slideSprite_Selected(object sender, EventArgs e)
        {
            if (!Focused && !OverFocused)
            {
                return;
            }

            var firstSprite = sender as SlideSprite;

            currentIndex++;
            RemoveNext();
            switch (firstSprite.CurrentSelection)
            {
            case 0:
                var keyButtonSprite = new SlideSprite(device, resourceManager, sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                keyButtonSprite.Selected    += keyButtonSprite_Selected;
                keyButtonSprite.LostFocused += slideSprite_LostFocused;
                keyButtonSprite.AddSelection(Utility.Language["AssingKeyButton"]);
                keyButtonSprite.AddSelection(Utility.Language["ChangeCurrentController"]);
                keyButtonSprite.AddSelection(Utility.Language["ChangeCurrentSetting"]);
                allSlideSprite.AddChild(keyButtonSprite);
                FocusManager.Focus(keyButtonSprite);
                break;

            case 1:
                var accountSprite = new SlideSprite(device, resourceManager, sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                accountSprite.Selected    += accountSprite_Selected;
                accountSprite.LostFocused += slideSprite_LostFocused;
                accountSprite.AddSelection(WebManager.Instance.IsLogined ? Utility.Language["Logout"] : Utility.Language["Login"]);
                allSlideSprite.AddChild(accountSprite);
                FocusManager.Focus(accountSprite);
                break;

            case 2:
                var changeVolumeSprite = new ChangeVolumeSprite(device, resourceManager, myGame, sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                changeVolumeSprite.LostFocused += slideSprite_LostFocused;
                allSlideSprite.AddChild(changeVolumeSprite);
                FocusManager.Focus(changeVolumeSprite);
                break;
            }
        }
Exemplo n.º 4
0
        void slideSprite_Selected(object sender, EventArgs e)
        {
            var slideSprite = sender as SlideSprite;

            switch (slideSprite.CurrentSelection)
            {
            case 0:
                GameHost.Exit();
                break;

            case 1:
                GameHost.CancelExit();
                break;

            case 2:
                currentIndex++;
                RemoveNext();

                var keyButtonSprite = new SlideSprite(device, ResourceManager, Sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                keyButtonSprite.Selected    += keyButtonSprite_Selected;
                keyButtonSprite.LostFocused += slideSprite_LostFocused;
                keyButtonSprite.AddSelection(Utility.Language["ChangeCurrentController"]);
                keyButtonSprite.AddSelection(Utility.Language["ChangeCurrentSetting"]);
                allSlideSprite.AddChild(keyButtonSprite);
                focusManager.Focus(keyButtonSprite);
                break;

            case 3:
                currentIndex++;
                RemoveNext();

                var changeVolumeSprite = new ChangeVolumeSprite(device, ResourceManager, myGame, Sound)
                {
                    Position = new SharpDX.Vector2(800 * currentIndex, 0)
                };
                changeVolumeSprite.LostFocused += slideSprite_LostFocused;
                allSlideSprite.AddChild(changeVolumeSprite);
                focusManager.Focus(changeVolumeSprite);
                break;

            case 4:
                GameHost.GoHome();
                break;
            }
        }
Exemplo n.º 5
0
        public override void Load()
        {
            OnLoadProgressed(0);
            this.AddChild((allSlideSprite = new SpriteObject(device)));
            OnLoadProgressed(10);
            firstSprite = new SlideSprite(device, resourceManager, sound)
            {
                FirstSlide = true
            };
            OnLoadProgressed(40);
            firstSprite.AddSelection(Utility.Language["KeyAndButtonSetting"]);
            OnLoadProgressed(60);
            firstSprite.AddSelection(Utility.Language["AccountSetting"]);
            firstSprite.AddSelection(Utility.Language["VolumeSetting"]);
            allSlideSprite.AddChild(firstSprite);
            OnLoadProgressed(90);

            firstSprite.Selected += slideSprite_Selected;
            GotFocused           += SettingPanel_GotFocused;
            OnLoadProgressed(100);
        }