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; } }
void MoviePanel_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Up)) { CurrentThumbList.CurrentIndex--; if (CurrentThumbList.CurrentIndex < 0) { CurrentThumbList.CurrentIndex = 0; } else { sound.Play(PPDSetting.DefaultSounds[0], -1000); } updateCount = 0; } else if (args.InputInfo.IsPressed(ButtonType.Down)) { CurrentThumbList.CurrentIndex++; if (CurrentThumbList.CurrentIndex >= currentParent.ChildrenCount) { CurrentThumbList.CurrentIndex = currentParent.ChildrenCount - 1; } else { sound.Play(PPDSetting.DefaultSounds[0], -1000); } updateCount = 0; } else if (args.InputInfo.IsPressed(ButtonType.Circle)) { if (currentParent.Children.Length == 0) { return; } if (!PlayMovie()) { SongInformation current = currentParent.Children[CurrentThumbList.CurrentIndex]; sound.Play(PPDSetting.DefaultSounds[1], -1000); AddThumbs(current); } updateCount = 0; } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { if (currentParent.Parent != null) { currentParent = currentParent.Parent; removeList.Add(thumbSprite[thumbSprite.ChildrenCount - 1] as ThumbList); sound.Play(PPDSetting.DefaultSounds[2], -1000); } updateCount = 0; } else if (args.InputInfo.IsPressed(ButtonType.Start)) { if (playing) { FocusManager.Focus(movieController); } } }
private bool PlayMovie() { SongInformation current = currentParent.Children[CurrentThumbList.CurrentIndex]; if (current.IsPPDSong) { if (currentPlaying != current) { StopMovie(); var movie = myGame.GetMovie(current); var moviePlayer = new MoviePlayer(device, movie, current, CurrentThumbList[CurrentThumbList.CurrentIndex] as LoadablePictureComponent); moviePlayer.PlayNext += moviePlayer_PlayNext; movieSprite.AddChild(moviePlayer); playing = true; currentPlaying = current; movieController.MoviePlayer = moviePlayer; if (FocusManager.CurrentFocusObject != movieController) { FocusManager.Focus(movieController); } } return(true); } return(false); }
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); }
public void Focus() { if (!IsFocused && Focusable) { focus = Disposable.Combine(Keyboard.Focus(this), FocusManager.Focus(this)); } }
public override bool Load() { this.AddChild((allSlideSprite = new SpriteObject(device))); LoadLastCreatedRoom(); firstSprite = new SlideSprite(device, ResourceManager, Sound) { FirstSlide = true }; firstSprite.AddSelection(Utility.Language["CreateRoom"]); firstSprite.AddSelection(Utility.Language["EnterRoom"]); firstSprite.AddSelection(Utility.Language["WaitPlayerAsHost"]); firstSprite.AddSelection(Utility.Language["ConnectToHost"]); allSlideSprite.AddChild(firstSprite); focusManager = new FocusManager(); focusManager.Focus(firstSprite); this.AddChild(new PictureObject(device, ResourceManager, Utility.Path.Combine("background.png"))); firstSprite.Selected += slideSprite_Selected; return(true); }
protected override void UpdateImpl() { if (shouldFocusTextBox) { FocusManager.Focus(textBox); shouldFocusTextBox = false; } }
void startPanel_SettingFinished(object sender, EventArgs e) { this.ClearChildren(); focusManager.Focus(hbm); focusManager.Focus(fp); currentPanel = fp; this.AddChild(hbm); this.AddChild(header); this.AddChild(sp); this.AddChild(mp); this.AddChild(glp); this.AddChild(fp); this.AddChild(back); PPDGeneralSetting.Setting.IsFirstExecution = false; (GameHost as MyGame).KeyConfigManager.Write("keyconfig.ini"); (GameHost as MyGame).Input.AssignMode = false; }
private void ShowTextBox(LogicFolderTreeViewItem lftvi) { textBox.DrawOnlyFocus = true; textBox.DrawMode = DxTextBox.DrawingMode.DrawAll; textBox.Text = lftvi.TextureString.Text; textBox.Position = new Vector2(lftvi.TextureString.Position.X, lftvi.TextureString.Position.Y); textBox.MaxWidth = textBox.TextBoxWidth = Math.Max(300, (int)lftvi.TextureString.MaxWidth); textBox.TextBoxHeight = 14; FocusManager.Focus(textBox); }
private void FocusTextBox() { textBox.DrawMode = DxTextBox.DrawingMode.DrawCaret | DxTextBox.DrawingMode.DrawSelection; textBox.DrawOnlyFocus = false; textBox.Position = new Vector2(240, 65); textBox.TextBoxWidth = 300; textBox.TextBoxHeight = 20; textBox.TextChanged += textBox_TextChanged; FocusManager.Focus(textBox); }
protected override void UpdateImpl() { if (currentIndex == 0 && FocusManager != null && FocusManager.CurrentFocusObject == this) { FocusManager.Focus(firstSprite); } if (Focused || OverFocused) { allSlideSprite.Position = new SharpDX.Vector2(AnimationUtility.GetAnimationValue(allSlideSprite.Position.X, -currentIndex * 800), allSlideSprite.Position.Y); } }
protected virtual bool RequestFocus(FocusState state) { try { _pendingFocusRequestState = state; return(FocusManager.Focus(this)); } finally { _pendingFocusRequestState = null; } }
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; } }
public override void Load() { focusManager = new FocusManager(); ResultSet += GameResult_ResultSet; ScoreSent += GameResult_ScoreSent; ScoreSending += GameResult_ScoreSending; grs = new GameResultScore(device, ResourceManager, PPDGameUtility, Sound, TweetManager, ReviewManager, GameHost); grs.Retryed += grs_Retryed; grs.Returned += grs_Returned; grs.Replayed += grs_Replayed; focusManager.Focus(grs); grs.UpdateRanking(); this.AddChild(grs); }
void ItemSettingComponent_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.Circle)) { if (CurrentUser != null) { var dialog = new UserMenuDialog(device, resourceManager); dialog.LostFocused += dialog_LostFocused; dialog.Position = CurrentUser.ScreenPos + new Vector2(20, 40); if (dialog.Position.Y + dialog.Height >= 450) { dialog.Position = CurrentUser.ScreenPos + new Vector2(20, -dialog.Height); } this.InsertChild(dialog, 0); FocusManager.Focus(dialog); } sound.Play(PPDSetting.DefaultSounds[1], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { ChangeSelectedUserIndex(-2); } else if (args.InputInfo.IsPressed(ButtonType.Down)) { ChangeSelectedUserIndex(2); } else if (args.InputInfo.IsPressed(ButtonType.Left)) { ChangeSelectedUserIndex(index % 2 == 0 ? 1 : -1); } else if (args.InputInfo.IsPressed(ButtonType.Right)) { ChangeSelectedUserIndex(index % 2 == 0 ? 1 : -1); } }
public override void SceneStackPoped(Dictionary <string, object> param) { switch (lastPlayState) { case LastPlayState.TryToPlayGame: selfUser.CurrentState = UserState.NotReady; client.Write(MessagePackSerializer.Serialize(new ChangeUserStateNetworkData { State = selfUser.CurrentState })); break; case LastPlayState.GoToPlay: while (focusManager.CurrentFocusObject != chatComponent) { focusManager.RemoveFocus(); } gameResultComponent.ClearResult(); if (param != null && param.ContainsKey("Result") && param["Result"] != null) { var results = (param["Result"] as Tuple <int, Result>[]) .Select(t => new UserResult { User = FindUser(t.Item1), Result = t.Item2 }) .Where(r => r.User != null).ToArray(); focusManager.Focus(gameResultComponent); Array.Sort(results, CompareResult); foreach (var result in results) { gameResultComponent.AddResult(result); } logger.AddResult(currentRule, currentSelectSong.SongInformation, results); } else { chatComponent.AddSystemMessage(Utility.Language["HostStopGame"]); } break; } waitingGoToPlay = false; movieManager.Change(true); base.SceneStackPoped(param); }
void sic_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { if (sic.CanGoNext()) { fm.Focus(cc); sic.FadeOut(); mss.Disappear(); cc.SetInfo(ssm.SelectedSongInformation.SongInfo.DirectoryName, sic.Difficult); Sound.Play(PPDSetting.DefaultSounds[1], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { fm.RemoveFocus(); Sound.Play(PPDSetting.DefaultSounds[2], -1000); } else { if (args.InputInfo.IsPressed(ButtonType.Left)) { if (sic.ChangeDifficulty(-1)) { Sound.Play(PPDSetting.DefaultSounds[0], -1000); } } if (args.InputInfo.IsPressed(ButtonType.Right)) { if (sic.ChangeDifficulty(1)) { Sound.Play(PPDSetting.DefaultSounds[0], -1000); } } } }
public StartPanel(PPDDevice device, MyGame myGame, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.myGame = myGame; this.resourceManager = resourceManager; contentSprite = new SpriteObject(device); this.AddChild(contentSprite); var sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["WelcomeToPPD"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["StartInitialSetting"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["StartKeyButtonSetting"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["InsertKeyboardAndController"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); sprite = new SpriteObject(device); sprite.AddChild((controllerNameText = new TextureString(device, "", 14, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 10) })); reload = new FadableButton(device, resourceManager, Utility.Path.Combine("reload.png"), Utility.Path.Combine("reload_select.png"), ""); reload.MouseLeftClick += reload_MouseLeftClick; up = new FadableButton(device, resourceManager, Utility.Path.Combine("up.png"), Utility.Path.Combine("up_select.png"), ""); up.MouseLeftClick += up_MouseLeftClick; down = new FadableButton(device, resourceManager, Utility.Path.Combine("down.png"), Utility.Path.Combine("down_select.png"), ""); down.MouseLeftClick += down_MouseLeftClick; sprite.AddChild(up); sprite.AddChild(down); sprite.AddChild(reload); up.Position = down.Position = reload.Position = new SharpDX.Vector2(400, 225); sprite.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("keysettinggrid.png")) { Position = new SharpDX.Vector2(290, 30) }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 390), Text = Utility.Language["Start"] }); sprite.AddChild(new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(320, 420), Text = Utility.Language["Home"] }); keys = new TextureString[ButtonUtility.Array.Length]; buttons = new TextureString[ButtonUtility.Array.Length]; if (myGame.KeyConfigManager.Configs.Length > 0) { keyConfig = myGame.KeyConfigManager[0]; } for (int i = 0; i < ButtonUtility.Array.Length; i++) { var textButton = new TextButton(device, resourceManager) { Position = new SharpDX.Vector2(530, 90 + i * 30), Text = Utility.Language["Change"], Index = i }; textButton.MouseLeftDown += textButton_MouseLeftDown; keys[i] = new TextureString(device, keyConfig.GetKeyMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(388, 82 + i * 30) }; buttons[i] = new TextureString(device, keyConfig.GetButtonMap((ButtonType)i).ToString(), 14, true, PPDColors.White) { Position = new SharpDX.Vector2(460, 82 + i * 30) }; sprite.AddChild(textButton); sprite.AddChild(keys[i]); sprite.AddChild(buttons[i]); } Add(sprite); sprite = new SpriteObject(device); sprite.AddChild(new TextureString(device, Utility.Language["SettingCompleted"], 20, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 200) }); sprite.AddChild(new TextureString(device, Utility.Language["UserKeyboardOrController"], 16, true, PPDColors.White) { Position = new SharpDX.Vector2(400, 240) }); Add(sprite); right = new FadableButton(device, resourceManager, Utility.Path.Combine("right.png"), Utility.Path.Combine("right_select.png"), "Next") { Position = new SharpDX.Vector2(770, 225) }; this.AddChild(right); left = new FadableButton(device, resourceManager, Utility.Path.Combine("left.png"), Utility.Path.Combine("left_select.png"), "Back") { Position = new SharpDX.Vector2(30, 225) }; this.AddChild(left); left.MouseLeftClick += left_MouseLeftClick; right.MouseLeftClick += right_MouseLeftClick; focusManager = new FocusManager(); focusManager.Focus(this); left.Alpha = 0; this.Alpha = 0; }
void LeftMenu_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { switch (selection) { case SelectionMode.UpdateScore: FocusManager.Focus(usc); break; case SelectionMode.Filter: FocusManager.Focus(fc); break; case SelectionMode.ScoreManage: FocusManager.Focus(sm); break; case SelectionMode.PlayRecord: FocusManager.Focus(pr); break; case SelectionMode.Replay: FocusManager.Focus(rlc); break; case SelectionMode.ItemList: FocusManager.Focus(ilc); break; case SelectionMode.UpdateScoreDB: SongInformation.Update(); FocusManager.RemoveFocus(); break; case SelectionMode.Mod: FocusManager.Focus(mp); break; case SelectionMode.Finish: ShouldFinish = true; FocusManager.RemoveFocus(); break; case SelectionMode.RandomSelect: FocusManager.Focus(randomSelect); break; } if (!ShouldFinish) { sound.Play(PPDSetting.DefaultSounds[1], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Square)) { FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { selection--; if (selection < 0) { selection = SelectionMode.MaxCount - 1; } if (selection == SelectionMode.PlayRecord && !PlayRecordAvailable) { selection--; } sound.Play(PPDSetting.DefaultSounds[0], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Down)) { selection++; if (selection >= SelectionMode.MaxCount) { selection = 0; } if (selection == SelectionMode.PlayRecord && !PlayRecordAvailable) { selection++; } sound.Play(PPDSetting.DefaultSounds[0], -1000); } float selectY = selectDiffY; switch (selection) { case SelectionMode.UpdateScore: selectY += updateScore.Position.Y; break; case SelectionMode.Filter: selectY += filter.Position.Y; break; case SelectionMode.ScoreManage: selectY += scoreManage.Position.Y; break; case SelectionMode.PlayRecord: selectY += playRecord.Position.Y; break; case SelectionMode.Replay: selectY += replay.Position.Y; break; case SelectionMode.ItemList: selectY += itemList.Position.Y; break; case SelectionMode.UpdateScoreDB: selectY += updateScoreDB.Position.Y; break; case SelectionMode.Mod: selectY += mod.Position.Y; break; case SelectionMode.Finish: selectY += finish.Position.Y; break; case SelectionMode.RandomSelect: selectY += randomSelect.Position.Y; break; } select.Position = new Vector2(select.Position.X, selectY); }
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; } }
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; } } }
protected virtual bool FocusTextView() => FocusManager.Focus(_textBoxView);
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); } } }
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); } } }
void keyButtonSprite_Selected(object sender, EventArgs e) { if (!Focused && !OverFocused) { return; } currentIndex++; RemoveNext(); var keyButtonSprite = sender as SlideSprite; switch (keyButtonSprite.CurrentSelection) { case 0: var changeKeyConfigSprite = new ChangeKeyConfigSprite(device, resourceManager, myGame, myGame.KeyConfigManager.CurrentConfig, sound) { Position = new SharpDX.Vector2(800 * currentIndex, 0) }; changeKeyConfigSprite.LostFocused += slideSprite_LostFocused; allSlideSprite.AddChild(changeKeyConfigSprite); FocusManager.Focus(changeKeyConfigSprite); break; case 1: 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 SharpDX.Vector2(400, 220) }); } else { changeControllerSprite.CurrentSelection = myGame.Input.CurrentJoyStickIndex; } allSlideSprite.AddChild(changeControllerSprite); FocusManager.Focus(changeControllerSprite); break; case 2: 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; } }
void GameResultScore_Inputed(IFocusable sender, InputEventArgs args) { if (state == State.Done) { // カーソル移動 if (args.InputInfo.IsPressed(ButtonType.Left)) { buttons[gridSelection.Current].Selected = false; do { gridSelection.Left(); } while (!buttons[gridSelection.Current].Enabled); buttons[gridSelection.Current].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } if (args.InputInfo.IsPressed(ButtonType.Right)) { buttons[gridSelection.Current].Selected = false; do { gridSelection.Right(); } while (!buttons[gridSelection.Current].Enabled); buttons[gridSelection.Current].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } if (args.InputInfo.IsPressed(ButtonType.Up)) { buttons[gridSelection.Current].Selected = false; do { gridSelection.Up(); if (!buttons[gridSelection.Current].Enabled) { gridSelection.Left(); } } while (!buttons[gridSelection.Current].Enabled); buttons[gridSelection.Current].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } if (args.InputInfo.IsPressed(ButtonType.Down)) { buttons[gridSelection.Current].Selected = false; do { gridSelection.Down(); if (!buttons[gridSelection.Current].Enabled) { gridSelection.Left(); } } while (!buttons[gridSelection.Current].Enabled); buttons[gridSelection.Current].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } // 丸だったら戻る準備 if (args.InputInfo.IsPressed(ButtonType.Circle)) { switch (gridSelection.Current) { case 0: FocusManager.Focus(td); break; case 1: FocusManager.Focus(rd); break; case 2: state = State.WaitFadeForRetry; break; case 3: state = State.WaitFadeForReplay; break; case 4: state = State.WaitFadeForReturn; break; } } } if ((args.InputInfo.IsPressed(ButtonType.Circle) || args.InputInfo.IsPressed(ButtonType.Left) || args.InputInfo.IsPressed(ButtonType.Right)) && state < State.Done) { state = State.Done; for (int i = 0; i < scoresmalls.Length; i++) { if (i >= MarkEvals.Length) { scoresmalls[i].Value = (uint)MaxCombo; } else { scoresmalls[i].Value = (uint)MarkEvals[i]; } } scorebig.Value = (uint)Score; ShowAll(); } }
void ModPanel_Inputed(IFocusable sender, InputEventArgs args) { if (!initialized || updating) { return; } if (args.InputInfo.IsPressed(ButtonType.Cross)) { if (currentModInfo == ModManager.Instance.Root) { FocusManager.RemoveFocus(); } else { var selectIndex = Array.IndexOf(currentModInfo.Parent.Children, currentModInfo); currentModInfo = currentModInfo.Parent; Reload(selectIndex); } sound.Play(PPDSetting.DefaultSounds[2], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Circle)) { if (currentIndex >= 0) { if (CurrentComponent.ModInfoBase.IsDir) { currentModInfo = CurrentComponent.ModInfoBase; Reload(0); sound.Play(PPDSetting.DefaultSounds[1], -1000); } else { var modComponent = (ModInfoComponent)CurrentComponent; if (modComponent.CanApply) { modComponent.ModInfo.IsApplied = !modComponent.ModInfo.IsApplied; sound.Play(PPDSetting.DefaultSounds[3], -1000); } } } } else if (args.InputInfo.IsPressed(ButtonType.Triangle)) { if (currentIndex >= 0 && !CurrentComponent.ModInfoBase.IsDir) { var modComponent = (ModInfoComponent)CurrentComponent; if (modComponent.ModInfo.Settings.Length > 0) { var modSettingPanel = new ModSettingPanel(device, gameHost, resourceManager, sound, modComponent.ModInfo); modSettingPanel.LostFocused += (s, e) => { this.RemoveChild(modSettingPanel); }; FocusManager.Focus(modSettingPanel); sound.Play(PPDSetting.DefaultSounds[1], -1000); this.InsertChild(modSettingPanel, 0); } } } else if (args.InputInfo.IsPressed(ButtonType.Square)) { if (currentIndex >= 0 && !CurrentComponent.ModInfoBase.IsDir) { var modComponent = (ModInfoComponent)CurrentComponent; if (modComponent.ModInfo.CanUpdate) { updating = true; updateSprite.Hidden = false; modComponent.ModInfo.UpdateFinished += ModInfo_UpdateFinished; ThreadManager.Instance.GetThread(() => modComponent.ModInfo.Update()).Start(); } } } else if (args.InputInfo.IsPressed(ButtonType.Down)) { if (currentIndex >= 0) { CurrentComponent.Selected = false; currentIndex++; if (currentIndex >= currentModInfo.Children.Length) { currentIndex = 0; } CurrentComponent.Selected = true; sound.Play(PPDSetting.DefaultSounds[0], -1000); AdjustScrollBar(); ChangeModInfo(); } } else if (args.InputInfo.IsPressed(ButtonType.Up)) { if (currentIndex >= 0) { CurrentComponent.Selected = false; currentIndex--; if (currentIndex < 0) { currentIndex = currentModInfo.Children.Length - 1; } CurrentComponent.Selected = true; sound.Play(PPDSetting.DefaultSounds[0], -1000); AdjustScrollBar(); ChangeModInfo(); } } }
public override bool Load() { WebManager.Instance.UpdateAccountInfo(); //init var list = SongInformation.All; int selectnum = 0; string initialdirectory = PPDSetting.Setting.SongDir; ContestInfo contestInfo = null; WebSongInformation[] activeScores = null; ListInfo[] lists = null; Action[] actions = { () => { contestInfo = WebManager.Instance.GetContestInfo(); }, () => { activeScores = WebManager.Instance.GetScores(true); }, () => { lists = WebManager.Instance.GetListInfos(); }, PerfectTrialCache.Instance.Update }; Parallel.ForEach(actions, (action) => action()); // 前のメニューからのパラメーターを調べる if (PreviousParam.TryGetValue("PPDGameUtility", out object temp)) { var gameutility = temp as PPDGameUtility; initialdirectory = gameutility.SongInformation.ParentDirectory; } ssm = new SelectSongManager(contestInfo, activeScores, lists); ssm.SongChanged += ssm_SongChanged; ssm.DirectoryChanged += ssm_DirectoryChanged; ssm.ModeChanged += ssm_ModeChanged; ssm.Filter.Desc = SkinSetting.Setting.Desc; ssm.Filter.Difficulty = SkinSetting.Setting.Difficulty; ssm.Filter.Field = SkinSetting.Setting.SortField; ssm.Filter.Type = SkinSetting.Setting.ScoreType; textBox = new DxTextBox(device, GameHost, ResourceManager); mss = new MenuSelectSong(device, ResourceManager, this); mss.Inputed += mss_Inputed; mss.GotFocused += mss_GotFocused; sic = new SongInfoControl(device, ResourceManager); sic.Inputed += sic_Inputed; cc = new ConfirmControl(device, ResourceManager); cc.Inputed += cc_Inputed; oc = new OptionControl(device, ResourceManager, Sound); lm = new LeftMenu(device, GameHost, ResourceManager, textBox, ssm, Sound); lm.RandomSelected += lm_RandomSelected; lm.FilterChanged += lm_FilterChanged; ss = new ScoreSearcher(device, ResourceManager, textBox, ssm.Filter); obd = new OpenBrowserDialog(device, ResourceManager, Sound); fm = new FocusManager(this); fm.Focus(mss); mss.DisapperFinish += cc.Show; bgd = new BackGroundDisplay(device, ResourceManager, "skins\\PPDSingle_BackGround.xml", "Menu"); black = new RectangleComponent(device, ResourceManager, PPDColors.Black) { RectangleHeight = 450, RectangleWidth = 800, Alpha = 0 }; menuMovie = new MenuMovie(device); this.AddChild(black); this.AddChild(textBox); this.AddChild(obd); this.AddChild(cc); this.AddChild(oc); this.AddChild(ss); this.AddChild(lm); this.AddChild(sic); this.AddChild(mss); var po = new PictureObject(device, ResourceManager, Utility.Path.Combine("bottom.png")); po.Position = new Vector2(0, 450 - po.Height + 1); po.AddChild(new TextureString(device, Utility.Language["SearchScore"], 14, PPDColors.Gray) { Position = new Vector2(85, 7) }); po.AddChild(new TextureString(device, Utility.Language["Move"], 14, PPDColors.Gray) { Position = new Vector2(205, 7) }); po.AddChild(new TextureString(device, Utility.Language["Menu"], 14, PPDColors.Gray) { Position = new Vector2(325, 7) }); po.AddChild(new TextureString(device, Utility.Language["Option"], 14, PPDColors.Gray) { Position = new Vector2(445, 7) }); po.AddChild(new TextureString(device, Utility.Language["Decide"], 14, PPDColors.Gray) { Position = new Vector2(565, 7) }); po.AddChild(new TextureString(device, Utility.Language["Back"], 14, PPDColors.Gray) { Position = new Vector2(685, 7) }); this.AddChild(po); this.AddChild(menuMovie); this.AddChild(bgd); oc.Connect = SkinSetting.Setting.Connect; oc.RivalGhost = SkinSetting.Setting.RivalGhost; ssm.CurrentRoot = SongInformation.Root; ssm.CurrentLogicRoot = LogicFolderInfomation.Root; if (PreviousParam.TryGetValue("CurrentRoot", out temp)) { var root = temp as SongInformation; ssm.CurrentRoot = root; } if (PreviousParam.TryGetValue("CurrentLogicRoot", out temp)) { var root = temp as LogicFolderInfomation; ssm.CurrentLogicRoot = root; } if (PreviousParam.TryGetValue("CurrentMode", out temp)) { var mode = (SelectSongManager.Mode)temp; ssm.ChangeMode(mode); } if (PreviousParam.TryGetValue("SelectedIndex", out temp)) { selectnum = (int)temp; } ssm.SelectedIndex = selectnum; return(true); }
void ScoreManager_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { ProcessCircleInput(); } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { FocusManager.RemoveFocus(); sound.Play(PPDSetting.DefaultSounds[2], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Triangle)) { if (lfTreeView.SelectedItem == null) { foreach (MenuItem menuItem in cm.Menus) { menuItem.Enabled = menuItem.Name == createlinkmenu || menuItem.Name == createfoldermenu || (menuItem.Name == pastemenu && cutOrCopylftvi != null); } cm.Position = new Vector2(500, 200); } else { foreach (MenuItem menuItem in cm.Menus) { if (menuItem.Name == pastemenu && cutOrCopylftvi == null) { menuItem.Enabled = false; } else { menuItem.Enabled = true; } } var lftvi = lfTreeView.SelectedItem as LogicFolderTreeViewItem; var pos = new Vector2(lftvi.TextureString.Position.X, lftvi.TextureString.Position.Y + lftvi.TextureString.CharacterHeight + 20); if (cm.CheckPositionX(pos) >= 0) { if (cm.CheckPositionY(pos) >= 0) { } else { pos.Y = lftvi.TextureString.Position.Y - cm.Height; } } else { if (cm.CheckPositionY(pos) >= 0) { pos.X = pos.X + cm.CheckPositionX(pos); } else { pos = new Vector2(pos.X + cm.CheckPositionX(pos), lftvi.TextureString.Position.Y - cm.Height); } } cm.Position = pos; } FocusManager.Focus(cm); } else if (args.InputInfo.IsPressed(ButtonType.Square)) { swap = true; swaplftvi = lfTreeView.SelectedItem as LogicFolderTreeViewItem; } else if (args.InputInfo.IsPressed(ButtonType.R)) { focusPanel = FocusPanel.Right; sound.Play(PPDSetting.DefaultSounds[3], -1000); } else if (args.InputInfo.IsPressed(ButtonType.L)) { focusPanel = FocusPanel.Left; sound.Play(PPDSetting.DefaultSounds[3], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { if (ProcessUpInput()) { sound.Play(PPDSetting.DefaultSounds[0], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Down)) { if (ProcessDownInput()) { sound.Play(PPDSetting.DefaultSounds[0], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Left)) { bool ok = false; for (int i = 0; i < maxHeightNumber / 2; i++) { ok |= ProcessUpInput(); } if (ok) { sound.Play(PPDSetting.DefaultSounds[0], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Right)) { bool ok = false; for (int i = 0; i < maxHeightNumber / 2; i++) { ok |= ProcessDownInput(); } if (ok) { sound.Play(PPDSetting.DefaultSounds[0], -1000); } } if (args.InputInfo.IsReleased(ButtonType.Square)) { if (swap) { ChangeIndex(swaplftvi); swap = false; swaplftvi = null; } } }
public override bool Load() { PPDFramework.Web.WebModInfo[] webMods = null; Action[] actions = { () => { webMods = PPDFramework.Web.WebManager.Instance.GetMods(); }, PPDScoreManager.Manager.Initialize, }; Parallel.ForEach(actions, (action) => action()); allowedModList = new AllowedModList { WebMods = webMods }; logger = new Logger(String.Format("{0}.txt", DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"))); Sound.AddSound(notifySoundPath); version = FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(this.GetType()).Location).FileVersion; userList = new ChangableList <User>(); userList.ItemChanged += userList_ItemChanged; movieManager = new MovieManager(device, GameHost); movieManager.MovieChanged += MovieManager_MovieChanged; movieManager.MovieChangeFailed += MovieManager_MovieChangeFailed; clientHandledData = new Queue <NetworkData>(); selfUser = new User { Name = PPDFramework.Web.WebManager.Instance.CurrentUserName, AccountId = PPDFramework.Web.WebManager.Instance.CurrentAccountId, CurrentState = UserState.NotReady, Color = RandomColorGenerator.GetColor(), IsSelf = true, IsHost = (bool)this.Param["AsHost"] }; this.AddChild(gameResultComponent = new GameResultComponent(device, GameHost, ResourceManager, Sound)); this.AddChild(leftMenu = new LeftMenu(device, GameHost, ResourceManager, Sound, movieManager, selfUser, userList, allowedModList)); leftMenu.SongSelected += leftMenu_SongSelected; leftMenu.ShowResult += leftMenu_ShowResult; leftMenu.UpdateScoreDB += leftMenu_UpdateScoreDB; leftMenu.RuleChanged += leftMenu_RuleChanged; leftMenu.TryToPlayGame += leftMenu_TryToPlayGame; leftMenu.ChangeLeader += leftMenu_ChangeLeader; leftMenu.KickUser += leftMenu_KickUser; this.AddChild(textBox = new DxTextBox(device, GameHost, ResourceManager)); this.AddChild((chatComponent = new ChatComponent(device, ResourceManager, GameHost) { Position = new SharpDX.Vector2(430, 0) })); this.AddChild(userListComponent = new UserListComponent(device, ResourceManager) { Position = new SharpDX.Vector2(10, 10) }); PictureObject bottom; this.AddChild(bottom = new PictureObject(device, ResourceManager, Utility.Path.Combine("menu_bottom.png")) { Position = new SharpDX.Vector2(0, 421) }); bottom.AddChild(new PictureObject(device, ResourceManager, Utility.Path.Combine("bottom_triangle.png")) { Position = new SharpDX.Vector2(7, 7) }); bottom.AddChild(new TextureString(device, Utility.Language["Menu"], 16, PPDColors.White) { Position = new SharpDX.Vector2(30, 5) }); bottom.AddChild(new PictureObject(device, ResourceManager, Utility.Path.Combine("bottom_circle.png")) { Position = new SharpDX.Vector2(157, 7) }); bottom.AddChild(stateString = new TextureString(device, Utility.Language["ChangeReadyState"], 16, PPDColors.White) { Position = new SharpDX.Vector2(180, 5) }); this.AddChild((bgd = new BackGroundDisplay(device, ResourceManager, "skins\\PPDMulti_BackGround.xml", "Menu"))); focusManager = new FocusManager(); focusManager.Focus(chatComponent); userList.Add(selfUser); chatComponent.Inputed += chatComponent_Inputed; textBox.LostFocused += textBox_LostFocused; leftMenu.Closed += leftMenu_Closed; if (selfUser.IsHost) { WebManager webManager = null; if (this.Param.ContainsKey("WebManager")) { webManager = this.Param["WebManager"] as WebManager; } RoomInfo roomInfo = null; if (this.Param.ContainsKey("RoomInfo")) { roomInfo = this.Param["RoomInfo"] as RoomInfo; } server = new PPDServer((int)Param["Port"], webManager, roomInfo, GameHost); server.FailedToCreateRoom += server_FailedToCreateRoom; client = new Client { Address = "127.0.0.1", Port = (int)Param["Port"] }; timer = new Timer(state => { server.Update(); }, null, 0, 1); } else { client = new Client { Address = (string)Param["IP"], Port = (int)Param["Port"] }; } client.Closed += client_Closed; client.Read += client_Read; byteReader = new TcpByteReader(); byteReader.ByteReaded += TcpByteReader_ByteReaded; if (server != null) { server.Start(); } client.Start(); if (client.HasConnection) { // send login data client.Write(MessagePackSerializer.Serialize(new AddUserNetworkData { UserName = selfUser.Name, AccountId = selfUser.AccountId, State = selfUser.CurrentState, Version = version })); } else { chatComponent.AddSystemMessage(Utility.Language["CannotConnectToHost"]); } // load SongInformation.All.ToArray(); return(true); }