protected void drawVesselSummary() { Vessel[] unloadedVessels = FlightGlobals.VesselsUnloaded.ToArray(); UnloadedQualitySummary qualitySummary; bool createdNewRecord; scrollPos = GUILayout.BeginScrollView(scrollPos, scrollViewOptions); for (int index = 0; index < unloadedVessels.Length; index++) { //Get the summary info. qualitySummary = BARISScenario.Instance.GetUnloadedQualitySummary(unloadedVessels[index], out createdNewRecord); if (qualitySummary == null) { continue; } //Skip vessels marked as debris. if (!BARISUtils.IsFilterEnabled(qualitySummary.vessel)) { continue; } //Update the summary qualitySummary.UpdateAndGetFailureCandidates(0); if (qualitySummary.IsBroken()) { GUILayout.BeginScrollView(originPoint, infoPanelOptionsBroken); //Vessel name & reliability GUILayout.Label("<color=white><b>" + unloadedVessels[index].vesselName + "</b></color>"); GUILayout.Label("<color=white><b>" + BARISScenario.ConditionLabel + "</b> " + BARISScenario.RepairTimeBroken + "</color>"); drawTigerTeamRepairs(qualitySummary); GUILayout.EndScrollView(); } else { GUILayout.BeginScrollView(originPoint, infoPanelOptions); //Vessel name & reliability GUILayout.Label("<color=white><b>" + unloadedVessels[index].vesselName + "</b></color>"); GUILayout.Label("<color=white><b>" + BARISScenario.ReliabilityLabel + "</b> " + qualitySummary.reliability + "%</color>"); GUILayout.EndScrollView(); } } GUILayout.EndScrollView(); }
protected void drawVesselSummary() { UnloadedQualitySummary qualitySummary; scrollPos = GUILayout.BeginScrollView(scrollPos, scrollViewOptions); for (int index = 0; index < unloadedQualityCache.Length; index++) { //Get the summary info. qualitySummary = unloadedQualityCache[index]; //Skip vessels marked as debris. if (!BARISUtils.IsFilterEnabled(qualitySummary.vessel)) { continue; } if (qualitySummary.IsBroken()) { GUILayout.BeginScrollView(originPoint, infoPanelOptionsBroken); //Vessel name & reliability GUILayout.Label("<color=white><b>" + qualitySummary.vessel.vesselName + "</b></color>"); GUILayout.Label("<color=white><b>" + BARISScenario.ConditionLabel + "</b> " + BARISScenario.RepairTimeBroken + "</color>"); drawTigerTeamRepairs(qualitySummary); GUILayout.EndScrollView(); } else { GUILayout.BeginScrollView(originPoint, infoPanelOptions); //Vessel name & reliability GUILayout.Label("<color=white><b>" + qualitySummary.vessel.vesselName + "</b></color>"); GUILayout.Label("<color=white><b>" + BARISScenario.ReliabilityLabel + "</b> " + qualitySummary.reliability + "%</color>"); GUILayout.EndScrollView(); } } GUILayout.EndScrollView(); }
public override void SetVisible(bool newValue) { base.SetVisible(newValue); if (wrenchIcon == null) { wrenchIcon = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/Wrench", false); } if (newValue) { unloadedQualityCache = BARISScenario.Instance.unloadedQualityCache.Values.ToArray(); //Build the cache if needed. UnloadedQualitySummary qualitySummary; if (unloadedQualityCache.Length == 0) { debugLog("No unloaded quality cache, rebuilding..."); Vessel[] unloadedVessels = FlightGlobals.VesselsUnloaded.ToArray(); bool createdNewRecord; List <UnloadedQualitySummary> cache = new List <UnloadedQualitySummary>(); for (int index = 0; index < unloadedVessels.Length; index++) { //Skip vessels marked as debris. if (!BARISUtils.IsFilterEnabled(unloadedVessels[index])) { continue; } //Skip mothballed vessels qualitySummary = BARISScenario.Instance.GetUnloadedQualitySummary(unloadedVessels[index], out createdNewRecord); if (qualitySummary != null) { cache.Add(qualitySummary); } } unloadedQualityCache = cache.ToArray(); } //Update the summary for (int index = 0; index < unloadedQualityCache.Length; index++) { //Get the summary info. qualitySummary = unloadedQualityCache[index]; //Skip vessels marked as debris. if (!BARISUtils.IsFilterEnabled(qualitySummary.vessel)) { continue; } qualitySummary.UpdateAndGetFailureCandidates(0); } //Game events BARISScenario.Instance.onQualityCheck += onQualityCheck; } else { BARISScenario.Instance.onQualityCheck -= onQualityCheck; } }