protected override void FillTab() { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; Rect position = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(20f); bool isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony; try { GUI.BeginGroup(position); float num = 10f; Rect rect = new Rect(10f, num, position.width - 20f, 32f); MedicalCareUtility.MedicalCareSetter(rect, ref base.SelPawn.playerSettings.medCare); num += 32f; num += 18f; Rect rect2 = new Rect(10f, num, position.width - 28f, position.height - num); bool getsFood = base.SelPawn.guest.GetsFood; num += WidgetDrawer.DrawLabeledCheckbox(rect2, "GetsFood".Translate(), ref getsFood); base.SelPawn.guest.GetsFood = getsFood; if (isPrisonerOfColony) { num += 6f; int length = Enum.GetValues(typeof(PrisonerInteractionMode)).Length; float height = (float)(length * 28 + 20); Rect rect3 = new Rect(0f, num, position.width, height); TabDrawer.DrawBox(rect3); Rect rect4 = rect3.ContractedBy(10f); rect4.height = 28f; IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator(); while (enumerator.MoveNext()) { PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current); if (WidgetDrawer.DrawLabeledRadioButton(rect4, prisonerInteractionMode.GetLabel(), base.SelPawn.guest.interactionMode == prisonerInteractionMode, true)) { base.SelPawn.guest.interactionMode = prisonerInteractionMode; } rect4.y += 28f; } Rect rect5 = new Rect(rect3.x, rect3.y + rect3.height + 5f, rect3.width - 4f, 28f); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect5, "RecruitmentDifficulty".Translate() + ": " + base.SelPawn.guest.RecruitDifficulty.ToString("##0")); Text.Anchor = TextAnchor.UpperLeft; } } finally { GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; } if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn selPawn = base.SelPawn; if (selPawn != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawn); } } }
public void Draw(Rect rect, ThingWithComps ownerPawn) { Text.Font = GameFont.Small; string value = "-"; switch (oType) { case objectType.Stat: Text.Anchor = TextAnchor.MiddleCenter; StatDef stat = (StatDef)displayObject; string statValue = (stat.ValueToString(ownerPawn.GetStatValue((StatDef)displayObject, true))); Widgets.Label(rect, statValue); if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(stat.LabelCap); stringBuilder.AppendLine(); stringBuilder.AppendLine(stat.description); TooltipHandler.TipRegion(rect, new TipSignal(stringBuilder.ToString(), rect.GetHashCode())); break; case objectType.Skill: if ((ownerPawn is Pawn) && (ownerPawn as Pawn).RaceProps.Humanlike) { DrawSkill(rect, ownerPawn as Pawn); } break; case objectType.Need: if (ownerPawn is Pawn) { DrawNeed(rect, ownerPawn as Pawn); } break; case objectType.Age: Text.Anchor = TextAnchor.MiddleCenter; string ageValue = ((ownerPawn as Pawn).ageTracker.AgeBiologicalYears.ToString()); Widgets.Label(rect, ageValue); if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } break; case objectType.Gear: DrawGear(rect, ownerPawn); break; case objectType.ControlPrisonerGetsFood: if (ownerPawn is Pawn) { if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } bool getsFood = (ownerPawn as Pawn).guest.GetsFood; Widgets.CheckboxLabeled(new Rect(rect.x + 8f, rect.y + 3f, 27f, 27f), "", ref getsFood, false); (ownerPawn as Pawn).guest.GetsFood = getsFood; } break; case objectType.ControlPrisonerInteraction: if (ownerPawn is Pawn) { if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } float x = 8f; GUI.BeginGroup(rect); IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator(); try { while (enumerator.MoveNext()) { PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current); if (Widgets.RadioButton(new Vector2(x, 3f), (ownerPawn as Pawn).guest.interactionMode == prisonerInteractionMode)) { (ownerPawn as Pawn).guest.interactionMode = prisonerInteractionMode; } TooltipHandler.TipRegion(new Rect(x, 0f, 30f, 30f), new TipSignal(prisonerInteractionMode.GetLabel())); x += 30f; } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } GUI.EndGroup(); } break; case objectType.ControlMedicalCare: if (ownerPawn is Pawn) { MedicalCareSetter(rect, ref (ownerPawn as Pawn).playerSettings.medCare); } break; case objectType.AnimalMilkFullness: Text.Anchor = TextAnchor.MiddleCenter; if (ownerPawn is Pawn && ((Pawn)ownerPawn).ageTracker.CurLifeStage.milkable) { var comp = ((Pawn)ownerPawn).AllComps.Where <ThingComp>(x => x is CompMilkable).FirstOrDefault(); if (comp != null) { value = ((CompMilkable)comp).Fullness.ToStringPercent(); } } Widgets.Label(rect, value); break; case objectType.AnimalWoolGrowth: Text.Anchor = TextAnchor.MiddleCenter; if (ownerPawn is Pawn && ((Pawn)ownerPawn).ageTracker.CurLifeStage.shearable) { var comp = ((Pawn)ownerPawn).AllComps.Where <ThingComp>(x => x is CompShearable).FirstOrDefault(); if (comp != null) { value = ((CompShearable)comp).Fullness.ToStringPercent(); } } Widgets.Label(rect, value); break; case objectType.CurrentJob: if (ownerPawn is Pawn) { string text = ((Pawn)ownerPawn).jobs.curDriver.GetReport(); Text.Anchor = TextAnchor.MiddleLeft; Rect tRect = new Rect(rect.xMin + 2, rect.yMin + 3, rect.width - 2, rect.height); GenText.SetTextSizeToFit(text, tRect); if (Text.Font == GameFont.Tiny) { Widgets.Label(tRect, text); } else { Rect sRect = new Rect(rect.xMin + 2, rect.yMin, rect.width - 2, rect.height); Widgets.Label(sRect, text); } if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } } break; } }
public void Draw(Rect rect, Pawn ownerPawn) { switch (oType) { case objectType.Stat: Text.Anchor = TextAnchor.MiddleCenter; StatDef stat = (StatDef)displayObject; string statValue = (stat.ValueToString(ownerPawn.GetStatValue((StatDef)displayObject, true))); Widgets.Label(rect, statValue); if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(stat.LabelCap); stringBuilder.AppendLine(); stringBuilder.AppendLine(stat.description); TooltipHandler.TipRegion(rect, new TipSignal(stringBuilder.ToString(), rect.GetHashCode())); break; case objectType.Skill: DrawSkill(rect, ownerPawn); break; case objectType.Need: DrawNeed(rect, ownerPawn); break; case objectType.Gear: DrawGear(rect, ownerPawn); break; case objectType.ControlPrisonerGetsFood: if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } bool getsFood = ownerPawn.guest.GetsFood; Widgets.LabelCheckbox(new Rect(rect.x + 8f, rect.y + 3f, 27f, 27f), "", ref getsFood, false); ownerPawn.guest.GetsFood = getsFood; break; case objectType.ControlPrisonerInteraction: if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); } float x = 8f; GUI.BeginGroup(rect); IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator(); try { while (enumerator.MoveNext()) { PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current); if (Widgets.RadioButton(new Vector2(x, 3f), ownerPawn.guest.interactionMode == prisonerInteractionMode)) { ownerPawn.guest.interactionMode = prisonerInteractionMode; } TooltipHandler.TipRegion(new Rect(x, 0f, 30f, 30f), new TipSignal(prisonerInteractionMode.GetLabel())); x += 30f; } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } GUI.EndGroup(); break; case objectType.ControlMedicalCare: MedicalCareSetter(rect, ref ownerPawn.playerSettings.medCare); break; } }