void OnGUI() { if (enabled) // don't do any work at all unless we're enabled { if (gui_enabled) // don't create windows unless we're going to show them { GUI.skin = HighLogic.Skin; if (windowpos.x == 0) { windowpos = new Rect(Screen.width / 2 - 250, Screen.height / 2 - 30, 0, 0); } string name = "Extraplanetary Launchpad"; string ver = ExVersionReport.GetVersion(); windowpos = GUILayout.Window(GetInstanceID(), windowpos, WindowGUI, name + " " + ver, GUILayout.Width(500)); if (windowpos.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { InputLockManager.SetControlLock("EL_Settings_window_lock"); } else { InputLockManager.RemoveControlLock("EL_Settings_window_lock"); } } else { InputLockManager.RemoveControlLock("EL_Settings_window_lock"); } } }
void OnGUI() { GUI.skin = HighLogic.Skin; string name = "Extraplanetary Launchpad"; string ver = ExVersionReport.GetVersion(); string sit = control.builder.vessel.situation.ToString(); windowpos = GUILayout.Window(GetInstanceID(), windowpos, WindowGUI, name + " " + ver + ": " + sit, GUILayout.Width(695)); }
void InfoWindow(int windowID) { var cost = cashed_cost; double required_mass = 0; double resource_mass = 0; double kerbalHours = 0; foreach (var res in cost.required) { kerbalHours += res.kerbalHours * res.amount; required_mass += res.mass; } kerbalHours = Math.Round(kerbalHours, 4); foreach (var res in cost.optional) { resource_mass += res.mass; } GUILayout.BeginVertical(); MassLabel("Dry mass", buildCost.mass); MassLabel("Resource mass", resource_mass); MassLabel("Total mass", required_mass + resource_mass); UnitLabel("Build Time", kerbalHours, "Kh"); cost.optional.Sort(); GUILayout.Label(" "); scrollPosR = ResourcePanel("Required", cost.required, scrollPosR); scrollPosO = ResourcePanel("Optional", cost.optional, scrollPosO); string ver = ExVersionReport.GetVersion(); GUILayout.Label(ver); GUILayout.EndVertical(); GUI.DragWindow(); }