private void InterfaceDropHaul(Thing t) { if (SelPawnForGear.HoldTrackerIsHeld(t)) { SelPawnForGear.HoldTrackerForget(t); } ThingWithComps thingWithComps = t as ThingWithComps; Apparel apparel = t as Apparel; if (apparel != null && SelPawnForGear.apparel != null && SelPawnForGear.apparel.WornApparel.Contains(apparel)) { Job job = JobMaker.MakeJob(JobDefOf.RemoveApparel, apparel); job.haulDroppedApparel = true; SelPawnForGear.jobs.TryTakeOrderedJob(job); } else if (thingWithComps != null && SelPawnForGear.equipment != null && SelPawnForGear.equipment.AllEquipmentListForReading.Contains(thingWithComps)) { SelPawnForGear.jobs.TryTakeOrderedJob(JobMaker.MakeJob(JobDefOf.DropEquipment, thingWithComps)); } else if (!t.def.destroyOnDrop) { Thing thing; SelPawn.inventory.innerContainer.TryDrop(t, SelPawn.Position, SelPawn.Map, ThingPlaceMode.Near, out thing); } }
private void DrawOverallArmor(Rect rect, StatDef stat, string label, Texture image) { // Dark magic from vanilla code calculating armor value until the blank line. float num = 0f; float num2 = Mathf.Clamp01(SelPawnForGear.GetStatValue(stat, true) / 2f); List <BodyPartRecord> allParts = SelPawnForGear.RaceProps.body.AllParts; List <Apparel> list = (SelPawnForGear.apparel == null) ? null : SelPawnForGear.apparel.WornApparel; for (int i = 0; i < allParts.Count; i++) { float num3 = 1f - num2; if (list != null) { for (int j = 0; j < list.Count; j++) { if (list[j].def.apparel.CoversBodyPart(allParts[i])) { float num4 = Mathf.Clamp01(list[j].GetStatValue(stat, true) / 2f); num3 *= 1f - num4; } } } num += allParts[i].coverageAbs * (1f - num3); } num = Mathf.Clamp(num * 2f, 0f, 2f); Rect iconRect = new Rect(rect.x, rect.y, SmallIconSize, SmallIconSize); GUI.DrawTexture(iconRect, image); TooltipHandler.TipRegion(iconRect, label); // the 36px can make the percentage number look like it is centered in the field. Brilliant Sandy. Rect valRect = new Rect(rect.x + SmallIconSize + 36f, rect.y + SmallIconMargin, statBoxWidth - SmallIconSize, SmallIconSize); Widgets.Label(valRect, num.ToStringPercent()); }
private void DrawComfyTemperatureRange(Vector2 topLeft) { if (SelPawnForGear.Dead) { return; } Rect iconRect = new Rect(topLeft.x, topLeft.y, SmallIconSize, SmallIconSize); GUI.DrawTexture(iconRect, ContentFinder <Texture2D> .Get("UI/Icons/Min_Temperature")); TooltipHandler.TipRegion(iconRect, "ComfyTemperatureRange".Translate()); float statValue = SelPawnForGear.GetStatValue(StatDefOf.ComfyTemperatureMin); Rect textRect = new Rect(topLeft.x + SmallIconSize + MediumMargin, topLeft.y + SmallIconMargin, statBoxWidth - SmallIconSize, SmallIconSize); Widgets.Label(textRect, " " + statValue.ToStringTemperature("F0")); iconRect.Set(iconRect.x, iconRect.y + SmallIconSize + SmallIconMargin, SmallIconSize, SmallIconSize); GUI.DrawTexture(iconRect, ContentFinder <Texture2D> .Get("UI/Icons/Max_Temperature")); TooltipHandler.TipRegion(iconRect, "ComfyTemperatureRange".Translate()); statValue = SelPawnForGear.GetStatValue(StatDefOf.ComfyTemperatureMax); textRect.Set(textRect.x, textRect.y + SmallIconSize + SmallIconMargin, statBoxWidth - SmallIconSize, SmallIconSize); Widgets.Label(textRect, " " + statValue.ToStringTemperature("F0")); }
// RimWorld.ITab_Pawn_Gear private void TryDrawOverallArmor(ref float curY, float width, StatDef stat, string label, string unit) { float naturalArmor = SelPawnForGear.GetStatValue(stat); float averageArmor = naturalArmor; List <Apparel> wornApparel = SelPawnForGear.apparel?.WornApparel; foreach (Apparel apparel in wornApparel ?? Enumerable.Empty <Apparel>()) { averageArmor += apparel.GetStatValue(stat, true) * apparel.def.apparel.HumanBodyCoverage; } if (averageArmor > 0.0001f) { Rect rect = new Rect(0f, curY, width, _standardLineHeight); string text = ""; foreach (BodyPartRecord bodyPart in SelPawnForGear.RaceProps.body.AllParts) { BodyPartRecord part = bodyPart; float armorValue = bodyPart.IsInGroup(CE_BodyPartGroupDefOf.CoveredByNaturalArmor) ? naturalArmor : 0f; if (part.depth == BodyPartDepth.Outside && (part.coverage >= 0.1 || (part.def == BodyPartDefOf.Eye || part.def == BodyPartDefOf.Neck))) { text += part.LabelCap + ": "; foreach (Apparel apparel in wornApparel ?? Enumerable.Empty <Apparel>()) { if (apparel.def.apparel.CoversBodyPart(part)) { armorValue += apparel.GetStatValue(stat, true); } } text += formatArmorValue(armorValue, unit) + "\n"; } } TooltipHandler.TipRegion(rect, text); Widgets.Label(rect, label.Truncate(200f, null)); rect.xMin += 200; Widgets.Label(rect, formatArmorValue(averageArmor, unit)); curY += _standardLineHeight; } }
//private bool CanControl //{ // get // { // Pawn selPawnForGear = this.SelPawnForGear; // return !selPawnForGear.Downed && !selPawnForGear.InMentalState && (selPawnForGear.Faction == Faction.OfPlayer || selPawnForGear.IsPrisonerOfColony) && (!selPawnForGear.IsPrisonerOfColony || !selPawnForGear.Spawned || selPawnForGear.Map.mapPawns.AnyFreeColonistSpawned) && (!selPawnForGear.IsPrisonerOfColony || (!PrisonBreakUtility.IsPrisonBreaking(selPawnForGear) && (selPawnForGear.CurJob == null || !selPawnForGear.CurJob.exitMapOnArrival))); // } //} //private bool CanControlColonist //{ // get // { // return this.CanControl && this.SelPawnForGear.IsColonistPlayerControlled; // } //} //private Pawn SelPawnForGear //{ // get // { // if (SelPawn != null) // { // return SelPawn; // } // Corpse corpse = SelThing as Corpse; // if (corpse != null) // { // return corpse.InnerPawn; // } // throw new InvalidOperationException("Gear tab on non-pawn non-corpse " + SelThing); // } //} #endregion Properties #region Methods public override void FillTab() { // get the inventory comp CompInventory comp = SelPawn.TryGetComp <CompInventory>(); // set up rects Rect listRect = new Rect( _margin, _topPadding, size.x - 2 * _margin, size.y - _topPadding - _margin); if (comp != null) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_InventoryWeightBulk, KnowledgeAmount.FrameDisplayed); // adjust rects if comp found listRect.height -= (_margin / 2 + _barHeight) * 2; Rect weightRect = new Rect(_margin, listRect.yMax + _margin / 2, listRect.width, _barHeight); Rect bulkRect = new Rect(_margin, weightRect.yMax + _margin / 2, listRect.width, _barHeight); // draw bars Utility_Loadouts.DrawBar(bulkRect, comp.currentBulk, comp.capacityBulk, "CE_Bulk".Translate(), SelPawn.GetBulkTip()); Utility_Loadouts.DrawBar(weightRect, comp.currentWeight, comp.capacityWeight, "CE_Weight".Translate(), SelPawn.GetWeightTip()); // draw text overlays on bars Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; string currentBulk = CE_StatDefOf.CarryBulk.ValueToString(comp.currentBulk, CE_StatDefOf.CarryBulk.toStringNumberSense); string capacityBulk = CE_StatDefOf.CarryBulk.ValueToString(comp.capacityBulk, CE_StatDefOf.CarryBulk.toStringNumberSense); Widgets.Label(bulkRect, currentBulk + "/" + capacityBulk); string currentWeight = comp.currentWeight.ToString("0.#"); string capacityWeight = CE_StatDefOf.CarryWeight.ValueToString(comp.capacityWeight, CE_StatDefOf.CarryWeight.toStringNumberSense); Widgets.Label(weightRect, currentWeight + "/" + capacityWeight); Text.Anchor = TextAnchor.UpperLeft; } // start drawing list (rip from ITab_Pawn_Gear) GUI.BeginGroup(listRect); Text.Font = GameFont.Small; GUI.color = Color.white; Rect outRect = new Rect(0f, 0f, listRect.width, listRect.height); Rect viewRect = new Rect(0f, 0f, listRect.width - 16f, _scrollViewHeight); Widgets.BeginScrollView(outRect, ref _scrollPosition, viewRect); float num = 0f; TryDrawComfyTemperatureRange(ref num, viewRect.width); if (ShouldShowOverallArmorCE(SelPawnForGear)) { Widgets.ListSeparator(ref num, viewRect.width, "OverallArmor".Translate()); TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Blunt, "ArmorBlunt".Translate(), " " + "CE_MPa".Translate()); TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Sharp, "ArmorSharp".Translate(), "CE_mmRHA".Translate()); TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Heat, "ArmorHeat".Translate(), "%"); } if (ShouldShowEquipment(SelPawnForGear)) { // get the loadout so we can make a decision to show a button. bool showMakeLoadout = false; Loadout curLoadout = SelPawnForGear.GetLoadout(); if (SelPawnForGear.IsColonist && (curLoadout == null || curLoadout.Slots.NullOrEmpty()) && (SelPawnForGear.inventory.innerContainer.Any() || SelPawnForGear.equipment?.Primary != null)) { showMakeLoadout = true; } if (showMakeLoadout) { num += 3; // Make a little room for the button. } float buttonY = num; // Could be accomplished with seperator being after the button... Widgets.ListSeparator(ref num, viewRect.width, "Equipment".Translate()); foreach (ThingWithComps current in SelPawnForGear.equipment.AllEquipmentListForReading) { DrawThingRowCE(ref num, viewRect.width, current); } // only offer this button if the pawn has no loadout or has the default loadout and there are things/equipment... if (showMakeLoadout) { Rect loadoutButtonRect = new Rect(viewRect.width / 2, buttonY, viewRect.width / 2, 26f); // button is half the available width... // Backup GUI color Color color = GUI.color; TextAnchor anchor = Text.Anchor; // Highlight if mouse over GUI.color = Color.cyan; if (Mouse.IsOver(loadoutButtonRect)) { GUI.color = Color.white; } Text.Anchor = TextAnchor.UpperRight; Widgets.Label(loadoutButtonRect, "CE_MakeLoadout".Translate()); if (Widgets.ButtonInvisible(loadoutButtonRect.ContractedBy(2), doMouseoverSound: true)) { Loadout loadout = SelPawnForGear.GenerateLoadoutFromPawn(); LoadoutManager.AddLoadout(loadout); SelPawnForGear.SetLoadout(loadout); // Opening this window is the same way as if from the assign tab so should be correct. Find.WindowStack.Add(new Dialog_ManageLoadouts(SelPawnForGear.GetLoadout())); } // Restore GUI color Text.Anchor = anchor; GUI.color = color; } } if (ShouldShowApparel(SelPawnForGear)) { Widgets.ListSeparator(ref num, viewRect.width, "Apparel".Translate()); foreach (Apparel current2 in from ap in SelPawnForGear.apparel.WornApparel orderby ap.def.apparel.bodyPartGroups[0].listOrder descending select ap) { DrawThingRowCE(ref num, viewRect.width, current2); } } if (ShouldShowInventory(SelPawnForGear)) { Widgets.ListSeparator(ref num, viewRect.width, "Inventory".Translate()); workingInvList.Clear(); workingInvList.AddRange(SelPawnForGear.inventory.innerContainer); for (int i = 0; i < workingInvList.Count; i++) { DrawThingRowCE(ref num, viewRect.width, workingInvList[i], true); } } if (Event.current.type == EventType.Layout) { _scrollViewHeight = num + 30f; } Widgets.EndScrollView(); GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }
public void DrawThingRowCE(ref float y, float width, Thing thing, bool showDropButtonIfPrisoner = false) { Rect rect = new Rect(0f, y, width, _thingRowHeight); Widgets.InfoCardButton(rect.width - 24f, y, thing.GetInnerIfMinified()); rect.width -= 24f; if (CanControl || (SelPawnForGear.Faction == Faction.OfPlayer && SelPawnForGear.RaceProps.packAnimal) || (showDropButtonIfPrisoner && SelPawnForGear.IsPrisonerOfColony)) { var dropForbidden = SelPawnForGear.IsItemQuestLocked(thing); Color color = dropForbidden ? Color.grey : Color.white; Color mouseoverColor = dropForbidden ? Color.grey : GenUI.MouseoverColor; Rect dropRect = new Rect(rect.width - 24f, y, 24f, 24f); TooltipHandler.TipRegion(dropRect, dropForbidden ? "DropThingLocked".Translate() : "DropThing".Translate()); if (Widgets.ButtonImage(dropRect, TexButton.Drop, color, mouseoverColor) && !dropForbidden) { SoundDefOf.Tick_High.PlayOneShotOnCamera(); InterfaceDrop(thing); } rect.width -= 24f; } if (CanControlColonist) { if ((thing.def.IsNutritionGivingIngestible || thing.def.IsNonMedicalDrug) && thing.IngestibleNow && base.SelPawn.WillEat(thing, null) && (!SelPawnForGear.IsTeetotaler() || !thing.def.IsNonMedicalDrug)) { Rect rect3 = new Rect(rect.width - 24f, y, 24f, 24f); TooltipHandler.TipRegion(rect3, "ConsumeThing".Translate(thing.LabelNoCount, thing)); if (Widgets.ButtonImage(rect3, TexButton.Ingest)) { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); InterfaceIngest(thing); } } rect.width -= 24f; } Rect rect4 = rect; rect4.xMin = rect4.xMax - 60f; CaravanThingsTabUtility.DrawMass(thing, rect4); rect.width -= 60f; if (Mouse.IsOver(rect)) { GUI.color = _highlightColor; GUI.DrawTexture(rect, TexUI.HighlightTex); } if (thing.def.DrawMatSingle != null && thing.def.DrawMatSingle.mainTexture != null) { Widgets.ThingIcon(new Rect(4f, y, _thingIconSize, _thingIconSize), thing, 1f); } Text.Anchor = TextAnchor.MiddleLeft; GUI.color = ThingLabelColor; Rect thingLabelRect = new Rect(_thingLeftX, y, rect.width - _thingLeftX, _thingRowHeight); string thingLabel = thing.LabelCap; if ((thing is Apparel && SelPawnForGear.outfits != null && SelPawnForGear.outfits.forcedHandler.IsForced((Apparel)thing)) || (SelPawnForGear.inventory != null && SelPawnForGear.HoldTrackerIsHeld(thing))) { thingLabel = thingLabel + ", " + "ApparelForcedLower".Translate(); } Text.WordWrap = false; Widgets.Label(thingLabelRect, thingLabel.Truncate(thingLabelRect.width, null)); Text.WordWrap = true; string text2 = string.Concat(new object[] { thing.LabelCap, "\n", thing.DescriptionDetailed, "\n", thing.GetWeightAndBulkTip() }); if (thing.def.useHitPoints) { string text3 = text2; text2 = string.Concat(new object[] { text3, "\n", "HitPointsBasic".Translate().CapitalizeFirst(), ": ", thing.HitPoints, " / ", thing.MaxHitPoints }); } TooltipHandler.TipRegion(thingLabelRect, text2); y += 28f; // RMB menu if (Widgets.ButtonInvisible(thingLabelRect) && Event.current.button == 1) { List <FloatMenuOption> floatOptionList = new List <FloatMenuOption>(); floatOptionList.Add(new FloatMenuOption("ThingInfo".Translate(), delegate { Find.WindowStack.Add(new Dialog_InfoCard(thing)); }, MenuOptionPriority.Default, null, null)); if (CanControl) { // Equip option ThingWithComps eq = thing as ThingWithComps; if (eq != null && eq.TryGetComp <CompEquippable>() != null) { CompInventory compInventory = SelPawnForGear.TryGetComp <CompInventory>(); CompBiocodable compBiocoded = eq.TryGetComp <CompBiocodable>(); if (compInventory != null) { FloatMenuOption equipOption; string eqLabel = GenLabel.ThingLabel(eq.def, eq.Stuff, 1); if (compBiocoded != null && compBiocoded.Biocoded && compBiocoded.CodedPawn != SelPawnForGear) { equipOption = new FloatMenuOption("CannotEquip".Translate(eqLabel) + ": " + "BiocodedCodedForSomeoneElse".Translate(), null); } else if (SelPawnForGear.IsQuestLodger() && !EquipmentUtility.QuestLodgerCanEquip(eq, SelPawnForGear)) { var forbiddenEquipOrPutAway = SelPawnForGear.equipment.AllEquipmentListForReading.Contains(eq) ? "CE_CannotPutAway".Translate(eqLabel) : "CannotEquip".Translate(eqLabel); equipOption = new FloatMenuOption(forbiddenEquipOrPutAway + ": " + "CE_CannotChangeEquipment".Translate(), null); } else if (SelPawnForGear.equipment.AllEquipmentListForReading.Contains(eq) && SelPawnForGear.inventory != null) { equipOption = new FloatMenuOption("CE_PutAway".Translate(eqLabel), new Action(delegate { SelPawnForGear.equipment.TryTransferEquipmentToContainer(SelPawnForGear.equipment.Primary, SelPawnForGear.inventory.innerContainer); })); } else if (!SelPawnForGear.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) { equipOption = new FloatMenuOption("CannotEquip".Translate(eqLabel), null); } else { string equipOptionLabel = "Equip".Translate(eqLabel); if (eq.def.IsRangedWeapon && SelPawnForGear.story != null && SelPawnForGear.story.traits.HasTrait(TraitDefOf.Brawler)) { equipOptionLabel = equipOptionLabel + " " + "EquipWarningBrawler".Translate(); } equipOption = new FloatMenuOption( equipOptionLabel, (SelPawnForGear.story != null && SelPawnForGear.WorkTagIsDisabled(WorkTags.Violent)) ? null : new Action(delegate { compInventory.TrySwitchToWeapon(eq); })); } floatOptionList.Add(equipOption); } } //Reload apparel option var worn_apparel = SelPawnForGear?.apparel?.WornApparel; foreach (var apparel in worn_apparel) { var compReloadable = apparel.TryGetComp <CompReloadable>(); if (compReloadable != null && compReloadable.AmmoDef == thing.def && compReloadable.NeedsReload(true)) { if (!SelPawnForGear.Drafted) //TODO-1.2 This should be doable for drafted pawns as well, but the job does nothing. Figure out what's wrong and remove this condition. { FloatMenuOption reloadApparelOption = new FloatMenuOption( "CE_ReloadApparel".Translate(apparel.Label, thing.Label), new Action(delegate { //var reloadJob = JobMaker.MakeJob(JobDefOf.Reload, apparel, thing); //SelPawnForGear.jobs.StartJob(reloadJob, JobCondition.InterruptForced, null, SelPawnForGear.CurJob?.def != reloadJob.def, true); SelPawnForGear.jobs.TryTakeOrderedJob(JobMaker.MakeJob(JobDefOf.Reload, apparel, thing)); }) ); floatOptionList.Add(reloadApparelOption); } } } // Consume option if (CanControl && thing.IngestibleNow && base.SelPawn.RaceProps.CanEverEat(thing)) { Action eatFood = delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(); InterfaceIngest(thing); }; string label = thing.def.ingestible.ingestCommandString.NullOrEmpty() ? (string)"ConsumeThing".Translate(thing.LabelShort, thing) : string.Format(thing.def.ingestible.ingestCommandString, thing.LabelShort); if (SelPawnForGear.IsTeetotaler() && thing.def.IsNonMedicalDrug) { floatOptionList.Add(new FloatMenuOption(label + ": " + TraitDefOf.DrugDesire.degreeDatas.Where(x => x.degree == -1).First()?.label, null)); } else { floatOptionList.Add(new FloatMenuOption(label, eatFood)); } } // Drop, and drop&haul options if (SelPawnForGear.IsItemQuestLocked(eq)) { floatOptionList.Add(new FloatMenuOption("CE_CannotDropThing".Translate() + ": " + "DropThingLocked".Translate(), null)); floatOptionList.Add(new FloatMenuOption("CE_CannotDropThingHaul".Translate() + ": " + "DropThingLocked".Translate(), null)); } else { floatOptionList.Add(new FloatMenuOption("DropThing".Translate(), new Action(delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(); InterfaceDrop(thing); }))); floatOptionList.Add(new FloatMenuOption("CE_DropThingHaul".Translate(), new Action(delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(); InterfaceDropHaul(thing); }))); } // Stop holding in inventory option if (CanControl && SelPawnForGear.HoldTrackerIsHeld(thing)) { Action forgetHoldTracker = delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(); SelPawnForGear.HoldTrackerForget(thing); }; floatOptionList.Add(new FloatMenuOption("CE_HoldTrackerForget".Translate(), forgetHoldTracker)); } } FloatMenu window = new FloatMenu(floatOptionList, thing.LabelCap, false); Find.WindowStack.Add(window); } // end menu }
protected override void FillTab() { var pawnSave = SelPawnForGear.GetSaveablePawn(); // Outfit + Status button var rectStatus = new Rect(20f, 15f, 380f, ButtonHeight); var outfitRect = new Rect(rectStatus.x, rectStatus.y, (392f / 3) - Margin, ButtonHeight); var outfitEditRect = new Rect(outfitRect.xMax + Margin, outfitRect.y, outfitRect.width, ButtonHeight); var outfitJobRect = new Rect(outfitEditRect.xMax + Margin, outfitRect.y, outfitRect.width, ButtonHeight); // select outfit if (Widgets.ButtonText(outfitRect, SelPawnForGear.outfits.CurrentOutfit.label)) { var options = new List <FloatMenuOption>(); foreach (var current in Current.Game.outfitDatabase.AllOutfits) { var localOut = current; options.Add( new FloatMenuOption( localOut.label, delegate { SelPawnForGear.outfits.CurrentOutfit = localOut; })); } var window = new FloatMenu(options, "SelectOutfit".Translate()); Find.WindowStack.Add(window); } // edit outfit if (Widgets.ButtonText( outfitEditRect, "OutfitterEditOutfit".Translate() + " ...")) //"OutfitterEditOutfit".Translate() + " " + SelPawnForGear.outfits.CurrentOutfit.label + " ...")) { Find.WindowStack.Add(new Dialog_ManageOutfits(SelPawnForGear.outfits.CurrentOutfit)); } // job outfit if (Widgets.ButtonText( outfitJobRect, pawnSave.MainJob == MainJob.Anything ? "MainJob".Translate() : "PreferedGear".Translate() + " " + pawnSave.MainJob.ToString() .Replace("00", " - ") .Replace("_", " "))) { var options = new List <FloatMenuOption>(); foreach (MainJob mainJob in Enum.GetValues(typeof(MainJob))) { options.Add( new FloatMenuOption( mainJob.ToString().Replace("00", " - ").Replace("_", " "), delegate { pawnSave.MainJob = mainJob; pawnSave.ForceStatUpdate = true; SelPawnForGear.mindState.Notify_OutfitChanged(); if (SelPawnForGear.jobs.curJob != null && SelPawnForGear.jobs.IsCurrentJobPlayerInterruptible()) { SelPawnForGear.jobs.EndCurrentJob(JobCondition .InterruptForced); } })); } var window = new FloatMenu(options, "MainJob".Translate()); Find.WindowStack.Add(window); } // Status checkboxes var rectCheckboxes = new Rect(rectStatus.x, rectStatus.yMax + Margin, rectStatus.width, 72f); var check1 = new Rect(rectCheckboxes.x, rectCheckboxes.y, rectCheckboxes.width, 24f); var check2 = new Rect(rectCheckboxes.x, check1.yMax, rectCheckboxes.width, 24f); var check3 = new Rect(rectCheckboxes.x, check2.yMax, rectCheckboxes.width, 24f); var pawnSaveAddWorkStats = pawnSave.AddWorkStats; var pawnSaveAddIndividualStats = pawnSave.AddIndividualStats; var pawnSaveAddPersonalStats = pawnSave.AddPersonalStats; Widgets.CheckboxLabeled(check1, "AddWorkStats".Translate(), ref pawnSaveAddWorkStats); Widgets.CheckboxLabeled(check2, "AddIndividualStats".Translate(), ref pawnSaveAddIndividualStats); Widgets.CheckboxLabeled(check3, "AddPersonalStats".Translate(), ref pawnSaveAddPersonalStats); if (GUI.changed) { pawnSave.AddWorkStats = pawnSaveAddWorkStats; pawnSave.AddIndividualStats = pawnSaveAddIndividualStats; pawnSave.AddPersonalStats = pawnSaveAddPersonalStats; pawnSave.ForceStatUpdate = true; } // main canvas var canvas = new Rect(20f, rectCheckboxes.yMax, 392f, size.y - rectCheckboxes.yMax - 20f); GUI.BeginGroup(canvas); var cur = Vector2.zero; DrawTemperatureStats(pawnSave, ref cur, canvas); cur.y += Margin; DrawApparelStats(cur, canvas); GUI.EndGroup(); DrawApparelList(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }