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 = ELVersionReport.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; windowpos = GUILayout.Window(GetInstanceID(), windowpos, WindowGUI, ELVersionReport.GetVersion(), width695); }
void InfoWindow(int windowID) { ELStyles.Init(); 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(" "); ResourcePanel("Required", cost.required, reqScroll); ResourcePanel("Optional", cost.optional, optScroll); string ver = ELVersionReport.GetVersion(); GUILayout.Label(ver); GUILayout.EndVertical(); GUI.DragWindow(); }