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 ResetTextures() { BrowseButtonDrawer.ResetTextures(); ITab_Pawn_Health_Alternate.ResetTextures(); MedicalCareUtility.Reset(); BillDrawer.ResetTextures(); TabDrawer.ResetTextures(); }
public static void DrawTrainingCard(Rect rect, Pawn pawn) { try { GUI.BeginGroup(rect); Rect rect2 = new Rect(0f, 0f, rect.width, 25f); string text = "Master".Translate() + ": "; Vector2 vector = Text.CalcSize(text); Widgets.Label(rect2, text); Rect rect3 = new Rect(rect2.x + vector.x + 6f, rect2.y, 200f, rect2.height); if (pawn.training.IsCompleted(TrainableDefOf.Obedience)) { rect3.y -= 1f; string label = TrainableUtility.MasterString(pawn); if (Widgets.TextButton(rect3, label, true, false)) { TrainableUtility.OpenMasterSelectMenu(pawn); } } else { GUI.color = new Color(0.7f, 0.7f, 0.7f); Widgets.Label(rect3, "None".Translate()); GUI.color = Color.white; } List <TrainableDef> trainableDefsInListOrder = TrainableUtility.TrainableDefsInListOrder; int count = trainableDefsInListOrder.Count; float height = (float)(count * 28 + 20); Rect rect4 = new Rect(0f, rect2.y + 35f, rect.width, height); TabDrawer.DrawBox(rect4); Rect rect5 = rect4.ContractedBy(10f); rect5.height = 28f; for (int i = 0; i < trainableDefsInListOrder.Count; i++) { if (TrainingCardUtility.TryDrawTrainableRow(rect5, pawn, trainableDefsInListOrder[i])) { rect5.y += 28f; } } Text.Anchor = TextAnchor.UpperRight; string label2 = "TrainableIntelligence".Translate() + ": " + pawn.RaceProps.trainableIntelligence.GetLabel(); Widgets.Label(new Rect(0f, rect4.y + rect4.height + 5f, rect4.width - 2f, 25f), label2); Text.Anchor = TextAnchor.UpperLeft; } finally { GUI.EndGroup(); } }
public static TabRecord DrawTabs(Rect baseRect, IEnumerable <TabRecord> tabsEnum, Texture2D atlas) { TabDrawer.tabList.Clear(); foreach (TabRecord current in tabsEnum) { TabDrawer.tabList.Add(current); } TabRecord tabRecord = null; TabRecord tabRecord2 = (from t in TabDrawer.tabList where t.selected select t).FirstOrDefault <TabRecord>(); if (tabRecord2 == null) { Debug.LogWarning("Drew tabs without any being selected."); return(TabDrawer.tabList[0]); } float num = baseRect.width + (float)(TabDrawer.tabList.Count - 1) * 10f; float tabWidth = num / (float)TabDrawer.tabList.Count; if (tabWidth > 200f) { tabWidth = 200f; } Rect position = new Rect(baseRect); position.y -= 32f; position.height = 9999f; GUI.BeginGroup(position); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; Func <TabRecord, Rect> func = delegate(TabRecord tab) { int num2 = TabDrawer.tabList.IndexOf(tab); float left = (float)num2 * (tabWidth - 10f); return(new Rect(left, 1f, tabWidth, 32f)); }; List <TabRecord> list = TabDrawer.tabList.ListFullCopy <TabRecord>(); list.Remove(tabRecord2); list.Add(tabRecord2); TabRecord tabRecord3 = null; List <TabRecord> list2 = list.ListFullCopy <TabRecord>(); list2.Reverse(); for (int i = 0; i < list2.Count; i++) { TabRecord tabRecord4 = list2[i]; Rect rect = func(tabRecord4); if (tabRecord3 == null && rect.Contains(Event.current.mousePosition)) { tabRecord3 = tabRecord4; } MouseoverSounds.DoRegion(rect); if (Widgets.InvisibleButton(rect)) { tabRecord = tabRecord4; } } foreach (TabRecord current2 in list) { Rect rect2 = func(current2); TabDrawer.DrawTab(current2, rect2, atlas); } Text.Anchor = TextAnchor.UpperLeft; GUI.EndGroup(); if (tabRecord != null) { SoundDefOf.SelectDesignator.PlayOneShotOnCamera(); if (tabRecord.clickedAction != null) { tabRecord.clickedAction(); } } return(tabRecord); }
protected override void FillTab() { Pawn pawnToShowInfoAbout = this.PawnToShowInfoAbout; try { GUI.BeginGroup(new Rect(ITab_Pawn_Character_Alternate.PaddingSize.x, ITab_Pawn_Character_Alternate.PaddingSize.y, ITab_Pawn_Character_Alternate.ContentSize.x, ITab_Pawn_Character_Alternate.ContentSize.y)); float num = 0f; float num2 = 12f; bool allowRename = !pawnToShowInfoAbout.Dead && !pawnToShowInfoAbout.Destroyed; num += TabDrawer.DrawNameAndBasicInfo(0f, num, this.PawnToShowInfoAbout, ITab_Pawn_Character_Alternate.ContentSize.x, allowRename); num += num2; num += TabDrawer.DrawHeader(0f, num, ITab_Pawn_Character_Alternate.ContentSize.x, "Backstory".Translate(), true, TextAnchor.UpperLeft); num += 2f; Text.Font = GameFont.Small; GUI.color = TabDrawer.TextColor; Vector2 vector = new Vector2(ITab_Pawn_Character_Alternate.ContentSize.x, 24f); Vector2 vector2 = new Vector2(90f, 24f); Vector2 vector3 = new Vector2(3f, 2f); int num3 = 0; IEnumerator enumerator = Enum.GetValues(typeof(BackstorySlot)).GetEnumerator(); try { while (enumerator.MoveNext()) { BackstorySlot backstorySlot = (BackstorySlot)enumerator.Current; Rect rect = new Rect(0f, num, vector.x, vector.y); if (rect.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(rect); } TooltipHandler.TipRegion(rect, pawnToShowInfoAbout.story.GetBackstory(backstorySlot).FullDescriptionFor(pawnToShowInfoAbout)); rect.x += vector3.x; rect.width -= vector3.x * 2f; rect.y += vector3.y; GUI.skin.label.alignment = TextAnchor.MiddleLeft; string str = (backstorySlot == BackstorySlot.Adulthood) ? "Adulthood".Translate() : "Childhood".Translate(); Widgets.Label(rect, str + ":"); GUI.skin.label.alignment = TextAnchor.UpperLeft; Rect rect2 = new Rect(rect.x + vector2.x, rect.y, vector.x - vector2.x, vector.y); string title = pawnToShowInfoAbout.story.GetBackstory(backstorySlot).title; Widgets.Label(rect2, title); num += vector.y + 2f; num3++; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } num -= 6f; num += num2; num += TabDrawer.DrawHeader(0f, num, ITab_Pawn_Character_Alternate.ContentSize.x, "Skills".Translate(), true, TextAnchor.UpperLeft); num += 6f; float height = (float)DefDatabase <SkillDef> .AllDefs.Count <SkillDef>() * 24f; Rect position = new Rect(0f, num, 390f, height); GUI.color = TabDrawer.TextColor; GUI.BeginGroup(position); this.skillDrawer.DrawSkillsOf(pawnToShowInfoAbout, new Vector2(0f, 0f)); GUI.EndGroup(); num += position.height; num += num2; float num4 = num; float num5 = ITab_Pawn_Character_Alternate.ContentSize.x * 0.4f - ITab_Pawn_Character_Alternate.PaddingSize.x / 2f; float num6 = ITab_Pawn_Character_Alternate.ContentSize.x * 0.6f - ITab_Pawn_Character_Alternate.PaddingSize.x / 2f; float left = num5 + ITab_Pawn_Character_Alternate.PaddingSize.x; num += TabDrawer.DrawHeader(0f, num, num5, "IncapableOf".Translate(), true, TextAnchor.UpperLeft); num += 4f; Vector2 vector4 = new Vector2(num5, 22f); Text.Font = GameFont.Small; GUI.color = TabDrawer.TextColor; List <WorkTags> list = pawnToShowInfoAbout.story.DisabledWorkTags.ToList <WorkTags>(); GUI.skin.label.alignment = TextAnchor.UpperLeft; if (list.Count == 0) { Rect rect3 = new Rect(0f, num, num5, vector4.y); GUI.color = TabDrawer.SeparatorColor; Widgets.Label(rect3, "NoneLower".Translate()); GUI.color = TabDrawer.TextColor; num += rect3.height - 1f; } else { foreach (WorkTags current in list) { Rect rect4 = new Rect(0f, num, num5, vector4.y); Widgets.Label(rect4, current.LabelTranslated()); num += vector4.y - 1f; } } num = num4; num += TabDrawer.DrawHeader(left, num, num6, "Traits".Translate(), true, TextAnchor.UpperLeft); num += 4f; Vector2 vector5 = new Vector2(num6, 22f); Text.Font = GameFont.Small; GUI.color = TabDrawer.TextColor; float num7 = 0f; foreach (Trait current2 in pawnToShowInfoAbout.story.traits.allTraits) { num7 += vector5.y + 2f; Rect rect5 = new Rect(left, num, num6, vector5.y); if (rect5.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(rect5); } rect5.x += 2f; Widgets.Label(rect5, current2.LabelCap); TooltipHandler.TipRegion(rect5, current2.TipString(pawnToShowInfoAbout)); num += vector5.y - 1f; } } finally { GUI.EndGroup(); } if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value && pawnToShowInfoAbout != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, pawnToShowInfoAbout); } GUI.color = Color.white; }
protected override void FillTab() { Pawn pawn = null; if (base.SelPawn != null) { pawn = base.SelPawn; } else { Corpse corpse = base.SelThing as Corpse; if (corpse != null) { pawn = corpse.innerPawn; } } if (pawn == null) { Log.Error("Health tab found no selected pawn to display."); return; } Corpse corpse2 = base.SelThing as Corpse; bool showBloodLoss = corpse2 == null || corpse2.Age < 60000; bool flag = !pawn.RaceProps.Humanlike && pawn.Downed; bool flag2 = base.SelThing.def.AllRecipes.Any <RecipeDef>(); bool flag3 = flag2 && !pawn.Dead && (pawn.IsColonist || pawn.IsPrisonerOfColony || flag); TextAnchor anchor = Text.Anchor; Rect rect = new Rect(20f, 51f, ITab_Pawn_Health_Alternate.PanelSize.x - 40f, 345f); float height = this.size.y - rect.height - 109f; Rect position = new Rect(rect.x, rect.y + rect.height + 16f, rect.width, height); if (!flag3) { this.operationsTabSelected = false; } List <TabRecord> list = new List <TabRecord>(); list.Add(new TabRecord("HealthOverview".Translate(), delegate { this.operationsTabSelected = false; }, !this.operationsTabSelected)); if (flag3) { string label; if (pawn.RaceProps.mechanoid) { label = "MedicalOperationsMechanoidsShort".Translate(new object[] { pawn.BillStack.Count }); } else { label = "MedicalOperationsShort".Translate(new object[] { pawn.BillStack.Count }); } list.Add(new TabRecord(label, delegate { this.operationsTabSelected = true; }, this.operationsTabSelected)); } GUI.color = TabDrawer.BoxColor; GUI.DrawTexture(rect, TabDrawer.WhiteTexture); GUI.color = TabDrawer.BoxBorderColor; Widgets.DrawBox(rect, 1); GUI.color = Color.white; TabDrawer.DrawTabs(new Rect(rect.x, rect.y, rect.width - 90f, rect.height), list, ITab_Pawn_Health_Alternate.TabAtlasTex); float num = 0f; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; if (!this.operationsTabSelected) { Rect position2 = rect.ContractedBy(12f); if (pawn.playerSettings != null && !pawn.Dead) { Rect rect2 = new Rect(position2.x + 4f, position2.y + 8f, position2.width, 32f); MedicalCareUtility.MedicalCareSetter(rect2, ref pawn.playerSettings.medCare); position2.y += 50f; position2.height -= 50f; } try { GUI.BeginGroup(position2); Rect leftRect = new Rect(0f, num, position2.width, position2.height - num); num = this.healthCardUtility.DrawStatus(leftRect, pawn, num, showBloodLoss); } finally { GUI.EndGroup(); } } else { Rect position3 = rect.ContractedBy(12f); try { GUI.BeginGroup(position3); Rect rect3 = new Rect(0f, 0f, position3.width, position3.height); this.operationsScrollView.Begin(rect3); ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.MedicalOperations, KnowledgeAmount.GuiFrame); num = this.healthCardUtility.DrawMedOperationsTab(rect3, pawn, base.SelThing, num); this.operationsScrollView.End(num); } finally { GUI.EndGroup(); } } Text.Font = GameFont.Small; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; GUI.BeginGroup(position); Rect leftRect2 = new Rect(0f, 0f, position.width, position.height); this.healthCardUtility.DrawInjuries(leftRect2, pawn, showBloodLoss); GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn pawn2 = null; if (base.SelPawn != null) { pawn2 = base.SelPawn; } else { Corpse corpse3 = base.SelThing as Corpse; if (corpse3 != null) { pawn2 = corpse3.innerPawn; } } if (pawn2 != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, pawn2); } } GUI.color = Color.white; Text.Anchor = anchor; Rect rect4 = new Rect(0f, 0f, this.size.x, this.size.y); if (Event.current.type == EventType.ScrollWheel && Mouse.IsOver(rect4)) { Event.current.Use(); } }
public float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY, bool showBloodLoss) { curY += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Status".Translate(), true, TextAnchor.UpperLeft); curY += 4f; Text.Font = GameFont.Small; float bleedingRate = pawn.health.hediffSet.BleedingRate; if ((double)bleedingRate > 0.01) { string rightLabel = string.Concat(new string[] { bleedingRate.ToStringPercent(), "/", "Day".Translate() }); curY = this.DrawLeftRow(leftRect, curY, "BleedingRate".Translate(), rightLabel, HealthCardUtility.GetBleedingRateColor(bleedingRate), null); } if (pawn.def.race.isFlesh) { Pair <string, Color> painLabel = RimWorld.HealthCardUtility.GetPainLabel(pawn); string tipLabel = "PainLevel".Translate() + ": " + (pawn.health.hediffSet.Pain * 100f).ToString("F0") + "%"; curY = this.DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, tipLabel); } if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source; if (pawn.def.race.Humanlike) { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x; } else if (pawn.def.race.Animal) { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnAnimals select x; } else { source = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnMechanoids select x; } foreach (PawnCapacityDef current in from act in source orderby act.listOrder select act) { if (PawnCapacityUtility.BodyCanEverDoActivity(pawn.RaceProps.body, current)) { Pair <string, Color> efficiencyLabel = RimWorld.HealthCardUtility.GetEfficiencyLabel(pawn, current); string tipLabel2 = "Efficiency".Translate() + ": " + (pawn.health.capacities.GetEfficiency(current) * 100f).ToString("F0") + "%"; curY = this.DrawLeftRow(leftRect, curY, current.GetLabelFor(pawn.RaceProps.isFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, tipLabel2); } } } curY += 16f; curY += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Injuries".Translate(), true, TextAnchor.UpperLeft); curY += 4f; Rect position = new Rect(leftRect.x, curY, leftRect.width, leftRect.height - curY); GUI.BeginGroup(position); Rect outRect = new Rect(0f, 0f, position.width, position.height); Rect viewRect = new Rect(0f, 0f, position.width - 16f, HealthCardUtility.scrollViewHeight); Rect rect = new Rect(position.x, position.y, position.width - 16f, position.height); GUI.color = Color.white; Widgets.BeginScrollView(outRect, ref HealthCardUtility.scrollPosition, viewRect); float num = 0f; HealthCardUtility.highlight = true; bool flag = false; foreach (IGrouping <BodyPartRecord, Hediff> current2 in ((IEnumerable <IGrouping <BodyPartRecord, Hediff> >) this.visibleHediffGroupsInOrderMethod.Invoke(null, new object[] { pawn, showBloodLoss }))) { flag = true; this.DrawHediffRow(rect, pawn, current2, ref num); } if (!flag) { GUI.color = Color.gray; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(new Rect(0f, 0f, position.width, 30f), new GUIContent("NoInjuries".Translate())); Text.Anchor = TextAnchor.UpperLeft; } if (Event.current.type == EventType.Layout) { HealthCardUtility.scrollViewHeight = num; } Widgets.EndScrollView(); GUI.EndGroup(); GUI.color = Color.white; return(curY); }
protected override void FillTab() { Text.Font = GameFont.Small; Rect rect = new Rect(0f, 8f, this.size.x, this.size.y - 8f); Rect rect2 = rect.ContractedBy(24f); Rect position = new Rect(rect2.x, rect2.y, rect2.width, rect2.height - 24f); try { GUI.BeginGroup(position); Text.Font = GameFont.Small; GUI.color = Color.white; Rect outRect = new Rect(0f, 0f, position.width, position.height); Rect viewRect = new Rect(0f, 0f, position.width - 16f, this.scrollViewHeight); Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect); float num = 0f; bool flag = false; if (this.SelPawnForGear.equipment != null) { num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Equipment".Translate(), true, TextAnchor.UpperLeft); foreach (ThingWithComps current in this.SelPawnForGear.equipment.AllEquipment) { this.DrawThingRow(ref num, viewRect.width, current); flag = true; } if (!flag) { num += 4f; Rect rect3 = new Rect(0f, num, viewRect.width, 24f); GUI.color = TabDrawer.SeparatorColor; Widgets.Label(rect3, "NoneLower".Translate()); GUI.color = TabDrawer.TextColor; num += ITab_Pawn_Gear_Alternate.LineHeight; } } flag = false; if (this.SelPawnForGear.apparel != null) { num += 10f; num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Apparel".Translate(), true, TextAnchor.UpperLeft); num += 4f; foreach (Apparel current2 in from ap in this.SelPawnForGear.apparel.WornApparel orderby ap.def.apparel.bodyPartGroups[0].listOrder descending select ap) { this.DrawThingRow(ref num, viewRect.width, current2); flag = true; } if (!flag) { num += 4f; Rect rect4 = new Rect(0f, num, viewRect.width, 24f); GUI.color = TabDrawer.SeparatorColor; Widgets.Label(rect4, "NoneLower".Translate()); GUI.color = TabDrawer.TextColor; num += ITab_Pawn_Gear_Alternate.LineHeight; } } flag = false; if (this.SelPawnForGear.inventory != null) { num += 10f; num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Inventory".Translate(), true, TextAnchor.UpperLeft); foreach (Thing current3 in this.SelPawnForGear.inventory.container) { this.DrawThingRow(ref num, viewRect.width, current3); flag = true; } if (!flag) { num += 4f; Rect rect5 = new Rect(0f, num, viewRect.width, 24f); GUI.color = TabDrawer.SeparatorColor; Widgets.Label(rect5, "NoneLower".Translate()); GUI.color = TabDrawer.TextColor; num += ITab_Pawn_Gear_Alternate.LineHeight; } } if (Event.current.type == EventType.Layout) { this.scrollViewHeight = num + 8f; } Widgets.EndScrollView(); } finally { GUI.EndGroup(); } if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn selPawnForGear = this.SelPawnForGear; if (selPawnForGear != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawnForGear); } } GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }