Beispiel #1
0
 public void OnDestroy()
 {
     if (graphWindow != null)
     {
         graphWindow.save_settings();
         graphWindow.shown = false;
     }
     if (GameEvents.onGUIApplicationLauncherReady != null)
     {
         GameEvents.onGUIApplicationLauncherReady.Remove(onAppLauncherLoad);
     }
     if (GameEvents.onGUIApplicationLauncherUnreadifying != null)
     {
         GameEvents.onGUIApplicationLauncherUnreadifying.Remove(onAppLauncherUnload);
     }
     if (GameEvents.onEditorRestart != null)
     {
         GameEvents.onEditorRestart.Remove(TurnOffCoL);
     }
     if (GameEvents.onEditorShipModified != null)
     {
         GameEvents.onEditorShipModified.Remove(EditorPartEvent);
     }
     if (new_CoL_marker != null)
     {
         Destroy(new_CoL_marker);
     }
     graphWindow = null;
 }
Beispiel #2
0
        void Start()
        {
            Debug.Log("[CorrectCoL]: Starting!");

            if (!far_searched)
            {
                foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    if (a.GetName().Name.Equals("FerramAerospaceResearch"))
                    {
                        far_found = true;
                        break;
                    }
                }
                far_searched = true;
            }
            if (far_found)
            {
                Debug.Log("[CorrectCoL]: FAR found, disabling itself!");
                GameObject.Destroy(this.gameObject);
                return;
            }

            overlays = EditorVesselOverlays.fetch;
            if (overlays == null)
            {
                Debug.Log("[CorrectCoL]: overlays is null!");
                GameObject.Destroy(this.gameObject);
                return;
            }
            old_CoL_marker = overlays.CoLmarker;
            if (old_CoL_marker == null)
            {
                Debug.Log("[CorrectCoL]: CoL_marker is null!");
                GameObject.Destroy(this.gameObject);
                return;
            }
            bodylift_curves = PhysicsGlobals.GetLiftingSurfaceCurve("BodyLift");
            if (new_CoL_marker == null)
            {
                new_CoL_marker                 = this.gameObject.AddComponent <CoLMarkerFull>();
                CoLMarkerFull.lift_curves      = bodylift_curves;
                new_CoL_marker.posMarkerObject = (GameObject)GameObject.Instantiate(old_CoL_marker.dirMarkerObject);
                new_CoL_marker.posMarkerObject.transform.parent     = new_CoL_marker.transform;
                new_CoL_marker.posMarkerObject.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
                new_CoL_marker.posMarkerObject.SetActive(false);
                new_CoL_marker.posMarkerObject.layer = 2;
                foreach (Transform child in new_CoL_marker.posMarkerObject.transform)
                {
                    child.gameObject.layer = 2;
                }
                GameEvents.onEditorRestart.Add(new EventVoid.OnEvent(TurnOffCoL));
                // should be called once, so let's deserialize graph here too
                GraphWindow.load_settings();
                GraphWindow.init_textures(true);
                GraphWindow.init_reflections();

                clickEvent = new Button.ButtonClickedEvent();
                clickEvent.AddListener(ToggleCoL);
            }
            GameEvents.onGUIApplicationLauncherReady.Add(onAppLauncherLoad);
            GameEvents.onGUIApplicationLauncherUnreadifying.Add(onAppLauncherUnload);
            onAppLauncherLoad();
            GraphWindow.shown      = false;
            new_CoL_marker.enabled = false;
            old_CoL_marker.gameObject.SetActive(false);
            overlays.toggleCoLbtn.onClick = clickEvent;
            //overlays.toggleCoLbtn.methodToInvoke = "ToggleCoL";
        }
Beispiel #3
0
 void OnGUI()
 {
     GraphWindow.OnGUI();
 }
Beispiel #4
0
 public void OnDestroy()
 {
     GameEvents.onEditorRestart.Remove(new EventVoid.OnEvent(TurnOffCoL));
     GraphWindow.save_settings();
     GraphWindow.shown = false;
 }