Beispiel #1
0
        public void Change(ButtonType button)
        {
            if (button == ButtonType.Down || button == ButtonType.Up)
            {
                selectables[(int)state].Selected = false;
                int result = (int)state + (button == ButtonType.Down ? 1 : -1);
                if (result < 0)
                {
                    result = (int)State.Profile;
                }
                if (result > (int)State.Profile)
                {
                    result = 0;
                }
                state = (State)result;
                selectables[(int)state].Selected = true;
            }
            else
            {
                bool isChange = button == ButtonType.Circle || button == ButtonType.Left || button == ButtonType.Right;
                switch (state)
                {
                case State.Auto:
                    if (isChange)
                    {
                        Auto = !Auto;
                    }
                    ExceptSlideAuto &= Auto;
                    break;

                case State.ExceptSlide:
                    if (isChange)
                    {
                        ExceptSlideAuto = !ExceptSlideAuto;
                    }
                    Auto |= ExceptSlideAuto;
                    break;

                case State.Random:
                    if (isChange)
                    {
                        Random = !Random;
                    }
                    break;

                case State.MuteSE:
                    if (isChange)
                    {
                        MuteSE = !MuteSE;
                    }
                    break;

                case State.Connect:
                    if (isChange)
                    {
                        Connect = !Connect;
                    }
                    break;

                case State.PerfectTrial:
                    if (WebManager.Instance.IsLogined)
                    {
                        if (isChange)
                        {
                            PerfectTrial = !PerfectTrial;
                        }
                    }
                    else
                    {
                        var drd = new GeneralDialog(device, resourceManager, sound, Utility.Language["LoginNecessaryForPerfectTrial"]);
                        FocusManager.Focus(drd);
                        this.InsertChild(drd, 0);
                        drd.LostFocused += drd_LostFocused;
                    }
                    break;

                case State.RivalGhost:
                    if (WebManager.Instance.IsLogined)
                    {
                        if (isChange)
                        {
                            RivalGhost = !RivalGhost;
                        }
                    }
                    else
                    {
                        var drd = new GeneralDialog(device, resourceManager, sound, Utility.Language["LoginNecessaryForRivalGhost"]);
                        FocusManager.Focus(drd);
                        this.InsertChild(drd, 0);
                        drd.LostFocused += drd_LostFocused;
                    }
                    break;

                case State.RivalGhostCount:
                    if (isChange)
                    {
                        var isLeft = button == ButtonType.Left;
                        if (isLeft)
                        {
                            selectables[(int)State.RivalGhostCount].Left();
                        }
                        else
                        {
                            selectables[(int)State.RivalGhostCount].Right();
                        }
                    }
                    break;

                case State.Speed:
                    if (isChange)
                    {
                        var isLeft = button == ButtonType.Left;
                        if (isLeft)
                        {
                            selectables[(int)State.Speed].Left();
                        }
                        else
                        {
                            selectables[(int)State.Speed].Right();
                        }
                    }
                    break;

                case State.Profile:
                    if (isChange)
                    {
                        var isLeft = button == ButtonType.Left;
                        if (isLeft)
                        {
                            ProfileManager.Instance.Previous();
                            selectables[(int)State.Profile].Left();
                        }
                        else
                        {
                            selectables[(int)State.Profile].Right();
                            ProfileManager.Instance.Next();
                        }
                    }
                    break;
                }
            }
        }
