Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        private float DrawFactionRowCommsIoM(Faction faction, float rowY, Rect fillRect, Pawn negotiator)
        {
            Rect rect  = new Rect(5f, rowY, fillRect.width - 10f, 50f);
            Rect rect2 = rect;

            if (Widgets.ButtonText(rect, faction.def.LabelCap, true, true, true))
            {
                if (faction.leader == null)
                {
                    Log.Error("NoLeader for: " + faction.Name);
                }
                this.Close();
                CorruptionStoryTrackerUtilities.TryOpenIoMComms(negotiator, faction);
            }
            float num  = Text.CalcHeight(faction.def.LabelCap, fillRect.width);
            float num2 = Mathf.Max(80f, num);

            return(num2);
        }
Esempio n. 3
0
        private static IEnumerable <DiaOption> DebugOptions(Faction faction)
        {
            DiaOption opt = new DiaOption("(Debug) Goodwill +10");

            opt.action = delegate
            {
                CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, 10f);
            };
            opt.linkLateBind = (() => FactionDialogMaker_IoM.FactionDialogFor(FactionDialogMaker_IoM.negotiator, FactionDialogMaker_IoM.faction));
            yield return(opt);

            DiaOption opt2 = new DiaOption("(Debug) Goodwill -10");

            opt2.action = delegate
            {
                CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, -10f);
            };
            opt2.linkLateBind = (() => FactionDialogMaker_IoM.FactionDialogFor(FactionDialogMaker_IoM.negotiator, FactionDialogMaker_IoM.faction));
            yield return(opt2);
        }
Esempio n. 4
0
        private static DiaOption OfferGiftOption(Map map)
        {
            if (FactionDialogMaker_IoM.AmountSendableSilver(map) < 300)
            {
                DiaOption diaOption = new DiaOption("OfferGift".Translate());
                diaOption.Disable("NeedSilverLaunchable".Translate(new object[]
                {
                    300
                }));
                return(diaOption);
            }
            float     goodwillDelta = 5f * FactionDialogMaker_IoM.negotiator.GetStatValue(StatDefOf.GiftImpact, true);
            DiaOption diaOption2    = new DiaOption("OfferGift".Translate() + " (" + "SilverForGoodwill".Translate(new object[]
            {
                300,
                goodwillDelta.ToString("#####0")
            }) + ")");

            diaOption2.action = delegate
            {
                TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 300, map, null);
                CorruptionStoryTrackerUtilities.AffectGoodwillWithSpacerFaction(Faction.OfPlayer, faction, goodwillDelta);
            };
            string text = "SilverGiftSent".Translate(new object[]
            {
                FactionDialogMaker_IoM.faction.leader.LabelIndefinite(),
                Mathf.RoundToInt(goodwillDelta)
            }).CapitalizeFirst();

            diaOption2.link = new DiaNode(text)
            {
                options =
                {
                    FactionDialogMaker_IoM.OKToRoot()
                }
            };
            return(diaOption2);
        }
Esempio n. 5
0
        protected override void FillTab()
        {
            Rect rect = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(5f);

            CorruptionStoryTrackerUtilities.DrawCorruptionStoryTrackerTab(console.corruptionStoryTracker, rect);
        }
