Ejemplo n.º 1
0
        void LeftMenu_Inputed(IFocusable sender, InputEventArgs args)
        {
            if (args.InputInfo.IsPressed(ButtonType.Cross))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Triangle))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Circle))
            {
                switch (mode)
                {
                case Mode.SongSelect:
                    if (songSelectComponent == null)
                    {
                        songSelectComponent = new SongSelectComponent(device, resourceManager, sound, this, movieManager);
                        songSelectComponent.SongSelected += songSelectComponent_SongSelected;
                        songSelectSprite.InsertChild(songSelectComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(songSelectComponent);
                    break;

                case Mode.GameRule:
                    if (gameRuleComponent == null)
                    {
                        gameRuleComponent              = new GameRuleComponent(device, resourceManager, sound);
                        gameRuleComponent.RuleChanged += gameRuleComponent_RuleChanged;
                        gameRuleSprite.InsertChild(gameRuleComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(gameRuleComponent);
                    break;

                case Mode.UserManage:
                    if (userSelectComponent == null)
                    {
                        userSelectComponent = new UserSelectComponent(device, resourceManager, sound, users);
                        userSelectComponent.ChangeLeader += userSelectComponent_ChangeLeader;
                        userSelectComponent.KickUser     += userSelectComponent_KickUser;
                        userSelectSprite.InsertChild(userSelectComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(userSelectComponent);
                    break;

                case Mode.ItemSetting:
                    if (itemSettingComponent == null)
                    {
                        itemSettingComponent = new ItemSettingComponent(device, resourceManager, sound);
                        itemSettingSprite.InsertChild(itemSettingComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(itemSettingComponent);
                    break;

                case Mode.TryToPlayGame:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.RemoveFocus();
                    OnTryToPlayGame();
                    break;

                case Mode.MuteSE:
                    sound.Play(PPDSetting.DefaultSounds[3], -1000);
                    MuteSE = !MuteSE;
                    (back[(int)mode] as TextureString).Text = String.Format("{0}:{1}", Utility.Language["MuteSE"], MuteSE ? Utility.Language["ON"] : Utility.Language["OFF"]);
                    break;

                case Mode.Connect:
                    sound.Play(PPDSetting.DefaultSounds[3], -1000);
                    Connect = !Connect;
                    (back[(int)mode] as TextureString).Text = String.Format("{0}:{1}", Utility.Language["Connect"], Connect ? Utility.Language["ON"] : Utility.Language["OFF"]);
                    SkinSetting.Setting.Connect             = Connect;
                    break;

                case Mode.ShowResult:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    if (ShowResult != null)
                    {
                        ShowResult.Invoke(this, EventArgs.Empty);
                    }
                    break;

                case Mode.UpdateDB:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    if (UpdateScoreDB != null)
                    {
                        UpdateScoreDB.Invoke(this, EventArgs.Empty);
                    }
                    break;

                case Mode.Mod:
                    if (modPanel == null)
                    {
                        modPanel = new ModPanel(device, gameHost, resourceManager, sound, allowedModList);
                        modSprite.InsertChild(modPanel, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(modPanel);
                    break;

                case Mode.Finish:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    var confirmComponent = new ConfirmComponent(device, resourceManager, Utility.Path, Utility.Language["FinishConfirm"], Utility.Language["Yes"], Utility.Language["No"], Utility.Language["OK"], ConfirmComponent.ConfirmButtonType.YesNo);
                    confirmComponent.LostFocused += confirmComponent_LostFocused;
                    this.InsertChild(confirmComponent, 0);
                    FocusManager.Focus(confirmComponent);
                    break;
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Up))
            {
                mode--;
                while (true)
                {
                    if (mode < 0)
                    {
                        mode = (Mode)(enables.Length - 1);
                    }

                    if (enables[(int)mode])
                    {
                        break;
                    }
                    mode--;
                }
                sound.Play(PPDSetting.DefaultSounds[0], -1000);
            }
            else if (args.InputInfo.IsPressed(ButtonType.Down))
            {
                mode++;
                while (true)
                {
                    if ((int)mode >= enables.Length)
                    {
                        mode = Mode.SongSelect;
                    }

                    if (enables[(int)mode])
                    {
                        break;
                    }
                    mode++;
                }
                sound.Play(PPDSetting.DefaultSounds[0], -1000);
            }

            select.Position = new Vector2(select.Position.X, selectDiffY + back[(int)mode].Position.Y);
        }