Пример #1
0
        public override TipSignal GetTooltip()
        {
            StringBuilder s = new StringBuilder();

            s.AppendLine(this.LabelCap + " " + this.kindDef.label);
            s.AppendLine("Current energy: " + this.TotalCharge.ToString("0.0") + "W/" + this.MaxEnergy.ToString() + "Wd");
            if (this.equipment != null && this.equipment.Primary != null)
            {
                s.AppendLine(this.equipment.Primary.LabelCap);
            }
            s.AppendLine(HealthUtility.GetGeneralConditionLabel(this));
            return(new TipSignal(s.ToString().TrimEnd(new char[]
            {
                '\n'
            }), this.thingIDNumber * 152317, TooltipPriority.Pawn));
        }
Пример #2
0
        public static void DrawHealth(WidgetRow row, Thing t)
        {
            Pawn   pawn = t as Pawn;
            float  fillPct;
            string label;

            if (pawn == null)
            {
                if (!t.def.useHitPoints)
                {
                    return;
                }
                if (t.HitPoints >= t.MaxHitPoints)
                {
                    GUI.color = Color.white;
                }
                else if ((float)t.HitPoints > (float)t.MaxHitPoints * 0.5f)
                {
                    GUI.color = Color.yellow;
                }
                else if (t.HitPoints > 0)
                {
                    GUI.color = Color.red;
                }
                else
                {
                    GUI.color = Color.grey;
                }
                fillPct = (float)t.HitPoints / (float)t.MaxHitPoints;
                label   = t.HitPoints.ToStringCached() + " / " + t.MaxHitPoints.ToStringCached();
            }
            else
            {
                GUI.color = Color.white;
                fillPct   = pawn.health.summaryHealth.SummaryHealthPercent;
                label     = HealthUtility.GetGeneralConditionLabel(pawn, true);
            }
            row.FillableBar(93f, 16f, fillPct, label, InspectPaneFiller.HealthTex, InspectPaneFiller.BarBGTex);
            GUI.color = Color.white;
        }