private void Open() { // fade menu in if already open if (m_ToolbarMenu != null && m_ToolbarMenu.IsFadingOut) { m_ToolbarMenu.FadeIn(); return; } if (m_MenuPrefab == null || m_MenuObject != null) { return; } m_MenuObject = Instantiate(m_MenuPrefab); if (m_MenuObject == null) { return; } m_MenuObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform); m_MenuObject.transform.position = GetAnchor(); m_ToolbarMenu = m_MenuObject.GetComponent <UI.ToolbarMenu> (); if (m_ToolbarMenu != null) { m_ToolbarMenu.SetControl(this); if (!NodeTools.PatchedConicsUnlocked) { m_ToolbarMenu.DisableMainWindow(); } } GUIComponentManager.ProcessStyle(m_MenuObject); GUIComponentManager.ProcessLocalization(m_MenuObject); GUIComponentManager.ReplaceLabelsWithTMPro(m_MenuObject); }
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 CreateOrbitInfoControls(GameObject panel) { if (OrbitInfoPrefab == null) { return; } var orbitinfoObj = UnityEngine.Object.Instantiate(OrbitInfoPrefab); GUIComponentManager.ProcessStyle(orbitinfoObj); GUIComponentManager.ProcessLocalization(orbitinfoObj); GUIComponentManager.ProcessTooltips(orbitinfoObj); GUIComponentManager.ReplaceLabelsWithTMPro(orbitinfoObj); var orbitinfocontrol = orbitinfoObj.GetComponent <UI.OrbitInfoControl>(); orbitinfocontrol.SetControl(new OrbitInfoControlInterface(this)); orbitinfoObj.transform.SetParent(panel.transform, false); }
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; }
private void CreateUtAxisControls(GameObject panel) { if (UTPrefab == null || AxisPrefab == null) { return; } var utObj = UnityEngine.Object.Instantiate(UTPrefab); GUIComponentManager.ProcessStyle(utObj); GUIComponentManager.ProcessLocalization(utObj); GUIComponentManager.ProcessTooltips(utObj); GUIComponentManager.ReplaceLabelsWithTMPro(utObj); var utcontrol = utObj.GetComponent <UI.UTControl>(); utcontrol.SetControl(new UTControlInterface(this)); utObj.transform.SetParent(panel.transform, false); var progradeObj = UnityEngine.Object.Instantiate(AxisPrefab); GUIComponentManager.ProcessStyle(progradeObj); GUIComponentManager.ReplaceLabelsWithTMPro(progradeObj); var progradeAxis = progradeObj.GetComponent <UI.AxisControl>(); progradeAxis.SetControl(new AxisControlInterface(this, AxisControlInterface.Axis.prograde)); progradeObj.transform.SetParent(panel.transform, false); var normalObj = UnityEngine.Object.Instantiate(AxisPrefab); GUIComponentManager.ProcessStyle(normalObj); GUIComponentManager.ReplaceLabelsWithTMPro(normalObj); var normalAxis = normalObj.GetComponent <UI.AxisControl>(); normalAxis.SetControl(new AxisControlInterface(this, AxisControlInterface.Axis.normal)); normalObj.transform.SetParent(panel.transform, false); var radialObj = UnityEngine.Object.Instantiate(AxisPrefab); GUIComponentManager.ProcessStyle(radialObj); GUIComponentManager.ReplaceLabelsWithTMPro(radialObj); var radialAxis = radialObj.GetComponent <UI.AxisControl>(); radialAxis.SetControl(new AxisControlInterface(this, AxisControlInterface.Axis.radial)); radialObj.transform.SetParent(panel.transform, false); }
private void CreatePagerControls(GameObject panel) { if (PagerPrefab == null) { return; } var pagerObj = UnityEngine.Object.Instantiate(PagerPrefab); GUIComponentManager.ProcessStyle(pagerObj); GUIComponentManager.ProcessLocalization(pagerObj); GUIComponentManager.ProcessTooltips(pagerObj); GUIComponentManager.ReplaceLabelsWithTMPro(pagerObj); var pagercontrol = pagerObj.GetComponent <UI.PagerControl>(); pagercontrol.SetControl(new PagerControlInterface(this)); pagerObj.transform.SetParent(panel.transform, false); }
private void CreateGizmoControls(GameObject panel) { if (GizmoPrefab == null) { return; } var gizmoObj = UnityEngine.Object.Instantiate(GizmoPrefab); GUIComponentManager.ProcessStyle(gizmoObj); GUIComponentManager.ProcessLocalization(gizmoObj); GUIComponentManager.ProcessTooltips(gizmoObj); GUIComponentManager.ReplaceLabelsWithTMPro(gizmoObj); var gizmocontrol = gizmoObj.GetComponent <UI.GizmoControl>(); gizmocontrol.SetControl(new GizmoControlInterface(this)); gizmoObj.transform.SetParent(panel.transform, false); }
private void CreateTimeAlarmControls(GameObject panel) { if (TimeAlarmPrefab == null) { return; } var timeAlarmObj = UnityEngine.Object.Instantiate(TimeAlarmPrefab); GUIComponentManager.ProcessStyle(timeAlarmObj); GUIComponentManager.ProcessLocalization(timeAlarmObj); GUIComponentManager.ProcessTooltips(timeAlarmObj); GUIComponentManager.ReplaceLabelsWithTMPro(timeAlarmObj); var timealarmcontrol = timeAlarmObj.GetComponent <UI.TimeAlarmControl>(); timealarmcontrol.SetControl(new TimeAlarmControlInterface(this)); GUIComponentManager.ReplaceLabelsWithTMPro(timeAlarmObj); timeAlarmObj.transform.SetParent(panel.transform, false); }