Esempio n. 6
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect baseRect   = inRect;
            Rect leftRect   = new Rect(0f, 15f, 120f, baseRect.height - 25f);
            Rect centerRect = new Rect(baseRect.width / 2f - 220f, 120f, 440f, baseRect.height - 120f);
            Rect rightRect  = new Rect(baseRect.width - 120f, 15f, 120f, baseRect.height - 25f);

            GUI.BeginGroup(inRect);
            Rect titleRect = new Rect(baseRect.x, baseRect.y, baseRect.width, 30f);

            //       GUI.BeginGroup(titleRect);
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Medium;
            string title = "Subsector " + storyTracker.SubsectorName;

            Widgets.Label(titleRect, title);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            //        GUI.EndGroup();

            GUI.BeginGroup(leftRect);
            float num = leftRect.y;

            CorruptionStoryTrackerUtilities.ListSeparatorBig(ref num, leftRect.width, "ImperialFrequencies".Translate());
            num += 50f;
            for (int i = 0; i < storyTracker.ImperialFactions.Count; i++)
            {
                num += DrawFactionRowCommsIoM(storyTracker.ImperialFactions[i], num, leftRect, negotiator);
            }
            //      Widgets.DrawRectFast(leftRect, Color.white);
            GUI.EndGroup();

            this.DrawStarGrid(centerRect);
            //        GUI.BeginGroup(centerRect);
            Rect worldRect = new Rect((centerRect.x + centerRect.width / 2f) - 30f, (centerRect.y + centerRect.height / 2f) - 30f, 60f, 60f);

            if (Widgets.ButtonImage(worldRect, CorruptionStoryTrackerUtilities.PlanetMedium))
            {
                List <FloatMenuOption>      list       = new List <FloatMenuOption>();
                IEnumerable <ICommunicable> enumerable = negotiator.Map.passingShipManager.passingShips.Cast <ICommunicable>().Concat(Find.FactionManager.AllFactionsInViewOrder.Cast <ICommunicable>());
                foreach (ICommunicable commTarget in enumerable)
                {
                    ICommunicable localCommTarget = commTarget;
                    string        text            = "CallOnRadio".Translate(new object[]
                    {
                        localCommTarget.GetCallLabel()
                    });
                    Faction faction = localCommTarget as Faction;
                    if (faction != null)
                    {
                        if (faction.IsPlayer)
                        {
                            continue;
                        }
                        if (!Building_CommsConsole.LeaderIsAvailableToTalk(faction))
                        {
                            list.Add(new FloatMenuOption(text + " (" + "LeaderUnavailable".Translate(new object[]
                            {
                                faction.leader.LabelShort
                            }) + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null));
                            continue;
                        }
                    }
                    Action action = delegate
                    {
                        localCommTarget.TryOpenComms(negotiator);
                    };
                    list.Add(new FloatMenuOption(text, action, MenuOptionPriority.InitiateSocial, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list, null, false));
            }
            TooltipHandler.TipRegion(worldRect, "CurrentWorldInfoRect".Translate(new object[]
            {
                Find.World.info.name
            }));

            Rect worldLabelrect = worldRect;

            worldLabelrect.y    += 65f;
            worldLabelrect.width = 80f;
            GUI.color            = Color.red;
            Widgets.Label(worldLabelrect, Find.World.info.name);
            GUI.color = Color.white;

            foreach (StarMapObject current in storyTracker.SubSectorObjects)
            {
                //          Log.Message(current.objectName + current.objectRect.ToString());
                //          Widgets.DrawRectFast(current.objectRect, Color.red);

                if (Widgets.ButtonImage(current.objectRect, current.objectTex))
                {
                }

                TooltipHandler.TipRegion(current.objectRect, "StarmapObjectInfo".Translate(new object[]
                {
                    current.objectName,
                    current.diameter,
                    "Unknown"
                }));
            }

            //            GUI.EndGroup();

            GUI.BeginGroup(rightRect);

            //      Widgets.DrawRectFast(rightRect, Color.red);
            float num2 = rightRect.y;

            CorruptionStoryTrackerUtilities.ListSeparatorBig(ref num2, rightRect.width, "UnknownFrequencies".Translate());
            num2 += 50f;
            for (int i = 0; i < storyTracker.XenoFactions.Count; i++)
            {
                num2 += DrawFactionRowCommsXeno(storyTracker.XenoFactions[i], num2, rightRect, negotiator);
            }

            GUI.EndGroup();
            GUI.EndGroup();
            if (Widgets.CloseButtonFor(inRect.AtZero()))
            {
                this.Close();
            }
        }