private void DrawFactionButtons(Rect inRect, int buttonSize) //Used to draw a list of buttons from the 'buttons' list { Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; for (int i = 0; i < buttons.Count; i++) { if (Widgets.ButtonText(new Rect(140, 110 + ((buttonSize + 5) * i), 170, buttonSize), buttons[i])) { if (buttons[i] == "FCOverview".Translate()) { //if click trade policy button //Log.Message(buttons[i]); Log.Message("Success"); Find.WindowStack.Add(new FCWindow_Overview()); } if (buttons[i] == "Military".Translate()) { if (FactionColonies.getPlayerColonyFaction() == null) { Messages.Message(new Message("NoFactionForMilitary".Translate(), MessageTypeDefOf.RejectInput)); } else { Find.WindowStack.Add(new MilitaryCustomizationWindowFc()); } } if (buttons[i] == "Actions".Translate()) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("TaxDeliveryMap".Translate(), delegate { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); list2.Add(new FloatMenuOption("SetMap".Translate(), delegate { List <FloatMenuOption> settlementList = new List <FloatMenuOption>(); foreach (Map map in Find.Maps) { if (map.IsPlayerHome) { settlementList.Add(new FloatMenuOption(map.Parent.LabelCap, delegate { faction.taxMap = map; Find.LetterStack.ReceiveLetter("Map Set!", "The tax delivery map has been set to the player colony of " + map.Parent.LabelCap + ".\n All taxes and other goods will be delivered there", LetterDefOf.NeutralEvent); } )); } } if (settlementList.Count == 0) { settlementList.Add(new FloatMenuOption("No valid settlements to use.", null)); } FloatMenu floatMenu2 = new FloatMenu(settlementList); floatMenu2.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu2); })); FloatMenu floatMenu = new FloatMenu(list2); floatMenu.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu); })); list.Add(new FloatMenuOption("SetCapital".Translate(), delegate { faction.setCapital(); })); list.Add(new FloatMenuOption("ActivateResearch".Translate(), delegate { faction.updateDailyResearch(); })); list.Add(new FloatMenuOption("ResearchLevel".Translate(), delegate { Messages.Message("CurrentResearchLevel".Translate(faction.techLevel.ToString(), faction.returnNextTechToLevel()), MessageTypeDefOf.NeutralEvent); })); if (faction.hasPolicy(FCPolicyDefOf.technocratic)) { list.Add(new FloatMenuOption("FCSendResearchItems".Translate(), delegate { if (Find.ColonistBar.GetColonistsInOrder().Count > 0) { Pawn playerNegotiator = Find.ColonistBar.GetColonistsInOrder()[0]; //Log.Message(playerNegotiator.Name + " Negotiator"); FCTrader_Research trader = new FCTrader_Research(); Find.WindowStack.Add(new Dialog_Trade(playerNegotiator, trader)); } else { Log.Message("Where are all the colonists?"); } })); } if (faction.hasPolicy(FCPolicyDefOf.feudal)) { list.Add(new FloatMenuOption("FCRequestMercenary".Translate(), delegate { if (faction.traitFeudalBoolCanUseMercenary) { faction.traitFeudalBoolCanUseMercenary = false; faction.traitFeudalTickLastUsedMercenary = Find.TickManager.TicksGame; PawnGenerationRequest request = FCPawnGenerator.WorkerOrMilitaryRequest; request.ColonistRelationChanceFactor = 20f; Pawn pawn = PawnGenerator.GeneratePawn(request); IncidentParms parms = new IncidentParms { target = Find.CurrentMap, faction = FactionColonies.getPlayerColonyFaction(), points = 999, raidArrivalModeForQuickMilitaryAid = true, raidNeverFleeIndividual = true, raidForceOneIncap = true, raidArrivalMode = PawnsArrivalModeDefOf.CenterDrop, raidStrategy = RaidStrategyDefOf.ImmediateAttackFriendly }; parms.raidArrivalModeForQuickMilitaryAid = true; PawnsArrivalModeWorker_EdgeWalkIn worker = new PawnsArrivalModeWorker_EdgeWalkIn(); worker.TryResolveRaidSpawnCenter(parms); worker.Arrive(new List <Pawn> { pawn }, parms); Find.LetterStack.ReceiveLetter("FCMercenaryJoined".Translate(), "FCMercenaryJoinedText".Translate(pawn.NameFullColored), LetterDefOf.PositiveEvent, new LookTargets(pawn)); pawn.SetFaction(Faction.OfPlayer); } else { Messages.Message("FCActionMercenaryOnCooldown".Translate(((faction.traitFeudalTickLastUsedMercenary + GenDate.TicksPerSeason) - Find.TickManager.TicksGame).ToTimeString()), MessageTypeDefOf.RejectInput); } })); } FloatMenu menu = new FloatMenu(list); Find.WindowStack.Add(menu); } } } }
private void DrawFactionButtons(Rect inRect, int buttonSize) //Used to draw a list of buttons from the 'buttons' list { Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; for (int i = 0; i < buttons.Count(); i++) { if (Widgets.ButtonText(new Rect(140, 110 + ((buttonSize + 5) * i), 170, buttonSize), buttons[i])) { if (buttons[i] == "Policies-Traits".Translate()) { //if click trade policy button //Log.Message(buttons[i]); Find.WindowStack.Add(new traitWindowFC()); } if (buttons[i] == "Military".Translate()) { Find.WindowStack.Add(new militaryCustomizationWindowFC()); } if (buttons[i] == "Actions".Translate()) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("TaxDeliveryMap".Translate(), delegate { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); list2.Add(new FloatMenuOption("SetMap".Translate(), delegate { List <FloatMenuOption> settlementList = new List <FloatMenuOption>(); foreach (Map map in Find.Maps) { if (map.IsPlayerHome == true) { settlementList.Add(new FloatMenuOption(map.Parent.LabelCap, delegate { faction.taxMap = map; Find.LetterStack.ReceiveLetter("Map Set!", "The tax delivery map has been set to the player colony of " + map.Parent.LabelCap + ".\n All taxes and other goods will be delivered there", LetterDefOf.NeutralEvent); }, MenuOptionPriority.Default, null, null, 0f, null, null )); } } if (settlementList.Count == 0) { settlementList.Add(new FloatMenuOption("No valid settlements to use.", null)); } FloatMenu floatMenu2 = new FloatMenu(settlementList); floatMenu2.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu2); }, MenuOptionPriority.Default, null, null, 0f, null, null)); FloatMenu floatMenu = new FloatMenu(list2); floatMenu.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu); })); list.Add(new FloatMenuOption("SetCapital".Translate(), delegate { faction.setCapital(); })); list.Add(new FloatMenuOption("ActivateResearch".Translate(), delegate { faction.updateDailyResearch(); })); FloatMenu menu = new FloatMenu(list); Find.WindowStack.Add(menu); } } } }
private void DrawFactionButtons(Rect inRect, int buttonSize) //Used to draw a list of buttons from the 'buttons' list { Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; for (int i = 0; i < buttons.Count; i++) { if (Widgets.ButtonText(new Rect(140, 110 + ((buttonSize + 5) * i), 170, buttonSize), buttons[i])) { if (buttons[i] == "FCOverview".Translate()) { //if click trade policy button //Log.Message(buttons[i]); Log.Message("Success"); Find.WindowStack.Add(new FCWindow_Overview()); } if (buttons[i] == "Military".Translate()) { if (FactionColonies.getPlayerColonyFaction() == null) { Messages.Message(new Message("NoFactionForMilitary".Translate(), MessageTypeDefOf.RejectInput)); } else { Find.WindowStack.Add(new militaryCustomizationWindowFC()); } } if (buttons[i] == "Actions".Translate()) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("TaxDeliveryMap".Translate(), delegate { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); list2.Add(new FloatMenuOption("SetMap".Translate(), delegate { List <FloatMenuOption> settlementList = new List <FloatMenuOption>(); foreach (Map map in Find.Maps) { if (map.IsPlayerHome) { settlementList.Add(new FloatMenuOption(map.Parent.LabelCap, delegate { faction.taxMap = map; Find.LetterStack.ReceiveLetter("Map Set!", "The tax delivery map has been set to the player colony of " + map.Parent.LabelCap + ".\n All taxes and other goods will be delivered there", LetterDefOf.NeutralEvent); } )); } } if (settlementList.Count == 0) { settlementList.Add(new FloatMenuOption("No valid settlements to use.", null)); } FloatMenu floatMenu2 = new FloatMenu(settlementList); floatMenu2.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu2); })); FloatMenu floatMenu = new FloatMenu(list2); floatMenu.vanishIfMouseDistant = true; Find.WindowStack.Add(floatMenu); })); list.Add(new FloatMenuOption("SetCapital".Translate(), delegate { faction.setCapital(); })); list.Add(new FloatMenuOption("ActivateResearch".Translate(), delegate { faction.updateDailyResearch(); })); list.Add(new FloatMenuOption("ResearchLevel".Translate(), delegate { Messages.Message("CurrentResearchLevel".Translate(faction.techLevel.ToString(), faction.returnNextTechToLevel()), MessageTypeDefOf.NeutralEvent); })); if (faction.hasPolicy(FCPolicyDefOf.technocratic)) { list.Add(new FloatMenuOption("FCSendResearchItems".Translate(), delegate { if (Find.ColonistBar.GetColonistsInOrder().Count > 0) { Pawn playerNegotiator = Find.ColonistBar.GetColonistsInOrder()[0]; //Log.Message(playerNegotiator.Name + " Negotiator"); FCTrader_Research trader = new FCTrader_Research(); Find.WindowStack.Add(new Dialog_Trade(playerNegotiator, trader)); } else { Log.Message("Where are all the colonists?"); } })); } if (faction.hasPolicy(FCPolicyDefOf.feudal)) { list.Add(new FloatMenuOption("FCRequestMercenary".Translate(), delegate { if (faction.traitFeudalBoolCanUseMercenary) { faction.traitFeudalBoolCanUseMercenary = false; faction.traitFeudalTickLastUsedMercenary = Find.TickManager.TicksGame; List <PawnKindDef> listKindDef = new List <PawnKindDef>(); foreach (ThingDef def in Find.World.GetComponent <FactionFC>().raceFilter.AllowedThingDefs) { listKindDef.Add(def.race.AnyPawnKind); } PawnGroupMaker groupMaker = FactionColonies.getPlayerColonyFaction().def.pawnGroupMakers.RandomElement(); PawnGroupMakerParms group = new PawnGroupMakerParms(); group.groupKind = groupMaker.kindDef; group.faction = FactionColonies.getPlayerColonyFaction(); group.dontUseSingleUseRocketLaunchers = true; group.generateFightersOnly = true; group.points = 2000; group.raidStrategy = RaidStrategyDefOf.ImmediateAttackFriendly; PawnKindDef pawnkind = new PawnKindDef(); PawnKindDef kind = groupMaker.GeneratePawns(group).RandomElement().kindDef; pawnkind = listKindDef.RandomElement(); pawnkind.techHediffsTags = kind.techHediffsTags; pawnkind.apparelTags = kind.apparelTags; pawnkind.isFighter = kind.isFighter; pawnkind.combatPower = kind.combatPower; pawnkind.gearHealthRange = kind.gearHealthRange; pawnkind.weaponTags = kind.weaponTags; pawnkind.apparelMoney = kind.apparelMoney; pawnkind.weaponMoney = kind.weaponMoney; pawnkind.apparelAllowHeadgearChance = kind.apparelAllowHeadgearChance; pawnkind.techHediffsMoney = kind.techHediffsMoney; pawnkind.label = kind.label; Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(pawnkind, Find.FactionManager.OfPlayer, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f)); IncidentParms parms = new IncidentParms(); parms.target = Find.CurrentMap; parms.faction = FactionColonies.getPlayerColonyFaction(); parms.points = 999; parms.raidArrivalModeForQuickMilitaryAid = true; parms.raidNeverFleeIndividual = true; parms.raidForceOneIncap = true; parms.raidArrivalMode = PawnsArrivalModeDefOf.CenterDrop; parms.raidStrategy = RaidStrategyDefOf.ImmediateAttackFriendly; parms.raidArrivalModeForQuickMilitaryAid = true; PawnsArrivalModeWorker_EdgeWalkIn worker = new PawnsArrivalModeWorker_EdgeWalkIn(); worker.TryResolveRaidSpawnCenter(parms); worker.Arrive(new List <Pawn> { pawn }, parms); Find.LetterStack.ReceiveLetter("FCMercenaryJoined".Translate(), "FCMercenaryJoinedText".Translate(pawn.NameFullColored), LetterDefOf.PositiveEvent, new LookTargets(pawn)); } else { Messages.Message("FCActionMercenaryOnCooldown".Translate(((faction.traitFeudalTickLastUsedMercenary + GenDate.TicksPerSeason) - Find.TickManager.TicksGame).ToStringTicksToDays()), MessageTypeDefOf.RejectInput); } })); } FloatMenu menu = new FloatMenu(list); Find.WindowStack.Add(menu); } } } }