protected void UpdateOverheatBox(double val, double minVal) { if (!vessel.isActiveVessel) { overheatBox = null; return; } if (val >= (minVal - 0.00001d)) { if (overheatBox == null) { overheatBox = part.stackIcon.DisplayInfo(); overheatBox.SetMsgBgColor(XKCDColors.DarkRed.A(0.6f)); overheatBox.SetMsgTextColor(XKCDColors.OrangeYellow.A(0.6f)); overheatBox.SetMessage("Eng. Int."); overheatBox.SetProgressBarBgColor(XKCDColors.DarkRed.A(0.6f)); overheatBox.SetProgressBarColor(XKCDColors.OrangeYellow.A(0.6f)); } double scalar = 1d / (1d - minVal); double scaleFac = 1f - scalar; float gaugeMin = (float)(scalar * minVal + scaleFac); overheatBox.SetValue(Mathf.Clamp01((float)(val * scalar + scaleFac)), gaugeMin, 1.0f); } else { if (overheatBox != null) { part.stackIcon.RemoveInfo(overheatBox); overheatBox = null; } } }
private ProtoStageIconInfo InitEmptyGauge() //could remove emptygauge, mainly a QoL thing, removal might increase performance slightly { EnsureStagingIcon(); ProtoStageIconInfo g = part.stackIcon.DisplayInfo(); // fix nullref if no stackicon exists if (g != null) { g.SetMsgBgColor(XKCDColors.AlmostBlack); g.SetMsgTextColor(XKCDColors.Yellow); g.SetMessage(Localizer.Format("#LOC_BDArmory_ProtoStageIconInfo_AmmoOut"));//"Ammo Depleted" g.SetProgressBarBgColor(XKCDColors.Yellow); g.SetProgressBarColor(XKCDColors.Black); } return(g); }
private ProtoStageIconInfo InitHeatGauge() //thanks DYJ { EnsureStagingIcon(); ProtoStageIconInfo v = part.stackIcon.DisplayInfo(); // fix nullref if no stackicon exists if (v != null) { v.SetMsgBgColor(XKCDColors.DarkRed); v.SetMsgTextColor(XKCDColors.Orange); v.SetMessage(Localizer.Format("#LOC_BDArmory_ProtoStageIconInfo_Overheat"));//"Overheat" v.SetProgressBarBgColor(XKCDColors.DarkRed); v.SetProgressBarColor(XKCDColors.Orange); } return(v); }
private ProtoStageIconInfo InitAmmoGauge(string ammoName) //thanks DYJ { EnsureStagingIcon(); ProtoStageIconInfo a = part.stackIcon.DisplayInfo(); // fix nullref if no stackicon exists if (a != null) { a.SetMsgBgColor(XKCDColors.Grey); a.SetMsgTextColor(XKCDColors.Yellow); //a.SetMessage("Ammunition"); a.SetMessage($"{ammoName}"); a.SetProgressBarBgColor(XKCDColors.DarkGrey); a.SetProgressBarColor(XKCDColors.Yellow); } return(a); }
private ProtoStageIconInfo InitReloadBar() { EnsureStagingIcon(); ProtoStageIconInfo v = part.stackIcon.DisplayInfo(); if (v == null) { return(v); } v.SetMsgBgColor(XKCDColors.DarkGrey); v.SetMsgTextColor(XKCDColors.White); v.SetMessage(Localizer.Format("#LOC_BDArmory_ProtoStageIconInfo_Reloading"));//"Reloading" v.SetProgressBarBgColor(XKCDColors.DarkGrey); v.SetProgressBarColor(XKCDColors.Silver); return(v); }
private ProtoStageIconInfo InitReloadBar() { EnsureStagingIcon(); ProtoStageIconInfo v = part.stackIcon.DisplayInfo(); if (v == null) { return(v); } v.SetMsgBgColor(XKCDColors.DarkGrey); v.SetMsgTextColor(XKCDColors.White); v.SetMessage("Reloading"); v.SetProgressBarBgColor(XKCDColors.DarkGrey); v.SetProgressBarColor(XKCDColors.Silver); return(v); }
protected void UpdateOverheatBox(double val, double minVal) { if (val >= (minVal - 0.00001d)) { if (overheatBox == null) { overheatBox = part.stackIcon.DisplayInfo(); overheatBox.SetMsgBgColor(XKCDColors.DarkRed.A(0.6f)); overheatBox.SetMsgTextColor(XKCDColors.OrangeYellow.A(0.6f)); overheatBox.SetMessage("Eng. Int."); overheatBox.SetProgressBarBgColor(XKCDColors.DarkRed.A(0.6f)); overheatBox.SetProgressBarColor(XKCDColors.OrangeYellow.A(0.6f)); } double scalar = 1d / (1d - minVal); double scaleFac = 1f - scalar; float gaugeMin = (float)(scalar * minVal + scaleFac); overheatBox.SetValue(Mathf.Clamp01((float)(val * scalar + scaleFac)), gaugeMin, 1.0f); } else { if (overheatBox != null) { part.stackIcon.RemoveInfo(overheatBox); overheatBox = null; } } }