Beispiel #2
0
        protected override void UpdateImpl()
        {
            if (!loading)
            {
                if (!waitSprite.Hidden)
                {
                    Generate();
                    waitSprite.Hidden = true;
                }
            }
            if (!rectangle.Hidden)
            {
                UpdateScroll();
                rectangle.Position = AnimationUtility.GetAnimationPosition(rectangle.Position, mainSprite.Position + new Vector2(0, ItemHeight * selection));
            }
            if (dialogState != DialogState.None)
            {
                switch (dialogState)
                {
                case DialogState.WaitIncludeFine:
                    var dialog = new GeneralDialog(device, resourceManager, sound, Utility.Language["IncludeFineConfirm"], GeneralDialog.ButtonTypes.YesNo);
                    FocusManager.Focus(dialog);
                    this.InsertChild(dialog, 0);
                    dialog.LostFocused += (sender, e) =>
                    {
                        if (dialog.OK)
                        {
                            UseItem["IncludeFine"] = true;
                        }
                        this.RemoveChild(dialog);
                        dialog.Dispose();
                        if (UseItem.ItemType == ItemType.Auto4 || (UseItem.ContainsParameter("SubItemType") && (ItemType)UseItem["SubItemType"] == ItemType.Auto4))
                        {
                            dialogState = DialogState.WaitUseNotIncludeButton;
                        }
                    };
                    break;

                case DialogState.WaitUseNotIncludeButton:
                    dialog = new GeneralDialog(device, resourceManager, sound, Utility.Language["DumpNotesConfirm"], GeneralDialog.ButtonTypes.YesNo);
                    FocusManager.Focus(dialog);
                    this.InsertChild(dialog, 0);
                    dialog.LostFocused += (sender, e) =>
                    {
                        if (dialog.OK)
                        {
                            UseItem["AllowAllButton"] = true;
                        }
                        this.RemoveChild(dialog);
                        dialog.Dispose();
                        if (UseItem.ItemType == ItemType.Auto4 || (UseItem.ContainsParameter("SubItemType") && (ItemType)UseItem["SubItemType"] == ItemType.Auto4))
                        {
                            dialogState = DialogState.WaitAllowWarnScript;
                        }
                    };
                    break;

                case DialogState.WaitAllowWarnScript:
                    dialog = new GeneralDialog(device, resourceManager, sound, Utility.Language["AllowWarnScriptConfirm"], GeneralDialog.ButtonTypes.YesNo);
                    FocusManager.Focus(dialog);
                    this.InsertChild(dialog, 0);
                    dialog.LostFocused += (sender, e) =>
                    {
                        if (dialog.OK)
                        {
                            UseItem["AllowWarnScript"] = true;
                        }
                        this.RemoveChild(dialog);
                        dialog.Dispose();
                    };
                    break;
                }

                dialogState = DialogState.None;
            }
        }
