コード例 #1
0
        public void Start()
        {
            log = new Log(this.GetType().Name);
            log.Debug("Start");

            if (gui == null)
            {
                gui = this.gameObject.AddComponent <MainMenuGui> ();
                gui.UpdateToolbarStock();
                gui.SetVisible(false);
            }

            config = readConfig();

            KspIssue3838Fix.ApplyFix(config.enableExperimentalEditorExtensionsCompatibility);

            editorFSM = (KerbalFSM)Refl.GetValue(EditorLogic.fetch, "\u0001");

            cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker() : (CursorLocker) new UnityLocker();

            movementBounds = new Bounds();
            if (EditorDriver.editorFacility == EditorFacility.VAB)
            {
                movementBounds = config.vab.bounds;
            }
            else if (EditorDriver.editorFacility == EditorFacility.SPH)
            {
                movementBounds = config.sph.bounds;
            }
            if (!config.enforceBounds)
            {
                movementBounds = new Bounds(Vector3.zero, Vector3.one * float.MaxValue);
            }

            var restartListener = new EventVoid.OnEvent(this.OnEditorRestart);

            GameEvents.onEditorRestart.Add(restartListener);
            OnCleanup += () => GameEvents.onEditorRestart.Remove(restartListener);

            var partEventListener = new EventData <ConstructionEventType, Part> .OnEvent(this.OnPartEvent);

            GameEvents.onEditorPartEvent.Add(partEventListener);
            OnCleanup += () => GameEvents.onEditorPartEvent.Remove(partEventListener);

            if (config.defaultCamera)
            {
                SwitchMode(false);
                ResetCamera();
            }
        }
コード例 #2
0
        public void Start()
        {
            Log.SetTitle("this.GetType ().Name");

            Log.Debug("Start");
#if (DEBUG)
            Log.SetLevel(Log.LEVEL.INFO);
            Log.Debug("Start 2");
            gui = null;
#endif

            if (gui == null)
            {
                gui = this.gameObject.AddComponent <MainMenuGui>();
                gui.UpdateToolbarStock();
                gui.SetVisible(false);
            }

            readConfig();

            // KspIssue3838Fix.ApplyFix (config.enableExperimentalEditorExtensionsCompatibility);

            //editorFSM = (KerbalFSM)Refl.GetValue (EditorLogic.fetch, "\u0001");
            //Log.Info ("editorFSM: " + editorFSM.ToString ());

            cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker() : (CursorLocker) new UnityLocker();



            var restartListener = new EventVoid.OnEvent(this.OnEditorRestart);
            GameEvents.onEditorRestart.Add(restartListener);
            OnCleanup += () => GameEvents.onEditorRestart.Remove(restartListener);

            var partEventListener = new EventData <ConstructionEventType, Part> .OnEvent(this.OnPartEvent);

            GameEvents.onEditorPartEvent.Add(partEventListener);
            OnCleanup += () => GameEvents.onEditorPartEvent.Remove(partEventListener);

            UpdateForEditor();
        }
コード例 #3
0
 public void Update()
 {
     if (gui == null)
     {
         gui = this.gameObject.AddComponent <MainMenuGui> ();
         gui.UpdateToolbarStock();
         gui.SetVisible(false);
     }
     if (HighLogic.LoadedScene == GameScenes.EDITOR)
     {
         if (MainMenuGui.WASD_Button == null)
         {
             GameEvents.onGUIApplicationLauncherReady.Add(gui.OnGUIApplicationLauncherReady);
         }
         gui.OnGUIShowApplicationLauncher();
     }
     else
     {
         //setToolbarButtonVisibility (true);
     }
     gui.set_WASD_Button_active(cameraEnabled && EditorLogic.SelectedPart == null);
 }
コード例 #4
0
        public void Update()
        {
            if (lastEditorMode != EditorDriver.editorFacility)
            {
                checkMovementBounds();
                if (config.defaultCamera)
                {
                    SwitchMode(false, false, true);
                    ResetCamera();
                }
                //UpdateForEditor();
            }

            if (gui == null)
            {
                gui = this.gameObject.AddComponent <MainMenuGui>();
                gui.UpdateToolbarStock();
                gui.SetVisible(false);
            }

            gui.set_WASD_Button_active(cameraEnabled && EditorLogic.SelectedPart == null);
        }
