Example #1
0
        public static void GenerateFactionsIntoWorldPostFix()
        {
            Log.Message("Generating Corruption Story Tracker");
            CorruptionStoryTracker corrTracker = (CorruptionStoryTracker)WorldObjectMaker.MakeWorldObject(DefOfs.C_WorldObjectDefOf.CorruptionStoryTracker);

            corrTracker.Tile = TileFinder.RandomStartingTile();
            Find.WorldObjects.Add(corrTracker);
        }
Example #2
0
        private static void DrawImperialFactionRows(CorruptionStoryTracker tracker, Rect rect)
        {
            float num = 0f;

            for (int i = 0; i < tracker.ImperialFactions.Count; i++)
            {
                GUI.color = new Color(1f, 1f, 1f, 0.2f);
                Widgets.DrawLineHorizontal(0f, num, rect.width);
                GUI.color = Color.white;
                num      += CorruptionStoryTrackerUtilities.DrawImperialFactionRow(tracker.ImperialFactions[i], num, rect);
            }
        }
Example #3
0
 public override void SpawnSetup(Map map)
 {
     base.SpawnSetup(map);
     this.powerComp = base.GetComp <CompPowerTrader>();
     this.corruptionStoryTracker = Find.World.worldObjects.AllWorldObjects.Find(x => x.def == C_WorldObjectDefOf.CorruptionStoryTracker) as CorruptionStoryTracker;
     if (this.corruptionStoryTracker == null)
     {
         Log.Message("StoryTracker not found");
     }
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildOrbitalTradeBeacon, OpportunityType.GoodToKnow);
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.OpeningComms, OpportunityType.GoodToKnow);
 }
Example #4
0
        public static void DrawImperialTitheTab(CorruptionStoryTracker tracker, Rect rect)
        {
            Text.Anchor = TextAnchor.MiddleCenter;
            float num = 0f;
            List <TitheEntryGlobal> list = tracker.currentTithes;
            int numEntriesFirst          = Math.Min(list.Count, 5);

            for (int i = 0; i < numEntriesFirst; i++)
            {
                Rect rect3 = new Rect(30f, num, 200f, 25f);
                Widgets.Label(rect3, list[i].titheDef.LabelCap);
                Rect rect4 = new Rect(40f, num + 30f, 200f, 30f);
                Widgets.FillableBar(rect4, list[i].tithePercent, TitheUtilities.TitheBarFillTex, TitheUtilities.TitheBarBGTex, true);
                Widgets.Label(rect4, list[i].collectedTitheAmount + " / " + list[i].requestedTitheAmount);
                num += 75f;
            }
            if (list.Count > 5)
            {
                num = 0f;
                for (int i = 5; i < 11; i++)
                {
                    Rect rect3 = new Rect(240f, num, 200f, 25f);
                    Widgets.Label(rect3, list[i].titheDef.LabelCap);
                    Rect rect4 = new Rect(240f, num + 30f, 200f, 30f);
                    Widgets.FillableBar(rect4, list[i].tithePercent, TitheUtilities.TitheBarFillTex, TitheUtilities.TitheBarBGTex, true);
                    Widgets.Label(rect4, list[i].collectedTitheAmount + " / " + list[i].requestedTitheAmount);
                    num += 75f;
                }
            }

            Rect          rect5         = new Rect(450f, 0f, 200f, 100f);
            StringBuilder stringBuilder = new StringBuilder();
            string        text          = string.Concat(new string[]
            {
                "TitheDueIn".Translate(),
                "\n",
                tracker.DaysToTitheCollection.ToString()
            });

            if (tracker.DaysToTitheCollection < 8)
            {
                GUI.color = Color.red;
            }
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect5, text);

            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
        }
Example #5
0
        public static void DrawCorruptionStoryTrackerTab(CorruptionStoryTracker tracker, Rect rect)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = new Rect(rect.x, rect.y + 20f, rect.width, 55f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect2, Faction.OfPlayer.Name);
            Text.Font = GameFont.Small;

            Rect rect3 = rect2;

            rect3.y      = rect2.yMax + 30f;
            rect3.height = rect.height - rect2.height - 30f;

            Widgets.DrawMenuSection(rect3, true);
            List <TabRecord> list = new List <TabRecord>();

            list.Add(new TabRecord("ImperialInstitutions".Translate(), delegate
            {
                CorruptionStoryTrackerUtilities.ImperialInstitutionsSelected = true;
            }, CorruptionStoryTrackerUtilities.ImperialInstitutionsSelected));

            if (tracker.AcknowledgedByImperium)
            {
                list.Add(new TabRecord("TabTitheContainer".Translate(), delegate
                {
                    CorruptionStoryTrackerUtilities.ImperialInstitutionsSelected = false;
                }, !CorruptionStoryTrackerUtilities.ImperialInstitutionsSelected));
            }
            TabDrawer.DrawTabs(rect3, list);
            rect3 = rect3.ContractedBy(9f);
            GUI.BeginGroup(rect3);

            GUI.color = Color.white;

            if (CorruptionStoryTrackerUtilities.ImperialInstitutionsSelected)
            {
                DrawImperialFactionRows(tracker, rect3);
            }
            else
            {
                DrawImperialTitheTab(tracker, rect3);
            }

            GUI.EndGroup();
            GUI.EndGroup();
        }
