protected override void OnLateUpdate() { base.OnLateUpdate(); // disable sub-panels depending on situation Controller.ToggleOnPlanet(VSL.OnPlanet); Controller.ToggleInOrbit(VSL.InOrbit); // set states of the indicators Controller.Ascending.isOn = TCA.IsStateSet(TCAState.Ascending); Controller.LoosingAltitude.isOn = TCA.IsStateSet(TCAState.LoosingAltitude); Controller.TerrainCollision.isOn = TCA.IsStateSet(TCAState.GroundCollision); Controller.VesselCollision.isOn = TCA.IsStateSet(TCAState.VesselCollision); Controller.LowControlAuthority.isOn = !VSL.Controls.HaveControlAuthority; Controller.EnginesUnoptimized.isOn = TCA.IsStateSet(TCAState.Unoptimized); Controller.VSC.isOn = TCAModule.ExistsAndActive(VSC); Controller.ALT.isOn = TCAModule.ExistsAndActive(ALT); Controller.VTOLMode.isOn = TCAModule.ExistsAndActive(VTOL_control); Controller.VTOLAssist.isOn = TCA.IsStateSet(TCAState.VTOLAssist); Controller.Stabilizing.isOn = TCA.IsStateSet(TCAState.StabilizeFlight); Controller.NoEngines.isOn = TCA.IsStateSet(TCAState.HaveEC) && !TCA.IsStateSet(TCAState.HaveActiveEngines); Controller.NoEC.isOn = TCA.IsStateSet(TCAState.Enabled) && !TCA.IsStateSet(TCAState.HaveEC); Controller.SmartEngines.isOn = CFG.UseSmartEngines; Controller.Stop.isOn = CFG.HF[HFlight.Stop] || TCAModule.ExistsAndActive(anchor); Controller.Navigation.isOn = CFG.Nav.Any(Navigation.GoToTarget, Navigation.FollowPath, Navigation.FollowTarget); // fade out irrelevant indicators Controller.TerrainCollision.SetActive(TCAModule.ExistsAndActive(RAD)); Controller.VesselCollision.SetActive(CFG.UseCPS); Controller.VTOLAssist.SetActive(CFG.VTOLAssistON); Controller.Stabilizing.SetActive(CFG.StabilizeFlight); Controller.SmartEngines.SetActive(VSL.Engines.Clusters.Multi); }
string StatusString() { if (TCA.IsStateSet(TCAState.Enabled)) { if (TCA.IsStateSet(TCAState.ObstacleAhead)) { return("<color=red>Obstacle On Course</color>"); } else if (TCA.IsStateSet(TCAState.GroundCollision)) { return("<color=red>Ground Collision Possible</color>"); } else if (TCA.IsStateSet(TCAState.LoosingAltitude)) { return("<color=red>Loosing Altitude</color>"); } else if (!VSL.Controls.HaveControlAuthority) { return("<color=red>Low Control Authority</color>"); } else if (TCA.IsStateSet(TCAState.Unoptimized)) { return("<color=yellow>Engines Unoptimized</color>"); } else if (TCA.IsStateSet(TCAState.Ascending)) { return("<color=yellow>Ascending</color>"); } else if (TCA.IsStateSet(TCAState.VTOLAssist)) { return("<color=yellow>VTOL Assist On</color>"); } else if (TCA.IsStateSet(TCAState.StabilizeFlight)) { return("<color=yellow>Stabilizing Flight</color>"); } else if (TCA.IsStateSet(TCAState.AltitudeControl)) { return("<color=lime>Altitude Control</color>"); } else if (TCA.IsStateSet(TCAState.VerticalSpeedControl)) { return("<color=lime>Vertical Speed Control</color>"); } else if (TCA.State == TCAState.Nominal) { return("<color=lime>Systems Nominal</color>"); } else if (TCA.State == TCAState.NoActiveEngines) { return("<color=yellow>No Active Engines</color>"); } else if (TCA.State == TCAState.NoEC) { return("<color=red>No Electric Charge</color>"); } else //this should never happen { return("<color=magenta>Unknown State</color>"); } } return("<color=grey>Disabled</color>"); }
void StatusString() { var state = "Disabled"; var style = Styles.grey; if (TCA.IsStateSet(TCAState.Enabled)) { if (TCA.IsStateSet(TCAState.ObstacleAhead)) { state = "Obstacle On Course"; style = Styles.red; } else if (TCA.IsStateSet(TCAState.GroundCollision)) { state = "Ground Collision Possible"; style = Styles.red; } else if (TCA.IsStateSet(TCAState.LoosingAltitude)) { state = "Loosing Altitude"; style = Styles.red; } else if (!VSL.Controls.HaveControlAuthority) { state = "Low Control Authority"; style = Styles.red; } else if (TCA.IsStateSet(TCAState.Unoptimized)) { state = "Engines Unoptimized"; style = Styles.yellow; } else if (TCA.IsStateSet(TCAState.Ascending)) { state = "Ascending"; style = Styles.yellow; } else if (TCA.IsStateSet(TCAState.VTOLAssist)) { state = "VTOL Assist On"; style = Styles.yellow; } else if (TCA.IsStateSet(TCAState.StabilizeFlight)) { state = "Stabilizing Flight"; style = Styles.yellow; } else if (TCA.IsStateSet(TCAState.AltitudeControl)) { state = "Altitude Control"; style = Styles.green; } else if (TCA.IsStateSet(TCAState.VerticalSpeedControl)) { state = "Vertical Speed Control"; style = Styles.green; } else if (TCA.State == TCAState.Nominal) { state = "Systems Nominal"; style = Styles.green; } else if (TCA.State == TCAState.NoActiveEngines) { state = "No Active Engines"; style = Styles.yellow; } else if (TCA.State == TCAState.NoEC) { state = "No Electric Charge"; style = Styles.red; } else //this should never happen { state = "Unknown State"; style = Styles.magenta; } } GUILayout.Label(state, style, GUILayout.ExpandWidth(false)); }