protected override void ExtraOnGUI()
        {
            EnsureSpecificHealthTabForPawnValid();
            base.ExtraOnGUI();
            Pawn localSpecificHealthTabForPawn = specificHealthTabForPawn;

            if (localSpecificHealthTabForPawn != null)
            {
                Rect  tabRect = base.TabRect;
                float specificHealthTabWidth = SpecificHealthTabWidth;
                Rect  rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificHealthTabWidth, tabRect.height);
                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (!localSpecificHealthTabForPawn.DestroyedOrNull())
                    {
                        Rect outRect = new Rect(0f, 20f, rect.width, rect.height - 20f);
                        HealthCardUtility.DrawPawnHealthCard(outRect, localSpecificHealthTabForPawn, allowOperations: false, showBloodLoss: true, localSpecificHealthTabForPawn);
                        if (Widgets.CloseButtonFor(rect.AtZero()))
                        {
                            specificHealthTabForPawn = null;
                            SoundDefOf.TabClose.PlayOneShotOnCamera();
                        }
                    }
                });
            }
        }
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect;

            GUI.BeginGroup(inRect);
            Rect rect2 = rect.ContractedBy(10f);

            rect2.height = 20f;

            for (int i = 0; i < this.options.Count; i++)
            {
                if (Widgets.RadioButtonLabeled(rect2, options[i], FactionColorUtilities.currentPlayerStoryTracker.BannerGraphicPath == "UI/Flags/" + options[i]))
                {
                    FactionColorUtilities.currentPlayerStoryTracker.BannerGraphicPath = "UI/Flags/" + options[i];
                }
                rect2.y += 28f;
            }
            Rect rect3 = new Rect(rect2.x + rect2.width / 2 - 50f, rect2.y, 100f, 25f);

            if (Widgets.ButtonText(rect3, "Confirm".Translate(), true, true))
            {
                this.Close(true);
            }
            if (Widgets.CloseButtonFor(inRect.AtZero()))
            {
                this.Close(true);
            }
            GUI.EndGroup();
        }
Exemple #3
0
        public void DoPageContents(Rect inRect, Flow flow)
        {
            if (onClose != null && Widgets.CloseButtonFor(inRect))
            {
                flow.navigate(onClose.Invoke());
            }
            if (onBack != null && Widgets.ButtonImage(new Rect(inRect.x + 4f, inRect.y + 4f, 18f, 18f), Materials.backButtonSmall, Color.white, Widgets.MouseoverOptionColor))
            {
                flow.navigate(onBack.Invoke());
            }
            Text.Font = GameFont.Medium;
            TextAnchor anchor = Text.Anchor;

            Text.Anchor = TextAnchor.MiddleCenter;
            float titleBarHeight = Math.Max(Text.LineHeight + 8f, 26f);

            Widgets.Label(new Rect(inRect.x + 26f, inRect.y + 4f, inRect.width - 52f, titleBarHeight - 4f), title(flow));
            inRect = new Rect(inRect.x, inRect.y + titleBarHeight, inRect.width, inRect.height - titleBarHeight);

            Rect contentRect = inRect.ContractedBy(4f);

            foreach (BaseRenderer cr in components)
            {
                cr.DoComponentContents(inRect, flow);
            }
            Text.Anchor = anchor;
        }
        protected override void ExtraOnGUI()
        {
            EnsureSpecificSocialTabForPawnValid();
            base.ExtraOnGUI();
            Pawn localSpecificSocialTabForPawn = specificSocialTabForPawn;

            if (localSpecificSocialTabForPawn != null)
            {
                Rect  tabRect = base.TabRect;
                float specificSocialTabWidth = SpecificSocialTabWidth;
                Rect  rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificSocialTabWidth, tabRect.height);
                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (!localSpecificSocialTabForPawn.DestroyedOrNull())
                    {
                        SocialCardUtility.DrawSocialCard(rect.AtZero(), localSpecificSocialTabForPawn);
                        if (Widgets.CloseButtonFor(rect.AtZero()))
                        {
                            specificSocialTabForPawn = null;
                            SoundDefOf.TabClose.PlayOneShotOnCamera();
                        }
                    }
                });
            }
        }
Exemple #5
0
        protected override void ExtraOnGUI()
        {
            base.ExtraOnGUI();
            Pawn localSpecificHealthTabForPawn = this.specificHealthTabForPawn;

            if (localSpecificHealthTabForPawn != null)
            {
                Rect  tabRect = base.TabRect;
                float specificHealthTabWidth = this.SpecificHealthTabWidth;
                Rect  rect = new Rect((float)(tabRect.xMax - 1.0), tabRect.yMin, specificHealthTabWidth, tabRect.height);
                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (!localSpecificHealthTabForPawn.DestroyedOrNull())
                    {
                        Rect outRect = new Rect(0f, 20f, rect.width, (float)(rect.height - 20.0));
                        HealthCardUtility.DrawPawnHealthCard(outRect, localSpecificHealthTabForPawn, false, true, localSpecificHealthTabForPawn);
                        if (Widgets.CloseButtonFor(rect.AtZero()))
                        {
                            this.specificHealthTabForPawn = null;
                            SoundDefOf.TabClose.PlayOneShotOnCamera(null);
                        }
                    }
                }, true, false, 1f);
            }
        }
 internal void <> m__0()
 {
     if (!this.$this.StillValid || !this.$this.IsVisible)
     {
         return;
     }
     if (Widgets.CloseButtonFor(this.rect.AtZero()))
     {
         this.$this.CloseTab();
     }
     try
     {
         this.$this.FillTab();
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(string.Concat(new object[]
         {
             "Exception filling tab ",
             this.$this.GetType(),
             ": ",
             ex
         }), 49827, false);
     }
 }
        public override void DoWindowContents(Rect inRect)
        {
            soundClose = SoundDefOf.InfoCard_Close;
            //closeOnClickedOutside = true;
            absorbInputAroundWindow = false;
            forcePause          = false;
            preventCameraMotion = false;
            draggable           = true;
            //resizeable = true;

            if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape))
            {
                Event.current.Use();
            }

            Rect windowRect = inRect.ContractedBy(windowMargin);
            Rect mainRect   = new Rect(windowRect.x, windowRect.y, windowRect.width, windowRect.height);
            Rect closeRect  = new Rect(windowRect.xMax, 0f, 20f, 20f);

            MainContents(mainRect);
            if (Widgets.CloseButtonFor(closeRect))
            {
                Close();
            }
            closeRect.x -= 20f;
        }
Exemple #8
0
        protected override void ExtraOnGUI()
        {
            base.ExtraOnGUI();
            var localSpecificHealthTabForPawn = specificHealthTabForPawn;

            if (localSpecificHealthTabForPawn != null)
            {
                var tabRect = TabRect;
                var specificHealthTabWidth = SpecificHealthTabWidth;
                var rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificHealthTabWidth, tabRect.height);
                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (localSpecificHealthTabForPawn.DestroyedOrNull())
                    {
                        return;
                    }
                    var outRect = new Rect(0f, 20f, rect.width, rect.height - 20f);
                    HealthCardUtility.DrawPawnHealthCard(outRect, localSpecificHealthTabForPawn, false, true,
                                                         localSpecificHealthTabForPawn);
                    if (Widgets.CloseButtonFor(rect.AtZero()))
                    {
                        specificHealthTabForPawn = null;
                        SoundDefOf.TabClose.PlayOneShotOnCamera(null);
                    }
                }, true, false, 1f);
            }
        }
