Inheritance: UnityEngine.MonoBehaviour
示例#1
0
        void Awake()
        {
            loadConfigXML();
            Debug.Log("[IR GUI] awake");
            //enabled = false;
            guiEnabled         = false;
            groupEditorEnabled = false;
            var scene = HighLogic.LoadedScene;

            if (scene == GameScenes.FLIGHT)
            {
                GameEvents.onVesselChange.Add(onVesselChange);
                GameEvents.onVesselWasModified.Add(this.onVesselWasModified);
                gui_controller = this;
            }
            else if (scene == GameScenes.EDITOR || scene == GameScenes.SPH)
            {
                //partCounter = EditorLogic.fetch.ship.parts.Count;
                GameEvents.onPartAttach.Add(onPartAttach);
                GameEvents.onPartRemove.Add(onPartRemove);
                gui_controller = this;
            }
            else
            {
                gui_controller = null;
            }

            if (System.IO.File.Exists(KSPUtil.ApplicationRootPath + @"GameData/MagicSmokeIndustries/Plugins/14to15.txt"))
            {
                Debug.Log("debug found!");
                update14to15 = true;
            }

            if (ToolbarManager.ToolbarAvailable)
            {
                IRMinimizeButton             = ToolbarManager.Instance.add("sirkut", "IREditorButton");
                IRMinimizeButton.TexturePath = "MagicSmokeIndustries/Textures/icon_button";
                IRMinimizeButton.ToolTip     = "Infernal Robotics";
                IRMinimizeButton.Visibility  = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.SPH, GameScenes.FLIGHT);
                IRMinimizeButton.OnClick    += (e) => guiEnabled = !guiEnabled;

                IRMinimizeGroupButton             = ToolbarManager.Instance.add("sirkut2", "IREditorGroupButton");
                IRMinimizeGroupButton.TexturePath = "MagicSmokeIndustries/Textures/icon_buttonGROUP";
                IRMinimizeGroupButton.ToolTip     = "Infernal Robotics Group Editor";
                IRMinimizeGroupButton.Visibility  = new GameScenesVisibility(GameScenes.FLIGHT);
                IRMinimizeGroupButton.OnClick    += (e) => groupEditorEnabled = !groupEditorEnabled;
            }
            else
            {
                //enabled = true;
                //              guiEnabled = true;
                //              groupEditorEnabled = true;
                GameEvents.onGUIApplicationLauncherReady.Add(onAppReady);
            }

            initialGroupECUpdate = false;
        }
示例#2
0
        void Awake()
        {
            loadConfigXML();
            Debug.Log("[IR GUI] awake");
            //enabled = false;
            guiEnabled = false;
            groupEditorEnabled = false;
            var scene = HighLogic.LoadedScene;
            if (scene == GameScenes.FLIGHT)
            {

                GameEvents.onVesselChange.Add(onVesselChange);
                GameEvents.onVesselWasModified.Add(this.onVesselWasModified);
                gui_controller = this;
            }
            else if (scene == GameScenes.EDITOR)
            {
                //partCounter = EditorLogic.fetch.ship.parts.Count;
                GameEvents.onPartAttach.Add(onPartAttach);
                GameEvents.onPartRemove.Add(onPartRemove);
                GameEvents.onEditorShipModified.Add(onEditorShipModified);
                gui_controller = this;
            }
            else
            {
                gui_controller = null;
            }

            if (System.IO.File.Exists(KSPUtil.ApplicationRootPath + @"GameData/MagicSmokeIndustries/Plugins/14to15.txt"))
            {
                Debug.Log("debug found!");
                update14to15 = true;
            }

            if (ToolbarManager.ToolbarAvailable)
            {
                IRMinimizeButton = ToolbarManager.Instance.add("sirkut", "IREditorButton");
                IRMinimizeButton.TexturePath = "MagicSmokeIndustries/Textures/icon_button";
                IRMinimizeButton.ToolTip = "Infernal Robotics";
                IRMinimizeButton.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.FLIGHT);
                IRMinimizeButton.OnClick += (e) => guiEnabled = !guiEnabled;

                IRMinimizeGroupButton = ToolbarManager.Instance.add("sirkut2", "IREditorGroupButton");
                IRMinimizeGroupButton.TexturePath = "MagicSmokeIndustries/Textures/icon_buttonGROUP";
                IRMinimizeGroupButton.ToolTip = "Infernal Robotics Group Editor";
                IRMinimizeGroupButton.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
                IRMinimizeGroupButton.OnClick += (e) => groupEditorEnabled = !groupEditorEnabled;
            }
            else
            {
                //enabled = true;
                //            	guiEnabled = true;
                //            	groupEditorEnabled = true;
                GameEvents.onGUIApplicationLauncherReady.Add(onAppReady);
            }

            initialGroupECUpdate = false;
        }