コード例 #5
0
        public void Update()
        {
            if (gui == null) {
                gui = this.gameObject.AddComponent<MainMenuGui> ();
                gui.UpdateToolbarStock ();
                gui.SetVisible (false);

            }
            if (HighLogic.LoadedScene == GameScenes.EDITOR ) {
                if (gui.WASD_Button == null)
                    GameEvents.onGUIApplicationLauncherReady.Add (gui.OnGUIApplicationLauncherReady);
                gui.OnGUIShowApplicationLauncher ();
            } else {
                //setToolbarButtonVisibility (true);
            }
            gui.set_WASD_Button_active (cameraEnabled && EditorLogic.SelectedPart == null );
        }
コード例 #6
0
        public void Start()
        {
            Log.SetTitle ("this.GetType ().Name");

            Log.Debug ("Start");
            #if (DEBUG)
            Log.SetLevel (Log.LEVEL.INFO);
            Log.Debug ("Start");
            gui = null;
            #endif

            if (gui == null) {
                gui = this.gameObject.AddComponent<MainMenuGui> ();
                gui.UpdateToolbarStock ();
                gui.SetVisible (false);

            }

            readConfig ();

            KspIssue3838Fix.ApplyFix (config.enableExperimentalEditorExtensionsCompatibility);

            editorFSM = (KerbalFSM)Refl.GetValue (EditorLogic.fetch, "\u0001");

            cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker () : (CursorLocker)new UnityLocker ();

            movementBounds = new Bounds ();
            if (EditorDriver.editorFacility == EditorFacility.VAB) {
                movementBounds = config.vab.bounds;
            } else if (EditorDriver.editorFacility == EditorFacility.SPH) {
                movementBounds = config.sph.bounds;
            }
            if (!config.enforceBounds) {
                movementBounds = new Bounds (Vector3.zero, Vector3.one * float.MaxValue);
            }

            var restartListener = new EventVoid.OnEvent (this.OnEditorRestart);
            GameEvents.onEditorRestart.Add (restartListener);
            OnCleanup += () => GameEvents.onEditorRestart.Remove (restartListener);

            var partEventListener = new EventData<ConstructionEventType, Part>.OnEvent (this.OnPartEvent);
            GameEvents.onEditorPartEvent.Add (partEventListener);
            OnCleanup += () => GameEvents.onEditorPartEvent.Remove (partEventListener);

            if (config.defaultCamera) {
                SwitchMode (false);
                ResetCamera ();
            }
        }
        public void Start()
        {
            Log.SetTitle ("this.GetType ().Name");

            Log.Debug ("Start");
            #if (DEBUG)
            Log.SetLevel (Log.LEVEL.INFO);
            Log.Debug ("Start 2");
            gui = null;
            #endif

            if (gui == null) {
                gui = this.gameObject.AddComponent<MainMenuGui> ();
                gui.UpdateToolbarStock ();
                gui.SetVisible (false);

            }

            readConfig ();

            // KspIssue3838Fix.ApplyFix (config.enableExperimentalEditorExtensionsCompatibility);

            //editorFSM = (KerbalFSM)Refl.GetValue (EditorLogic.fetch, "\u0001");
            //Log.Info ("editorFSM: " + editorFSM.ToString ());

            cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker () : (CursorLocker)new UnityLocker ();

            checkMovementBounds ();

            var restartListener = new EventVoid.OnEvent (this.OnEditorRestart);
            GameEvents.onEditorRestart.Add (restartListener);
            OnCleanup += () => GameEvents.onEditorRestart.Remove (restartListener);

            var partEventListener = new EventData<ConstructionEventType, Part>.OnEvent (this.OnPartEvent);
            GameEvents.onEditorPartEvent.Add (partEventListener);
            OnCleanup += () => GameEvents.onEditorPartEvent.Remove (partEventListener);

            if (config.defaultCamera) {
                SwitchMode (false);
                ResetCamera ();
            }
        }