private void AddFocusableElement(IFocusable element) { _focusableElements.Add(element); if (_focusableElementIndex == -1) _focusableElementIndex = 0; }
public UIInputViewToolbar(IFocusable focusableElement) : base(new RectangleF(0, 0, 320, 44)) { FocusableElement = focusableElement; var themeable = FocusableElement as IThemeable; if (themeable != null) TintColor = themeable.Theme.BarTintColor; Translucent = true; }
public UIKeyboardToolbar(IFocusable focusableElement) : base(new RectangleF(0, 0, 320, 44)) { _FocusableElement = focusableElement; _PrevButton = new UIBarButtonItem("Previous", UIBarButtonItemStyle.Bordered, PreviousField); _NextButton = new UIBarButtonItem("Next", UIBarButtonItemStyle.Bordered, NextField); _Spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); _DoneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, DismissKeyboard); UIBarButtonItem[] buttons = { _PrevButton, _NextButton, _Spacer, _DoneButton }; Items = buttons; if (_FocusableElement != null && _FocusableElement.Entry != null && _FocusableElement.Entry.InputAccessoryView == null) { TintColor = ((IElement)_FocusableElement).Theme.BarTintColor; Translucent = true; } }
public UIDatePickerToolbar(IFocusable focusableElement) : base(focusableElement) { }
public static void RemoveFocusObject(IFocusable Object) { allFocusPoints.Remove(Object); //Make sure that we try to remove the object from the activelist aswell, so we dont get left with ghostpoints //(RemoveActivePoint() does its own checks to see if the point exists, so will only remove the point if it acctualy exists inside activelist) RemoveActivePoint(Object); Console.WriteLine("Removed Focus Point"); }
/// <summary> /// Constructor /// </summary> /// <param name="game"></param> /// <param name="focus">The Tile which should be focused by the camera</param> public Camera2D(Game game, IFocusable focus) : base(game) { Focus = focus; }
public UIKeyboardToolbar(IFocusable focusableView) : base(focusableView) { PreviousButtonVisible = true; NextButtonVisible = true; }
public void Remove(IFocusable f) => Items.Remove(f);
void TweetDialog_Inputed(IFocusable sender, InputEventArgs args) { if (tweetWaiting) { return; } if (opening) { if (args.AnyPressed) { back.Seek(EffectObject.SeekPosition.End); return; } } if (args.InputInfo.IsPressed(ButtonType.Circle)) { switch (selection) { case 0: Sound.Play(PPDSetting.DefaultSounds[1], -1000); tweetWaiting = true; processing.Hidden = false; buttons[0].Hidden = buttons[1].Hidden = true; TweetManager.Tweet(); break; case 1: Sound.Play(PPDSetting.DefaultSounds[2], -1000); FocusManager.RemoveFocus(); break; } } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { Sound.Play(PPDSetting.DefaultSounds[2], -1000); FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Left)) { buttons[selection].Selected = false; selection--; if (selection < 0) { selection = 1; } buttons[selection].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Right)) { buttons[selection].Selected = false; selection++; if (selection > 1) { selection = 0; } buttons[selection].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } }
public void Update(IFocusable focusable) { centre = new Vector2(focusable.Position.X, focusable.Position.Y); transform = Matrix.CreateTranslation(new Vector3(-centre.X, -centre.Y, 0)) * Matrix.CreateRotationZ(Rotation) * Matrix.CreateScale(new Vector3(Zoom, Zoom, 0)) * Matrix.CreateTranslation(new Vector3(viewport.Width / 2, viewport.Height / 2, 0)); }
void SongInfoControl_LostFocused(IFocusable sender, FocusEventArgs args) { state = State.normal; }
public virtual bool AcceptInput(ConsoleKeyInfo keyPressed, GraphicsContext g) { foreach (var c in Components) { if (c is IFocusable foc && foc.IsFocusable() && foc.IsFocused()) { if (foc.AcceptInput(keyPressed, g)) { return(true); } var ins = c.InputMap.Compile(); var str = Utils.GetActionNameForKey(ins, keyPressed); if (str != null) { var actMap = c.ActionMap.Compile(); if (actMap.ContainsKey(str)) { actMap[str](c, new ActionEventArgs(c, keyPressed, g)); return(true); } } } } // If we are still here it means that none of the focusable components have accepted any input // Use our own shortcuts to switch to the next focusable component var prev = GetFocusedElement(false); var inputs = InputMap.Compile(); IFocusable next = null; if (Utils.KeyCorresponds(inputs, keyPressed, StandardActionNames.MoveUp)) { next = Strategy.GetUpFocusableElement(this, prev); } else if (Utils.KeyCorresponds(inputs, keyPressed, StandardActionNames.MoveLeft)) { next = Strategy.GetPreviousFocusableElement(this, prev); } else if (Utils.KeyCorresponds(inputs, keyPressed, StandardActionNames.MoveRight)) { next = Strategy.GetNextFocusableElement(this, prev); } else if (Utils.KeyCorresponds(inputs, keyPressed, StandardActionNames.MoveDown)) { next = Strategy.GetDownFocusableElement(this, prev); } if (next != null) { if (prev != null) { var f = prev as IFocusable; Debug.Assert(f != null, nameof(f) + " != null"); f.SetFocused(false, g); } next.SetFocused(true, g); return(true); } return(false); }
public Camera3D(IFocusable focus) { this.focus = focus; S.View = Matrix.CreateLookAt(viewPos, new Vector3(0), Vector3.Up); }
public void RegisterFocusable(IFocusable focusable) { focusable.Focused += onObjectFocused; focusable.Unfocused += onObjectUnfocused; }
private void onObjectFocused(IFocusable focusable) { FocusedObject?.Unfocus(); FocusedObject = focusable; }
void PreviewPlayDialog_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { switch (selection) { case 0: OK = true; Sound.Play(PPDSetting.DefaultSounds[1], -1000); break; case 1: Sound.Play(PPDSetting.DefaultSounds[2], -1000); break; } FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { Sound.Play(PPDSetting.DefaultSounds[2], -1000); FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Left)) { buttons[selection].Selected = false; selection--; if (selection < 0) { selection = 1; } buttons[selection].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Right)) { buttons[selection].Selected = false; selection++; if (selection > 1) { selection = 0; } buttons[selection].Selected = true; Sound.Play(PPDSetting.DefaultSounds[0], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Down)) { if (diffCount > 0) { diffCount -= ((MenuInputInfo)args.InputInfo).GetPressingInterval(ButtonType.Down); if (diffCount < 0) { diffCount = 0; } Sound.Play(PPDSetting.DefaultSounds[3], -1000); } diffTimeContent.Text = diffCount.ToString(); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { diffCount += ((MenuInputInfo)args.InputInfo).GetPressingInterval(ButtonType.Up); diffTimeContent.Text = diffCount.ToString(); Sound.Play(PPDSetting.DefaultSounds[3], -1000); } }
private static void AddActivePoint(IFocusable Point) { if (!activeList.Contains(Point)) activeList.Add(Point); }
void GameResultComponent_GotFocused(IFocusable sender, FocusEventArgs args) { back.Position = new SharpDX.Vector2(0, 50); Alpha = 0; }
private static void CheckRanges() { for (int i = allFocusPoints.Count-1; i >= 0; i--) { float distance = Math.Abs((allFocusPoints[i].Position - defaultFocus.Position).Length()); if (distance < allFocusPoints[i].InterestRadius) { AddActivePoint(allFocusPoints[i]); } if (distance < allFocusPoints[i].ControlRadius) { currentFocus = allFocusPoints[i]; break; } } for (int i = activeList.Count - 1; i >= 0; i--) { float distance = Math.Abs((activeList[i].Position - defaultFocus.Position).Length()); if (distance > activeList[i].InterestRadius) RemoveActivePoint(activeList[i]); } }
public void FocusOn(IFocusable focus) { Focus = focus; }
private void MoveFocus(IList<IFocusable> elements) { _Focus = null; var nextElements = elements.SkipWhile(e => e != this); _Focus = nextElements.Skip(1).FirstOrDefault(); if (_Focus == null) { _Focus = elements.FirstOrDefault(); TableView.ScrollToRow(_Focus.IndexPath, UITableViewScrollPosition.Top, true); _Timer = NSTimer.CreateScheduledTimer(TimeSpan.FromMilliseconds(500), FocusTimer); } else { TableView.ScrollToRow(_Focus.IndexPath, UITableViewScrollPosition.Top, true); _Focus.ElementView.BecomeFirstResponder(); } }
/// <summary> /// Crea la camara para el juego, recibe de una vez el foco. /// </summary> /// <param name="game"></param> /// <param name="focus"></param> public Camera2D(Game game, IFocusable focus) { this.focus = focus; this.viewportHeight = game.GraphicsDevice.Viewport.Height; this.viewportWidth = game.GraphicsDevice.Viewport.Width; this.zoom = 1.0f; this.zoomInLimit = 1.6f; this.zoomOutLimit = 0.7f; this.zoomSpeed = 1.0f; this.zoomTarget = 1.0f; this.rotation = 0.0f; this.cameraViewRectangle = new Rectangle(0, 0, (int)viewportWidth, (int)viewportHeight); this.moveSpeed = 2f; this.isEnabled = true; this.initCollisionWidth = 250; this.initCollisionHeight = 250; initialize(); }
void RoomListComponent_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Cross)) { FocusManager temp = FocusManager; temp.RemoveFocus(); temp.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Circle)) { if (CurrentComponent != null) { sound.Play(PPDSetting.DefaultSounds[1], -1000); if (CurrentComponent.RoomInfo.HasPassword) { var dialog = new PasswordDialog(device, resourceManager, gameHost, CurrentComponent.RoomInfo); dialog.Processed += dialog_Processed; FocusManager.Focus(dialog); this.InsertChild(dialog, 0); } else { GoToRoom(); } } } else if (args.InputInfo.IsPressed(ButtonType.Left)) { if (CurrentComponent != null) { sound.Play(PPDSetting.DefaultSounds[0], -1000); currentIndex -= MaxDisplayCount / 2; if (currentIndex < 0) { currentIndex = listSprite.ChildrenCount - 1; } AdjustScrollBar(); } } else if (args.InputInfo.IsPressed(ButtonType.Right)) { if (CurrentComponent != null) { sound.Play(PPDSetting.DefaultSounds[0], -1000); currentIndex += MaxDisplayCount / 2; if (currentIndex >= listSprite.ChildrenCount) { currentIndex = 0; } AdjustScrollBar(); } } else if (args.InputInfo.IsPressed(ButtonType.Up)) { if (CurrentComponent != null) { sound.Play(PPDSetting.DefaultSounds[0], -1000); currentIndex--; if (currentIndex < 0) { currentIndex = listSprite.ChildrenCount - 1; } AdjustScrollBar(); } } else if (args.InputInfo.IsPressed(ButtonType.Down)) { if (CurrentComponent != null) { sound.Play(PPDSetting.DefaultSounds[0], -1000); currentIndex++; if (currentIndex >= listSprite.ChildrenCount) { currentIndex = 0; } AdjustScrollBar(); } } }
public UIDatePickerToolbar(IFocusable focusableView) : base(focusableView) { }
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(); } } }
internal void SetFocus(IFocusable res) { Invoke(() => SetFocusWorker(res)); }
public virtual void SetFocus(IFocusable focus) { if ( IFocus != focus ) IFocus = focus; if ( IFocus != null ) IFocus.Focused = true; }
public Camera2D(Game game, IFocusable focus) : base(game) { Focus = focus; }
public virtual void SetInstantFocus(IFocusable focus) { SetFocus(focus); m_Tween = false; }
/// <summary> /// Focusses on this object /// </summary> /// <param name="focusable"></param> public void FocusOn(IFocusable focusable) { this.Focus = focusable; }
public virtual void OnFocusChanged(IFocusable focused, GameObject go, HandTrackedInfo.Direction direction, GameObject origin) { }
public static void AddFocusObject(IFocusable Object) { Object.InterestCircle = CreateCircle(Object.InterestRadius); Object.ControlCircle = CreateCircle(Object.ControlRadius); allFocusPoints.Add(Object); }
private void Update() { if (!entity.HasControl) { return; } //Retrieve input. PlayerInput = new Input { Movement = new Vector2(UnityEngine.Input.GetAxis("Horizontal"), UnityEngine.Input.GetAxis("Vertical")), Mouse = new Vector2(UnityEngine.Input.GetAxis("Mouse X"), UnityEngine.Input.GetAxis("Mouse Y")), IsCrouching = UnityEngine.Input.GetKey(KeyCode.LeftControl), IsSprinting = UnityEngine.Input.GetKey(KeyCode.LeftShift), ScrollWheel = UnityEngine.Input.GetAxis("Mouse ScrollWheel"), Interaction = UnityEngine.Input.GetKeyDown(KeyCode.E), Reload = UnityEngine.Input.GetKeyDown(KeyCode.R), Jump = UnityEngine.Input.GetKeyDown(KeyCode.Space), LeftMouse = UnityEngine.Input.GetMouseButtonDown(0) }; if (PlayerInput.Reload) { Weapon currentWeapon = state.Weapons[state.ActiveWeaponIndex]; if (currentWeapon.CurrentAmmoInMagazine < currentWeapon.MagazineSize && currentWeapon.EntireAmmo > currentWeapon.CurrentAmmoInMagazine) { switch (state.ActiveWeaponIndex) { case 0: StartCoroutine(weaponSystem.chalkWeaponState.Reload()); break; case 1: StartCoroutine(weaponSystem.staplerWeaponState.Reload()); break; case 2: StartCoroutine(weaponSystem.slingshotWeaponState.Reload()); break; } } } #region Jump if (PlayerInput.Jump && onGround) { _jumping = true; _jumpingTimer = 0.2f; } if (_jumpingTimer > 0) { _jumpingTimer -= Time.deltaTime; } if (_jumpingTimer <= 0) { _jumping = false; } #endregion //Cast a ray Ray ray = playerCamera.ScreenPointToRay(UnityEngine.Input.mousePosition); if (Physics.Raycast(ray, out var hit, 3)) { _focusedObject = hit.transform; IInteractable intractable = _focusedObject.GetComponent <IInteractable>(); IFocusable focusable = _focusedObject.GetComponent <IFocusable>(); if (intractable != null && PlayerInput.Interaction) { intractable.Interact(entity); } if (focusable != null) { focusText.text = focusable.Focus(); } }
public static void ResetValues(Vector2 StartPos) { rotation = 0f; zoom = 1f; moveSpeed = 1.5f; targetChangeSpeed = 2.5f; setFocusSpeed = 2.5f; position = StartPos; target = StartPos; pastDefaultFocusPos = StartPos; defaultFocus = null; currentFocus = null; justChangedTarget = true; targetOffset = Vector2.Zero; }
void MovieController_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Left)) { list[currentIndex].Selected = false; currentIndex--; if (currentIndex < 0) { currentIndex = list.Length - 1; } list[currentIndex].Selected = true; } else if (args.InputInfo.IsPressed(ButtonType.Right)) { list[currentIndex].Selected = false; currentIndex++; if (currentIndex >= list.Length) { currentIndex = 0; } list[currentIndex].Selected = true; } else if (args.InputInfo.IsPressed(ButtonType.Circle)) { switch (currentIndex) { case 0: moviePlayer.ToggleAspectRatio(); break; case 1: moviePlayer.SeekBackward(); break; case 2: moviePlayer.TogglePlayOrPause(); break; case 3: moviePlayer.Stop(); break; case 4: moviePlayer.SeekForward(); break; case 5: moviePlayer.CreateThumb(); break; case 6: if (PPDGeneralSetting.Setting.MovieLoopType >= MovieLoopType.Random) { PPDGeneralSetting.Setting.MovieLoopType = MovieLoopType.One; } else { PPDGeneralSetting.Setting.MovieLoopType++; } break; } } else if (args.InputInfo.IsPressed(ButtonType.Cross) || args.InputInfo.IsPressed(ButtonType.Start)) { FocusManager.RemoveFocus(); } }
private static void CheckCurrentVsDefaultRange() { float distance = Math.Abs((defaultFocus.Position - currentFocus.Position).Length()); if (distance > currentFocus.ControlRadius) currentFocus = null; }
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; } } }
private static void RemoveActivePoint(IFocusable Point) { if(activeList.Contains(Point)) activeList.Remove(Point); }
public Camera(Game game, IFocusable focused) : base(game) { Focus = focused; }
public void FocusMe(IFocusable supervisee) { _lastFocused.IsFocused = false; supervisee.IsFocused = true; _lastFocused = supervisee; }
public Camera2D(Game game, IFocusable Focus) : base(game) { this.Focus = Focus; Initialize(); }
void ContextMenu_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { FocusManager.RemoveFocus(); OnSelected(); } else if (args.InputInfo.IsPressed(ButtonType.Cross)) { FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Triangle)) { FocusManager.RemoveFocus(); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { if (currentIndex >= 0) { menuSprite[currentIndex].Selected = false; int iter = currentIndex - 1 < 0 ? menuSprite.ChildrenCount - 1 : currentIndex - 1; while (iter != currentIndex) { if (menuSprite[iter].Enabled) { menuSprite[iter].Selected = true; break; } iter--; if (iter < 0) { iter = menuSprite.ChildrenCount - 1; } } currentIndex = iter; menuSprite[currentIndex].Selected = true; UpdateRectangle(); sound.Play(PPDSetting.DefaultSounds[0], -1000); } } else if (args.InputInfo.IsPressed(ButtonType.Down)) { if (currentIndex >= 0) { menuSprite[currentIndex].Selected = false; int iter = currentIndex + 1 >= menuSprite.ChildrenCount ? 0 : currentIndex + 1; while (iter != currentIndex) { if (menuSprite[iter].Enabled) { menuSprite[iter].Selected = true; break; } iter++; if (iter >= menuSprite.ChildrenCount) { iter = 0; } } currentIndex = iter; menuSprite[currentIndex].Selected = true; UpdateRectangle(); sound.Play(PPDSetting.DefaultSounds[0], -1000); } } }