public override void Update() { base.Update(); bool select = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.select)); bool left = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.left)); bool right = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.right)); if (select) { if (Radio.Selected) { if (RadioPlayer.Instance.isPlaying) { RadioPlayer.Instance.Pause(); } else { RadioPlayer.Instance.Play(); } } else if (PreviousRadio.Selected) { RadioPlayer.Instance.Prev(); } else if (NextRadio.Selected) { RadioPlayer.Instance.Next(); } } Radio.Label = string.Format("{0} {1}", RadioPlayer.Instance.isPlaying ? "[>]" : "[ ]", RadioPlayer.Instance.getRadioInfos().name); // Volume.width = (int)(RadioPlayer.Instance.Volume * totalWidth); if (VolumeSelected) { if (right) { RadioPlayer.Instance.VolumeUp(); } else if (left) { RadioPlayer.Instance.VolumeDown(); } } Volume.Color = VolumeSelected ? EDColors.YELLOW : EDColors.getColor(EDColors.ORANGE, 0.6f); Volume.Value = (int)(RadioPlayer.Instance.Volume * 100.0f); }
private void SteamVR_NexHUD_PostUpdateCallback(object sender, EventArgs e) { if (m_state == MenuState.Initialize) { return; } if (Shortcuts.holdMode) { if (NexHudEngine.isShortcutIsHold(Shortcuts.get(ShortcutId.menu))) { if (!m_frame.renderOverlay) { m_frame.renderOverlay = true; if (NexHudSettings.GetInstance().stealFocus) { FocusHelper.focusonNexHud(); } } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.back))) { if (m_state != MenuState.Main && m_state != MenuState.Improve && m_state != MenuState.Search) { changeState(MenuState.Main); } } } else { if (m_frame.renderOverlay) { m_frame.renderOverlay = false; if (NexHudSettings.GetInstance().stealFocus) { FocusHelper.focusOnGame(); } } return; } } else { if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.menu))) { if (m_frame.renderOverlay) { if (m_state != MenuState.Main) { if (m_state != MenuState.Improve && m_state != MenuState.Search) { changeState(MenuState.Main); } } else { m_frame.renderOverlay = false; if (NexHudSettings.GetInstance().stealFocus) { FocusHelper.focusOnGame(); } } } else { changeState(MenuState.Main); m_frame.renderOverlay = true; if (NexHudSettings.GetInstance().stealFocus) { FocusHelper.focusonNexHud(); } } } } if (m_frame.renderOverlay) { //MAIN MENU NAVIGATION if (m_uiMainMenu.isVisible) { bool up = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.up)); bool down = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.down)); bool left = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.left)); bool right = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.right)); bool select = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.select)); if (Cursor.Y == 0) { if (right) { m_uiMainMenu.selectNext(); } else if (left) { m_uiMainMenu.selectPrev(); } else if (down) { Cursor = new Point(1, 1); } else if (select) { if (m_uiMainMenu.isSelectedMenuActive()) { switch (m_uiMainMenu.SelectedMenu) { case UiMainMenuButton.MenuButtonType.Search: changeState(MenuState.Search); break; case UiMainMenuButton.MenuButtonType.Improve: changeState(MenuState.Improve); break; case UiMainMenuButton.MenuButtonType.Trade: changeState(MenuState.Trade); break; } } } } else { if (up) { Cursor.Y--; } else if (down && Cursor.Y < 2) { Cursor.Y++; } else if (left && Cursor.X > 0 && Cursor.Y < 2) { Cursor.X--; } else if (right && Cursor.X < 2 && Cursor.Y < 2) { Cursor.X++; } m_UiRadio.PreviousRadio.Selected = Cursor == new Point(0, 1); m_UiRadio.Radio.Selected = Cursor == new Point(1, 1); m_UiRadio.NextRadio.Selected = Cursor == new Point(2, 1); m_UiRadio.VolumeSelected = Cursor.Y == 2; } } } }
public override void Update() { base.Update(); if (!isVisible) { _skipUpdate = true; return; } else if (_skipUpdate) { _skipUpdate = false; return; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.right)) && m_CursorCoords.X < m_CursorMaxX) { m_CursorCoords.X++; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.left)) && m_CursorCoords.X > 0) { m_CursorCoords.X--; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.down))) { if (m_CursorCoords.Y < m_CursorMaxY[m_CursorCoords.X]) { m_CursorCoords.Y++; } else if (m_CursorCoords.X < m_CursorMaxX) { m_CursorCoords.X++; m_CursorCoords.Y = 0; } } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.up))) { if (m_CursorCoords.Y > (m_CursorCoords.X == 0 ? 1 : 0)) { m_CursorCoords.Y--; } else if (m_CursorCoords.X > 0) { m_CursorCoords.X--; m_CursorCoords.Y = m_CursorMaxY[m_CursorCoords.X]; } } //Pick the one NxButton _selected = null; while (_selected == null) { _selected = m_Buttons.Where(x => x.Coords == m_CursorCoords).FirstOrDefault(); if (_selected != null && !_selected.isSelectable) { if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.up))) { m_CursorCoords.Y--; } else { m_CursorCoords.Y++; } _selected = null; continue; } if (_selected == null) { if (m_CursorCoords.Y > 1) { m_CursorCoords.Y--; } else if (m_CursorCoords.X > 0) { m_CursorCoords.X--; } else { break; } } } foreach (NxButton b in m_Buttons) { b.Selected = b == _selected; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.select)) && _selected != null) { if (_selected.Obj is string) { m_TypeSelected = (string)_selected.Obj; } else if (_selected.Obj is BlueprintDatas) { BlueprintDatas d = (BlueprintDatas)_selected.Obj; BlueprintDatas _maxGrade = EngineerHelper.blueprints.Where(x => x.Type == d.Type && x.Name == d.Name && x.Grade == d.MaxGrade).FirstOrDefault(); m_uiImprove.BlueprintDetails.setBlueprint(_maxGrade); m_uiImprove.changeState(UiImprove.UiImproveState.BlueprintDetail); } refresh(); } }