Exemple #9
0
        public void DoTabGUI()
        {
            Rect rect = this.TabRect;

            Find.WindowStack.ImmediateWindow(235086, rect, WindowLayer.GameUI, delegate
            {
                if (!this.StillValid || !this.IsVisible)
                {
                    return;
                }
                if (Widgets.CloseButtonFor(rect.AtZero()))
                {
                    this.CloseTab();
                }
                try
                {
                    this.FillTab();
                }
                catch (Exception ex)
                {
                    Log.ErrorOnce(string.Concat(new object[]
                    {
                        "Exception filling tab ",
                        this.GetType(),
                        ": ",
                        ex
                    }), 49827, false);
                }
            }, true, false, 1f);
            this.ExtraOnGUI();
        }
Exemple #10
0
        protected override void ExtraOnGUI()
        {
            this.EnsureSpecificNeedsTabForPawnValid();
            base.ExtraOnGUI();
            Pawn localSpecificNeedsTabForPawn = this.specificNeedsTabForPawn;

            if (localSpecificNeedsTabForPawn != null)
            {
                Rect  tabRect = base.TabRect;
                float specificNeedsTabWidth = this.SpecificNeedsTabWidth;
                Rect  rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificNeedsTabWidth, tabRect.height);
                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (localSpecificNeedsTabForPawn.DestroyedOrNull())
                    {
                        return;
                    }
                    NeedsCardUtility.DoNeedsMoodAndThoughts(rect.AtZero(), localSpecificNeedsTabForPawn, ref this.thoughtScrollPosition);
                    if (Widgets.CloseButtonFor(rect.AtZero()))
                    {
                        this.specificNeedsTabForPawn = null;
                        SoundDefOf.TabClose.PlayOneShotOnCamera(null);
                    }
                }, true, false, 1f);
            }
        }
Exemple #11
0
        public override void DoWindowContents(Rect inRect)
        {
            if (MultiplayerMod.settings.transparentChat && !Mouse.IsOver(inRect))
            {
                GUI.contentColor    = new Color(1, 1, 1, 0.8f);
                GUI.backgroundColor = new Color(1, 1, 1, 0.8f);
            }

            if (!drawShadow)
            {
                Widgets.DrawShadowAround(inRect);
            }

            if (Widgets.CloseButtonFor(inRect))
            {
                Close();
            }

            inRect = inRect.ContractedBy(18f);

            Multiplayer.session.hasUnread = false;

            Text.Font = GameFont.Small;

            if (Event.current.type == EventType.KeyDown)
            {
                if (Event.current.keyCode == KeyCode.Return)
                {
                    SendMsg();
                    Event.current.Use();
                }
            }

            const float infoWidth = 140f;
            Rect        chat      = new Rect(inRect.x, inRect.y, inRect.width - infoWidth - 10f, inRect.height);

            DrawChat(chat);

            GUI.BeginGroup(new Rect(chat.xMax + 10f, chat.y, infoWidth, inRect.height));
            DrawInfo(new Rect(0, 0, infoWidth, inRect.height));
            GUI.EndGroup();

            if (KeyBindingDefOf.Cancel.KeyDownEvent && Find.WindowStack.focusedWindow == this)
            {
                Close(true);
                Event.current.Use();
            }
        }
Exemple #12
0
        // RimWorld.Planet.WITab_Caravan_Needs
        //[DetourMethod(typeof(RimWorld.Planet.WITab_Caravan_Needs),"ExtraOnGUI")]
        protected override void ExtraOnGUI()
        {
            //base.ExtraOnGUI();
            Log.Message("ExtraOnGUI() 0 ");

            Pawn localSpecificNeedsTabForPawn = this.specificNeedsTabForPawn;

            if (localSpecificNeedsTabForPawn != null)
            {
                Rect tabRect = base.TabRect;

                tabRect.y      -= UI.PawnPolicyCard.Size.y;
                tabRect.height += UI.PawnPolicyCard.Size.y;

                float specificNeedsTabWidth = this.SpecificNeedsTabWidth;
                //Rect rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificNeedsTabWidth, tabRect.height);

                Rect rect = new Rect(tabRect.xMax - 1f, tabRect.yMin, specificNeedsTabWidth, tabRect.height + UI.PawnPolicyCard.Size.y);

                Find.WindowStack.ImmediateWindow(1439870015, rect, WindowLayer.GameUI, delegate
                {
                    if (localSpecificNeedsTabForPawn.DestroyedOrNull())
                    {
                        return;
                    }
                    Log.Message("ExtraOnGUI() 1 " + rect);
                    NeedsCardUtility.DoNeedsMoodAndThoughts(rect, localSpecificNeedsTabForPawn, ref this.thoughtScrollPosition);

                    // --------- MOD ---------

                    Rect policyCardRect = new Rect(rect.x, rect.y + UI.PawnPolicyCard.Size.y, UI.PawnPolicyCard.Size.x, UI.PawnPolicyCard.Size.y);
                    Log.Message("ExtraOnGUI() 2 " + rect);

                    UI.PawnPolicyCard.Draw(rect, this.specificNeedsTabForPawn);

                    // --------- MOD END ---------

                    if (Widgets.CloseButtonFor(rect.AtZero()))
                    {
                        this.specificNeedsTabForPawn = null;
                        SoundDefOf.TabClose.PlayOneShotOnCamera();
                    }
                }, true, false, 1f);
            }
        }
            public override void DoWindowContents(Rect inRect)
            {
                Rect titleRect = new Rect(inRect.x, inRect.y, inRect.width, 30f);

                Widgets.Label(titleRect, "RebellionIoM".Translate());
                Rect descRect = new Rect(inRect.x, titleRect.yMax, inRect.width, 150f);

                Widgets.Label(descRect, "RebellionIoMDesc".Translate());

                Rect imageRect = new Rect(inRect.x, descRect.yMax, 384f, 128f);

                GUI.DrawTexture(imageRect, RebellionIoMTexture);

                if (Widgets.CloseButtonFor(inRect.AtZero()))
                {
                    this.Close();
                }
            }
        public override void DoWindowContents(Rect inRect)
        {
            this.forcePause = true;
            Rect rect = inRect;

            GUI.BeginGroup(inRect);
            Rect rect2 = rect.ContractedBy(10f);

            rect2.width -= 20f;
            DrawFactionColorSliders(rect2, title.Translate());
            Rect rect3 = new Rect(inRect.x, inRect.y, 15f, 15f);

            if (Widgets.CloseButtonFor(inRect.AtZero()))
            {
                this.Close(true);
            }
            GUI.EndGroup();
        }
Exemple #15
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect titleRect = new Rect(inRect);

            titleRect.height = 30f;
            Text.Anchor      = TextAnchor.MiddleCenter;
            Text.Font        = GameFont.Medium;
            Widgets.Label(titleRect, "LetterLabelTithesDue".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
            Rect descRect = new Rect(titleRect.x, titleRect.yMax + 30f, inRect.width, 70f);

            Widgets.Label(descRect, C_MapConditionDefOf.TitheCollectorArrived.description);
            Rect imageRect = new Rect(titleRect.x, descRect.yMax + 5f, 384f, 128f);

            GUI.DrawTexture(imageRect, CorruptionStoryTrackerUtilities.ShipsArrival);
            if (Widgets.CloseButtonFor(inRect.AtZero()))
            {
                this.Close();
            }
        }
