Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }