public PawnInfoMenu(Pawn pawn, TieredFloatMenu parentWindow, ColonistGroup colonistGroup, Rect originRect, Texture2D backgroundTexture) : base(parentWindow, colonistGroup, originRect, backgroundTexture) { this.options = new List <TieredFloatMenuOption>(); this.pawn = pawn; this.parentWindow.layer = WindowLayer.Dialog; this.layer = WindowLayer.GameUI; for (int i = 0; i < options.Count; i++) { options[i].SetSizeMode(SizeMode); } TacticSkillUI.Reset(); }
public override void DoWindowContents(Rect rect) { base.DoWindowContents(rect); Vector2 zero = Vector2.zero; zero += InitialFloatOptionPositionShift; for (int i = 0; i < options.Count; i++) { TieredFloatMenuOption floatMenuOption = options[i]; Rect rect2 = new Rect(zero.x, zero.y, (this.backgroundTexture.width - InitialFloatOptionPositionShift.x) / 1.2f, floatMenuOption.curIcon.height); if (floatMenuOption.DoGUI(rect2, this)) { Find.WindowStack.TryRemove(this); break; } zero.y += floatMenuOption.bottomIndent; } var pawnBox = new Rect(rect.x + 10f, rect.y + 23f, 130f, 180f); GUI.DrawTexture(pawnBox, PortraitsCache.Get(pawn, pawnBox.size, Rot4.South, PawnTextureCameraOffset, 1.15f)); Widgets.InfoCardButton(pawnBox.x + pawnBox.width - 18f, pawnBox.x + pawnBox.height - 23f, pawn); Text.Anchor = TextAnchor.MiddleLeft; //var pawnTabsRect = new Rect(pawnBox.x, pawnBox.yMax + 10, 120, 120); //Widgets.DrawBox(pawnTabsRect); //MainTabWindow_Inspect mainTabWindow_Inspect = (MainTabWindow_Inspect)MainButtonDefOf.Inspect.TabWindow; // //TacticInspectPaneUtility.UpdateTabs(mainTabWindow_Inspect); var armorValue = pawn.apparel.WornApparel != null?TacticUtils.OverallArmorValue(pawn) : 0f; var armorValueLabel = new Rect(pawnBox.xMax + 5, pawnBox.y, 27, 26); Widgets.Label(armorValueLabel, armorValue.ToStringDecimalIfSmall()); var armorValueRect = new Rect(armorValueLabel.xMax, pawnBox.y, Textures.CrossHairs.width, Textures.CrossHairs.height); GUI.DrawTexture(armorValueRect, Textures.ArmorIcon); var dpsValue = pawn.equipment.Primary != null?TacticUtils.WeaponScoreGain(pawn.equipment.Primary) : pawn.GetStatValue(StatDefOf.MeleeDPS); var dpsValueLabel = new Rect(pawnBox.xMax + 5, armorValueLabel.yMax, 27, 26); Widgets.Label(dpsValueLabel, dpsValue.ToStringDecimalIfSmall()); var dpsValueRect = new Rect(dpsValueLabel.xMax, dpsValueLabel.y, Textures.CrossHairs.width, Textures.CrossHairs.height); GUI.DrawTexture(dpsValueRect, Textures.CrossHairs); var pawnInfoRect = new Rect(dpsValueRect.xMax - 30, rect.y + 90f, rect.width - 170f, rect.height - 110f); TacticCharacterCardUtility.DrawCharacterCard(pawnInfoRect, pawn, null, rect); Text.Anchor = TextAnchor.MiddleCenter; var moodTexture = GetMoodTexture(out string moodLabel); var moodRect = new Rect(rect.x + 425f, rect.y + 90, moodTexture.width, moodTexture.height); GUI.DrawTexture(moodRect, moodTexture); var moodLabelRect = new Rect(moodRect.x, moodRect.y + moodTexture.height, 45, 24); Widgets.Label(moodLabelRect, moodLabel); TooltipHandler.TipRegion(moodRect, Strings.MoodIconTooltip); var healthTexture = GetHealthTexture(out string healthPercent); var healthRect = new Rect(moodRect.x + 45f, moodRect.y, healthTexture.width, healthTexture.height); GUI.DrawTexture(healthRect, healthTexture); var healthLabelRect = new Rect(healthRect.x, healthRect.y + healthRect.height, 40, 24); Widgets.Label(healthLabelRect, healthPercent); TooltipHandler.TipRegion(healthRect, Strings.HealthIconTooltip); var restTexture = GetRestTexture(out string restPercent); var restRect = new Rect(healthRect.x + 45f, healthRect.y, restTexture.width, restTexture.height); GUI.DrawTexture(restRect, restTexture); var restLabelRect = new Rect(restRect.x, restRect.y + restRect.height, 40, 24); Widgets.Label(restLabelRect, restPercent); TooltipHandler.TipRegion(restRect, Strings.RestIconTooltip); var foodTexture = GetFoodTexture(out string foodPercent); var foodStatRect = new Rect(restRect.x + 45f, restRect.y, foodTexture.width, foodTexture.height); GUI.DrawTexture(foodStatRect, foodTexture); var foodLabelRect = new Rect(foodStatRect.x, foodStatRect.y + foodStatRect.height, 40, 24); Widgets.Label(foodLabelRect, foodPercent); TooltipHandler.TipRegion(foodStatRect, Strings.HungerIconTooltip); var needRect = new Rect(moodRect.x - 5f, moodLabelRect.yMax, 180f, rect.height - 160); TacticNeedsCardUtility.DoNeeds(needRect, pawn); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; var skillRect = new Rect(needRect.xMax + 10, moodRect.y - 1f, 164, rect.height - 110); TacticSkillUI.DrawSkillsOf(pawn, new Vector2(skillRect.x, skillRect.y), TacticSkillUI.SkillDrawMode.Gameplay); }