Exemple #16
0
        public override float Draw(Rect area, float lineHeight)
        {
            int textHeight = (int)Text.CalcHeight(this.label, area.width - lineHeight);

            //Set height of area to be integral units of lineHeight
            area.height = (textHeight % (int)lineHeight == 0) ? textHeight : textHeight + ((int)lineHeight - textHeight % (int)lineHeight);
            Widgets.DrawHighlightIfMouseover(area);

            Rect labelRect = new Rect(area);

            labelRect.width -= lineHeight;
            TextAnchor anchor = Text.Anchor;

            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(labelRect, this.label);
            Text.Anchor = anchor;

            if (Mouse.IsOver(area))
            {
                GUI.DrawTexture(area, TexUI.HighlightTex);
                ReservationUtility.cellsToBeHighlighted.Add(cell);
                if (!this.tipText.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(area, this.tipText);
                }
            }

            Rect removeReservationRect = new Rect(area.xMax - lineHeight, area.yMin, lineHeight, lineHeight);

            if (Widgets.CloseButtonFor(removeReservationRect))
            {
                SoundDefOf.TinyBell.PlayOneShotOnCamera();
                shelf.RemoveCellReservation(cell);
                this.Remove();
            }

            return(area.yMax);
        }
Exemple #17
0
        public void DoTabGui(ITab tab)
        {
            MainTabWindow_Inspect inspectWorker = (MainTabWindow_Inspect)MainTabDefOf.Inspect.Window;

            this.updateSizeMethod.Invoke(tab, null);
            Vector2 vector  = (Vector2)this.sizeField.GetValue(tab);
            float   y       = vector.y;
            float   top     = inspectWorker.PaneTopY - 30f - y;
            Rect    outRect = new Rect(0f, top, vector.x, y);

            Find.WindowStack.ImmediateWindow(235086, outRect, WindowLayer.GameUI, delegate
            {
                if (Find.MainTabsRoot.OpenTab != MainTabDefOf.Inspect || !this.CurTabs.Contains(tab) || !tab.IsVisible)
                {
                    return;
                }
                if (Widgets.CloseButtonFor(outRect.AtZero()))
                {
                    inspectWorker.CloseOpenTab();
                }
                try
                {
                    this.fillTabMethod.Invoke(tab, null);
                }
                catch (Exception ex)
                {
                    Log.ErrorOnce(string.Concat(new object[]
                    {
                        "Exception filling tab ",
                        this.GetType(),
                        ": ",
                        ex.ToString()
                    }), 49827);
                }
            }, true, false, 1f);
        }
        public void DoTabGUI()
        {
            Rect rect = TabRect;

            Find.WindowStack.ImmediateWindow(235086, rect, WindowLayer.GameUI, delegate
            {
                if (StillValid && IsVisible)
                {
                    if (Widgets.CloseButtonFor(rect.AtZero()))
                    {
                        CloseTab();
                    }
                    try
                    {
                        FillTab();
                    }
                    catch (Exception ex)
                    {
                        Log.ErrorOnce(string.Concat("Exception filling tab ", GetType(), ": ", ex), 49827);
                    }
                }
            });
            ExtraOnGUI();
        }
        public void DoTabGUI()
        {
            Rect rect = this.TabRect;

            Find.WindowStack.ImmediateWindow(235086, rect, WindowLayer.GameUI, delegate
            {
                if (this.StillValid && this.IsVisible)
                {
                    if (Widgets.CloseButtonFor(rect.AtZero()))
                    {
                        this.CloseTab();
                    }
                    try
                    {
                        this.FillTab();
                    }
                    catch (Exception ex)
                    {
                        Log.ErrorOnce("Exception filling tab " + base.GetType() + ": " + ex, 49827);
                    }
                }
            }, true, false, 1f);
            this.ExtraOnGUI();
        }
Exemple #20
0
        public virtual void WindowOnGUI()
        {
            if (this.resizeable)
            {
                if (this.resizer == null)
                {
                    this.resizer = new WindowResizer();
                }
                if (this.resizeLater)
                {
                    this.resizeLater = false;
                    this.windowRect  = this.resizeLaterRect;
                }
            }
            this.windowRect = this.windowRect.Rounded();
            Rect winRect = this.windowRect.AtZero();

            this.windowRect = GUI.Window(this.ID, this.windowRect, delegate(int x)
            {
                UnityGUIBugsFixer.OnGUI();
                Find.WindowStack.currentlyDrawnWindow = this;
                if (this.doWindowBackground)
                {
                    Widgets.DrawWindowBackground(winRect);
                }
                if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
                {
                    Find.WindowStack.Notify_PressedEscape();
                }
                if (Event.current.type == EventType.MouseDown)
                {
                    Find.WindowStack.Notify_ClickedInsideWindow(this);
                }
                if (Event.current.type == EventType.KeyDown && !Find.WindowStack.GetsInput(this))
                {
                    Event.current.Use();
                }
                if (!this.optionalTitle.NullOrEmpty())
                {
                    GUI.Label(new Rect(this.Margin, this.Margin, this.windowRect.width, 25f), this.optionalTitle);
                }
                if (this.doCloseX && Widgets.CloseButtonFor(winRect))
                {
                    this.Close(true);
                }
                if (this.resizeable && Event.current.type != EventType.Repaint)
                {
                    Rect lhs = this.resizer.DoResizeControl(this.windowRect);
                    if (lhs != this.windowRect)
                    {
                        this.resizeLater     = true;
                        this.resizeLaterRect = lhs;
                    }
                }
                Rect rect = winRect.ContractedBy(this.Margin);
                if (!this.optionalTitle.NullOrEmpty())
                {
                    rect.yMin += (float)(this.Margin + 25.0);
                }
                GUI.BeginGroup(rect);
                try
                {
                    this.DoWindowContents(rect.AtZero());
                }
                catch (Exception ex)
                {
                    Log.Error("Exception filling window for " + base.GetType().ToString() + ": " + ex);
                }
                GUI.EndGroup();
                if (this.resizeable && Event.current.type == EventType.Repaint)
                {
                    this.resizer.DoResizeControl(this.windowRect);
                }
                if (this.doCloseButton)
                {
                    Text.Font             = GameFont.Small;
                    double num            = winRect.width / 2.0;
                    Vector2 closeButSize  = this.CloseButSize;
                    double x2             = num - closeButSize.x / 2.0;
                    double y              = winRect.height - 55.0;
                    Vector2 closeButSize2 = this.CloseButSize;
                    float x3              = closeButSize2.x;
                    Vector2 closeButSize3 = this.CloseButSize;
                    Rect rect2            = new Rect((float)x2, (float)y, x3, closeButSize3.y);
                    if (Widgets.ButtonText(rect2, "CloseButton".Translate(), true, false, true))
                    {
                        this.Close(true);
                    }
                }
                if (this.closeOnEscapeKey && Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Escape || Event.current.keyCode == KeyCode.Return))
                {
                    this.Close(true);
                    Event.current.Use();
                }
                if (this.draggable)
                {
                    GUI.DragWindow();
                }
                else if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                }
                ScreenFader.OverlayOnGUI(winRect.size);
                Find.WindowStack.currentlyDrawnWindow = null;
            }, string.Empty, Widgets.EmptyStyle);
        }
            internal void <> m__0(int x)
            {
                UnityGUIBugsFixer.OnGUI();
                Find.WindowStack.currentlyDrawnWindow = this.$this;
                if (this.$this.doWindowBackground)
                {
                    Widgets.DrawWindowBackground(this.winRect);
                }
                if (KeyBindingDefOf.Cancel.KeyDownEvent)
                {
                    Find.WindowStack.Notify_PressedCancel();
                }
                if (KeyBindingDefOf.Accept.KeyDownEvent)
                {
                    Find.WindowStack.Notify_PressedAccept();
                }
                if (Event.current.type == EventType.MouseDown)
                {
                    Find.WindowStack.Notify_ClickedInsideWindow(this.$this);
                }
                if (Event.current.type == EventType.KeyDown && !Find.WindowStack.GetsInput(this.$this))
                {
                    Event.current.Use();
                }
                if (!this.$this.optionalTitle.NullOrEmpty())
                {
                    GUI.Label(new Rect(this.$this.Margin, this.$this.Margin, this.$this.windowRect.width, 25f), this.$this.optionalTitle);
                }
                if (this.$this.doCloseX && Widgets.CloseButtonFor(this.winRect))
                {
                    this.$this.Close(true);
                }
                if (this.$this.resizeable && Event.current.type != EventType.Repaint)
                {
                    Rect rect = this.$this.resizer.DoResizeControl(this.$this.windowRect);
                    if (rect != this.$this.windowRect)
                    {
                        this.$this.resizeLater     = true;
                        this.$this.resizeLaterRect = rect;
                    }
                }
                Rect rect2 = this.winRect.ContractedBy(this.$this.Margin);

                if (!this.$this.optionalTitle.NullOrEmpty())
                {
                    rect2.yMin += this.$this.Margin + 25f;
                }
                GUI.BeginGroup(rect2);
                try
                {
                    this.$this.DoWindowContents(rect2.AtZero());
                }
                catch (Exception ex)
                {
                    Log.Error(string.Concat(new object[]
                    {
                        "Exception filling window for ",
                        this.$this.GetType(),
                        ": ",
                        ex
                    }), false);
                }
                GUI.EndGroup();
                if (this.$this.resizeable && Event.current.type == EventType.Repaint)
                {
                    this.$this.resizer.DoResizeControl(this.$this.windowRect);
                }
                if (this.$this.doCloseButton)
                {
                    Text.Font = GameFont.Small;
                    Rect rect3 = new Rect(this.winRect.width / 2f - this.$this.CloseButSize.x / 2f, this.winRect.height - 55f, this.$this.CloseButSize.x, this.$this.CloseButSize.y);
                    if (Widgets.ButtonText(rect3, "CloseButton".Translate(), true, false, true))
                    {
                        this.$this.Close(true);
                    }
                }
                if (KeyBindingDefOf.Cancel.KeyDownEvent && this.$this.IsOpen)
                {
                    this.$this.OnCancelKeyPressed();
                }
                if (this.$this.draggable)
                {
                    GUI.DragWindow();
                }
                else if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                }
                ScreenFader.OverlayOnGUI(this.winRect.size);
                Find.WindowStack.currentlyDrawnWindow = null;
            }
Exemple #22
0
        public static void Draw(Listing_Standard listing, Rect win)
        {
            listing.Label(Strings.settings_dnspy);
            Settings.PathToDnspy = listing.TextEntry(Settings.PathToDnspy);
            listing.Gap();
            DubGUI.LabeledSliderFloat(listing, Strings.settings_updates_per_second, ref Settings.updatesPerSecond, 1.0f, 20.0f);
            DubGUI.Checkbox(Strings.settings_logging, listing, ref Settings.verboseLogging);
            DubGUI.Checkbox(Strings.settings_disable_tps_counter, listing, ref Settings.disableTPSCounter);
            DubGUI.Checkbox("settings.debuglog".Tr(), listing, ref Settings.enableLog);

            var s    = Strings.settings_disable_cleanup;
            var rect = listing.GetRect(Text.LineHeight);

            DubGUI.Checkbox(rect, s, ref Settings.disableCleanup);
            TooltipHandler.TipRegion(rect, Strings.settings_disable_cleanup_desc);

            listing.GapLine();

            DubGUI.CenterText(() => listing.Label("devoptions.heading".Tr()));
            listing.GapLine();

            var tabs = listing.GetRect(tabRect.height);

            tabs.width = tabRect.width;

            Drawtab(tabs, 0, "Patch Tools");
            tabs.x = tabs.xMax;
            Drawtab(tabs, 1, $"Saved Patches ({Settings.SavedPatches_Tick.Count + Settings.SavedPatches_Update.Count})");
            listing.Gap(4);
            if (PatchTab == 0)
            {
                if (listing.ButtonTextLabeled("Logging cycle", patchType.ToString()))
                {
                    if (patchType == Category.Tick)
                    {
                        patchType = Category.Update;
                    }
                    else
                    {
                        patchType = Category.Tick;
                    }
                    //For if onGui gets added
                    //var list = new List<FloatMenuOption>
                    //{
                    //    new FloatMenuOption("devoptions.patchtype.tick".Tr(), () => patchType = Category.Tick),
                    //    new FloatMenuOption("devoptions.patchtype.update".Tr(), () => patchType = Category.Update)
                    //    new FloatMenuOption("devoptions.patchtype.ongui".Tr(), () => patchType = Category.OnGui)
                    //};
                    //Find.WindowStack.Add(new FloatMenu(list));
                }

                if (showSearchbox)
                {
                    Window_SearchBar.Control();
                }
                var inputR = DisplayInputField(listing);

                Window_SearchBar.SetCurrentInput(input);
                Window_SearchBar.UpdateSearchString(currentInput);

                var searchRect = listing.GetRect(Mathf.Min(listing.curY, win.height - listing.curY));

                lock (Window_SearchBar.sync)
                {
                    if (showSearchbox && !Mouse.IsOver(searchRect) && Event.current.type != EventType.MouseDown)
                    {
                        showSearchbox = false;
                    }
                    if (GUI.GetNameOfFocusedControl() == "profileinput")
                    {
                        showSearchbox = true;
                    }
                    else
                    if (Mouse.IsOver(inputR))
                    {
                        showSearchbox = true;
                    }
                }

                if (showSearchbox)
                {
                    Window_SearchBar.DoWindowContents(searchRect);
                }
            }
            else
            {
                foreach (var patch in Settings.SavedPatches_Tick.ToList())
                {
                    var row = listing.GetRect(Text.LineHeight);
                    if (Widgets.CloseButtonFor(row.LeftPartPixels(30f)))
                    {
                        Settings.SavedPatches_Tick.Remove(patch);
                    }
                    Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Tick");
                    listing.GapLine();
                }
                foreach (var patch in Settings.SavedPatches_Update.ToList())
                {
                    var row = listing.GetRect(Text.LineHeight);
                    if (Widgets.CloseButtonFor(row.LeftPartPixels(30f)))
                    {
                        Settings.SavedPatches_Update.Remove(patch);
                    }
                    Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Update");
                    listing.GapLine();
                }
            }
        }
Exemple #23
0
        public virtual void WindowOnGUI()
        {
            if (resizeable)
            {
                if (resizer == null)
                {
                    resizer = new WindowResizer();
                }
                if (resizeLater)
                {
                    resizeLater = false;
                    windowRect  = resizeLaterRect;
                }
            }
            windowRect = windowRect.Rounded();
            Rect winRect = windowRect.AtZero();

            windowRect = GUI.Window(ID, windowRect, delegate
            {
                UnityGUIBugsFixer.OnGUI();
                Find.WindowStack.currentlyDrawnWindow = this;
                if (doWindowBackground)
                {
                    Widgets.DrawWindowBackground(winRect);
                }
                if (KeyBindingDefOf.Cancel.KeyDownEvent)
                {
                    Find.WindowStack.Notify_PressedCancel();
                }
                if (KeyBindingDefOf.Accept.KeyDownEvent)
                {
                    Find.WindowStack.Notify_PressedAccept();
                }
                if (Event.current.type == EventType.MouseDown)
                {
                    Find.WindowStack.Notify_ClickedInsideWindow(this);
                }
                if (Event.current.type == EventType.KeyDown && !Find.WindowStack.GetsInput(this))
                {
                    Event.current.Use();
                }
                if (!optionalTitle.NullOrEmpty())
                {
                    GUI.Label(new Rect(Margin, Margin, windowRect.width, 25f), optionalTitle);
                }
                if (doCloseX && Widgets.CloseButtonFor(winRect))
                {
                    Close();
                }
                if (resizeable && Event.current.type != EventType.Repaint)
                {
                    Rect lhs = resizer.DoResizeControl(windowRect);
                    if (lhs != windowRect)
                    {
                        resizeLater     = true;
                        resizeLaterRect = lhs;
                    }
                }
                Rect rect = winRect.ContractedBy(Margin);
                if (!optionalTitle.NullOrEmpty())
                {
                    rect.yMin += Margin + 25f;
                }
                GUI.BeginGroup(rect);
                try
                {
                    DoWindowContents(rect.AtZero());
                }
                catch (Exception ex)
                {
                    Log.Error("Exception filling window for " + GetType() + ": " + ex);
                }
                GUI.EndGroup();
                if (resizeable && Event.current.type == EventType.Repaint)
                {
                    resizer.DoResizeControl(windowRect);
                }
                if (doCloseButton)
                {
                    Text.Font            = GameFont.Small;
                    float num            = winRect.width / 2f;
                    Vector2 closeButSize = CloseButSize;
                    float x2             = num - closeButSize.x / 2f;
                    float y = winRect.height - 55f;
                    Vector2 closeButSize2 = CloseButSize;
                    float x3 = closeButSize2.x;
                    Vector2 closeButSize3 = CloseButSize;
                    Rect rect2            = new Rect(x2, y, x3, closeButSize3.y);
                    if (Widgets.ButtonText(rect2, "CloseButton".Translate()))
                    {
                        Close();
                    }
                }
                if (KeyBindingDefOf.Cancel.KeyDownEvent && IsOpen)
                {
                    OnCancelKeyPressed();
                }
                if (draggable)
                {
                    GUI.DragWindow();
                }
                else if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                }
                ScreenFader.OverlayOnGUI(winRect.size);
                Find.WindowStack.currentlyDrawnWindow = null;
            }, string.Empty, Widgets.EmptyStyle);
        }
        private Rect DrawInfoPane(ConceptDef conc)
        {
            float knowledge       = PlayerKnowledgeDatabase.GetKnowledge(conc);
            bool  complete        = PlayerKnowledgeDatabase.IsComplete(conc);
            bool  drawProgressBar = !complete && knowledge > 0f;

            Text.Font = GameFont.Medium;
            float titleHeight = Text.CalcHeight(conc.LabelCap, 276f);

            Text.Font = GameFont.Small;
            float textHeight = Text.CalcHeight(conc.HelpTextAdjusted, 296f);
            float num        = titleHeight + textHeight + 14f + 5f;

            if (this.selectedConcept == conc)
            {
                num += 40f;
            }
            if (drawProgressBar)
            {
                num += 30f;
            }
            Rect outRect  = new Rect((float)UI.screenWidth - 8f - 200f - 8f - 310f, 8f, 310f, num);
            Rect outRect2 = outRect;

            Find.WindowStack.ImmediateWindow(987612111, outRect, WindowLayer.Super, delegate
            {
                outRect   = outRect.AtZero();
                Rect rect = outRect.ContractedBy(7f);
                Widgets.DrawShadowAround(outRect);
                Widgets.DrawWindowBackgroundTutor(outRect);
                Rect rect2   = rect;
                rect2.width -= 20f;
                rect2.height = titleHeight + 5f;
                Text.Font    = GameFont.Medium;
                Widgets.Label(rect2, conc.LabelCap);
                Text.Font    = GameFont.Small;
                Rect rect3   = rect;
                rect3.yMin   = rect2.yMax;
                rect3.height = textHeight;
                Widgets.Label(rect3, conc.HelpTextAdjusted);
                if (drawProgressBar)
                {
                    Rect rect4   = rect;
                    rect4.yMin   = rect3.yMax;
                    rect4.height = 30f;
                    Widgets.FillableBar(rect4, PlayerKnowledgeDatabase.GetKnowledge(conc), LearningReadout.ProgressBarFillTex);
                }
                if (this.selectedConcept == conc)
                {
                    if (Widgets.CloseButtonFor(outRect))
                    {
                        this.selectedConcept = null;
                        SoundDefOf.PageChange.PlayOneShotOnCamera(null);
                    }
                    Rect rect5 = new Rect(rect.center.x - 70f, rect.yMax - 30f, 140f, 30f);
                    if (!complete)
                    {
                        if (Widgets.ButtonText(rect5, "MarkLearned".Translate(), true, false, true))
                        {
                            this.selectedConcept = null;
                            SoundDefOf.PageChange.PlayOneShotOnCamera(null);
                            PlayerKnowledgeDatabase.SetKnowledge(conc, 1f);
                        }
                    }
                    else
                    {
                        GUI.color   = new Color(1f, 1f, 1f, 0.5f);
                        Text.Anchor = TextAnchor.MiddleCenter;
                        Widgets.Label(rect5, "AlreadyLearned".Translate());
                        Text.Anchor = TextAnchor.UpperLeft;
                        GUI.color   = Color.white;
                    }
                }
            }, false, false, 1f);
            return(outRect2);
        }
Exemple #25
0
        public override void DoWindowContents(Rect inRect)
        {
            if (refreshWarframePortrait)
            {
                // this.newWF.Drawer.renderer.graphics.ResolveAllGraphics();
                // PortraitsCache.SetDirty(this.newWF);
                //  PortraitsCache.PortraitsCacheUpdate();
                refreshWarframePortrait = false;
            }

            var rect27 = new Rect(inRect)
            {
                width  = 240f + 16f,
                height = 200f + 16f
            };

            rect27    = rect27.CenteredOnXIn(inRect);
            rect27    = rect27.CenteredOnYIn(inRect);
            rect27.x -= 88f;
            rect27.y -= 32f;
            if (newWF != null)
            {
                //picture
                GUI.DrawTexture(rect27,
                                ContentFinder <Texture2D> .Get("WFPicture/" + nowWarframeKind.defName.Replace("Warframe_", "")),
                                ScaleMode.ScaleToFit);
                //  Widgets.InfoCardButton(position.xMax - 16f, position.y, this.newWF);

                var rectsk = new Rect(rect27.x + rect27.width + 16, rect27.y, 50, 50);
                var recttx = new Rect(rectsk.x + 56, rectsk.y + 6, 160, 50);
                for (var i = 0; i < 4; i++)
                {
                    var arect = new Rect(rectsk.x, rectsk.y + (i * 54f), 50, 50);
                    Widgets.ButtonImage(arect,
                                        ContentFinder <Texture2D> .Get("Skills/" + nowWarframeKind.defName.Replace("Warframe_", "") +
                                                                       "Skill" + (i + 1)));
                    var trect = new Rect(recttx.x, recttx.y + (i * 54f), 160, 50);
                    Text.Font = GameFont.Medium;
                    Widgets.Label(trect,
                                  (nowWarframeKind.defName.Replace("Warframe_", "") + "Skill" + (i + 1) + ".name").Translate());
                    Text.Font = GameFont.Small;
                    TooltipHandler.TipRegion(arect,
                                             (nowWarframeKind.defName.Replace("Warframe_", "") + "Skill" + (i + 1) + ".desc").Translate());
                }

                //title
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Medium;
                Widgets.Label(new Rect(0f, 0f, inRect.width, 32f), "CraftWarframe".Translate());
                Text.Anchor = TextAnchor.UpperLeft;


                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleCenter;
                var rect10 = new Rect(0 + 120, inRect.height * 0.75f, 240f, 24f);
                if (Widgets.ButtonText(rect10, nowWarframeKind.label, true, false))
                {
                    FloatMenuUtility.MakeMenu(WarframeStaticMethods.GetAllWarframeKind(), Kind => Kind.label, Kind =>
                                              delegate
                    {
                        nowWarframeKind = Kind;
                        newWF           = getNewWF();
                        RefreshCosts();
                    });
                }

                Text.Anchor = TextAnchor.UpperLeft;


                //click craft
                //float num2 = rect27.x + rect27.width + 16f + (inRect.width - 1);
                var rect9 = new Rect((inRect.width / 2) - 60, inRect.height - 32, 120, 32);
                Text.Font = GameFont.Medium;
                // Text.Anchor = TextAnchor.LowerCenter;
                if (Widgets.ButtonText(rect9, "WarframeStartCraft".Translate(), true, false))
                {
                    WFCraft.nowCraftKind = nowWarframeKind;

                    WFCraft.tryDropAllParts();
                    WFCraft.fuelCost = fuelCost;
                    WFCraft.curState = Building_WarframeCrafter.CraftState.Filling;
                    Close();
                }

                var recttime = new Rect(rect9.x, rect9.y - 60, 30, 30);
                Widgets.ButtonImage(recttime, ContentFinder <Texture2D> .Get("UI/Icons/ColonistBar/Idle"));
                var recttimec = new Rect(recttime.x + 30, recttime.y, 30, 30);
                Text.Font = GameFont.Small;
                Widgets.Label(recttimec, timeCost + "DaysLower".Translate());
                TooltipHandler.TipRegion(recttime, "Time Cost");


                var rectcostbase = new Rect(recttimec.x + 30, recttime.y, 30, 30);
                for (var j = 0; j < 3; j++)
                {
                    var rrrect  = new Rect(rectcostbase.x + (j * 30), rectcostbase.y, 30, 30);
                    var nowpart = "";
                    switch (j)
                    {
                    case 0:
                        nowpart = "_Head";
                        break;

                    case 1:
                        nowpart = "_Body";
                        break;

                    case 2:
                        nowpart = "_Inside";
                        break;
                    }

                    var apartDef =
                        ThingDef.Named("WFPart_" + nowWarframeKind.defName.Replace("Warframe_", "") + nowpart);
                    Widgets.ButtonImage(rrrect, apartDef.uiIcon);
                    TooltipHandler.TipRegion(rrrect, apartDef.label + "\n" + apartDef.description);
                }

                //orokin cell icon draw
                var fuelRect  = new Rect(rectcostbase.x + (3 * 30), rectcostbase.y, 30, 30);
                var ocpartDef = ThingDef.Named("WFItem_OrokinCell");
                Widgets.ButtonImage(fuelRect, ocpartDef.uiIcon);
                TooltipHandler.TipRegion(fuelRect, ocpartDef.label + "\n" + ocpartDef.description);


                Text.Font = GameFont.Small;
                var costRect = new Rect(fuelRect.x + 30, fuelRect.y, 30, 30);
                Widgets.Label(costRect, fuelCost + "");
                TooltipHandler.TipRegion(costRect, ocpartDef.label + "\n" + ocpartDef.description);

                if (Widgets.CloseButtonFor(new Rect(inRect.width - 30, 0, 30, 30)))
                {
                    Close();
                }
            }

            Text.Anchor = TextAnchor.UpperLeft;
        }
Exemple #26
0
        private void _WindowOnGUI()
        {
            TryPruneFields();
            WindowFields fields;
            var          windowHash = GetHashCode();

            windowFields.TryGetValue(windowHash, out fields);
            if (fields == null)
            {
                fields = new WindowFields();
                windowFields.Add(windowHash, fields);
            }

            // ===== Vanilla begin ===
            if (this.resizeable)
            {
                if (fields.resizer == null)
                {
                    fields.resizer = new WindowResizer();
                }
                if (fields.resizeLater)
                {
                    fields.resizeLater = false;
                    this.windowRect    = fields.resizeLaterRect;
                }
            }
            Rect winRect = this.windowRect.AtZero();

            this.windowRect = GUI.Window(this.ID, this.windowRect, delegate(int x) {
                Find.WindowStack.currentlyDrawnWindow = this;
                if (this.doWindowBackground)
                {
                    Widgets.DrawWindowBackground(winRect);
                }
                if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
                {
                    Find.WindowStack.Notify_PressedEscape();
                }
                if (Event.current.type == EventType.MouseDown)
                {
                    Find.WindowStack.Notify_ClickedInsideWindow(this);
                }
                if (Event.current.type == EventType.KeyDown && !Find.WindowStack.GetsInput(this))
                {
                    Event.current.Use();
                }
                if (!this.optionalTitle.NullOrEmpty())
                {
                    GUI.Label(new Rect(this.Margin, this.Margin, this.windowRect.width, 25f), this.optionalTitle);
                }
                if (this.doCloseX && Widgets.CloseButtonFor(winRect))
                {
                    this.Close(true);
                }
                if (this.resizeable && Event.current.type != EventType.Repaint)
                {
                    Rect lhs = fields.resizer.DoResizeControl(this.windowRect);
                    if (lhs != this.windowRect)
                    {
                        fields.resizeLater     = true;
                        fields.resizeLaterRect = lhs;
                    }
                }
                Rect rect = winRect.ContractedBy(this.Margin);
                if (!this.optionalTitle.NullOrEmpty())
                {
                    rect.yMin += this.Margin + 25f;
                }
                GUI.BeginGroup(rect);
                // ===== Vanilla end ===
                var inRect       = rect.AtZero();
                var injectionSet = WindowInjectionManager.GetSetForWindowType(GetType());
                if (injectionSet != null && injectionSet.beforeContents != null)
                {
                    InvokeCallbackList(injectionSet.beforeContents, this, inRect);
                }
                if (injectionSet != null && injectionSet.replaceContents != null)
                {
                    InvokeCallbackList(injectionSet.replaceContents, this, inRect);
                }
                else
                {
                    // ===== Vanilla begin ===
                    try {
                        this.DoWindowContents(inRect);
                    } catch (Exception ex) {
                        Log.Error(string.Concat(new object[] {
                            "Exception filling window for ",
                            this.GetType().ToString(),
                            ": ",
                            ex
                        }));
                    }
                    // ===== Vanilla end ===
                }
                if (injectionSet != null && injectionSet.afterContents != null)
                {
                    InvokeCallbackList(injectionSet.afterContents, this, inRect);
                }
                // ===== Vanilla begin ===
                GUI.EndGroup();
                if (this.resizeable && Event.current.type == EventType.Repaint)
                {
                    fields.resizer.DoResizeControl(this.windowRect);
                }
                if (this.doCloseButton)
                {
                    Text.Font  = GameFont.Small;
                    Rect rect2 = new Rect(winRect.width / 2f - this.CloseButSize.x / 2f, winRect.height - 55f, this.CloseButSize.x, this.CloseButSize.y);
                    if (Widgets.ButtonText(rect2, "CloseButton".Translate(), true, false, true))
                    {
                        this.Close(true);
                    }
                }
                if (this.closeOnEscapeKey && Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Escape || Event.current.keyCode == KeyCode.Return))
                {
                    this.Close(true);
                    Event.current.Use();
                }
                if (this.draggable)
                {
                    GUI.DragWindow();
                }
                else if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                }
                ScreenFader.OverlayOnGUI(winRect.size);
                Find.WindowStack.currentlyDrawnWindow = null;
            }, string.Empty, Widgets.EmptyStyle);

            // ===== Vanilla end ===
        }
        private float DoWorkAreaPriorityRowElement(WorkGiverDef giverType, Rect inRect)
        {
            Rect rect1 = inRect.ContractedBy(cellSpacing);              //usedHeight considered in return
            Rect rect2 = new Rect(rect1.xMin, rect1.yMin, rect1.width * 0.35f, rect1.height);
            Rect rect3 = new Rect(rect2.xMax + rect1.width * 0.1f, rect2.yMin, rect1.width * 0.55f, rect1.height);

            AreaPriorityManager    aPM = map.GetComponent <AreaPriorityManager> ();
            WorkAreaPrioritization wAP = aPM.Prioritizations [giverType];

            Rect rect2a = new Rect(rect2.xMin + 2 * CellSpacing, rect2.yMin, rect2.width - 4 * CellSpacing, LineHeight);
            Rect rect2b = new Rect(rect2a.xMin + 4 * CellSpacing, rect2a.yMax, rect2.width / 2, LineHeight);
            Rect rect2c = new Rect(rect2b.xMin, rect2b.yMax, rect2b.width, LineHeight);

            Widgets.Label(rect2a, giverType.workType.gerundLabel.CapitalizeFirst() + ": "
                          + giverType.gerund.CapitalizeFirst());
            Widgets.CheckboxLabeled(rect2b, "Disable".Translate(), ref wAP.disabled);
            Widgets.Label(rect2c, "Remove".Translate());
            if (Widgets.CloseButtonFor(rect2c))
            {
                aPM.Prioritizations [giverType] = null;
            }

            WidgetRow rowA = new WidgetRow(rect3.xMin, rect3.yMin, UIDirection.RightThenUp, rect3.width, CellSpacing * 2f);
            WidgetRow rowB = new WidgetRow(rect3.xMin, rect3.yMin + LineHeight, UIDirection.RightThenUp, rect3.width, CellSpacing * 2f);
            WidgetRow rowC = new WidgetRow(rect3.xMin, rect3.yMin + 2 * LineHeight, UIDirection.RightThenUp, rect3.width, CellSpacing * 2f);

            if (rowA.ButtonText("HighPriority".Translate() + ": " + (wAP.highPriorityArea?.Label ?? "None")))
            {
                List <FloatMenuOption> highPriorityChoices = new List <FloatMenuOption>();
                foreach (Area area in map.areaManager.AllAreas.Except(wAP.Areas))
                {
                    highPriorityChoices.Add(new FloatMenuOption(area.Label, () => wAP.highPriorityArea = area));
                }
                if (wAP.highPriorityArea != null)
                {
                    highPriorityChoices.Add(new FloatMenuOption("None".Translate(), () => wAP.highPriorityArea = null));
                }
                Find.WindowStack.Add(new FloatMenu(highPriorityChoices));
            }
            float gapAdjust = (rect3.xMin + 0.7f * rect3.width) - rowA.FinalX;                  //Start invert box 70% across dialog

            if (gapAdjust > 0)
            {
                rowA.Gap(gapAdjust);
            }
            if (rowA.ButtonText(wAP.invertHighArea ? "Inverted".Translate() : "NotInverted".Translate()))
            {
                wAP.invertHighArea = !wAP.invertHighArea;
            }

            if (rowB.ButtonText("LowPriority".Translate() + ": " + (wAP.lowPriorityArea?.Label ?? "None")))
            {
                List <FloatMenuOption> lowPriorityChoices = new List <FloatMenuOption>();
                foreach (Area area in map.areaManager.AllAreas.Except(wAP.Areas))
                {
                    lowPriorityChoices.Add(new FloatMenuOption(area.Label, () => wAP.lowPriorityArea = area));
                }
                if (wAP.lowPriorityArea != null)
                {
                    lowPriorityChoices.Add(new FloatMenuOption("None".Translate(), () => wAP.lowPriorityArea = null));
                }
                Find.WindowStack.Add(new FloatMenu(lowPriorityChoices));
            }
            gapAdjust = (rect3.xMin + 0.7f * rect3.width) - rowB.FinalX;
            if (gapAdjust > 0)
            {
                rowB.Gap(gapAdjust);
            }
            if (rowB.ButtonText(wAP.invertLowArea ? "Inverted".Translate() : "NotInverted".Translate()))
            {
                wAP.invertLowArea = !wAP.invertLowArea;
            }

            if (rowC.ButtonText("AvoidPriority".Translate() + ": " + (wAP.avoidPriorityArea?.Label ?? "None")))
            {
                List <FloatMenuOption> avoidPriorityChoices = new List <FloatMenuOption>();
                foreach (Area area in map.areaManager.AllAreas.Except(wAP.Areas))
                {
                    avoidPriorityChoices.Add(new FloatMenuOption(area.Label, () => wAP.avoidPriorityArea = area));
                }
                if (wAP.avoidPriorityArea != null)
                {
                    avoidPriorityChoices.Add(new FloatMenuOption("None".Translate(), () => wAP.avoidPriorityArea = null));
                }
                Find.WindowStack.Add(new FloatMenu(avoidPriorityChoices));
            }
            gapAdjust = (rect3.xMin + 0.7f * rect3.width) - rowC.FinalX;
            if (gapAdjust > 0)
            {
                rowC.Gap(gapAdjust);
            }
            if (rowC.ButtonText(wAP.invertAvoidArea ? "Inverted".Translate() : "NotInverted".Translate()))
            {
                wAP.invertAvoidArea = !wAP.invertAvoidArea;
            }

            inRect.height = 3f * LineHeight + CellSpacing;
            Widgets.DrawBox(inRect, 1);

            return(RowHeight);
        }
