protected void MoveCursor(bool up) { CurrentItem.Deselect(); for (int i = 0; i < items.Count; i++) { if (up) { cursor--; if (cursor < 0) { cursor = items.Count - 1; } } else { cursor++; if (cursor >= items.Count) { cursor = 0; } } CurrentItem = items[cursor]; if (CurrentItem.Enabled) { CurrentItem.Select(); UpdateHelpText(); break; } } PlaySound(sndBrowse); }
public override void Close() { base.Close(); Back.Hide(); helpVis.Hide(); for (int i = 0; i < Items.Count; i++) { Items[i].Hide(); } CurrentItem?.Deselect(); isOpen = false; }
protected void SetCursor(int i) { if (i >= 0 && i < items.Count) { MainMenuItem newItem = items[i]; if (newItem.Enabled) { CurrentItem.Deselect(); cursor = i; CurrentItem = newItem; CurrentItem.Select(); UpdateHelpText(); } } }
protected void SetCursor(int i) { if (i >= 0 && i < Items.Count) { MainMenuItem newItem = Items[i]; if (newItem.Enabled) { CurrentItem?.Deselect(); cursor = i; CurrentItem = newItem; CurrentItem.Select(); UpdateHelpText(); } CursorChanged?.Invoke(this); } }
protected void MoveCursor(bool up) { //We do not have any items so we can not change the selected item. if ((Items?.Count ?? 0) <= 0) { return; } CurrentItem?.Deselect(); for (int i = 0; i < Items.Count; i++) { if (up) { cursor--; if (cursor < 0) { cursor = Items.Count - 1; } } else { cursor++; if (cursor >= Items.Count) { cursor = 0; } } CurrentItem = Items[cursor]; if (CurrentItem.Enabled) { CurrentItem.Select(); UpdateHelpText(); break; } } PlaySound(sndBrowse); CursorChanged?.Invoke(this); }