public static bool DrawCharacterCardP(ref Rect rect, ref Pawn pawn, ref Action randomizeCallback, ref Rect creationRect) { rect.position = new Vector2(17f, 17f); rect.size = new Vector2(cardX, cardY); bool flag = randomizeCallback != null; GUI.BeginGroup((!flag) ? rect : creationRect); Rect rectLabel = new Rect(0f, 0f, 300f, 30f); NameTriple nameTriple = pawn.Name as NameTriple; if (flag && nameTriple != null) { Rect rect3 = new Rect(rectLabel); rect3.width *= 0.333f; Rect rect4 = new Rect(rectLabel); rect4.width *= 0.333f; rect4.x += rect4.width; Rect rect5 = new Rect(rectLabel); rect5.width *= 0.333f; rect5.x += rect4.width * 2f; string first = nameTriple.First; string nick = nameTriple.Nick; string last = nameTriple.Last; CharacterCardUtility.DoNameInputRect(rect3, ref first, 12); if (nameTriple.Nick == nameTriple.First || nameTriple.Nick == nameTriple.Last) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } CharacterCardUtility.DoNameInputRect(rect4, ref nick, 9); GUI.color = Color.white; CharacterCardUtility.DoNameInputRect(rect5, ref last, 12); if (nameTriple.First != first || nameTriple.Nick != nick || nameTriple.Last != last) { pawn.Name = new NameTriple(first, nick, last); } TooltipHandler.TipRegion(rect3, "FirstNameDesc".Translate()); TooltipHandler.TipRegion(rect4, "ShortIdentifierDesc".Translate()); TooltipHandler.TipRegion(rect5, "LastNameDesc".Translate()); } else { rectLabel.width = 999f; Text.Font = GameFont.Medium; Widgets.Label(rectLabel, pawn.Name.ToStringFull); Text.Font = GameFont.Small; } if (randomizeCallback != null) { Rect rectRandomise = new Rect(creationRect.width - 24f - 100f, 0f, 100f, rectLabel.height); if (Widgets.ButtonText(rectRandomise, "Randomize".Translate(), true, false, true)) { SoundDefOf.TickTiny.PlayOneShotOnCamera(null); randomizeCallback(); } UIHighlighter.HighlightOpportunity(rectRandomise, "RandomizePawn"); } if (flag) { Widgets.InfoCardButton(creationRect.width - 24f, 0f, pawn); } else if (!pawn.health.Dead) { float num = CharacterCardUtility.PawnCardSize.x - 85f; if ((pawn.Faction == Faction.OfPlayer || pawn.IsPrisonerOfColony) && pawn.Spawned) { Rect rectBanish = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegion(rectBanish, PawnBanishUtility.GetBanishButtonTip(pawn)); if (Widgets.ButtonImage(rectBanish, ContentFinder <Texture2D> .Get("UI/Buttons/Banish", true))) { if (pawn.Downed) { Messages.Message("MessageCantBanishDownedPawn".Translate(new object[] { pawn.LabelShort }).AdjustedFor(pawn), pawn, MessageTypeDefOf.RejectInput); } else { PawnBanishUtility.ShowBanishPawnConfirmationDialog(pawn); } } num -= 40f; } if (pawn.IsColonist) { Rect rect8 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegion(rect8, "RenameColonist".Translate()); if (Widgets.ButtonImage(rect8, ContentFinder <Texture2D> .Get("UI/Buttons/Rename", true))) { Find.WindowStack.Add(new Dialog_ChangeNameTriple(pawn)); } num -= 40f; } } string label = pawn.MainDesc(true); Rect rectMainDesc = new Rect(0f, 45f, rect.width, 60f); Widgets.Label(rectMainDesc, label); Pawn p = pawn; TooltipHandler.TipRegion(rectMainDesc, () => p.ageTracker.AgeTooltipString, 6873641); Rect positionLeftHalf = new Rect(0f, 100f, 250f, cardY); Rect positionRightHalf = new Rect(positionLeftHalf.xMax, 100f, 258f, cardY); GUI.BeginGroup(positionLeftHalf); float currentY = 0f; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, 200f, 30f), "Backstory".Translate()); currentY += 30f; Text.Font = GameFont.Small; foreach (BackstorySlot backstorySlot in Enum.GetValues(typeof(BackstorySlot))) { Backstory backstory = pawn.story.GetBackstory(backstorySlot); if (backstory != null) { Rect rect10 = new Rect(0f, currentY, positionLeftHalf.width, 24f); if (Mouse.IsOver(rect10)) { Widgets.DrawHighlight(rect10); } TooltipHandler.TipRegion(rect10, backstory.FullDescriptionFor(pawn)); Text.Anchor = TextAnchor.MiddleLeft; string str = (backstorySlot != BackstorySlot.Adulthood) ? "Childhood".Translate() : "Adulthood".Translate(); Widgets.Label(rect10, str + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect11 = new Rect(rect10); rect11.x += 90f; rect11.width -= 90f; string title = backstory.Title; Widgets.Label(rect11, title); currentY += rect10.height + 2f; } } currentY += 25f; Text.Font = GameFont.Small; Widgets.Label(new Rect(0f, currentY, 200f, 30f), "IncapableOf".Translate()); currentY += 30f; Text.Font = GameFont.Small; StringBuilder stringBuilder = new StringBuilder(); WorkTags combinedDisabledWorkTags = pawn.story.CombinedDisabledWorkTags; if (combinedDisabledWorkTags == WorkTags.None) { stringBuilder.Append("(" + "NoneLower".Translate() + "), "); } else { List <WorkTags> list = WorkTagsFrom(combinedDisabledWorkTags).ToList <WorkTags>(); bool flag2 = true; foreach (WorkTags current in list) { if (flag2) { stringBuilder.Append(current.LabelTranslated().CapitalizeFirst()); } else { stringBuilder.Append(current.LabelTranslated()); } stringBuilder.Append(", "); flag2 = false; } } string text = stringBuilder.ToString(); text = text.Substring(0, text.Length - 2); Rect rect12 = new Rect(0f, currentY, positionLeftHalf.width, 999f); Widgets.Label(rect12, text); currentY += 100f; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, currentY, 200f, 30f), "Traits".Translate()); currentY += 30f; Text.Font = GameFont.Small; for (int i = 0; i < pawn.story.traits.allTraits.Count; i++) { Trait trait = pawn.story.traits.allTraits[i]; Rect rectCurrentTrait = new Rect(0f, currentY, positionLeftHalf.width, 24f); if (Mouse.IsOver(rectCurrentTrait)) { Widgets.DrawHighlight(rectCurrentTrait); } Widgets.Label(rectCurrentTrait, trait.LabelCap); currentY += rectCurrentTrait.height + 2f; Trait trLocal = trait; TipSignal tip = new TipSignal(() => trLocal.TipString(p), (int)currentY * 37); TooltipHandler.TipRegion(rectCurrentTrait, tip); } GUI.EndGroup(); GUI.BeginGroup(positionRightHalf); Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, 200f, 30f), "Skills".Translate()); SkillUI.SkillDrawMode mode; if (Current.ProgramState == ProgramState.Playing) { mode = SkillUI.SkillDrawMode.Gameplay; } else { mode = SkillUI.SkillDrawMode.Menu; } SkillUI.DrawSkillsOf(pawn, new Vector2(0f, 35f), mode); GUI.EndGroup(); GUI.EndGroup(); return(false); }
// Token: 0x06000032 RID: 50 RVA: 0x00003078 File Offset: 0x00001278 public override void DoWindowContents(Rect inRect) { var crafterProperties = pawnCrafter.def.GetModExtension <PawnCrafterProperties>(); if (newChildhoodBackstory != null) { newPawn.story.childhood = newChildhoodBackstory; newChildhoodBackstory = null; RefreshPawn(); } if (newAdulthoodBackstory != null) { newPawn.story.adulthood = newAdulthoodBackstory; newAdulthoodBackstory = null; RefreshPawn(); } if (traitsChanged) { var first = newTrait.First; var second = newTrait.Second; if (first < newPawn.story.traits.allTraits.Count) { newPawn.story.traits.allTraits.RemoveAt(first); newPawn.story.traits.allTraits.Insert(first, second); if (newPawn.workSettings != null) { newPawn.workSettings.Notify_DisabledWorkTypesChanged(); } if (newPawn.skills != null) { newPawn.skills.Notify_SkillDisablesChanged(); } if (!newPawn.Dead && newPawn.RaceProps.Humanlike) { newPawn.needs.mood.thoughts.situational.Notify_SituationalThoughtsDirty(); } } else { newPawn.story.traits.GainTrait(second); } newTrait = default; traitsChanged = false; traitPos = -1; RefreshPawn(); } var rect = new Rect(inRect) { width = PawnPortraitSize.x + 16f, height = PawnPortraitSize.y + 16f }; rect = rect.CenteredOnXIn(inRect); rect = rect.CenteredOnYIn(inRect); rect.x += 16f; rect.y += 16f; if (newPawn != null) { var rect2 = new Rect(rect.xMin + ((rect.width - PawnPortraitSize.x) / 2f) - 10f, rect.yMin + 20f, PawnPortraitSize.x, PawnPortraitSize.y); GUI.DrawTexture(rect2, PortraitsCache.Get(newPawn, PawnPortraitSize, Rot4.South)); Widgets.InfoCardButton(rect2.xMax - 16f, rect2.y, newPawn); Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(new Rect(0f, 0f, inRect.width, 32f), crafterProperties.crafterPawnCustomizationTitle.Translate()); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleLeft; var num = 32f; var rect3 = new Rect(32f, num, 240f, 24f); if (newPawn.Name is NameTriple nameTriple) { var rect4 = new Rect(rect3); rect4.width *= 0.333f; var rect5 = new Rect(rect3); rect5.width *= 0.333f; rect5.x += rect5.width; var rect6 = new Rect(rect3); rect6.width *= 0.333f; rect6.x += rect5.width * 2f; var first2 = nameTriple.First; var nick = nameTriple.Nick; var last = nameTriple.Last; CharacterCardUtility.DoNameInputRect(rect4, ref first2, 12); if (nameTriple.Nick == nameTriple.First || nameTriple.Nick == nameTriple.Last) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } CharacterCardUtility.DoNameInputRect(rect5, ref nick, 9); GUI.color = Color.white; CharacterCardUtility.DoNameInputRect(rect6, ref last, 12); if (nameTriple.First != first2 || nameTriple.Nick != nick || nameTriple.Last != last) { newPawn.Name = new NameTriple(first2, nick, last); } TooltipHandler.TipRegion(rect4, "FirstNameDesc".Translate()); TooltipHandler.TipRegion(rect5, "ShortIdentifierDesc".Translate()); TooltipHandler.TipRegion(rect6, "LastNameDesc".Translate()); } else { rect3.width = 999f; Text.Font = GameFont.Medium; Widgets.Label(rect3, newPawn.Name.ToStringFull); Text.Font = GameFont.Small; } var rect7 = new Rect(rect.x + rect.width + 16f, rect.y + 32f, inRect.width - (rect.x + rect.width + 16f), 32f); Text.Font = GameFont.Medium; if (Widgets.ButtonText(rect7, crafterProperties.crafterPawnCustomizationCraftButton.Translate(), true, false)) { pawnCrafter.pawnBeingCrafted = newPawn; pawnCrafter.crafterStatus = CrafterStatus.Filling; Close(); } Text.Font = GameFont.Small; if (Widgets.ButtonText(new Rect(304f, num, 120f, 24f), crafterProperties.crafterPawnCustomizationCraftRollFemaleButton.Translate(), true, false)) { newPawn.Destroy(); newPawn = GetNewPawn(); } if (Widgets.ButtonText(new Rect(424f, num, 120f, 24f), crafterProperties.crafterPawnCustomizationCraftRollMaleButton.Translate(), true, false)) { newPawn.Destroy(); newPawn = GetNewPawn(Gender.Male); } num += 26f; var rect8 = new Rect(32f, num, 240f, 24f); Widgets.DrawBox(rect8); Widgets.DrawHighlightIfMouseover(rect8); string text; if (newPawn.story.childhood != null) { text = crafterProperties.crafterPawnCustomizationCraftChildhoodBackstoryButton.Translate() + " " + newPawn.story.childhood.titleShort; } else { text = crafterProperties.crafterPawnCustomizationCraftChildhoodBackstoryButton.Translate() + " " + crafterProperties.crafterPawnCustomizationNone.Translate(); } if (Widgets.ButtonText(rect8, text, true, false)) { FloatMenuUtility.MakeMenu(from backstory in BackstoryDatabase.allBackstories.Select( delegate(KeyValuePair <string, Backstory> backstoryPair) { var keyValuePair = backstoryPair; return(keyValuePair.Value); }) where backstory.spawnCategories.Contains(crafterProperties .crafterPawnCustomizationPawnBackstoryTag) && backstory.slot == BackstorySlot.Childhood select backstory, backstory => backstory.titleShort, backstory => delegate { newChildhoodBackstory = backstory; }); } if (newPawn.story.childhood != null) { TooltipHandler.TipRegion(rect8, newPawn.story.childhood.FullDescriptionFor(newPawn)); } var rect9 = new Rect(304f, num, 240f, 24f); Widgets.DrawBox(rect9); Widgets.DrawHighlightIfMouseover(rect9); string text2; if (newPawn.story.adulthood != null) { text2 = crafterProperties.crafterPawnCustomizationCraftAdulthoodBackstoryButton.Translate() + " " + newPawn.story.adulthood.titleShort; } else { text2 = crafterProperties.crafterPawnCustomizationCraftAdulthoodBackstoryButton.Translate() + " " + crafterProperties.crafterPawnCustomizationNone.Translate(); } if (Widgets.ButtonText(rect9, text2, true, false)) { FloatMenuUtility.MakeMenu(from backstory in BackstoryDatabase.allBackstories.Select( delegate(KeyValuePair <string, Backstory> backstoryPair) { var keyValuePair = backstoryPair; return(keyValuePair.Value); }) where backstory.spawnCategories.Contains(crafterProperties .crafterPawnCustomizationPawnBackstoryTag) && backstory.slot == BackstorySlot.Adulthood select backstory, backstory => backstory.titleShort, backstory => delegate { newAdulthoodBackstory = backstory; }); } if (newPawn.story.adulthood != null) { TooltipHandler.TipRegion(rect9, newPawn.story.adulthood.FullDescriptionFor(newPawn)); } num += 48f; var vector = new Vector2(32f, num); SkillUI.DrawSkillsOf(newPawn, vector, SkillUI.SkillDrawMode.Gameplay); num = rect.y + rect.height; var num2 = rect.x + 24f; Text.Anchor = TextAnchor.MiddleCenter; foreach (var trait in newPawn.story.traits.allTraits) { var rect10 = new Rect(num2, num, 256f, 24f); Widgets.DrawBox(rect10); Widgets.DrawHighlightIfMouseover(rect10); Widgets.Label(rect10, trait.LabelCap); TooltipHandler.TipRegion(rect10, trait.TipString(newPawn)); num += 26f; } } Text.Anchor = 0; }
public static void DrawCharacterCard(Rect rect, Pawn pawn, Thing voidThing, Action randomizeCallback = null, Rect creationRect = default(Rect)) { bool flag = randomizeCallback != null; GUI.BeginGroup((!flag) ? rect : creationRect); Rect rect2 = new Rect(0f, 0f, 300f, 30f); NameTriple nameTriple = pawn.Name as NameTriple; if (flag && nameTriple != null) { Rect rect3 = new Rect(rect2); rect3.width *= 0.333f; Rect rect4 = new Rect(rect2); rect4.width *= 0.333f; rect4.x += rect4.width; Rect rect5 = new Rect(rect2); rect5.width *= 0.333f; rect5.x += rect4.width * 2f; string first = nameTriple.First; string nick = nameTriple.Nick; string last = nameTriple.Last; VoidKeyCardUtility.DoNameInputRect(rect3, ref first, 12); if (nameTriple.Nick == nameTriple.First || nameTriple.Nick == nameTriple.Last) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } VoidKeyCardUtility.DoNameInputRect(rect4, ref nick, 16); GUI.color = Color.white; VoidKeyCardUtility.DoNameInputRect(rect5, ref last, 12); if (nameTriple.First != first || nameTriple.Nick != nick || nameTriple.Last != last) { pawn.Name = new NameTriple(first, nick, last); } TooltipHandler.TipRegion(rect3, "FirstNameDesc".Translate()); TooltipHandler.TipRegion(rect4, "ShortIdentifierDesc".Translate()); TooltipHandler.TipRegion(rect5, "LastNameDesc".Translate()); } else { rect2.width = 999f; Text.Font = GameFont.Medium; Widgets.Label(rect2, pawn.Name.ToStringFull); Text.Font = GameFont.Small; } if (randomizeCallback != null) { Rect rect6 = new Rect(creationRect.width - 24f - 100f, 0f, 100f, rect2.height); if (Widgets.ButtonText(rect6, "Randomize".Translate(), true, false, true)) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null); randomizeCallback(); } UIHighlighter.HighlightOpportunity(rect6, "RandomizePawn"); } if (flag) { Widgets.InfoCardButton(creationRect.width - 24f, 0f, pawn); } float num = VoidKeyCardUtility.PawnCardSize.x - 85f; Rect rect7 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegion(rect7, "PolarisVoidKeyITabChoosePawn".Translate()); if (Widgets.ButtonImage(rect7, VoidKeyDataBase.ChioosePawnButton)) { Find.WindowStack.Add(new ChooseVoidPawnWindow(voidThing)); } num -= 40f; Rect rect8 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegion(rect8, "PolarisVoidKeyITabPawnInfo".Translate()); if (Widgets.ButtonImage(rect8, VoidKeyDataBase.VoidPawnInfoButton)) { Find.WindowStack.Add(new Dialog_InfoCard(pawn)); } num -= 76f; Rect rectPortrait = new Rect(num, 14f, 64f, 64f); Widgets.ThingIcon(rectPortrait, pawn, 1f); /*else if (!pawn.health.Dead) * { * float num = VoidKeyCardUtility.PawnCardSize.x - 85f; * if ((pawn.Faction == Faction.OfPlayer || pawn.IsPrisonerOfColony) && pawn.Spawned) * { * Rect rect7 = new Rect(num, 0f, 30f, 30f); * TooltipHandler.TipRegion(rect7, PawnBanishUtility.GetBanishButtonTip(pawn)); * if (Widgets.ButtonImage(rect7, TexButton.Banish)) * { * if (pawn.Downed) * { * Messages.Message("MessageCantBanishDownedPawn".Translate(new object[] * { * pawn.LabelShort * }).AdjustedFor(pawn, "PAWN"), pawn, MessageTypeDefOf.RejectInput, false); * } * else * { * PawnBanishUtility.ShowBanishPawnConfirmationDialog(pawn); * } * } * num -= 40f; * } * if (pawn.IsColonist) * { * Rect rect8 = new Rect(num, 0f, 30f, 30f); * TooltipHandler.TipRegion(rect8, "RenameColonist".Translate()); * if (Widgets.ButtonImage(rect8, TexButton.Rename)) * { * Find.WindowStack.Add(new Dialog_NamePawn(pawn)); * } * num -= 40f; * } * }*/ string label = pawn.MainDesc(true); Rect rect9 = new Rect(0f, 45f, rect.width, 60f); Widgets.Label(rect9, label); TooltipHandler.TipRegion(rect9, () => pawn.ageTracker.AgeTooltipString, 6873641); Rect position = new Rect(0f, 100f, 250f, 450f); Rect position2 = new Rect(position.xMax, 100f, 258f, 450f); GUI.BeginGroup(position); float num2 = 0f; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, 200f, 30f), "Backstory".Translate()); num2 += 30f; Text.Font = GameFont.Small; IEnumerator enumerator = Enum.GetValues(typeof(BackstorySlot)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; BackstorySlot backstorySlot = (BackstorySlot)obj; Backstory backstory = pawn.story.GetBackstory(backstorySlot); if (backstory != null) { Rect rect10 = new Rect(0f, num2, position.width, 24f); if (Mouse.IsOver(rect10)) { Widgets.DrawHighlight(rect10); } TooltipHandler.TipRegion(rect10, backstory.FullDescriptionFor(pawn)); Text.Anchor = TextAnchor.MiddleLeft; string str = (backstorySlot != BackstorySlot.Adulthood) ? "Childhood".Translate() : "Adulthood".Translate(); Widgets.Label(rect10, str + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect11 = new Rect(rect10); rect11.x += 90f; rect11.width -= 90f; string label2 = backstory.TitleCapFor(pawn.gender); Widgets.Label(rect11, label2); num2 += rect10.height + 2f; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } if (pawn.story != null && pawn.story.title != null) { Rect rect12 = new Rect(0f, num2, position.width, 24f); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect12, "Current".Translate() + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect13 = new Rect(rect12); rect13.x += 90f; rect13.width -= 90f; Widgets.Label(rect13, pawn.story.title); num2 += rect12.height + 2f; } num2 += 25f; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, num2, 200f, 30f), "IncapableOf".Translate()); num2 += 30f; Text.Font = GameFont.Small; StringBuilder stringBuilder = new StringBuilder(); WorkTags combinedDisabledWorkTags = pawn.story.CombinedDisabledWorkTags; if (combinedDisabledWorkTags == WorkTags.None) { stringBuilder.Append("(" + "NoneLower".Translate() + "), "); } else { List <WorkTags> list = VoidKeyCardUtility.WorkTagsFrom(combinedDisabledWorkTags).ToList <WorkTags>(); bool flag2 = true; foreach (WorkTags tags in list) { if (flag2) { stringBuilder.Append(tags.LabelTranslated().CapitalizeFirst()); } else { stringBuilder.Append(tags.LabelTranslated()); } stringBuilder.Append(", "); flag2 = false; } } string text = stringBuilder.ToString(); text = text.Substring(0, text.Length - 2); Rect rect14 = new Rect(0f, num2, position.width, 999f); Widgets.Label(rect14, text); num2 += 100f; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, num2, 200f, 30f), "Traits".Translate()); num2 += 30f; Text.Font = GameFont.Small; for (int i = 0; i < pawn.story.traits.allTraits.Count; i++) { Trait trait = pawn.story.traits.allTraits[i]; Rect rect15 = new Rect(0f, num2, position.width, 24f); if (Mouse.IsOver(rect15)) { Widgets.DrawHighlight(rect15); } Widgets.Label(rect15, trait.LabelCap); num2 += rect15.height + 2f; Trait trLocal = trait; TipSignal tip = new TipSignal(() => trLocal.TipString(pawn), (int)num2 * 37); TooltipHandler.TipRegion(rect15, tip); } GUI.EndGroup(); GUI.BeginGroup(position2); Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, 200f, 30f), "Skills".Translate()); SkillUI.SkillDrawMode mode; if (Current.ProgramState == ProgramState.Playing) { mode = SkillUI.SkillDrawMode.Gameplay; } else { mode = SkillUI.SkillDrawMode.Menu; } SkillUI.DrawSkillsOf(pawn, new Vector2(0f, 35f), mode); GUI.EndGroup(); GUI.EndGroup(); }