Beispiel #3
0
        void ReplayListComponent_Inputed(IFocusable sender, InputEventArgs args)
        {
            if (!waitSprite.Hidden)
            {
                return;
            }

            if (args.InputInfo.IsPressed(ButtonType.Cross))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Circle))
            {
                if (mainSprite.ChildrenCount > 0)
                {
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    if (SelectedComponent.SongInfo == null)
                    {
                        var obd = new OpenBrowserDialog(device, resourceManager, sound)
                        {
                            ScoreLibraryId = SelectedComponent.WebSongInfo.Hash
                        };
                        obd.LostFocused += obd_LostFocused;
                        this.InsertChild(obd, 0);
                        FocusManager.Focus(obd);
                    }
                    else
                    {
                        var gd = new GeneralDialog(device, resourceManager, sound, Utility.Language["ReplayConfirm"], GeneralDialog.ButtonTypes.OkCancel);
                        gd.LostFocused += gd_LostFocused;
                        this.InsertChild(gd, 0);
                        FocusManager.Focus(gd);
                    }
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Down))
            {
                if (mainSprite.ChildrenCount > 0)
                {
                    selection++;
                    if (selection >= mainSprite.ChildrenCount)
                    {
                        selection = 0;
                    }
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Up))
            {
                if (mainSprite.ChildrenCount > 0)
                {
                    selection--;
                    if (selection < 0)
                    {
                        selection = mainSprite.ChildrenCount - 1;
                    }
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
        }
Beispiel #4
0
        void ItemComponent_Inputed(IFocusable sender, InputEventArgs args)
        {
            if (!waitSprite.Hidden)
            {
                return;
            }

            if (args.InputInfo.IsPressed(ButtonType.Cross))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Circle))
            {
                if (mainSprite.ChildrenCount > 0 && SelectedComponent.Items.First().IsAvailable)
                {
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    GeneralDialogBase dialog;
                    if (SelectedComponent.ItemType == ItemType.AutoFreePass)
                    {
                        dialog = new SuperAutoDialog(device, resourceManager, sound,
                                                     String.Format(Utility.Language["UseItemConfirm"],
                                                                   Utility.Language[String.Format("Item{0}Name", ((ItemsComponent)mainSprite.GetChildAt(selection)).Items[0].ItemType)]));
                    }
                    else
                    {
                        dialog = new GeneralDialog(device, resourceManager, sound,
                                                   String.Format(Utility.Language["UseItemConfirm"],
                                                                 Utility.Language[String.Format("Item{0}Name", ((ItemsComponent)mainSprite.GetChildAt(selection)).Items[0].ItemType)]), GeneralDialog.ButtonTypes.OkCancel);
                    }
                    FocusManager.Focus(dialog);
                    this.InsertChild(dialog, 0);
                    dialog.LostFocused += drd_LostFocused;
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Triangle))
            {
                if (UseItem != null && !UseItem.IsUsed)
                {
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    var gd = new GeneralDialog(device, resourceManager, sound,
                                               String.Format(Utility.Language["CancelItemConfirm"],
                                                             Utility.Language[String.Format("Item{0}Name", UseItem.ItemType)]), GeneralDialog.ButtonTypes.OkCancel);
                    FocusManager.Focus(gd);
                    this.InsertChild(gd, 0);
                    gd.LostFocused += gd_LostFocused;
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Down))
            {
                if (mainSprite.ChildrenCount > 0)
                {
                    selection++;
                    if (selection >= mainSprite.ChildrenCount)
                    {
                        selection = 0;
                    }
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Up))
            {
                if (mainSprite.ChildrenCount > 0)
                {
                    selection--;
                    if (selection < 0)
                    {
                        selection = mainSprite.ChildrenCount - 1;
                    }
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
        }
Beispiel #5
0
 void PlayRecord_Inputed(IFocusable sender, InputEventArgs args)
 {
     if (args.InputInfo.IsPressed(ButtonType.Cross))
     {
         FocusManager.RemoveFocus();
         sound.Play(PPDSetting.DefaultSounds[2], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.Left))
     {
         graphDrawType--;
         if (graphDrawType < 0)
         {
             graphDrawType = GraphDrawType.FinishTime;
         }
         ChangeGraphData();
         sound.Play(PPDSetting.DefaultSounds[3], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.Right))
     {
         graphDrawType++;
         if (graphDrawType > GraphDrawType.FinishTime)
         {
             graphDrawType = GraphDrawType.Score;
         }
         ChangeGraphData();
         sound.Play(PPDSetting.DefaultSounds[3], -1000);
     }
     else if (args.InputInfo.IsPressed(ButtonType.R))
     {
         Difficulty last = selectedDifficulty;
         selectedDifficulty++;
         int iter = 0;
         while (!CheckExist() && iter < 4)
         {
             selectedDifficulty++;
             if (selectedDifficulty >= Difficulty.Other)
             {
                 selectedDifficulty = Difficulty.Easy;
             }
             iter++;
         }
         selectedIndex = 0;
         ChangeResultTableDifficulty();
         ChangeGraphData();
         ChangeResultTable();
         if (last != selectedDifficulty)
         {
             sound.Play(PPDSetting.DefaultSounds[3], -1000);
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.L))
     {
         Difficulty last = selectedDifficulty;
         selectedDifficulty--;
         int iter = 0;
         while (!CheckExist() && iter < 4)
         {
             selectedDifficulty--;
             if (selectedDifficulty < Difficulty.Easy)
             {
                 selectedDifficulty = Difficulty.Extreme;
             }
             iter++;
         }
         selectedIndex = 0;
         ChangeResultTableDifficulty();
         ChangeGraphData();
         ChangeResultTable();
         if (last != selectedDifficulty)
         {
             sound.Play(PPDSetting.DefaultSounds[3], -1000);
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Up))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             selectedIndex--;
             if (selectedIndex < 0)
             {
                 selectedIndex = 0;
             }
             else
             {
                 SetResultInfo();
                 sound.Play(PPDSetting.DefaultSounds[0], -1000);
             }
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Down))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             selectedIndex++;
             if (selectedIndex >= currentDifficultyRecults.Count)
             {
                 selectedIndex = currentDifficultyRecults.Count - 1;
             }
             else
             {
                 SetResultInfo();
                 sound.Play(PPDSetting.DefaultSounds[0], -1000);
             }
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Triangle))
     {
         if (graphDrawType == GraphDrawType.FinishTime && currentDifficultyRecults.Count > 0)
         {
             var ppd = new PreviewPlayDialog(device, resourceManager, sound)
             {
                 SongName   = songname.Text,
                 Difficulty = difficultyStrings[(int)selectedDifficulty],
                 StartTime  = FloatToFloatFormatter.Formatter.Format(currentDifficultyRecults[selectedIndex].FinishTime)
             };
             FocusManager.Focus(ppd);
             this.InsertChild(ppd, 0);
             ppd.LostFocused += ppd_LostFocused;
         }
     }
     else if (args.InputInfo.IsPressed(ButtonType.Square))
     {
         if (currentDifficultyRecults.Count > 0)
         {
             var drd = new GeneralDialog(device, resourceManager, sound, Utility.Language["DeleteRecordConfirm"], GeneralDialog.ButtonTypes.OkCancel);
             FocusManager.Focus(drd);
             this.InsertChild(drd, 0);
             drd.LostFocused += drd_LostFocused;
         }
     }
 }