Example #6
0
        private static IEnumerable <DiaOption> FactionSpecificOptions(Faction faction, Map map, Pawn negotiator)
        {
            CorruptionStoryTracker tracker = CorruptionStoryTrackerUtilities.currentStoryTracker;

            if (tracker.ImperialFactions.Contains(faction))
            {
                yield return(FactionDialogMaker_IoM.RequestAcknowledgement_IG(map));
            }

            if (faction == tracker.Mechanicus)
            {
                yield return(new DiaOption("PurchaseMecTemplates".Translate())
                {
                    link = FactionDialogMaker_IoM.PurchaseMechanicusTemplates(map, faction)
                });
            }

            //   DiaOption optA = new DiaOption();
            //   yield return optA;
            yield break;
        }
Example #7
0
        // Specific DiaOptions


        private static DiaOption RequestAcknowledgement_IG(Map map)
        {
            CorruptionStoryTracker tracker = CorruptionStoryTrackerUtilities.currentStoryTracker;

            if (tracker.ImperialFactions.Any(x => x.HostileTo(Faction.OfPlayer)) || tracker.PlayerIsEnemyOfMankind)
            {
                DiaOption diaOption = new DiaOption("RequestIoMAcknowledgement".Translate());
                diaOption.Disable("PlayerIsEnemyOfMankind".Translate());
                return(diaOption);
            }

            if (CorruptionStoryTrackerUtilities.currentStoryTracker.AcknowledgedByImperium)
            {
                DiaOption diaOption = new DiaOption("RequestIoMAcknowledgement".Translate());
                diaOption.Disable("AlreadyIoMAcknowledged".Translate());
                return(diaOption);
            }
            DiaOption diaOption2 = new DiaOption("RequestIoMAcknowledgement".Translate());
            string    text       = "IoMAcknowledgementGrant".Translate(new object[]
            {
                Find.World.info.name,
                CorruptionStoryTrackerUtilities.currentStoryTracker.SubsectorName,
                negotiator.Name
            }).CapitalizeFirst();

            DiaOption diaOption3 = new DiaOption("GoBack".Translate());

            diaOption3.linkLateBind = FactionDialogMaker_IoM.ResetToRoot();

            diaOption2.link = new DiaNode(text)
            {
                options =
                {
                    FactionDialogMaker_IoM.AcceptIoMAcknowledgement(map, negotiator),
                    diaOption3
                }
            };
            return(diaOption2);
        }
Example #8
0
        private static DiaOption AcceptIoMAcknowledgement(Map map, Pawn governorCandidate)
        {
            DiaOption diaOption2 = new DiaOption("AcceptIoMAcknowledgement".Translate());
            string    text       = "IoMAcknowledgementAccepted".Translate(new object[]
            {
            }).CapitalizeFirst();

            diaOption2.action = delegate
            {
                CorruptionStoryTracker tracker = CorruptionStoryTrackerUtilities.currentStoryTracker;
                tracker.PlanetaryGovernor = governorCandidate;
                Tithes.TitheUtilities.CalculateColonyTithes(tracker);
                Tithes.TitheUtilities.UpdateAllContaners();
                tracker.AcknowledgedByImperium = true;
            };
            diaOption2.link = new DiaNode(text)
            {
                options =
                {
                    FactionDialogMaker_IoM.OKToRoot()
                }
            };
            return(diaOption2);
        }
Example #9
0
 public int GetTitheID()
 {
     return(CorruptionStoryTracker.GetNextTitheID(ref this.curTitheID));
 }
Example #10
0
 public Window_IoMAcknowledgement(CorruptionStoryTracker storyTracker)
 {
     this.tracker = storyTracker;
 }
Example #11
0
 public Window_CCMBase(CorruptionStoryTracker tracker, Pawn negotiator)
 {
     this.storyTracker = tracker;
     this.negotiator   = negotiator;
     this.forcePause   = true;
 }