public void Start()
 {
     INSTANCE = this;
     DontDestroyOnLoad(this);
     if (partListLoadedEvent == null)
     {
         partListLoadedEvent = new EventVoid.OnEvent(onPartListLoaded);
         GameEvents.OnPartLoaderLoaded.Add(partListLoadedEvent);
     }
 }
示例#2
0
 public void Start()
 {
     Log.log("TexturesUnlimitedLoader - Start()");
     INSTANCE = this;
     DontDestroyOnLoad(this);
     if (partListLoadedEvent == null)
     {
         partListLoadedEvent = new EventVoid.OnEvent(onPartListLoaded);
         GameEvents.OnPartLoaderLoaded.Add(partListLoadedEvent);
     }
 }
        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();
            }
        }
示例#4
0
        public void Start()
        {
            MonoBehaviour.print("TULoader - Start()");
            INSTANCE = this;
            DontDestroyOnLoad(this);
            if (partListLoadedEvent == null)
            {
                partListLoadedEvent = new EventVoid.OnEvent(onPartListLoaded);
                GameEvents.OnPartLoaderLoaded.Add(partListLoadedEvent);
            }

            //check the graphics API, popup warning if using unsupported gfx (dx9/11/12/legacy-openGL)
            UnityEngine.Rendering.GraphicsDeviceType graphicsAPI = SystemInfo.graphicsDeviceType;
            if (graphicsAPI == UnityEngine.Rendering.GraphicsDeviceType.OpenGLCore)
            {
                //noop, everything is fine
            }
            else if (graphicsAPI == UnityEngine.Rendering.GraphicsDeviceType.Direct3D11)
            {
                //works, but needs alternate render
                alternateRender = true;
            }
            else if (graphicsAPI == UnityEngine.Rendering.GraphicsDeviceType.Direct3D9)
            {
                //has issues -- display warning, and needs alternate render
                alternateRender = true;
                if (apiCheckGUI == null)
                {
                    apiCheckGUI = this.gameObject.AddComponent <GraphicsAPIGUI>();
                    apiCheckGUI.openGUI();
                }
            }
            else
            {
                //unknown API -- display warning
                if (apiCheckGUI == null)
                {
                    apiCheckGUI = this.gameObject.AddComponent <GraphicsAPIGUI>();
                    apiCheckGUI.openGUI();
                }
            }
        }
        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();
        }
示例#6
0
        public void Start()
        {
            MonoBehaviour.print("TULoader - Start()");
            INSTANCE = this;
            DontDestroyOnLoad(this);
            if (partListLoadedEvent == null)
            {
                partListLoadedEvent = new EventVoid.OnEvent(onPartListLoaded);
                GameEvents.OnPartLoaderLoaded.Add(partListLoadedEvent);
            }

            //check the graphics API, popup warning if using unsupported gfx (dx9/11/12/legacy-openGL)
            UnityEngine.Rendering.GraphicsDeviceType graphicsAPI = SystemInfo.graphicsDeviceType;
            if (graphicsAPI != UnityEngine.Rendering.GraphicsDeviceType.OpenGLCore)
            {
                if (apiCheckGUI == null)
                {
                    apiCheckGUI = this.gameObject.AddComponent <GraphicsAPIGUI>();
                    apiCheckGUI.openGUI();
                }
            }
        }
示例#7
0
 public extern static bool RemoveEventUpwards(Transform transform, string eventName, EventVoid.OnEvent evt, bool removeFromAll);
示例#8
0
 public extern static bool RemoveEventScene(string eventName, EventVoid.OnEvent evt, bool removeFromAll);
示例#9
0
 /// <summary>
 /// Remove a method from the list of methods to be run when the EventVoid is fired.
 ///
 /// This is generally done in an object's OnDestroy method.
 /// </summary>
 /// <param name="evt">The method you want to remove, should contain no parameters</param>
 public extern void Remove(EventVoid.OnEvent evt);
示例#10
0
 public extern static bool AddEventUpwards(Transform transform, string eventName, EventVoid.OnEvent evt, bool addToAll);
示例#11
0
 public extern static bool AddEventScene(string eventName, EventVoid.OnEvent evt, bool addToAll);
示例#12
0
 /// <summary>
 /// Add a method to be run when the EventVoid is fired.
 ///
 /// This is generally done in an object's Start or Awake method, or a class' constructor.
 ///
 /// Can be setup like:
 ///
 /// GameEvents.someEventVoidEvent.Add(yourMethod);
 ///
 /// or
 ///
 /// GameEvents.someEventVoidEvent.Add(new EventVoid.OnEvent(yourMethod));
 /// </summary>
 /// <param name="evt">The method you want to add, should contain no parameters</param>
 public extern void Add(EventVoid.OnEvent evt);
        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 ();
            }
        }