private void LoadSettings() { List <ConfigNode> flightGUISettings = FARSettingsScenarioModule.FlightGUISettings; ConfigNode node = flightGUISettings.FirstOrDefault(t => t.name == "AirSpeedSettings"); if (node == null) { unitMode = 0; velMode = 0; } else { if (int.TryParse(node.GetValue("unitTypeIndex"), out int tmp)) { unitMode = (SurfaceVelUnit)tmp; } else { unitMode = 0; } if (int.TryParse(node.GetValue("velTypeIndex"), out tmp)) { velMode = (SurfaceVelMode)tmp; } else { velMode = 0; } } }
public void AirSpeedSettings() { if (buttonStyle == null) { buttonStyle = FlightGUI.buttonStyle; } GUILayout.BeginVertical(); Localizer.Format("FARFlightAirspeedLabel"); GUILayout.Space(10); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); velMode = (SurfaceVelMode)GUILayout.SelectionGrid((int)velMode, surfModel_str, 1, buttonStyle); unitMode = (SurfaceVelUnit)GUILayout.SelectionGrid((int)unitMode, surfUnit_str, 1, buttonStyle); GUILayout.EndHorizontal(); }
bool active; // Have we actually generated the string? public void AirSpeedSettings() { if (buttonStyle == null) { buttonStyle = FlightGUI.buttonStyle; } GUILayout.BeginVertical(); GUILayout.Label("Select Surface Velocity Settings"); GUILayout.Space(10); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); velMode = (SurfaceVelMode)GUILayout.SelectionGrid((int)velMode, surfModel_str, 1, buttonStyle); unitMode = (SurfaceVelUnit)GUILayout.SelectionGrid((int)unitMode, surfUnit_str, 1, buttonStyle); GUILayout.EndHorizontal(); // SaveAirSpeedPos.x = AirSpeedPos.x; // SaveAirSpeedPos.y = AirSpeedPos.y; }
void LoadSettings() { List <ConfigNode> flightGUISettings = FARSettingsScenarioModule.FlightGUISettings; ConfigNode node = null; for (int i = 0; i < flightGUISettings.Count; i++) { if (flightGUISettings[i].name == "AirSpeedSettings") { node = flightGUISettings[i]; break; } } if (node == null) { unitMode = 0; velMode = 0; } else { int tmp; //unitMode = (SurfaceVelUnit)int.Parse(node.GetValue("unitTypeIndex")); if (int.TryParse(node.GetValue("unitTypeIndex"), out tmp)) { unitMode = (SurfaceVelUnit)tmp; } else { unitMode = 0; } if (int.TryParse(node.GetValue("velTypeIndex"), out tmp)) { velMode = (SurfaceVelMode)tmp; } else { velMode = 0; } } }
public bool GetVelocityDisplayString(out string value_out, out SurfaceVelMode mode_out) { value_out = velString; mode_out = velMode; return(allEnabled && enabled && active); }
private void ChangeSurfVelocity(SurfaceVelMode velMode) { if (FlightUIController.speedDisplayMode != FlightUIController.SpeedDisplayModes.Surface) return; FlightUIController UI = FlightUIController.fetch; Vessel activeVessel = FlightGlobals.ActiveVessel; double unitConversion = 1; string unitString = "m/s"; if (unitMode == SurfaceVelUnit.KNOTS) { unitConversion = 1.943844492440604768413343347219; unitString = "knots"; } else if (unitMode == SurfaceVelUnit.KM_H) { unitConversion = 3.6; unitString = "km/h"; } else if (unitMode == SurfaceVelUnit.MPH) { unitConversion = 2.236936; unitString = "mph"; } if (velMode == SurfaceVelMode.DEFAULT) { UI.spdCaption.text = "Surface"; UI.speed.text = (activeVessel.srf_velocity.magnitude * unitConversion).ToString("F1") + unitString; } else if (velMode == SurfaceVelMode.IAS) { UI.spdCaption.text = "IAS"; double densityRatio = (FARAeroUtil.GetCurrentDensity(activeVessel.mainBody, activeVessel.altitude) * invKerbinSLDensity); double pressureRatio = FARAeroUtil.StagnationPressureCalc(MachNumber); UI.speed.text = (activeVessel.srf_velocity.magnitude * Math.Sqrt(densityRatio) * pressureRatio * unitConversion).ToString("F1") + unitString; } else if (velMode == SurfaceVelMode.EAS) { UI.spdCaption.text = "EAS"; double densityRatio = (FARAeroUtil.GetCurrentDensity(activeVessel.mainBody, activeVessel.altitude) * invKerbinSLDensity); UI.speed.text = (activeVessel.srf_velocity.magnitude * Math.Sqrt(densityRatio) * unitConversion).ToString("F1") + unitString; } else// if (velMode == SurfaceVelMode.MACH) { UI.spdCaption.text = "Mach"; UI.speed.text = mach; } }
private void AirSpeedGUI(int windowID) { GUIStyle mySty = new GUIStyle(GUI.skin.box); mySty.normal.textColor = mySty.focused.textColor = Color.white; mySty.hover.textColor = mySty.active.textColor = Color.yellow; mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green; mySty.padding = new RectOffset(4, 4, 4, 4); GUIStyle mytoggle = new GUIStyle(GUI.skin.button); mytoggle.normal.textColor = mytoggle.focused.textColor = Color.white; mytoggle.hover.textColor = mytoggle.active.textColor = mytoggle.onActive.textColor = Color.yellow; mytoggle.onNormal.textColor = mytoggle.onFocused.textColor = mytoggle.onHover.textColor = Color.green; mytoggle.padding = new RectOffset(4, 4, 4, 4); GUIStyle TabLabelStyle = new GUIStyle(GUI.skin.label); TabLabelStyle.fontStyle = FontStyle.Bold; TabLabelStyle.alignment = TextAnchor.UpperCenter; GUILayout.BeginVertical(); GUILayout.Label("Select Surface Velocity Settings", TabLabelStyle); GUILayout.Space(10); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); velMode = (SurfaceVelMode)GUILayout.SelectionGrid((int)velMode, surfModel_str, 1, mytoggle); unitMode = (SurfaceVelUnit)GUILayout.SelectionGrid((int)unitMode, surfUnit_str, 1, mytoggle); GUILayout.EndHorizontal(); AirSpeedHelp = GUILayout.Toggle(AirSpeedHelp, "Help", mytoggle, GUILayout.ExpandWidth(true)); // SaveAirSpeedPos.x = AirSpeedPos.x; // SaveAirSpeedPos.y = AirSpeedPos.y; GUI.DragWindow(); AirSpeedPos = FARGUIUtils.ClampToScreen(AirSpeedPos); }
void LoadSettings() { List<ConfigNode> flightGUISettings = FARSettingsScenarioModule.FlightGUISettings; ConfigNode node = null; for (int i = 0; i < flightGUISettings.Count; i++) if (flightGUISettings[i].name == "AirSpeedSettings") { node = flightGUISettings[i]; break; } if (node == null) { unitMode = 0; velMode = 0; } else { int tmp; //unitMode = (SurfaceVelUnit)int.Parse(node.GetValue("unitTypeIndex")); if (int.TryParse(node.GetValue("unitTypeIndex"), out tmp)) unitMode = (SurfaceVelUnit)tmp; else unitMode = 0; if (int.TryParse(node.GetValue("velTypeIndex"), out tmp)) velMode = (SurfaceVelMode)tmp; else velMode = 0; } }
public bool GetVelocityDisplayString(out string value_out, out SurfaceVelMode mode_out) { value_out = velString; mode_out = velMode; return active; }
bool active; // Have we actually generated the string? public void AirSpeedSettings() { if (buttonStyle == null) buttonStyle = FlightGUI.buttonStyle; GUILayout.BeginVertical(); GUILayout.Label("Select Surface Velocity Settings"); GUILayout.Space(10); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); velMode = (SurfaceVelMode)GUILayout.SelectionGrid((int)velMode, surfModel_str, 1, buttonStyle); unitMode = (SurfaceVelUnit)GUILayout.SelectionGrid((int)unitMode, surfUnit_str, 1, buttonStyle); GUILayout.EndHorizontal(); // SaveAirSpeedPos.x = AirSpeedPos.x; // SaveAirSpeedPos.y = AirSpeedPos.y; }