private void DrawFactionInfo(Rect rect, Faction faction) { Text.Anchor = TextAnchor.LowerRight; FactionRelationKind playerRelationKind = faction.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Widgets.Label(rect, playerRelationKind.GetLabel()); rect.height -= Text.CalcHeight(playerRelationKind.GetLabel(), rect.width) + Text.SpaceBetweenLines; GUI.color = Color.gray; Widgets.Label(rect, faction.Name + "\n" + "goodwill".Translate().CapitalizeFirst() + ": " + faction.PlayerGoodwill.ToStringWithSign()); GenUI.ResetLabelAlign(); GUI.color = Color.white; }
public override void DoWindowContents(Rect inRect) { GUI.BeginGroup(inRect); Rect rect = new Rect(0f, 0f, inRect.width / 2f, 70f); Rect rect2 = new Rect(0f, rect.yMax, rect.width, 60f); Rect rect3 = new Rect(inRect.width / 2f, 0f, inRect.width / 2f, 70f); Rect rect4 = new Rect(inRect.width / 2f, rect.yMax, rect.width, 60f); Text.Font = GameFont.Medium; Widgets.Label(rect, negotiator.LabelCap); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect3, commTarget.GetCallLabel()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; GUI.color = new Color(1f, 1f, 1f, 0.7f); Widgets.Label(rect2, "SocialSkillIs".Translate(negotiator.skills.GetSkill(SkillDefOf.Social).Level)); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect4, commTarget.GetInfoText()); Faction faction = commTarget.GetFaction(); if (faction != null) { FactionRelationKind playerRelationKind = faction.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Rect rect5 = new Rect(rect4.x, rect4.y + Text.CalcHeight(commTarget.GetInfoText(), rect4.width) + Text.SpaceBetweenLines, rect4.width, 30f); Widgets.Label(rect5, playerRelationKind.GetLabel()); } Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; GUI.EndGroup(); float num = 147f; Rect rect6 = new Rect(0f, num, inRect.width, inRect.height - num); DrawNode(rect6); }
public override void DoWindowContents(Rect inRect) { GUI.BeginGroup(position: inRect); Rect leftFactionLabel = new Rect(x: 0f, y: 0f, width: inRect.width / 2f, height: TitleHeight); Rect leftBox = new Rect(x: 0f, y: leftFactionLabel.yMax, width: leftFactionLabel.width, height: InfoHeight); Rect rightFactionLabel = new Rect(x: inRect.width / 2f, y: 0f, width: inRect.width / 2f, height: TitleHeight); Rect rightBox = new Rect(x: inRect.width / 2f, y: leftFactionLabel.yMax, width: leftFactionLabel.width, height: InfoHeight); Text.Font = GameFont.Medium; Widgets.Label(rect: leftFactionLabel, label: this.factionOne.GetCallLabel()); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect: rightFactionLabel, label: this.factionInstigator.GetCallLabel()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; GUI.color = new Color(r: 1f, g: 1f, b: 1f, a: 0.7f); Widgets.Label(rect: leftBox, label: this.factionOne.GetInfoText()); if (this.factionOne != null) { FactionRelationKind playerRelationKind = this.factionOne.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Rect factionOneRelactionBox = new Rect(x: leftBox.x, y: leftBox.y + Text.CalcHeight(text: this.factionOne.GetInfoText(), width: leftBox.width) + Text.SpaceBetweenLines, width: leftBox.width, height: 30f); Widgets.Label(rect: factionOneRelactionBox, label: playerRelationKind.GetLabel()); } GUI.color = new Color(r: 1f, g: 1f, b: 1f, a: 0.7f); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect: rightBox, label: this.factionInstigator.GetInfoText()); if (this.factionInstigator != null) { FactionRelationKind playerRelationKind = this.factionInstigator.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Rect factionInstigatorRelactionBox = new Rect(x: rightBox.x, y: rightBox.y + Text.CalcHeight(text: this.factionInstigator.GetInfoText(), width: rightBox.width) + Text.SpaceBetweenLines, width: rightBox.width, height: 30f); Widgets.Label(rect: factionInstigatorRelactionBox, label: playerRelationKind.GetLabel()); } Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; GUI.EndGroup(); const float magicalNum = 147f; Rect middleRemainingRectForDialog = new Rect(x: 0f, y: magicalNum, width: inRect.width, height: inRect.height - magicalNum); this.DrawNode(rect: middleRemainingRectForDialog); }
public static void DrawRelatedFactionInfo(Rect rect, Faction faction, ref float curY) { Text.Anchor = TextAnchor.LowerRight; curY += 10f; FactionRelationKind playerRelationKind = faction.PlayerRelationKind; string text = faction.Name.CapitalizeFirst() + "\n" + "goodwill".Translate().CapitalizeFirst() + ": " + faction.PlayerGoodwill.ToStringWithSign(); GUI.color = Color.gray; Rect rect2 = new Rect(rect.x, curY, rect.width, Text.CalcHeight(text, rect.width)); Widgets.Label(rect2, text); curY += rect2.height; GUI.color = playerRelationKind.GetColor(); Rect rect3 = new Rect(rect2.x, curY - 7f, rect2.width, 25f); Widgets.Label(rect3, playerRelationKind.GetLabel()); curY += rect3.height; GUI.color = Color.white; GenUI.ResetLabelAlign(); }
public static void DrawFactionWarBar(Rect fillRect) { if (!Find.World.GetComponent <WorldComponent_MFI_FactionWar>().StuffIsGoingDown) { return; } Faction factionOne = Find.World.GetComponent <WorldComponent_MFI_FactionWar>().WarringFactionOne; Faction factionInstigator = Find.World.GetComponent <WorldComponent_MFI_FactionWar>().WarringFactionTwo; Rect position = new Rect(fillRect.x, fillRect.y, fillRect.width, fillRect.height); GUI.BeginGroup(position); Text.Font = GameFont.Small; GUI.color = Color.white; //4 boxes: faction name and faction call label. Rect leftFactionLabel = new Rect(x: 0f, y: 0f, width: position.width / 2f, height: TitleHeight); Rect leftBox = new Rect(x: 0f, y: leftFactionLabel.yMax, width: leftFactionLabel.width, height: InfoHeight); Rect rightFactionLabel = new Rect(x: position.width / 2f, y: 0f, width: position.width / 2f, height: TitleHeight); Rect rightBox = new Rect(x: position.width / 2f, y: leftFactionLabel.yMax, width: leftFactionLabel.width, height: InfoHeight); //big central box Rect centreBoxForBigFactionwar = new Rect(0f, leftFactionLabel.yMax, width: position.width, height: TitleHeight); Text.Font = GameFont.Medium; GUI.color = Color.cyan; Text.Anchor = TextAnchor.MiddleCenter; string factionWarStatus = Find.World.GetComponent <WorldComponent_MFI_FactionWar>().WarIsOngoing ? "MFI_FactionWarProgress".Translate() : "MFI_UnrestIsBrewing".Translate(); Widgets.Label(centreBoxForBigFactionwar, factionWarStatus); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; //"score card" bar Rect leftFactionOneScoreBox = new Rect(0f, yPositionBar, position.width * Find.World.GetComponent <WorldComponent_MFI_FactionWar>().ScoreForFaction(factionOne), barHeight); GUI.DrawTexture(leftFactionOneScoreBox, FactionOneColorTexture(factionOne)); Rect rightFactionTwoScoreBox = new Rect(position.width * Find.World.GetComponent <WorldComponent_MFI_FactionWar>().ScoreForFaction(factionOne), yPositionBar, position.width * Find.World.GetComponent <WorldComponent_MFI_FactionWar>().ScoreForFaction(factionInstigator), barHeight); GUI.DrawTexture(rightFactionTwoScoreBox, FactionTwoColorTexture(factionInstigator)); //stuff that fills up and does the faction name and call label boxes. Text.Font = GameFont.Medium; Widgets.Label(rect: leftFactionLabel, label: factionOne.GetCallLabel()); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect: rightFactionLabel, label: factionInstigator.GetCallLabel()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; GUI.color = new Color(r: 1f, g: 1f, b: 1f, a: 0.7f); Widgets.Label(rect: leftBox, label: factionOne.GetInfoText()); if (factionOne != null) { FactionRelationKind playerRelationKind = factionOne.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Rect factionOneRelactionBox = new Rect(x: leftBox.x, y: leftBox.y + Text.CalcHeight(text: factionOne.GetInfoText(), width: leftBox.width) + Text.SpaceBetweenLines, width: leftBox.width, height: 30f); Widgets.Label(rect: factionOneRelactionBox, label: playerRelationKind.GetLabel()); } GUI.color = new Color(r: 1f, g: 1f, b: 1f, a: 0.7f); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect: rightBox, label: factionInstigator.GetInfoText()); if (factionInstigator != null) { FactionRelationKind playerRelationKind = factionInstigator.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Rect factionInstigatorRelactionBox = new Rect(x: rightBox.x, y: rightBox.y + Text.CalcHeight(text: factionInstigator.GetInfoText(), width: rightBox.width) + Text.SpaceBetweenLines, width: rightBox.width, height: 30f); Widgets.Label(rect: factionInstigatorRelactionBox, label: playerRelationKind.GetLabel()); } Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; GUI.EndGroup(); }
public override void DoWindowContents(Rect inRect) { if (war == null) { Close(false); } // Title Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.UpperCenter; Rect rect2 = inRect.AtZero(); rect2.height = 36f; rect2.xMin += 9f; rect2.yMin += 5f; var header = new Listing_Standard(); header.Begin(rect2); header.Label("WindowWarOverview".Translate(war.AttackerFaction(), war.DefenderFaction()), 50); header.GapLine(); header.End(); DevModeSliders(inRect); // Defender resource box float faction1Resources = Utilities.FactionsWar().GetByFaction(war.DefenderFaction()).resources / Utilities.FactionsWar().MaxResourcesForFaction(war.DefenderFaction()); GUI.color = Color.blue; Rect faction1Box = new Rect(inRect.x + factionBoxX, inRect.y + factionBoxY, inRect.xMax - factionBoxXMax, inRect.yMax - factionBoxYMax); Widgets.DrawBox(faction1Box, 5); Rect faction1 = new Rect(inRect.x + factionBoxX, inRect.y + factionBoxY + 109f * (1 - faction1Resources), inRect.xMax - factionBoxXMax, inRect.yMax - factionBoxYMax - 109f * (1 - faction1Resources)); Widgets.DrawBoxSolid(faction1, new Color(0.19607843137f, 0.2627450980f, 1f, 1)); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; GUI.color = Color.white; Widgets.Label(faction1Box, war.DefenderFaction().Name + "'s Resources: " + Math.Round(faction1Resources * 100) + "%"); Text.Font = GameFont.Small; //defender info Rect faction1Info = new Rect(inRect.x + factionBoxX, inRect.y + 220, inRect.xMax - factionBoxXMax, inRect.yMax - factionBoxYMax - 50); Text.Anchor = TextAnchor.UpperLeft; Faction faction = war.DefenderFaction(); Widgets.Label(faction1Info, faction.GetInfoText()); if (faction != null) { FactionRelationKind playerRelationKind = faction.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Widgets.Label(new Rect(faction1Info.x, faction1Info.y + Text.CalcHeight(faction.GetInfoText(), faction1Info.width) + Text.SpaceBetweenLines, faction1Info.width, 30f), playerRelationKind.GetLabel()); } // attacker resource boxes float faction2Resources = Utilities.FactionsWar().GetByFaction(war.AttackerFaction()).resources / Utilities.FactionsWar().MaxResourcesForFaction(war.AttackerFaction()); Rect faction2Box = new Rect(inRect.xMax - 230, inRect.y + factionBoxY, 210, inRect.yMax - factionBoxYMax); GUI.color = Color.red; Widgets.DrawBox(faction2Box, 5); Rect faction2 = new Rect(inRect.xMax - 230, inRect.y + factionBoxY + 109f * (1 - faction2Resources), 210, inRect.yMax - factionBoxYMax - 109f * (1 - faction2Resources)); Widgets.DrawBoxSolid(faction2, new Color(0.8117647058f, 0f, 0.0588235f, 1)); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; GUI.color = Color.white; Widgets.Label(faction2Box, war.AttackerFaction().Name + "'s Resources: " + Math.Round(faction2Resources * 100) + "%"); //attacker info Rect faction1Info2 = new Rect(inRect.xMax - 230, inRect.y + 220, 210, inRect.yMax - factionBoxYMax - 50); Text.Anchor = TextAnchor.UpperRight; Faction faction3 = war.AttackerFaction(); Widgets.Label(faction1Info2, faction3.GetInfoText()); if (faction3 != null) { FactionRelationKind playerRelationKind = faction3.PlayerRelationKind; GUI.color = playerRelationKind.GetColor(); Widgets.Label(new Rect(faction1Info2.x, faction1Info2.y + Text.CalcHeight(faction.GetInfoText(), faction1Info2.width) + Text.SpaceBetweenLines, faction1Info2.width, 30f), playerRelationKind.GetLabel()); } /*Text box*/ Text.Font = GameFont.Small; Rect textRect = new Rect(inRect); Text.Anchor = TextAnchor.MiddleCenter; GUI.color = Color.white; textRect.xMin += 5; textRect.xMax -= 5; textRect.yMin += 300; textRect.yMax -= 50; Widgets.TextAreaScrollable(textRect, war.warHistory, ref scrollPosition, true); Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; }
private void DrawFactionCard(Rect rect, ref int y, FactionInteraction faction) { Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; Rect r = new Rect(10, y, rect.width - 20, 75); Rect titleRect = new Rect(15, y, rect.width - 20, 50); Widgets.Label(titleRect, faction.Faction.Name); Text.Font = GameFont.Tiny; Rect rect2 = new Rect(15, y + 22, rect.width - 20, 50); FactionRelationKind kindWithPlayer = faction.Faction.PlayerRelationKind; Alliance alliance = faction.Alliance; Widgets.Label(rect2, "RelationsWithPlayer".Translate(kindWithPlayer.GetLabel(), faction.Faction.PlayerGoodwill.ToStringWithSign(), faction.Trust, "AllianceInformation".Translate(alliance == null ? "NoAllianceAlias".Translate().ToString() : alliance.Name))); Text.Font = GameFont.Small; Widgets.DrawHighlightIfMouseover(r); if (Mouse.IsOver(r)) { string str2 = "CurrentGoodwillTip".Translate(); if (faction.Faction.def.permanentEnemy) { str2 = str2 + "\n\n" + "CurrentGoodwillTip_PermanentEnemy".Translate(); } else { str2 += "\n\n"; switch (faction.Faction.PlayerRelationKind) { case FactionRelationKind.Ally: str2 += "CurrentGoodwillTip_Ally".Translate(0.ToString("F0")); break; case FactionRelationKind.Neutral: str2 += "CurrentGoodwillTip_Neutral".Translate(0.ToString("F0"), 75.ToString("F0")); break; case FactionRelationKind.Hostile: str2 += "CurrentGoodwillTip_Hostile".Translate(0.ToString("F0")); break; } if (faction.Faction.def.goodwillDailyGain > 0f || faction.Faction.def.goodwillDailyFall > 0f) { str2 = str2 + "\n\n" + "CurrentGoodwillTip_NaturalGoodwill".Translate(faction.Faction.def.naturalColonyGoodwill.min.ToString("F0"), faction.Faction.def.naturalColonyGoodwill.max.ToString("F0"), faction.Faction.def.goodwillDailyGain.ToString("0.#"), faction.Faction.def.goodwillDailyFall.ToString("0.#")); } } str2 += "TrustFactionInformation".Translate(); TooltipHandler.TipRegion(r, str2); } GUI.color = faction.Faction.Color; Widgets.DrawHighlight(r); GUI.color = Color.white; var war = hasWarsWithPlayer[faction]; if (war != null) { GUI.color = war.WarGoalDef.MenuColor; Widgets.DrawBox(r); GUI.color = Color.white; if (war.Started == false) { hasWarsWithPlayer[faction] = null; } } if (Widgets.ButtonInvisible(r)) { currentFaction = faction; defendant = currentFaction.Faction.leader; } y += 85; }