public override void OnUpdate() { status_str = currentActivity == null?Localizer.Format("#LOC_KSPIE_Refinery_Offline") : currentActivity.Status; }
private void HandleResourceActivities(float timeStep) { if (!ManualControl) { CurrentReactorThrottle = CalculateGoalThrottle(timeStep); } double burnRate = 0d; float fuelThrottle = CurrentReactorThrottle / 100f; bool fuelCheckPassed = true; // Check for full-ness foreach (ResourceRatio ratio in outputs) { if (CheckFull(ratio.ResourceName, fuelThrottle * ratio.Ratio * timeStep)) { ReactorDeactivated(); return; } } // CHeck for fuel and consume foreach (ResourceRatio ratio in inputs) { double amt = this.part.RequestResource(ratio.ResourceName, fuelThrottle * ratio.Ratio * timeStep, ratio.FlowMode); if (amt < 0.0000000000001) { ReactorDeactivated(); fuelCheckPassed = false; } if (ratio.ResourceName == FuelName) { burnRate = ratio.Ratio; } } // If fuel consumed, add waste if (fuelCheckPassed) { foreach (ResourceRatio ratio in outputs) { double amt = this.part.RequestResource(ratio.ResourceName, -fuelThrottle * ratio.Ratio * timeStep, ratio.FlowMode); } } if (GeneratesElectricity) { if (HighLogic.LoadedSceneIsEditor) { CurrentElectricalGeneration = ElectricalGeneration.Evaluate(CurrentReactorThrottle); } if (fuelCheckPassed) { CurrentElectricalGeneration = ElectricalGeneration.Evaluate(CurrentThrottle); this.part.RequestResource(PartResourceLibrary.ElectricityHashcode, -CurrentElectricalGeneration * timeStep, ResourceFlowMode.ALL_VESSEL); GeneratorStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_GeneratorStatus_Normal", CurrentElectricalGeneration.ToString("F1")); } else { GeneratorStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_GeneratorStatus_Offline"); } } // Find the time remaining at current rate FuelStatus = FindTimeRemaining( this.part.Resources.Get(PartResourceLibrary.Instance.GetDefinition(FuelName).id).amount, burnRate); }
public new void Start() { base.Start(); Fields["simulatedAbundance"].guiName = Localizer.Format("#LOC_KerbalismSystemHeat_SimulatedResourceAbundance", ResourceName); }
public override string GetModuleDisplayName() { return(Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_ModuleName")); }
public virtual void FixedUpdate() { if (HighLogic.LoadedSceneIsEditor) { HandleHeatGenerationEditor(); if (GeneratesElectricity) { CurrentElectricalGeneration = ElectricalGeneration.Evaluate(CurrentThrottle); } } if (HighLogic.LoadedSceneIsFlight) { if (part.vessel.missionTime > 0.0) { LastUpdateTime = Planetarium.GetUniversalTime(); } // Update reactor core integrity readout if (CoreIntegrity > 0) { CoreStatus = String.Format("{0:F2} %", CoreIntegrity); } else { CoreStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_CoreStatus_Meltdown"); } HandleCoreDamage(); HandleThrottle(); HandleHeatGeneration(); // IF REACTOR ON // ============= if (Enabled) { HandleResourceActivities(TimeWarp.fixedDeltaTime); if (heatModule.currentLoopTemperature > CurrentSafetyOverride) { ScreenMessages.PostScreenMessage(new ScreenMessage( Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Message_EmergencyShutdown", CurrentSafetyOverride.ToString("F0"), part.partInfo.title ), 5.0f, ScreenMessageStyle.UPPER_CENTER)); ReactorDeactivated(); } } // IF REACTOR OFF // ============= else { CurrentElectricalGeneration = 0f; GeneratorStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_GeneratorStatus_Offline"); // Update UI if (CoreIntegrity <= 0f) { FuelStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_FuelStatus_Meltdown"); ReactorOutput = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_ReactorOutput_Meltdown"); } else { FuelStatus = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_FuelStatus_Offline"); ReactorOutput = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_ReactorOutput_Offline"); } } } }
void Localize() { Events["ToggleVisibility"].guiName = Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_Event_ShowPath_Title"); Fields["StatusString"].guiName = Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorBuff_Title"); Fields["TargetString"].guiName = Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorName_Title"); }
public override string GetModuleDisplayName() { return(Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_ModuleName")); }
void DrawWindow(int windowId) { // Get window width from localization int windowWidth; if (int.TryParse(Localizer.GetStringByTag("#ModAutoAction_WindowWidth"), out windowWidth)) { _windowRectangle.width = windowWidth; } else { windowWidth = (int)_windowRectangle.width; } // Relative width unit float unit = (windowWidth - 10F) / 15F; GUI.Label( new Rect(5, 23, windowWidth - 5, 20), Localizer.Format("#ModAutoAction_PerVesselSettings"), LabelStyle); if (GUI.Button( new Rect(5, 45, 5 * unit, 18), Localizer.Format("#ModAutoAction_Abort"), GetButtonStyleByValue(_activateAbort))) { _activateAbort = GetNextValue(_activateAbort); RefreshPartModules(); } if (GUI.Button( new Rect(5 + 5 * unit, 45, 5 * unit, 18), Localizer.Format("#ModAutoAction_Brakes"), GetButtonStyleByValue(_activateBrakes))) { _activateBrakes = GetNextValue(_activateBrakes); RefreshPartModules(); } if (GUI.Button( new Rect(5 + 10 * unit, 45, 5 * unit, 18), Localizer.Format("#ModAutoAction_Gear"), GetButtonStyleByValue(_activateGear))) { _activateGear = GetNextValue(_activateGear); RefreshPartModules(); } if (GUI.Button( new Rect(5, 63, 5 * unit, 18), Localizer.Format("#ModAutoAction_Lights"), GetButtonStyleByValue(_activateLights))) { _activateLights = GetNextValue(_activateLights); RefreshPartModules(); } if (GUI.Button( new Rect(5 + 5 * unit, 63, 5 * unit, 18), Localizer.Format("#ModAutoAction_Rcs"), GetButtonStyleByValue(_activateRcs))) { _activateRcs = GetNextValue(_activateRcs); RefreshPartModules(); } if (GUI.Button( new Rect(5 + 10 * unit, 63, 5 * unit, 18), Localizer.Format("#ModAutoAction_Sas"), GetButtonStyleByValue(_activateSas))) { _activateSas = GetNextValue(_activateSas); RefreshPartModules(); } GUI.Label( new Rect(8, 81, windowWidth - 10, 20), Localizer.Format("#ModAutoAction_CustomActions"), LabelStyle); // Only show custom groups if unlocked in editor if (_showCustomGroups) { var activateGroupA = GUI.TextField( new Rect(5, 103, 3 * unit, 20), _activateGroupA.ToStringValue(nullValue: ""), 4, TextFieldStyle).ParseNullableInt(minValue: 1); if (activateGroupA != _activateGroupA) { _activateGroupA = activateGroupA; RefreshPartModules(); } var activateGroupB = GUI.TextField( new Rect(5 + 3 * unit, 103, 3 * unit, 20), _activateGroupB.ToStringValue(nullValue: ""), 4, TextFieldStyle).ParseNullableInt(minValue: 1); if (activateGroupB != _activateGroupB) { _activateGroupB = activateGroupB; RefreshPartModules(); } var activateGroupC = GUI.TextField( new Rect(5 + 6 * unit, 103, 3 * unit, 20), _activateGroupC.ToStringValue(nullValue: ""), 4, TextFieldStyle).ParseNullableInt(minValue: 1); if (activateGroupC != _activateGroupC) { _activateGroupC = activateGroupC; RefreshPartModules(); } var activateGroupD = GUI.TextField( new Rect(5 + 9 * unit, 103, 3 * unit, 20), _activateGroupD.ToStringValue(nullValue: ""), 4, TextFieldStyle).ParseNullableInt(minValue: 1); if (activateGroupD != _activateGroupD) { _activateGroupD = activateGroupD; RefreshPartModules(); } var activateGroupE = GUI.TextField( new Rect(5 + 12 * unit, 103, 3 * unit, 20), _activateGroupE.ToStringValue(nullValue: ""), 4, TextFieldStyle).ParseNullableInt(minValue: 1); if (activateGroupE != _activateGroupE) { _activateGroupE = activateGroupE; RefreshPartModules(); } } else { GUI.Label( new Rect(8, 103, windowWidth - 10, 20), Localizer.Format("#ModAutoAction_NotAvailable"), FailLabelStyle); } if (GUI.Button( new Rect(5, 125, 5 * unit, 20), Localizer.Format("#ModAutoAction_Throttle"), _setThrottle.HasValue ? OnButtonStyle : DefaultButtonStyle)) { _setThrottle = _setThrottle.HasValue ? (int?)null : _defaultSetThrottle; RefreshPartModules(); } if (_setThrottle.HasValue) { var setThrottle = GUI.TextField( new Rect(5 + 5 * unit, 125, 4 * unit, 20), _setThrottle.ToStringValue(nullValue: ""), 3, TextFieldStyle).ParseNullableInt(minValue: 0, maxValue: 100); if (setThrottle != _setThrottle) { _setThrottle = setThrottle; RefreshPartModules(); } GUI.Label( new Rect(10 + 9 * unit, 125, 2 * unit - 5, 20), "%", LabelStyle); } else { GUI.Label( new Rect(10 + 5 * unit, 125, 6 * unit - 5, 20), Localizer.Format("#ModAutoAction_Default"), LabelStyle); } if (GUI.Button( new Rect(5 + 11 * unit, 125, 4 * unit, 20), Localizer.Format("#ModAutoAction_PCtrl"), GetButtonStyleByValue(_setPrecCtrl))) { _setPrecCtrl = GetNextValue(_setPrecCtrl); RefreshPartModules(); } // Default settings GUI.Label( new Rect(5, 148, windowWidth - 5, 20), Localizer.Format(_facilityPrefix == "VAB" ? "#ModAutoAction_VabDefaults" : "#ModAutoAction_SphDefaults"), LabelStyle); if (GUI.Button( new Rect(windowWidth - 35, 150, 30, 18), _isWindowExpanded ? "â–²" : "â–¼", DefaultButtonStyle)) { _isWindowExpanded = !_isWindowExpanded; } if (_isWindowExpanded) { if (GUI.Button( new Rect(5, 170, 5 * unit, 18), Localizer.Format("#ModAutoAction_Abort"), GetButtonStyleByValue(_defaultActivateAbort))) { _defaultActivateAbort = !_defaultActivateAbort; SaveDefaultSettings(); } if (GUI.Button( new Rect(5 + 5 * unit, 170, 5 * unit, 18), Localizer.Format("#ModAutoAction_Brakes"), GetButtonStyleByValue(_defaultActivateBrakes))) { _defaultActivateBrakes = !_defaultActivateBrakes; SaveDefaultSettings(); } if (GUI.Button( new Rect(5 + 10 * unit, 170, 5 * unit, 18), Localizer.Format("#ModAutoAction_Gear"), GetButtonStyleByValue(_defaultActivateGear))) { _defaultActivateGear = !_defaultActivateGear; SaveDefaultSettings(); } if (GUI.Button( new Rect(5, 188, 5 * unit, 18), Localizer.Format("#ModAutoAction_Lights"), GetButtonStyleByValue(_defaultActivateLights))) { _defaultActivateLights = !_defaultActivateLights; SaveDefaultSettings(); } if (GUI.Button( new Rect(5 + 5 * unit, 188, 5 * unit, 18), Localizer.Format("#ModAutoAction_Rcs"), GetButtonStyleByValue(_defaultActivateRcs))) { _defaultActivateRcs = !_defaultActivateRcs; SaveDefaultSettings(); } if (GUI.Button( new Rect(5 + 10 * unit, 188, 5 * unit, 18), Localizer.Format("#ModAutoAction_Sas"), GetButtonStyleByValue(_defaultActivateSas))) { _defaultActivateSas = !_defaultActivateSas; SaveDefaultSettings(); } GUI.Label( new Rect(5, 208, 5 * unit, 20), Localizer.Format("#ModAutoAction_Throttle"), CenterAlingedLabelStyle); var defaultSetThrottle = GUI.TextField( new Rect(5 + 5 * unit, 208, 4 * unit, 20), _defaultSetThrottle.ToStringValue(), 3, TextFieldStyle).ParseNullableInt(minValue: 0, maxValue: 100) ?? 0; if (defaultSetThrottle != _defaultSetThrottle) { _defaultSetThrottle = defaultSetThrottle; SaveDefaultSettings(); } GUI.Label( new Rect(10 + 9 * unit, 208, 2 * unit - 5, 20), "%", LabelStyle); if (GUI.Button( new Rect(5 + 11 * unit, 208, 4 * unit, 20), Localizer.Format("#ModAutoAction_PCtrl"), GetButtonStyleByValue(_defaultSetPrecCtrl))) { _defaultSetPrecCtrl = !_defaultSetPrecCtrl; SaveDefaultSettings(); } } // Window is draggable GUI.DragWindow(); }
public void OnGUI() { // Only show on actions screen and if at least basic actions are unlocked if (EditorLogic.fetch.editorScreen == EditorScreen.Actions && _showBasicGroups) { _windowRectangle.height = _isWindowExpanded ? ExpandedWindowHeight : CollapsedWindowHeight; _windowRectangle = GUI.Window(WindowId, _windowRectangle, DrawWindow, Localizer.Format("#ModAutoAction_Title"), WindowStyle); } }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { string targetName = context?.targetBody?.displayName.LocalizeRemoveGender() ?? Localizer.Format("#KerCon_ABody"); ObserveBodyState losState = (ObserveBodyState)state; if (!losState.requirementMet) { if (losState.occluder != null) { return(Localizer.Format("#KerCon_OccludedByX", Lib.Color(losState.occluder.displayName.LocalizeRemoveGender(), Lib.Kolor.Red))); // Occluded by <<1>> } if (losState.distance > 0) { return(Localizer.Format("#KerCon_DistanceX", Lib.Color(Lib.HumanReadableDistance(losState.distance), Lib.Kolor.Red))); } if (!losState.angularRequirementMet && (minAngularVelocity != 0 ||  maxAngularVelocity != 0)) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Red); return(Localizer.Format("#KerCon_AngularVelX", angularVelocityStr)); } return(Localizer.Format("#KerCon_XisY", targetName, Lib.Color(Localizer.Format("#KerCon_NotVisible"), Lib.Kolor.Red))); } string result = Localizer.Format("#KerCon_XisY", targetName, Lib.Color(Localizer.Format("#KerCon_Visible"), Lib.Kolor.Green)); if (losState.angularRequirementMet) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Green); result += ", " + Localizer.Format("#KerCon_AngularVelX", angularVelocityStr); } return(result); }
public override string GetTitle(EvaluationContext context) { string targetName = context?.targetBody?.displayName.LocalizeRemoveGender() ?? Localizer.Format("#KerCon_ABody"); string result = Localizer.Format("#KerCon_LineOfSightToX", targetName); // Line of sight to <<1>> double distance = maxDistance; if (distance == 0 && maxDistanceAU != 0) { distance = Sim.AU * maxDistanceAU; } if (distance != 0) { result += ", " + Localizer.Format("#KerCon_MaxDistanceX", Lib.HumanReadableDistance(distance)); } if (minSurface != 0) { result += ", " + Localizer.Format("#KerCon_XofSurfaceObserved", Lib.HumanReadablePerc(minSurface / 100.0)); // <<1>> of surface observed } if (minAngularVelocity > 0) { result += ", " + Localizer.Format("#KerCon_MinAngularVelX", minAngularVelocity.ToString("F1")); } if (maxAngularVelocity > 0) { result += ", " + Localizer.Format("#KerCon_MaxAngularVelX", maxAngularVelocity.ToString("F1")); } return(result); }
public override void OnStart(StartState state) { powerSupply = part.FindModuleImplementing <IPowerSupply>(); if (powerSupply != null) { powerSupply.DisplayName = Localizer.Format("#LOC_KSPIE_Refinery_started"); //"started" } if (state == StartState.Editor) { return; } // load stored overflow setting _overflowAllowed = lastOverflowSettings; _windowId = new System.Random(part.GetInstanceID()).Next(int.MinValue, int.MaxValue); var refineriesList = part.FindModulesImplementing <IRefineryActivity>().ToList(); if (refineryType > 0) { AddIfMissing(refineriesList, new AluminiumElectrolyzer()); AddIfMissing(refineriesList, new AmmoniaElectrolyzer()); AddIfMissing(refineriesList, new AnthraquinoneProcessor()); AddIfMissing(refineriesList, new AtmosphereProcessor()); AddIfMissing(refineriesList, new CarbonDioxideElectrolyzer()); AddIfMissing(refineriesList, new HaberProcess()); AddIfMissing(refineriesList, new HeavyWaterElectrolyzer()); AddIfMissing(refineriesList, new PartialMethaneOxidation()); AddIfMissing(refineriesList, new PeroxideProcess()); AddIfMissing(refineriesList, new UF4Ammonolysiser()); AddIfMissing(refineriesList, new RegolithProcessor()); AddIfMissing(refineriesList, new ReverseWaterGasShift()); AddIfMissing(refineriesList, new NuclearFuelReprocessor()); AddIfMissing(refineriesList, new SabatierReactor()); AddIfMissing(refineriesList, new OceanProcessor()); AddIfMissing(refineriesList, new SolarWindProcessor()); AddIfMissing(refineriesList, new WaterElectrolyzer()); AddIfMissing(refineriesList, new WaterGasShift()); availableRefineries = refineriesList .Where(m => ((int)m.RefineryType & refineryType) == (int)m.RefineryType) .OrderBy(a => a.ActivityName).ToList(); } else { availableRefineries = refineriesList.OrderBy(a => a.ActivityName).ToList(); } // initialize refineries availableRefineries.ForEach(m => m.Initialize(part, this)); foreach (var availableRefinery in availableRefineries) { try { availableRefinery.Initialize(part, this); } catch (Exception e) { Debug.LogError("[KSPI]: Failed to initialized " + availableRefinery.ActivityName + " with exception: " + e.Message); } } // load same if (refinery_is_enabled && !string.IsNullOrEmpty(lastActivityName)) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastActivityName); currentActivity = availableRefineries.FirstOrDefault(a => a.ActivityName == lastActivityName); if (currentActivity == null) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastClassName); currentActivity = availableRefineries.FirstOrDefault(a => a.GetType().Name == lastClassName); } } if (currentActivity != null) { bool hasRequirement = currentActivity.HasActivityRequirements(); lastActivityName = currentActivity.ActivityName; Debug.Log("[KSPI]: ISRU Refinery initializing " + lastActivityName + " for which hasRequirement: " + hasRequirement); var timeDifference = (Planetarium.GetUniversalTime() - lastActiveTime); if (timeDifference > 0.01) { string message = Localizer.Format("#LOC_KSPIE_Refinery_Postmsg1", lastActivityName, timeDifference.ToString("0")); //"IRSU performed " + + " for " + + " seconds" Debug.Log("[KSPI]: " + message); ScreenMessages.PostScreenMessage(message, 20, ScreenMessageStyle.LOWER_CENTER); } var productionModifier = productionMult * baseProduction; if (lastActivityName == "Atmospheric Extraction") { ((AtmosphereProcessor)currentActivity).ExtractAir(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else if (lastActivityName == "Seawater Extraction") { ((OceanProcessor)currentActivity).ExtractSeawater(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else { currentActivity.UpdateFrame(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } } }
private void Window(int window) { if (_boldLabel == null) { _boldLabel = new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold, font = PluginHelper.MainFont } } ; if (_valueLabel == null) { _valueLabel = new GUIStyle(GUI.skin.label) { font = PluginHelper.MainFont } } ; if (_enabledButton == null) { _enabledButton = new GUIStyle(GUI.skin.button) { fontStyle = FontStyle.Bold, font = PluginHelper.MainFont } } ; if (_disabledButton == null) { _disabledButton = new GUIStyle(GUI.skin.button) { fontStyle = FontStyle.Normal, font = PluginHelper.MainFont } } ; if (GUI.Button(new Rect(_windowPosition.width - 20, 2, 18, 18), "x")) { showWindow = false; } GUILayout.BeginVertical(); if (currentActivity == null || !refinery_is_enabled) // if there is no processing going on or the refinery is not enabled { availableRefineries.ForEach(activity => // per each activity (notice the end brackets are there, 13 lines below) { GUILayout.BeginHorizontal(); bool hasRequirement = activity.HasActivityRequirements(); // if the requirements for the activity are fulfilled GUIStyle guiStyle = hasRequirement ? _enabledButton : _disabledButton; // either draw the enabled, bold button, or the disabled one var buttonText = string.IsNullOrEmpty(activity.Formula) ? activity.ActivityName : activity.ActivityName + " : " + activity.Formula; if (GUILayout.Button(buttonText, guiStyle, GUILayout.ExpandWidth(true))) // if user clicks the button and has requirements for the activity { ToggleRefinery(activity); } GUILayout.EndHorizontal(); }); } else { bool hasRequirement = currentActivity.HasActivityRequirements(); // show button to enable/disable resource overflow GUILayout.BeginHorizontal(); if (_overflowAllowed) { if (GUILayout.Button(Localizer.Format("#LOC_KSPIE_Refinery_DisableOverflow"), GUILayout.ExpandWidth(true)))//"Disable Overflow" { _overflowAllowed = false; } } else { if (GUILayout.Button(Localizer.Format("#LOC_KSPIE_Refinery_EnableOverflow"), GUILayout.ExpandWidth(true)))//"Enable Overflow" { _overflowAllowed = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#LOC_KSPIE_Refinery_CurrentActivity"), _boldLabel, GUILayout.Width(RefineryActivity.labelWidth));//"Current Activity" GUILayout.Label(currentActivity.ActivityName, _valueLabel, GUILayout.Width(RefineryActivity.valueWidth * 2)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("#LOC_KSPIE_Refinery_Status"), _boldLabel, GUILayout.Width(RefineryActivity.labelWidth));//"Status" GUILayout.Label(currentActivity.Status, _valueLabel, GUILayout.Width(RefineryActivity.valueWidth * 2)); GUILayout.EndHorizontal(); // allow current activity to show feedback currentActivity.UpdateGUI(); GUILayout.BeginHorizontal(); if (GUILayout.Button(Localizer.Format("#LOC_KSPIE_Refinery_DeactivateProcess"), GUILayout.ExpandWidth(true)))//"Deactivate Process" { refinery_is_enabled = false; currentActivity = null; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUI.DragWindow(); } } }
public override string GetInfo() { return(Localizer.Format("#LOC_KSPIE_Refinery_GetInfo"));//"Refinery Module capable of advanced ISRU processing." }
public void OnGUI() { if (!enable || !showGUI) { if (instructor_Werner != null && instructor_Werner.Instructor != null) { Destroy(instructor_Werner.Instructor.gameObject); } if (instructor_Werner != null) { instructor_Werner.Destroy(); instructor_Werner = null; } if (instructor_Linus != null && instructor_Linus.Instructor != null) { Destroy(instructor_Linus.Instructor.gameObject); } if (instructor_Linus != null) { instructor_Linus.Destroy(); instructor_Linus = null; } return; } //Create Instructor if (instructor_Werner == null || instructor_Werner != null && instructor_Werner.Instructor == null) { instructor_Werner = new ResearchBodiesInstructor("Instructor_Wernher"); } if (instructor_Werner != null && instructor_Werner.Instructor != null) { instructor_Werner.Instructor.enabled = true; } if (instructor_Linus == null || instructor_Linus != null && instructor_Linus.Instructor == null) { instructor_Linus = new ResearchBodiesInstructor("Strategy_ScienceGuy"); } if (instructor_Linus != null && instructor_Linus.Instructor != null) { instructor_Linus.Instructor.enabled = true; } try { if (!Textures.StylesSet) { Textures.SetupStyles(); } } catch (Exception ex) { RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI"); RSTLogWriter.Log("Exception: {0}", ex); } GUI.skin = Textures.ObsSkin; #if DEBUGFACILITY if (showObsdebugUI) { observRect = GUILayout.Window(_RBwindowId + 1, observRect, DrawObservDebug, "Research Bodies"); } #endif if (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityDamage() > 0) { ScreenMessages.PostScreenMessage(Localizer.Format("#autoLOC_RBodies_00018"), 3.0f, ScreenMessageStyle.UPPER_CENTER); return; } try { windowRect.ClampInsideScreen(); windowRect = GUILayout.Window(_RBwindowId, windowRect, DrawWindow, "Research Bodies"); Utilities.DrawToolTip(); } catch (Exception ex) { RSTLogWriter.Log("Unable to draw GUI"); RSTLogWriter.Log("Exception: {0}", ex); } }
internal void UpdateUI() { siteName.Text(SiteName); siteLogo.Image(selectedSite.logo); siteDescription.Text(selectedSite.LaunchSiteDescription); favToggle.SetIsOnWithoutNotify(selectedSite.favouriteSite == "Yes"); foldToggle.SetIsOnWithoutNotify(foldedIn); altitude.Info($"{selectedSite.refAlt:F1} m"); longitude.Info($"{selectedSite.refLon:F3}"); latitude.Info($"{selectedSite.refLat:F3}"); maxLength.Info(MaxSpec(selectedSite.LaunchSiteLength, " m")); maxWidth.Info(MaxSpec(selectedSite.LaunchSiteWidth, " m")); maxHeight.Info(MaxSpec(selectedSite.LaunchSiteHeight, " m")); maxMass.Info(MaxSpec(selectedSite.MaxCraftMass, " t")); maxParts.Info(MaxSpec(selectedSite.MaxCraftParts, "")); openBase.interactable = !selectedSite.isOpen; closeBase.interactable = selectedSite.isOpen; openBase.Text(Localizer.Format(KKLocalization.OpenBaseForFunds, selectedSite.OpenCost)); closeBase.Text(Localizer.Format(KKLocalization.CloseBaseForFunds, selectedSite.CloseValue)); if (!String.IsNullOrEmpty(selectedSite.MissionLog)) { logText.Text(selectedSite.MissionLog.Replace("|", "\n")); } else { logText.Text(KKLocalization.NoLog); } if (HighLogic.LoadedScene == GameScenes.EDITOR) { editorView.SetActive(true); flightView.SetActive(false); if (selectedSite.LaunchSiteName == EditorLogic.fetch.launchSiteName) { launchsiteStatus.Image(tSetLaunchsite); } else if (selectedSite.isOpen) { launchsiteStatus.Image(tOpenedLaunchsite); } else { launchsiteStatus.Image(tClosedLaunchsite); } setLaunchsite.interactable = (selectedSite.isOpen) && !(selectedSite.LaunchSiteName == EditorLogic.fetch.launchSiteName); } else { editorView.SetActive(false); flightView.SetActive(true); if (selectedSite.wayPoint != null && FinePrint.WaypointManager.FindWaypoint(selectedSite.wayPoint.navigationId) == null) { selectedSite.wayPoint = null; } createWaypoint.SetActive(selectedSite.wayPoint == null); deleteWaypoint.SetActive(selectedSite.wayPoint != null); } }
private void DrawWindow(int id) { GUIContent closeContent = new GUIContent(Textures.BtnRedCross, "Close Window"); Rect closeRect = new Rect(windowRect.width - 75, 4, 25, 25); if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle)) { ResearchBodies_Observatory.SpaceCenterObservatory.DeActivateObservatory_SC_Facility(); return; } GUILayout.BeginVertical(); #region Top Half Screen //Screen Top Half Starts GUILayout.BeginHorizontal(); GUILayout.BeginArea(new Rect((Utilities.scaledScreenWidth / 2) - 380, 50, 760, 500)); GUILayout.BeginHorizontal(GUILayout.Width(750)); GUILayout.BeginVertical(); GUILayout.BeginVertical(); #region Wernher_Portrait Panel 1 InstructorscrollViewVector = GUILayout.BeginScrollView(InstructorscrollViewVector, GUILayout.Width(248), GUILayout.Height(186)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (Event.current.type == EventType.Repaint) { GUILayout.Box(instructor_Werner.Portrait, GUILayout.Width(128), GUILayout.Height(128)); } else { GUILayout.Box(string.Empty, GUILayout.Width(128), GUILayout.Height(128)); } GUILayout.Label(instructor_Werner.InstructorName, GUILayout.Width(198)); } else { GUILayout.Label(Localizer.Format("#autoLOC_RBodies_00017"), GUILayout.Width(198), GUILayout.Height(128)); } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.BeginVertical(); #region BodyList Panel 2 scrollViewVector = GUILayout.BeginScrollView(scrollViewVector, GUILayout.Width(248), GUILayout.Height(300)); GUILayout.BeginVertical(); haveTrackedBodies = false; foreach (KeyValuePair <CelestialBody, CelestialBodyInfo> cb in Database.instance.CelestialBodies) { //if (cb.Value.isResearched && !cb.Value.ignore) if (cb.Value.isResearched) { if (GUILayout.Button(cb.Key.bodyDisplayName.LocalizeRemoveGender(), GUILayout.Width(215))) { if (selectedBody == cb.Key) { selectedBody = null; } else { selectedBody = cb.Key; } instructor_Werner.PlayOKEmote(); } if (!cb.Value.ignore) { haveTrackedBodies = true; } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical(); #region Research Panel 3 ResearchscrollViewVector = GUILayout.BeginScrollView(ResearchscrollViewVector, GUILayout.Width(500), GUILayout.Height(485)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (selectedBody == null) { if (!haveTrackedBodies) { GUILayout.Label("<color=orange>" + Localizer.Format("#autoLOC_RBodies_00001") + "</color>", GUILayout.Width(500)); } else { GUILayout.Label("<color=orange>" + Localizer.Format("#autoLOC_RBodies_00001") + "</color>", GUILayout.Width(500)); //GUILayout } } else { GUILayout.BeginHorizontal(); GUILayout.Label("<b><size=24><color=orange>" + selectedBody.displayName.LocalizeRemoveGender() + "</color></size></b>", GUILayout.Width(150)); GUILayout.Label("<i>" + (French ? Database.instance.CelestialBodies[selectedBody].discoveryMessage : Localizer.Format("#autoLOC_RBodies_discovery_" + selectedBody.bodyName)) + "</i>", GUILayout.Width(300)); GUILayout.EndHorizontal(); if (selectedBody != Planetarium.fetch.Sun && selectedBody.referenceBody != null && selectedBody.bodyName != selectedBody.referenceBody.bodyName) { if (selectedBody.referenceBody != Planetarium.fetch.Sun) { GUILayout.Label(Localizer.Format("#autoLOC_RBodies_00003", selectedBody.referenceBody.displayName.LocalizeRemoveGender()), GUILayout.Width(150)); } else { GUILayout.Label(Localizer.Format("#autoLOC_RBodies_00004"), GUILayout.Width(150)); } } GUILayout.Label(Localizer.Format("#autoLOC_RBodies_00005", Database.instance.CelestialBodies[selectedBody].researchState.ToString()), GUILayout.Width(480)); if (Database.instance.CelestialBodies[selectedBody].researchState == 0) { if ( GUILayout.Button("<color=#0ef907>" + Localizer.Format("#autoLOC_RBodies_00006", selectedBody.displayName.LocalizeRemoveGender()) + "\n</color><size=10><i>(" + Localizer.Format("#autoLOC_RBodies_00007", (Database.instance.RB_SettingsParms.ResearchCost + Database.instance.RB_SettingsParms.ProgressResearchCost).ToString() /* 10 */) + ")</i></size>", GUILayout.Width(480))) { LaunchResearchPlan(selectedBody); instructor_Werner.PlayNiceEmote(); } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 1) { if (!Database.instance.CelestialBodies[selectedBody].ignore) { if ( GUILayout.Button("<color=red>" + Localizer.Format("#autoLOC_RBodies_00008", selectedBody.displayName.LocalizeRemoveGender()) + "\n</color><size=10><i>(" + Localizer.Format("#autoLOC_RBodies_00009", Database.instance.RB_SettingsParms.ResearchCost.ToString() /* 5 */) + ")</i></size>", GUILayout.Width(480))) { StopResearchPlan(selectedBody); instructor_Werner.PlayBadEmote(); } } if (Database.instance.CelestialBodies[selectedBody].researchState < 40 && Database.instance.CelestialBodies[selectedBody].researchState >= 1) { if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX) { if (GUILayout.Button(Localizer.Format("#autoLOC_RBodies_00010"), GUILayout.Width(480))) { instructor_Werner.PlayNiceEmote(); Research(selectedBody, 10); } } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 40 && Database.instance.CelestialBodies[selectedBody].researchState < 100) { GUILayout.Label("<i><color=#0ef907>" + Localizer.Format("#autoLOC_RBodies_00010") + " ✓</color></i>", GUILayout.Width(480)); if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX) { if (GUILayout.Button(Localizer.Format("#autoLOC_RBodies_00011"), GUILayout.Width(480))) { instructor_Werner.PlayNiceEmote(); Research(selectedBody, 10); } } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 100) { GUILayout.Label("<i><color=#0ef907>" + Localizer.Format("#autoLOC_RBodies_00010") + " ✓</color></i>", GUILayout.Width(480)); //new Rect(188, 227, 502, 32), GUILayout.Label("<i><color=#0ef907>" + Localizer.Format("#autoLOC_RBodies_00011") + " ✓</color></i>", GUILayout.Width(480)); //new Rect(188, 264, 502, 32), GUILayout.Label("<b>" + Localizer.Format("#autoLOC_RBodies_00013", selectedBody.displayName.LocalizeRemoveGender()) + "</b>", GUILayout.Width(480)); } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndHorizontal(); //Screen Top Half Ends. #endregion #region Bottom Half Screen if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER) { GUILayout.BeginHorizontal(); GUILayout.BeginArea(new Rect((Utilities.scaledScreenWidth / 2) - 380, 560, 760, 300)); GUILayout.BeginHorizontal(GUILayout.Width(700)); GUILayout.BeginVertical(); #region Linus_Portrait Panel 1 InstructorscrollViewVector = GUILayout.BeginScrollView(InstructorscrollViewVector, GUILayout.Width(248), GUILayout.Height(186)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (Event.current.type == EventType.Repaint) { GUILayout.Box(instructor_Linus.Portrait, GUILayout.Width(128), GUILayout.Height(128)); } else { GUILayout.Box(string.Empty, GUILayout.Width(128), GUILayout.Height(128)); } GUILayout.Label(instructor_Linus.InstructorName, GUILayout.Width(178)); } else { GUILayout.Label(Localizer.Format("#autoLOC_RBodies_00017"), GUILayout.Width(188), GUILayout.Height(128)); } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); #region ContractsSection ContractsscrollViewVector = GUILayout.BeginScrollView(ResearchscrollViewVector, GUILayout.Width(500), GUILayout.Height(186)); GUILayout.BeginVertical(); GUILayout.Label("<b><size=24><color=orange>" + Localizer.Format("#autoLOC_RBodies_00103") + "</color></size></b>", GUILayout.Width(350)); GUILayout.Label("<b>" + Localizer.Format("#autoLOC_RBodies_00104") + "</b>", GUILayout.Width(350)); for (int i = 0; i < Contracts.ContractSystem.Instance.Contracts.Count; ++i) { Contract contract = Contracts.ContractSystem.Instance.Contracts[i]; if (contract.ContractState == Contract.State.Active) { ContractConfigurator.ConfiguredContract configuredContract = contract as ContractConfigurator.ConfiguredContract; if (configuredContract != null) { switch (configuredContract.subType) { case "RB_TeleScopeSearchSkies": case "RB_TelescopeResearchBody": case "RB_SearchSkies": case "RB_ResearchBody": //Display Contract GUILayout.Label(configuredContract.Title, GUILayout.Width(400)); ContractParameter parameter = configuredContract.GetParameter("Duration"); if (parameter != null) { GUILayout.Label("<color=#0ef907>" + parameter.Title + "</color>", GUILayout.Width(400)); } break; } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndHorizontal(); } #endregion GUILayout.EndVertical(); Utilities.SetTooltipText(); }
public void Display() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(isMachMode ? Localizer.Format("FAREditorStaticMachSweep") : Localizer.Format("FAREditorStaticAoASweep"), GUILayout.Width(250)); if (GUILayout.Button(isMachMode ? Localizer.Format("FAREditorStaticSwitchAoA") : Localizer.Format("FAREditorStaticSwitchMach"))) { isMachMode = !isMachMode; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GraphDisplay(); RightGraphInputsGUI(isMachMode ? machSweepInputs : aoASweepInputs); GUILayout.EndHorizontal(); BelowGraphInputsGUI(isMachMode ? machSweepInputs : aoASweepInputs); GUILayout.EndVertical(); }
// Info for ui public override string GetInfo() { return(Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_PartInfo", (FeedScale * 100.0).ToString("F0"))); }
private void RightGraphInputsGUI(GraphInputs input) { GUILayout.BeginVertical(); GUILayout.Label(Localizer.Format("FAREditorStabDerivPlanet")); bodySettingDropdown.GUIDropDownDisplay(); GUILayout.Label(Localizer.Format("FAREditorStabDerivFlap")); flapSettingDropdown.GUIDropDownDisplay(); input.flapSetting = flapSettingDropdown.ActiveSelection; GUILayout.Label(Localizer.Format("FAREditorStaticPitchSetting")); input.pitchSetting = GUILayout.TextField(input.pitchSetting, GUILayout.ExpandWidth(true)); input.pitchSetting = Regex.Replace(input.pitchSetting, @"[^-?[0-9]*(\.[0-9]*)?]", ""); GUILayout.Label(Localizer.Format("FAREditorStabDerivSpoiler")); input.spoilers = GUILayout.Toggle(input.spoilers, input.spoilers ? Localizer.Format("FAREditorStabDerivSDeploy") : Localizer.Format("FAREditorStabDerivSRetract")); GUILayout.EndVertical(); }
public void Start() { CommNet.CommNetParams commNetParams = HighLogic.CurrentGame.Parameters.CustomParams <CommNet.CommNetParams>(); List <ModuleDataTransmitter> MDTs = part.Modules.OfType <ModuleDataTransmitter>().ToList(); List <ModuleDeployableAntenna> MDAs = part.Modules.OfType <ModuleDeployableAntenna>().ToList(); var dsnpower = GameVariables.Instance.GetDSNRange( ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation)); OtherVesselRating = (float)(dsnpower / 1e9); Fields["OtherVesselRating"].guiActive = false; Fields["OtherVesselRating"].guiActiveEditor = false; if (MDTs.Count != 1) { foreach (var mdt in MDTs) { mdt.Fields["powerText"].SetValue( Formatter.ValueShort(mdt.antennaPower * commNetParams.rangeModifier) + (mdt.antennaCombinable ? string.Format(" ({0}, {1}: {2})", Localizer.Format("#CAE_PAW_Combinability"), Localizer.Format("#CAE_PAW_Combinab_Exponent_Short"), mdt.antennaCombinableExponent) : "") , mdt); } foreach (var field in Fields) { field.guiActive = false; field.guiActiveEditor = false; } return; } var moduleDT = MDTs[0]; //ModuleDeployableAntenna // status | Status | Retracted Retracting.. Extended Extending.. //moduleDA.status //statusText Antenna State Idle //moduleDT.statusText; if (MDAs.Count == 1) { var moduleDA = MDAs[0]; moduleDA.Fields["status"].group.name = "CommNetA"; moduleDA.Fields["status"].group.displayName = "#CAE_PAW_Group_Name"; moduleDA.Fields["status"].guiActiveEditor = true; } List <ModuleCommand> MCs = part.Modules.OfType <ModuleCommand>().ToList(); if (MCs.Count == 1) { MCs[0].Fields["commNetSignal"].group.name = "CommNetA"; MCs[0].Fields["commNetSignal"].group.displayName = "#CAE_PAW_Group_Name"; MCs[0].Fields["commNetFirstHopDistance"].group.name = "CommNetA"; MCs[0].Fields["commNetFirstHopDistance"].group.displayName = "#CAE_PAW_Group_Name"; } moduleDT.Fields["statusText"].group.name = "CommNetA"; moduleDT.Fields["statusText"].group.displayName = "#CAE_PAW_Group_Name"; moduleDT.Fields["powerText"].guiActive = false; moduleDT.Fields["powerText"].guiActiveEditor = false; double antennaPowerModified = moduleDT.antennaPower * commNetParams.rangeModifier; AntennaRatingStr = Formatter.ValueShort(antennaPowerModified); AntennaTypeStr = Formatter.ToTitleCase(moduleDT.antennaType.displayDescription()); DataResourceCostStr = Localizer.Format("#CAE_EC_Mit", moduleDT.DataResourceCost.ToString("#.##")); BandwidthStr = Localizer.Format("#CAE_Mit_S", (moduleDT.packetSize / moduleDT.packetInterval).ToString("#.##")); PacketStr = Localizer.Format("#CAE_Mit", moduleDT.packetSize.ToString("#.#")) + " & " + Localizer.Format("#CAE_EC", moduleDT.packetResourceCost.ToString("#.##")); if (moduleDT.antennaCombinable) { AntennaRatingStr += " " + Localizer.Format("#autoLOC_236248"); CombinabilityExponentStr = moduleDT.antennaCombinableExponent.ToString(); } else { Fields["CombinabilityExponentStr"].guiName = "#CAE_PAW_Combinability"; CombinabilityExponentStr = Localizer.Format("#autoLOC_439840"); } if (moduleDT.antennaType == AntennaType.INTERNAL) { Events["VesselRatingUpdate"].active = true; foreach (var f in Fields) { if (f.name != "AntennaTypeStr" && f.name != "AntennaRatingStr") { f.guiActive = false; f.guiActiveEditor = false; } } } }
private void BelowGraphInputsGUI(GraphInputs input) { GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("FAREditorStaticGraphLowLim"), GUILayout.Width(50.0F), GUILayout.Height(25.0F)); input.lowerBound = GUILayout.TextField(input.lowerBound, GUILayout.ExpandWidth(true)); GUILayout.Label(Localizer.Format("FAREditorStaticGraphUpLim"), GUILayout.Width(50.0F), GUILayout.Height(25.0F)); input.upperBound = GUILayout.TextField(input.upperBound, GUILayout.ExpandWidth(true)); GUILayout.Label(Localizer.Format("FAREditorStaticGraphPtCount"), GUILayout.Width(70.0F), GUILayout.Height(25.0F)); input.numPts = GUILayout.TextField(input.numPts, GUILayout.ExpandWidth(true)); GUILayout.Label(isMachMode ? Localizer.Format("FARAbbrevAoA") : Localizer.Format("FARAbbrevMach"), GUILayout.Width(50.0F), GUILayout.Height(25.0F)); input.otherInput = GUILayout.TextField(input.otherInput, GUILayout.ExpandWidth(true)); if (GUILayout.Button(isMachMode ? Localizer.Format("FAREditorStaticSweepMach") : Localizer.Format("FAREditorStaticSweepAoA"), GUILayout.Width(100.0F), GUILayout.Height(25.0F))) { input.lowerBound = Regex.Replace(input.lowerBound, @"[^-?[0-9]*(\.[0-9]*)?]", ""); input.upperBound = Regex.Replace(input.upperBound, @"[^-?[0-9]*(\.[0-9]*)?]", ""); input.numPts = Regex.Replace(input.numPts, @"[^-?[0-9]*(\.[0-9]*)?]", ""); input.pitchSetting = Regex.Replace(input.pitchSetting, @"[^-?[0-9]*(\.[0-9]*)?]", ""); input.otherInput = Regex.Replace(input.otherInput, @"[^-?[0-9]*(\.[0-9]*)?]", ""); double lowerBound, upperBound, numPts, pitchSetting, otherInput; lowerBound = double.Parse(input.lowerBound); lowerBound = FARMathUtil.Clamp(lowerBound, -90, 90); input.lowerBound = lowerBound.ToString(); upperBound = double.Parse(input.upperBound); upperBound = FARMathUtil.Clamp(upperBound, lowerBound, 90); input.upperBound = upperBound.ToString(); numPts = double.Parse(input.numPts); numPts = Math.Ceiling(numPts); input.numPts = numPts.ToString(); pitchSetting = double.Parse(input.pitchSetting); pitchSetting = FARMathUtil.Clamp(pitchSetting, -1, 1); input.pitchSetting = pitchSetting.ToString(); otherInput = double.Parse(input.otherInput); GraphData data; var sim = simManager.SweepSim; if (sim.IsReady()) { if (isMachMode) { data = sim.MachNumberSweep(otherInput, pitchSetting, lowerBound, upperBound, (int)numPts, input.flapSetting, input.spoilers, bodySettingDropdown.ActiveSelection); SetAngleVectors(pitchSetting, pitchSetting); } else { data = sim.AngleOfAttackSweep(otherInput, pitchSetting, lowerBound, upperBound, (int)numPts, input.flapSetting, input.spoilers, bodySettingDropdown.ActiveSelection); SetAngleVectors(lowerBound, upperBound); } UpdateGraph(data, isMachMode ? Localizer.Format("FAREditorStaticGraphMach") : Localizer.Format("FAREditorStaticGraphAoA"), Localizer.Format("FAREditorStaticGraphCoeff"), lowerBound, upperBound); } } GUILayout.EndHorizontal(); }
public virtual void Start() { if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor) { if (inputs == null || inputs.Count == 0) { ConfigNode node = ModuleUtils.GetModuleConfigNode(part, moduleName); if (node != null) { OnLoad(node); } } heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID); var range = (UI_FloatRange)this.Fields["CurrentSafetyOverride"].uiControlEditor; range.minValue = 0f; range.maxValue = MaximumTemperature; range = (UI_FloatRange)this.Fields["CurrentSafetyOverride"].uiControlFlight; range.minValue = 0f; range.maxValue = MaximumTemperature; foreach (BaseField field in this.Fields) { if (!string.IsNullOrEmpty(field.group.name)) { continue; } if (field.group.name == uiGroupName) { field.group.displayName = Localizer.Format(uiGroupDisplayName); } } foreach (BaseEvent baseEvent in this.Events) { if (!string.IsNullOrEmpty(baseEvent.group.name)) { continue; } if (baseEvent.group.name == uiGroupName) { baseEvent.group.displayName = Localizer.Format(uiGroupDisplayName); } } if (!GeneratesElectricity) { Fields["GeneratorStatus"].guiActive = false; } //Actions["TogglePanelAction"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Action_TogglePanelAction"); if (FirstLoad) { this.CurrentSafetyOverride = this.CriticalTemperature; FirstLoad = false; } } if (HighLogic.LoadedSceneIsFlight) { DoCatchup(); SetManualControl(ManualControl); } }
private void Start() { if (CompatibilityChecker.IsAllCompatible() && Instance == null) { Instance = this; } else { Destroy(this); return; } showGUI = false; if (FARDebugAndSettings.FARDebugButtonStock) { FARDebugAndSettings.FARDebugButtonStock.SetFalse(false); } _vehicleAero = new VehicleAerodynamics(); // ReSharper disable PossibleLossOfFraction guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10); // ReSharper restore PossibleLossOfFraction _instantSim = new InstantConditionSim(); var flapSettingDropDown = new GUIDropDown <int>(new[] { Localizer.Format("FARFlapSetting0"), Localizer.Format("FARFlapSetting1"), Localizer.Format("FARFlapSetting2"), Localizer.Format("FARFlapSetting3") }, new[] { 0, 1, 2, 3 }); GUIDropDown <CelestialBody> celestialBodyDropdown = CreateBodyDropdown(); modeDropdown = new GUIDropDown <FAREditorMode>(FAReditorMode_str, new[] { FAREditorMode.STATIC, FAREditorMode.STABILITY, FAREditorMode.SIMULATION, FAREditorMode.AREA_RULING }); _simManager = new EditorSimManager(_instantSim); _editorGraph = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDeriv = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager); Color crossSection = GUIColors.GetColor(3); crossSection.a = 0.8f; Color crossSectionDeriv = GUIColors.GetColor(2); crossSectionDeriv.a = 0.8f; _areaRulingOverlay = EditorAreaRulingOverlay.CreateNewAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5); guiRect.height = 500; guiRect.width = 650; GameEvents.onEditorVariantApplied.Add(UpdateGeometryEvent); GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent); GameEvents.onEditorUndo.Add(ResetEditorEvent); GameEvents.onEditorRedo.Add(ResetEditorEvent); GameEvents.onEditorShipModified.Add(ResetEditorEvent); GameEvents.onEditorLoad.Add(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns); RequestUpdateVoxel(); }
protected virtual void HandleThrottle() { if (!Enabled) { CurrentThrottle = Mathf.MoveTowards(CurrentThrottle, 0f, TimeWarp.fixedDeltaTime * ThrottleIncreaseRate); } else { CurrentThrottle = Mathf.MoveTowards(CurrentThrottle, CurrentReactorThrottle, TimeWarp.fixedDeltaTime * ThrottleIncreaseRate); } CoreTemp = String.Format("{0:F1}/{1:F1} {2}", heatModule.LoopTemperature, NominalTemperature, Localizer.Format("#LOC_SystemHeat_Units_K")); }
protected virtual void OnGUI() { GUI.skin = HighLogic.Skin; QGUI.Lock(IsMouseOver()); if (WindowSettings) { RectSettings = ClickThruBlocker.GUILayoutWindow(1545146, RectSettings, DrawSettings, RegisterToolbar.MOD + " " + RegisterToolbar.VERSION); } if (WindowHistory) { RectHistory = ClickThruBlocker.GUILayoutWindow(1545147, RectHistory, QHistory.Instance.Draw, RegisterToolbar.MOD + ": " + Localizer.Format("quicksearch_history")); } }
void OnGUI() { if (toolbarController != null) { toolbarController.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().useBlizzy); } if (!guiHasStarted) { OnGUIStarter(); } if (!hasStarted && (showActiveConnectWindow || showSelectCircleTypeWindow)) { rectNotStartedWindow = GUILayout.Window(485768, rectNotStartedWindow, NotStartedWindow, Localizer.Format("#autoLOC_AH_0001")); return; } if (showActiveConnectWindow) { rectActiveConnectWindow = GUILayout.Window(434324, rectActiveConnectWindow, ActiveConnectWindow, Localizer.Format("#autoLOC_AH_0001")); } if (showSelectCircleTypeWindow) { rectSelectCircleTypeWindow = GUILayout.Window(647886, rectSelectCircleTypeWindow, SelectCircleTypeWindow, Localizer.Format("#autoLOC_AH_0052")); } if (showPotentialRelaysWindow) { rectPotentialRelaysWindow.position = new Vector2( rectActiveConnectWindow.position.x, rectActiveConnectWindow.position.y + rectActiveConnectWindow.size.y); rectPotentialRelaysWindow = GUILayout.Window(307428, rectPotentialRelaysWindow, PotentialRelaysWindow, Localizer.Format("#autoLOC_AH_0053")); } if (showLinkDetailWindow) { rectLinkDetailWindow.position = rectActiveConnectWindow.position - linkDetailPosOffset; rectLinkDetailWindow = GUILayout.Window(675752, rectLinkDetailWindow, LinkDetailWindow, Localizer.Format("#autoLOC_AH_0054", new string[] { selectedLink ["aName"], selectedLink ["bName"] })); } }
// Panneau de configuration void DrawSettings(int id) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksearch_options"), GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); QSettings.Instance.EditorSearch = GUILayout.Toggle(QSettings.Instance.EditorSearch, Localizer.Format("quicksearch_editorSearch"), GUILayout.Width(400)); GUILayout.FlexibleSpace(); QSettings.Instance.RnDSearch = GUILayout.Toggle(QSettings.Instance.RnDSearch, Localizer.Format("quicksearch_enableRnD"), GUILayout.Width(400)); GUILayout.EndHorizontal(); if (QSettings.Instance.EditorSearch || QSettings.Instance.RnDSearch) { GUILayout.BeginHorizontal(); QSettings.Instance.enableSearchExtension = GUILayout.Toggle(QSettings.Instance.enableSearchExtension, Localizer.Format("quicksearch_enableExtended"), GUILayout.Width(400)); GUILayout.FlexibleSpace(); QSettings.Instance.enableHistory = GUILayout.Toggle(QSettings.Instance.enableHistory, Localizer.Format("quicksearch_enableHistory"), GUILayout.Width(400)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); QSettings.Instance.enableEnterToSearch = GUILayout.Toggle(QSettings.Instance.enableEnterToSearch, Localizer.Format("quicksearch_type"), GUILayout.Width(400)); GUILayout.FlexibleSpace(); GUILayout.Label("Time (in secs) to wait before starting search", GUILayout.Width(400)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(400); GUILayout.Label(QSettings.Instance.timeToWaitBeforeSearch.ToString("F1") + "(s)", GUILayout.Width(40)); QSettings.Instance.timeToWaitBeforeSearch = GUILayout.HorizontalSlider(QSettings.Instance.timeToWaitBeforeSearch, 0f, 2f, GUILayout.Width(350)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (QSettings.Instance.enableHistory) { GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksearch_history"), GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); bool b = QSettings.Instance.historySortby == (int)QHistory.SortBy.COUNT; QSettings.Instance.historySortby = GUILayout.Toggle(b, Localizer.Format("quicksearch_sortCount"), GUILayout.Width(400)) ? (int)QHistory.SortBy.COUNT : (int)QHistory.SortBy.DATE; GUILayout.FlexibleSpace(); QSettings.Instance.historySortby = GUILayout.Toggle(!b, Localizer.Format("quicksearch_sortDate"), GUILayout.Width(400)) ? (int)QHistory.SortBy.DATE : (int)QHistory.SortBy.COUNT; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_searchDisplay"), GUILayout.Width(300)); int i = 10; if (int.TryParse(GUILayout.TextField(QSettings.Instance.historyIndex.ToString(), TextField, GUILayout.Width(75)), out i)) { QSettings.Instance.historyIndex = i; } GUILayout.EndHorizontal(); } if (QSettings.Instance.enableSearchExtension) { GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksearch_shortcut"), GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_not"), GUILayout.Width(100)); QSettings.Instance.searchNOT = cleanString(GUILayout.TextField(QSettings.Instance.searchNOT, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_and"), GUILayout.Width(100)); QSettings.Instance.searchAND = cleanString(GUILayout.TextField(QSettings.Instance.searchAND, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_or"), GUILayout.Width(100)); QSettings.Instance.searchOR = cleanString(GUILayout.TextField(QSettings.Instance.searchOR, TextField, GUILayout.Width(75))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_wordBegin"), GUILayout.Width(100)); QSettings.Instance.searchBegin = cleanString(GUILayout.TextField(QSettings.Instance.searchBegin, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_wordEnd"), GUILayout.Width(100)); QSettings.Instance.searchEnd = cleanString(GUILayout.TextField(QSettings.Instance.searchEnd, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_word"), GUILayout.Width(100)); QSettings.Instance.searchWord = cleanString(GUILayout.TextField(QSettings.Instance.searchWord, TextField, GUILayout.Width(75))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_name"), GUILayout.Width(100)); QSettings.Instance.searchName = cleanString(GUILayout.TextField(QSettings.Instance.searchName, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_title"), GUILayout.Width(100)); QSettings.Instance.searchTitle = cleanString(GUILayout.TextField(QSettings.Instance.searchTitle, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_descr"), GUILayout.Width(100)); QSettings.Instance.searchDescription = cleanString(GUILayout.TextField(QSettings.Instance.searchDescription, TextField, GUILayout.Width(75))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_author"), GUILayout.Width(100)); QSettings.Instance.searchAuthor = cleanString(GUILayout.TextField(QSettings.Instance.searchAuthor, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_manufacturer"), GUILayout.Width(100)); QSettings.Instance.searchManufacturer = cleanString(GUILayout.TextField(QSettings.Instance.searchManufacturer, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_tag"), GUILayout.Width(100)); QSettings.Instance.searchTag = cleanString(GUILayout.TextField(QSettings.Instance.searchTag, TextField, GUILayout.Width(75))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_resources"), GUILayout.Width(100)); QSettings.Instance.searchResourceInfos = cleanString(GUILayout.TextField(QSettings.Instance.searchResourceInfos, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_tech"), GUILayout.Width(100)); QSettings.Instance.searchTechRequired = cleanString(GUILayout.TextField(QSettings.Instance.searchTechRequired, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_size"), GUILayout.Width(100)); QSettings.Instance.searchPartSize = cleanString(GUILayout.TextField(QSettings.Instance.searchPartSize, TextField, GUILayout.Width(75))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(Localizer.Format("quicksearch_module"), GUILayout.Width(100)); QSettings.Instance.searchModule = cleanString(GUILayout.TextField(QSettings.Instance.searchModule, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Label(Localizer.Format("quicksearch_regex"), GUILayout.Width(100)); QSettings.Instance.searchRegex = cleanString(GUILayout.TextField(QSettings.Instance.searchRegex, TextField, GUILayout.Width(75))); GUILayout.FlexibleSpace(); GUILayout.Space(185); GUILayout.EndHorizontal(); } } GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Localizer.Format("quicksearch_close"), GUILayout.Width(100))) { HideSettings(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
internal static void Display(Vector2 displayViewerPosition) { // Reset Tooltip active flag... ToolTipActive = false; _canShowToolTips = WindowSettings.ShowToolTips && ShowToolTips; Position = WindowSettings.Position; int scrollX = 20; GUILayout.Label(Localizer.Format("#autoLOC_RM_1055")); // #autoLOC_RM_1055 = Configuraton GUILayout.Label("____________________________________________________________________________________________", RMStyle.LabelStyleHardRule, GUILayout.Height(10), GUILayout.Width(350)); if (!ToolbarManager.ToolbarAvailable) { if (RMSettings.EnableBlizzyToolbar) { RMSettings.EnableBlizzyToolbar = false; } GUI.enabled = false; } else { GUI.enabled = true; } _label = Localizer.Format("#autoLOC_RM_1056"); // #autoLOC_RM_1056 = Enable Blizzy Toolbar (Replaces Stock Toolbar) _toolTip = Localizer.Format("#autoLOC_RM_1132"); // #autoLOC_RM_1132 = Switches the toolbar Icons over to Blizzy's toolbar, if installed.\nIf Blizzy's toolbar is not installed, option is not selectable. _guiLabel = new GUIContent(_label, _toolTip); RMSettings.EnableBlizzyToolbar = GUILayout.Toggle(RMSettings.EnableBlizzyToolbar, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } GUI.enabled = true; _label = Localizer.Format("#autoLOC_RM_1057"); // #autoLOC_RM_1057 = Enable Debug Window _toolTip = Localizer.Format("#autoLOC_RM_1133"); // #autoLOC_RM_1133 = Turns on or off the SM Debug window.\nAllows viewing log entries / errors generated by SM. _guiLabel = new GUIContent(_label, _toolTip); WindowDebugger.ShowWindow = GUILayout.Toggle(WindowDebugger.ShowWindow, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } _label = Localizer.Format("#autoLOC_RM_1058"); // #autoLOC_RM_1058 = Enable Verbose Logging _toolTip = Localizer.Format("#autoLOC_RM_1134"); // #autoLOC_RM_1134 = Turns on or off Expanded logging in the Debug Window.\nAids in troubleshooting issues in RM _guiLabel = new GUIContent(_label, _toolTip); RMSettings.VerboseLogging = GUILayout.Toggle(RMSettings.VerboseLogging, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } _label = Localizer.Format("#autoLOC_RM_1059"); // #autoLOC_RM_1059 = Enable RM Debug Window On Error _toolTip = Localizer.Format("#autoLOC_RM_1135"); // #autoLOC_RM_1135 = When On, Roster Manager automatically displays the RM Debug window on an error in RM.\nThis is a troubleshooting aid. _guiLabel = new GUIContent(_label, _toolTip); RMSettings.AutoDebug = GUILayout.Toggle(RMSettings.AutoDebug, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } _label = Localizer.Format("#autoLOC_RM_1060"); // #autoLOC_RM_1060 = Save Error log on Exit _toolTip = Localizer.Format("#autoLOC_RM_1136"); // #autoLOC_RM_1136 = When On, Roster Manager automatically saves the RM debug log on game exit.\nThis is a troubleshooting aid. _guiLabel = new GUIContent(_label, _toolTip); RMSettings.SaveLogOnExit = GUILayout.Toggle(RMSettings.SaveLogOnExit, _guiLabel, GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } // create Limit Error Log Length slider; GUILayout.BeginHorizontal(); _label = Localizer.Format("#autoLOC_RM_1061"); // #autoLOC_RM_1061 = Error Log Length: _toolTip = Localizer.Format("#autoLOC_RM_1137"); // #autoLOC_RM_1137 = Sets the maximum number of error entries stored in the log.\nAdditional entries will cause first entries to be removed from the log (rolling).\nSetting this value to '0' will allow unlimited entries. _guiLabel = new GUIContent(_label, _toolTip); GUILayout.Label(_guiLabel, GUILayout.Width(110)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, scrollX); } RMSettings.ErrorLogLength = GUILayout.TextField(RMSettings.ErrorLogLength, GUILayout.Width(40)); GUILayout.Label(Localizer.Format("#autoLOC_RM_1062"), GUILayout.Width(50)); // #autoLOC_RM_1062 = (lines) GUILayout.EndHorizontal(); _label = Localizer.Format("#autoLOC_RM_1065"); // #autoLOC_RM_1065 = Enable Kerbal Aging _toolTip = Localizer.Format("#autoLOC_RM_1066"); // #autoLOC_RM_1066 = Your Kerbals will age and eventually die from old age. RMLifeSpan.Instance.RMGameSettings.EnableAging = GUILayout.Toggle(RMLifeSpan.Instance.RMGameSettings.EnableAging, new GUIContent(_label, _toolTip), GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } if (!RMLifeSpan.Instance.RMGameSettings.EnableAging) { GUI.enabled = false; } GUILayout.BeginHorizontal(); _toolTip = Localizer.Format("#autoLOC_RM_1067"); // #autoLOC_RM_1067 = Average age of new Applicant Kerbals. GUILayout.Label(new GUIContent(Localizer.Format("#autoLOC_RM_1068"), _toolTip), GUILayout.Width(140)); // #autoLOC_RM_1068 = Kerbal Minimum Age: _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } string strMinimumAge = RMLifeSpan.Instance.RMGameSettings.MinimumAge.ToString(); strMinimumAge = GUILayout.TextField(strMinimumAge, GUILayout.Width(40)); GUILayout.Label(Localizer.Format("#autoLOC_RM_1069"), GUILayout.Width(50)); // #autoLOC_RM_1069 = (Years) if (int.TryParse(strMinimumAge, out int minimumAge)) { RMLifeSpan.Instance.RMGameSettings.MinimumAge = minimumAge; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); _toolTip = Localizer.Format("#autoLOC_RM_1070"); // #autoLOC_RM_1070 = Average Lifespan of Kerbals (how long they live). GUILayout.Label(new GUIContent(Localizer.Format("#autoLOC_RM_1071"), _toolTip), GUILayout.Width(140)); // #autoLOC_RM_1071 = Kerbal Lifespan: _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } string strMaximumAge = RMLifeSpan.Instance.RMGameSettings.MaximumAge.ToString(); strMaximumAge = GUILayout.TextField(strMaximumAge, GUILayout.Width(40)); GUILayout.Label(Localizer.Format("#autoLOC_RM_1072"), GUILayout.Width(50)); // #autoLOC_RM_1072 = (Years) if (int.TryParse(strMaximumAge, out int maximumAge)) { RMLifeSpan.Instance.RMGameSettings.MaximumAge = maximumAge; } GUILayout.EndHorizontal(); GUI.enabled = true; if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) { GUI.enabled = false; } _label = Localizer.Format("#autoLOC_RM_1073"); // #autoLOC_RM_1073 = Enable Salaries (career game only) _toolTip = Localizer.Format("#autoLOC_RM_1074"); // #autoLOC_RM_1074 = Kerbals must be paid Salaries. RMLifeSpan.Instance.RMGameSettings.EnableSalaries = GUILayout.Toggle(RMLifeSpan.Instance.RMGameSettings.EnableSalaries, new GUIContent(_label, _toolTip), GUILayout.Width(300)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } if (!RMLifeSpan.Instance.RMGameSettings.EnableSalaries) { GUI.enabled = false; } DisplaySelectSalaryPeriod(); GUILayout.BeginHorizontal(); _toolTip = Localizer.Format("#autoLOC_RM_1075"); // #autoLOC_RM_1075 = Default salary for each Kerbal per each salary period. GUILayout.Label(new GUIContent(Localizer.Format("#autoLOC_RM_1076"), _toolTip), GUILayout.Width(140)); // #autoLOC_RM_1076 = Default Kerbal Salary: _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } string strDefSalary = RMLifeSpan.Instance.RMGameSettings.DefaultSalary.ToString(CultureInfo.InvariantCulture); strDefSalary = GUILayout.TextField(strDefSalary, GUILayout.Width(70)); GUILayout.Label(Localizer.Format("#autoLOC_RM_1077"), GUILayout.Width(120)); // #autoLOC_RM_1077 = (Funds/per salary period) GUILayout.EndHorizontal(); if (double.TryParse(strDefSalary, out double defaultSalary)) { RMLifeSpan.Instance.RMGameSettings.DefaultSalary = defaultSalary; } GUI.enabled = true; if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) { GUI.enabled = false; } _label = Localizer.Format("#autoLOC_RM_1078"); // #autoLOC_RM_1078 = Charge funds for Profession Change (career game only) _toolTip = Localizer.Format("#autoLOC_RM_1079"); // #autoLOC_RM_1079 = Charge funds for changing a Kerbal's profession. RMLifeSpan.Instance.RMGameSettings.ChangeProfessionCharge = GUILayout.Toggle(RMLifeSpan.Instance.RMGameSettings.ChangeProfessionCharge, new GUIContent(_label, _toolTip), GUILayout.Width(320)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } if (!RMLifeSpan.Instance.RMGameSettings.ChangeProfessionCharge) { GUI.enabled = false; } GUILayout.BeginHorizontal(); _toolTip = Localizer.Format("#autoLOC_RM_1080"); // #autoLOC_RM_1080 = Cost of changing a Kerbals Profession. GUILayout.Label(new GUIContent(Localizer.Format("#autoLOC_RM_1081"), _toolTip), GUILayout.Width(140)); // #autoLOC_RM_1081 = Change Profession Cost: _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = RMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } string strChgProf = RMLifeSpan.Instance.RMGameSettings.ChangeProfessionCost.ToString(CultureInfo.InvariantCulture); strChgProf = GUILayout.TextField(strChgProf, GUILayout.Width(70)); GUILayout.Label(Localizer.Format("#autoLOC_RM_1082"), GUILayout.Width(50)); // #autoLOC_RM_1082 = (Funds) GUILayout.EndHorizontal(); if (double.TryParse(strChgProf, out double chgProf)) { RMLifeSpan.Instance.RMGameSettings.ChangeProfessionCost = chgProf; } GUI.enabled = true; }
private void MaintainContainment() { var antimatterResource = part.Resources[resourceName]; if (antimatterResource == null) { return; } if (chargeStatus > 0 && antimatterResource.amount > _minimumAntimatterAmount) { // chargeStatus is in seconds chargeStatus -= vessel.packed ? 0.05f : TimeWarp.fixedDeltaTime; } if (!_shouldCharge && antimatterResource.amount <= _minimumAntimatterAmount) { return; } var powerModifier = canExplodeFromGeeForce ? (resourceRatio * (currentGeeForce / 10) * 0.8) + ((part.temperature / 1000) * 0.2) : Math.Pow(resourceRatio, 2); effectivePowerNeeded = chargeNeeded * powerModifier; if (effectivePowerNeeded > 0.0) { double powerRequest = (chargeStatus >= maxCharge ? 1.0 : 2.0) * effectivePowerNeeded * TimeWarp.fixedDeltaTime; double chargeToAdd = consumeMegawatts(powerRequest / GameConstants.ecPerMJ, true, true, true) * GameConstants.ecPerMJ / effectivePowerNeeded; chargeStatus += chargeToAdd; if (chargeToAdd >= TimeWarp.fixedDeltaTime) { _charging = true; } else { _charging = false; if (TimeWarp.CurrentRateIndex > 3 && (antimatterResource.amount > _minimumAntimatterAmount)) { TimeWarp.SetRate(3, true); ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg7", TimeWarp.CurrentRate, antimatterResource.resourceName), 1, ScreenMessageStyle.UPPER_CENTER);//"Cannot Time Warp faster than " + + "x while " + + " Tank is Unpowered" } } } if (_startupTimeout > 0) { _startupTimeout--; } if (_startupTimeout == 0 && antimatterResource.amount > _minimumAntimatterAmount) { //verify temperature if (!CheatOptions.IgnoreMaxTemperature && canExplodeFromHeat && part.temperature > (double)(decimal)maxTemperature) { _temperatureExplodeCounter++; if (_temperatureExplodeCounter > 20) { DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg8"));//"Antimatter container exploded due to reaching critical temperature" } } else { _temperatureExplodeCounter = 0; } //verify geeforce _effectiveMaxGeeforce = resourceRatio > 0 ? Math.Min(10, maxGeeforce / resourceRatio) : 10; if (!CheatOptions.UnbreakableJoints && canExplodeFromGeeForce) { if (vessel.missionTime > 0) { if (currentGeeForce > _effectiveMaxGeeforce) { ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg9"), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: geeforce at critical!" _geeforceExplodeCounter++; if (_geeforceExplodeCounter > 30) { DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg10"));//"Antimatter container exploded due to reaching critical geeforce" } } else if (TimeWarp.CurrentRateIndex > maximumTimewarpWithGeeforceWarning && currentGeeForce > _effectiveMaxGeeforce - 0.02) { TimeWarp.SetRate(maximumTimewarpWithGeeforceWarning, true); ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg11", TimeWarp.CurrentRate), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: Cannot Time Warp faster than " + + "x while geeforce near maximum tolerance!" } else if (currentGeeForce > _effectiveMaxGeeforce - 0.04) { ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg12", (currentGeeForce / _effectiveMaxGeeforce * 100).ToString("F2")), 1, ScreenMessageStyle.UPPER_CENTER);//"ALERT: geeforce at " + + "% tolerance!" } else { _geeforceExplodeCounter = 0; } } else if (currentGeeForce > _effectiveMaxGeeforce) { ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg13"), 1, ScreenMessageStyle.UPPER_CENTER);//"Warning: geeforce tolerance exceeded but sustanable while the mission timer has not started" } } else { _geeforceExplodeCounter = 0; } //verify power if (chargeStatus <= 0) { chargeStatus = 0; if (!CheatOptions.InfiniteElectricity && antimatterResource.amount > 0.00001 * antimatterResource.maxAmount) { _powerExplodeCounter++; if (_powerExplodeCounter > 20) { DoExplode(Localizer.Format("#LOC_KSPIE_AntimatterStorageTank_Postmsg14"));//"Antimatter container exploded due to running out of power" } } } else { _powerExplodeCounter = 0; } } else { _effectiveMaxGeeforce = 0; _temperatureExplodeCounter = 0; _geeforceExplodeCounter = 0; _powerExplodeCounter = 0; } if (chargeStatus > maxCharge) { chargeStatus = maxCharge; } }