Exemple #28
0
        public override void DoWindowContents(Rect inRect)
        {
            if (this.SelThing == null)
            {
                this.Close();
            }
            if (Find.Selector.SingleSelectedThing as Pawn != this.SelPawn)
            {
                this.PreOpen();
            }
            this.SetInitialSizeAndPosition();
            Rect rect2 = inRect.ContractedBy(10f);

            rect2.height = 30f;
            rect2.width  = 300;
            rect2.x      = inRect.x + (inRect.width / 2) - 150;
            rect2.y     += 10f;
            //      GUI.BeginGroup(rect2);
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Medium;
            var tmp1 = rect2.y;

            Widgets.Label(rect2, "Patron :");
            //          GUI.EndGroup();
            Rect rect3 = rect2;

            rect3.y += 30f;
            //         GUI.BeginGroup(rect3);
            Rect rect4 = rect3;

            rect4.height = 300f;
            String    texpath = "UI/" + SelPawnPatron + "_bg";
            Texture2D tex     = ContentFinder <Texture2D> .Get(texpath, true);

            GUI.DrawTexture(rect4, tex as Texture);
//            GUI.EndGroup();
            Rect rect5 = rect3;

            rect5.y     += 320f;
            rect5.height = 30f;
            //        GUI.BeginGroup(rect5);
            GUI.color = PatronColor;
            var tmp2 = rect5.y + 5;

            Widgets.Label(rect5, SelPawnPatron.Translate());
            Widgets.ListSeparator(ref tmp2, inRect.width, "");
            GUI.color = Color.white;

            Rect rect7 = rect5;

            rect7.x     = 0f;
            rect7.width = inRect.width / 3;
            rect7.y    += 30;
            Text.Font   = GameFont.Medium;
            Widgets.Label(new Rect(rect7), "ReligiousTraits".Translate());
            Text.Font = GameFont.Small;
            float num    = rect7.y + 30f;
            Rect  rect13 = new Rect(rect7.x, num, rect7.width, 23f);;

            for (int i = 0; i < STraits.Count(); i++)
            {
                SoulTrait trait  = STraits[i];
                Rect      rect12 = new Rect(rect7.x, num, rect7.width, 23f);
                if (Mouse.IsOver(rect12))
                {
                    Widgets.DrawHighlight(rect12);
                }
                Widgets.Label(rect12, trait.SoulCurrentData.label);
                num += rect12.height + 15f;
                SoulTrait trLocal = trait;
                TipSignal tip2    = new TipSignal(() => trLocal.TipString(SelPawn), (int)num * 37);

                TooltipHandler.TipRegion(rect12, tip2);
                rect13 = rect12;
            }

            rect13.y += 53;
            if (Mouse.IsOver(rect13))
            {
                Widgets.DrawHighlight(rect13);
            }
            Widgets.Label(rect13, this.culturalTolerance.ToString());
            num += rect13.height + 15;
            TipSignal tip = new TipSignal(() => culturalToleranceToolTip(this.culturalTolerance), (int)num * 37);

            TooltipHandler.TipRegion(rect13, tip);


            Rect rect8 = rect7;

            rect8.x      = inRect.x + (inRect.width / 2) - 150;
            rect8.width -= 20;
            String desc = SelPawnPatron + "_Description";

            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(rect8), "Description".Translate());
            Rect rect8a = rect8;

            rect8a.y     += 30f;
            rect8a.height = 200f;
            Text.Font     = GameFont.Small;
            Widgets.Label(new Rect(rect8a), desc.Translate());

            Rect rect9 = rect7;

            rect9.x   = rect8.xMax + 20;
            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(rect9), "SoulStatus".Translate());
            Rect rect9a = rect9;

            rect9a.y += 30f;
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(rect9a), SelPawnSoulState.Translate());
            TipSignal tip3 = new TipSignal(() => this.AfflictionCategoryToolTip(soul.CurCategory), (int)num * 37);

            TooltipHandler.TipRegion(rect9a, tip3);
            Rect rect9b = rect9a;

            rect9b.y += rect9a.height + 15f;
            Widgets.Label(new Rect(rect9b), this.psykerPowerLevel);
            TipSignal tip4 = new TipSignal(() => this.PsykerPowerLevelToolTip(soul.PsykerPowerLevel), (int)num * 37);

            TooltipHandler.TipRegion(rect9b, tip4);
            Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.CloseButtonFor(inRect.AtZero()))
            {
                this.Close();
            }
            if (this.SelPawn == null)
            {
                this.Close();
            }
        }
        private void InnerWindowOnGUI(int x)
        {
            Rect rect = windowRect.AtZero();

            UnityGUIBugsFixer.OnGUI();
            Find.WindowStack.currentlyDrawnWindow = this;
            if (doWindowBackground)
            {
                Widgets.DrawWindowBackground(rect);
            }
            if (KeyBindingDefOf.Cancel.KeyDownEvent)
            {
                Find.WindowStack.Notify_PressedCancel();
            }
            if (KeyBindingDefOf.Accept.KeyDownEvent)
            {
                Find.WindowStack.Notify_PressedAccept();
            }
            if (Event.current.type == EventType.MouseDown)
            {
                Find.WindowStack.Notify_ClickedInsideWindow(this);
            }
            if (Event.current.type == EventType.KeyDown && !Find.WindowStack.GetsInput(this))
            {
                Event.current.Use();
            }
            if (!optionalTitle.NullOrEmpty())
            {
                GUI.Label(new Rect(Margin, Margin, windowRect.width, 25f), optionalTitle);
            }
            if (doCloseX && Widgets.CloseButtonFor(rect))
            {
                Close();
            }
            if (resizeable && Event.current.type != EventType.Repaint)
            {
                Rect lhs = resizer.DoResizeControl(windowRect);
                if (lhs != windowRect)
                {
                    resizeLater     = true;
                    resizeLaterRect = lhs;
                }
            }
            Rect rect2 = rect.ContractedBy(Margin);

            if (!optionalTitle.NullOrEmpty())
            {
                rect2.yMin += Margin + 25f;
            }
            GUI.BeginGroup(rect2);
            try
            {
                DoWindowContents(rect2.AtZero());
            }
            catch (Exception ex)
            {
                Log.Error(string.Concat("Exception filling window for ", GetType(), ": ", ex));
            }
            GUI.EndGroup();
            if (resizeable && Event.current.type == EventType.Repaint)
            {
                resizer.DoResizeControl(windowRect);
            }
            if (doCloseButton)
            {
                Text.Font = GameFont.Small;
                if (Widgets.ButtonText(new Rect(rect.width / 2f - CloseButSize.x / 2f, rect.height - 55f, CloseButSize.x, CloseButSize.y), "CloseButton".Translate()))
                {
                    Close();
                }
            }
            if (KeyBindingDefOf.Cancel.KeyDownEvent && IsOpen)
            {
                OnCancelKeyPressed();
            }
            if (draggable)
            {
                GUI.DragWindow();
            }
            else if (Event.current.type == EventType.MouseDown)
            {
                Event.current.Use();
            }
            ScreenFader.OverlayOnGUI(rect.size);
            Find.WindowStack.currentlyDrawnWindow = null;
        }
Exemple #30
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();
            }
        }