using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using RimWorld; using UnityEngine; namespace RJW_Genes { //Copied from GeneGizmo_ResourceHemogen, with small modifications public class GeneGizmo_ResourceLifeForce : GeneGizmo_Resource { public GeneGizmo_ResourceLifeForce(Gene_Resource gene, List drainGenes, Color barColor, Color barhighlightColor) : base(gene, drainGenes, barColor, barhighlightColor) { this.draggableBar = true; } public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms) { return base.GizmoOnGUI(topLeft, maxWidth, parms); } protected override string GetTooltip() { this.tmpDrainGenes.Clear(); string text = string.Format("{0}: {1} / {2}\n", this.gene.ResourceLabel.CapitalizeFirst().Colorize(ColoredText.TipSectionTitleColor), this.gene.ValueForDisplay, this.gene.MaxForDisplay); if (this.gene.pawn.IsColonistPlayerControlled || this.gene.pawn.IsPrisonerOfColony) { if (this.gene.targetValue <= 0f) { text += "NeverConsumeCum"; } else { text = text + ("ConsumeCumBelow" + ": ") + this.gene.PostProcessValue(this.gene.targetValue); } } if (!this.drainGenes.NullOrEmpty()) { float num = 0f; foreach (IGeneResourceDrain geneResourceDrain in this.drainGenes) { if (geneResourceDrain.CanOffset) { this.tmpDrainGenes.Add(new Pair(geneResourceDrain, geneResourceDrain.ResourceLossPerDay)); num += geneResourceDrain.ResourceLossPerDay; } } if (num != 0f) { string text2 = (num < 0f) ? "RegenerationRate".Translate() : "DrainRate".Translate(); text = string.Concat(new string[] { text, "\n\n", text2, ": ", "PerDay".Translate(Mathf.Abs(this.gene.PostProcessValue(num))).Resolve() }); foreach (Pair pair in this.tmpDrainGenes) { text = string.Concat(new string[] { text, "\n - ", pair.First.DisplayLabel.CapitalizeFirst(), ": ", "PerDay".Translate(this.gene.PostProcessValue(-pair.Second).ToStringWithSign()).Resolve() }); } } } if (!this.gene.def.resourceDescription.NullOrEmpty()) { text = text + "\n\n" + this.gene.def.resourceDescription.Formatted(this.gene.pawn.Named("PAWN")).Resolve(); } return text; } private List> tmpDrainGenes = new List>(); } }