public override void OnStart(PartModule.StartState state) { base.OnStart(state); if (state == StartState.Editor) { return; } flightStarted = true; RTGlobals.controller.createGUI(); RTGlobals.Load(); if (vessel.isActiveVessel) { RTGlobals.coreList.Clear(); } UPDRTmenuBool(); parts = vessel.parts.Count; }
public void GUI(int windowID) { GUILayout.Space(25); GUILayout.Label("Speed of light used to calculate control delay in m/s (minimum 1)"); GUILayout.BeginHorizontal(); SpeedOfLight = GUILayout.TextField(SpeedOfLight); char[] tmp = SpeedOfLight.ToArray(); SpeedOfLight = ""; foreach (char a in tmp) { if ("0123456789".Contains(a)) { SpeedOfLight += a; } } if (SpeedOfLight == "") { SpeedOfLight = "0"; } if (float.Parse(SpeedOfLight) < 1) { SpeedOfLight = "1"; } if (GUILayout.Button("Reset to default", GUILayout.Width(110))) { SpeedOfLight = "300000000"; } GUILayout.EndHorizontal(); GUILayout.Space(25); GUILayout.Label("Required crew for a command station (minimum 1)"); GUILayout.BeginHorizontal(); RcCrew = GUILayout.TextField(RcCrew); tmp = RcCrew.ToArray(); RcCrew = ""; foreach (char a in tmp) { if ("0123456789".Contains(a)) { RcCrew += a; } } if (RcCrew == "") { RcCrew = "0"; } if (float.Parse(RcCrew) < 1) { RcCrew = "1"; } if (GUILayout.Button("Reset to default", GUILayout.Width(110))) { RcCrew = "3"; } GUILayout.EndHorizontal(); GUILayout.Space(25); GUILayout.Label("Extended control range for unfocused vessels. If on, this could cause a bit of lag if you try to control an unfocused vessel when there are a lot of vessels in your immediate viscinity (default on)"); expack = GUILayout.Toggle(expack, "Extended control range " + (expack ? "on" : "off")); GUILayout.Space(25); GUILayout.Label("Colourblind friendly mode adds a small extra indicator to the flight computer (default off)"); colfriend = GUILayout.Toggle(colfriend, "Colourblind friendly mode " + (colfriend ? "on" : "off")); GUILayout.Space(25); if (GUILayout.Button("Reset window positions to default")) { RTGlobals.windowPos = new Rect(Screen.width / 4, Screen.height / 4, 350, 200); RTGlobals.SettingPos = new Rect((Screen.width / 2) - 175, (Screen.height / 2) - 300, 100, 200); RTGlobals.AttitudePos = new Rect((Screen.width / 2) - 132, Screen.height / 2, 100, 200); RTGlobals.ThrottlePos = new Rect((Screen.width / 2) - 109, (Screen.height / 2) - 133, 100, 200); RTGlobals.SaveData(); } }
public override void OnAwake() { base.OnAwake(); RTGlobals.make(); }
public void OnDestroy() { RTGlobals.SaveData(); }