private void FillSection(PreciseManeuverConfig.ModuleType type, bool state, UI.DraggableWindow window, Action <GameObject> createControls, bool initial = false) { int num = (int)type; if (state) { if (panels[num] == null) { panels[num] = window.CreateInnerContentPanel(num); if (!initial) { var fader = panels[num].GetComponent <UI.CanvasGroupFader> (); fader.SetTransparent(); fader.FadeIn(); } createControls(panels[num]); } else { if (panels[num].GetComponent <UI.CanvasGroupFader> ().IsFadingOut) { panels[num].GetComponent <UI.CanvasGroupFader> ().FadeIn(); } } } else { if (panels[num] != null) { panels[num].GetComponent <UI.CanvasGroupFader> ().FadeClose(); } } }
internal void UpdateMainWindow(UI.DraggableWindow window) { if (panels == null) { panels = new GameObject[size]; } bool initial = window.DivideContentPanel(panels.Length); // 0 - PAGER FillSection(PreciseManeuverConfig.ModuleType.PAGER, window, CreatePagerControls, initial); // 1 - TIME & ALARM (always on) FillSection(PreciseManeuverConfig.ModuleType.TIME, true, window, CreateTimeAlarmControls, initial); // 2 - SAVER FillSection(PreciseManeuverConfig.ModuleType.SAVER, window, CreateSaverControls, initial); // 3 - INCREMENT (on if manual || tools) bool state = Config.GetModuleState(PreciseManeuverConfig.ModuleType.INPUT) || Config.GetModuleState(PreciseManeuverConfig.ModuleType.TOOLS); FillSection(PreciseManeuverConfig.ModuleType.INCR, state, window, CreateIncrementControls, initial); // 4 - MANUAL INPUT FillSection(PreciseManeuverConfig.ModuleType.INPUT, window, CreateUtAxisControls, initial); // 5 - ORBIT TOOLS FillSection(PreciseManeuverConfig.ModuleType.TOOLS, window, CreateOrbitToolsControls, initial); // 6 - GIZMO FillSection(PreciseManeuverConfig.ModuleType.GIZMO, window, CreateGizmoControls, initial); // 7 - ENCOUNTER FillSection(PreciseManeuverConfig.ModuleType.ENCOT, window, CreateEncounterControls, initial); // 8 - EJECTION FillSection(PreciseManeuverConfig.ModuleType.EJECT, window, CreateEjectionControls, initial); // 9 - ORBIT INFO FillSection(PreciseManeuverConfig.ModuleType.ORBIT, window, CreateOrbitInfoControls, initial); // 10 - CONICS FillSection(PreciseManeuverConfig.ModuleType.PATCH, window, CreateConicsControls, initial); }
private void OpenMainWindow() { // fade in if already open if (m_MainWindow != null) { m_MainWindow.MoveToBackground(config.IsInBackground); if (m_MainWindow.IsFadingOut) { m_MainWindow.FadeIn(); } if (config.ModulesChanged) { mainWindow.UpdateMainWindow(m_MainWindow); } return; } if (m_WindowPrefab == null || m_MainWindowObject != null) { return; } // create object Vector3 pos = new Vector3(config.MainWindowPos.x, config.MainWindowPos.y, MainCanvasUtil.MainCanvasRect.position.z); m_MainWindowObject = Instantiate(m_WindowPrefab); if (m_MainWindowObject == null) { return; } m_MainWindow = m_MainWindowObject.GetComponent <UI.DraggableWindow> (); if (m_MainWindow != null) { m_MainWindow.SetTitle(Localizer.Format("precisemaneuver_caption")); m_MainWindow.SetMainCanvasTransform(MainCanvasUtil.MainCanvasRect); mainWindow.ClearMainWindow(); mainWindow.UpdateMainWindow(m_MainWindow); // should be done before moving to background GUIComponentManager.ReplaceLabelsWithTMPro(m_MainWindowObject); m_MainWindow.MoveToBackground(config.IsInBackground); m_MainWindow.setWindowInputLock = SetWindow1InputLock; m_MainWindow.resetWindowInputLock = ResetWindow1InputLock; } GUIComponentManager.ProcessStyle(m_MainWindowObject); // set object as a child of the main canvas m_MainWindowObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform); m_MainWindowObject.transform.position = pos; // do the scaling after the parent has been set ScaleMainWindow(); config.ListenToScaleChange(ScaleMainWindow); }
private void newKeyControl(UI.DraggableWindow window, string title, PreciseManeuverConfig.HotkeyType type) { GameObject keybindingsCtrlObject = Object.Instantiate(m_KeybindingsCtrlPrefab); if (keybindingsCtrlObject == null) { return; } UI.KeybindingControl keybindingCtrl = keybindingsCtrlObject.GetComponent <UI.KeybindingControl> (); keybindingCtrl.setControl(new KeybindingControlInterface(this, type, title)); window.AddToContent(keybindingsCtrlObject); }
private void OpenKeybindingsWindow() { // fade in if already open if (m_KeybindingsWindow != null) { if (m_KeybindingsWindow.IsFadingOut) { m_KeybindingsWindow.FadeIn(); } return; } if (m_WindowPrefab == null || m_KeybindingsWindowObject != null) { return; } // create window object Vector3 pos = new Vector3(config.KeymapperWindowPos.x, config.KeymapperWindowPos.y, MainCanvasUtil.MainCanvasRect.position.z); m_KeybindingsWindowObject = Instantiate(m_WindowPrefab); if (m_KeybindingsWindowObject == null) { return; } // populate window m_KeybindingsWindow = m_KeybindingsWindowObject.GetComponent <UI.DraggableWindow> (); if (m_KeybindingsWindow != null) { m_KeybindingsWindow.SetTitle(Localizer.Format("precisemaneuver_keybindings_caption")); m_KeybindingsWindow.SetMainCanvasTransform(MainCanvasUtil.MainCanvasRect); hotkeys.FillKeymapperWindow(m_KeybindingsWindow); m_KeybindingsWindow.setWindowInputLock = SetWindow2InputLock; m_KeybindingsWindow.resetWindowInputLock = ResetWindow2InputLock; } GUIComponentManager.ProcessStyle(m_KeybindingsWindowObject); GUIComponentManager.ProcessLocalization(m_KeybindingsWindowObject); GUIComponentManager.ReplaceLabelsWithTMPro(m_KeybindingsWindowObject); // set object as a child of the main canvas m_KeybindingsWindowObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform); m_KeybindingsWindowObject.transform.position = pos; }
internal void FillKeymapperWindow(UI.DraggableWindow window) { NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_enable"), PreciseManeuverConfig.HotkeyType.HIDEWIN); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_proginc"), PreciseManeuverConfig.HotkeyType.PROGINC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_progdec"), PreciseManeuverConfig.HotkeyType.PROGDEC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_progzero"), PreciseManeuverConfig.HotkeyType.PROGZER); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_norminc"), PreciseManeuverConfig.HotkeyType.NORMINC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_normdec"), PreciseManeuverConfig.HotkeyType.NORMDEC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_normzero"), PreciseManeuverConfig.HotkeyType.NORMZER); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_radinc"), PreciseManeuverConfig.HotkeyType.RADIINC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_raddec"), PreciseManeuverConfig.HotkeyType.RADIDEC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_radzero"), PreciseManeuverConfig.HotkeyType.RADIZER); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_timeinc"), PreciseManeuverConfig.HotkeyType.TIMEINC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_timedex"), PreciseManeuverConfig.HotkeyType.TIMEDEC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_circularize"), PreciseManeuverConfig.HotkeyType.CIRCORB); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_turnup"), PreciseManeuverConfig.HotkeyType.TURNOUP); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_turndown"), PreciseManeuverConfig.HotkeyType.TURNODN); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_encfocus"), PreciseManeuverConfig.HotkeyType.FOCNENC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_patchesmore"), PreciseManeuverConfig.HotkeyType.PLUSORB); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_patchesless"), PreciseManeuverConfig.HotkeyType.MINUORB); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_timex10"), PreciseManeuverConfig.HotkeyType.PAGEX10); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_nextnode"), PreciseManeuverConfig.HotkeyType.NEXTMAN); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_prevnode"), PreciseManeuverConfig.HotkeyType.PREVMAN); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_delnode"), PreciseManeuverConfig.HotkeyType.MNVRDEL); GameObject label = new GameObject("PreciseManeuverKeybindingsAltLabel"); label.AddComponent <RectTransform> (); var text = label.AddComponent <TMPro.TextMeshProUGUI> (); text.text = Localizer.Format("precisemaneuver_keybindings_alt"); text.font = UISkinManager.TMPFont; text.fontSize = 14; text.richText = false; text.color = Color.white; window.AddToContent(label); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_pageinc"), PreciseManeuverConfig.HotkeyType.PAGEINC); NewKeyControl(window, Localizer.Format("precisemaneuver_keybindings_pageconics"), PreciseManeuverConfig.HotkeyType.PAGECON); }
private void FillSection(PreciseManeuverConfig.ModuleType type, UI.DraggableWindow window, Action <GameObject> createControls, bool initial = false) { FillSection(type, Config.GetModuleState(type), window, createControls, initial); }