Пример #1
0
 public static void ExtraOnGUI(IInspectPane pane)
 {
     if (pane.AnythingSelected)
     {
         if (KeyBindingDefOf.SelectNextInCell.KeyDownEvent)
         {
             pane.SelectNextInCell();
         }
         pane.DrawInspectGizmos();
         InspectPaneUtility.DoTabs(pane);
     }
 }
 public static void InspectPaneOnGUI(Rect inRect, IInspectPane pane)
 {
     pane.RecentHeight = 165f;
     if (pane.AnythingSelected)
     {
         try
         {
             Rect rect = inRect.ContractedBy(12f);
             rect.yMin -= 4f;
             rect.yMax += 6f;
             GUI.BeginGroup(rect);
             float num = 0f;
             if (pane.ShouldShowSelectNextInCellButton)
             {
                 Rect rect2 = new Rect(rect.width - 24f, 0f, 24f, 24f);
                 if (Widgets.ButtonImage(rect2, TexButton.SelectOverlappingNext))
                 {
                     pane.SelectNextInCell();
                 }
                 num += 24f;
                 TooltipHandler.TipRegion(rect2, "SelectNextInSquareTip".Translate(new object[]
                 {
                     KeyBindingDefOf.SelectNextInCell.MainKeyLabel
                 }));
             }
             pane.DoInspectPaneButtons(rect, ref num);
             Rect   rect3 = new Rect(0f, 0f, rect.width - num, 50f);
             string label = pane.GetLabel(rect3);
             rect3.width += 300f;
             Text.Font    = GameFont.Medium;
             Text.Anchor  = TextAnchor.UpperLeft;
             Widgets.Label(rect3, label);
             if (pane.ShouldShowPaneContents)
             {
                 Rect rect4 = rect.AtZero();
                 rect4.yMin += 26f;
                 pane.DoPaneContents(rect4);
             }
         }
         catch (Exception ex)
         {
             Log.Error("Exception doing inspect pane: " + ex.ToString(), false);
         }
         finally
         {
             GUI.EndGroup();
         }
     }
 }
 public static void ExtraOnGUI(IInspectPane pane)
 {
     if (pane.AnythingSelected)
     {
         if (KeyBindingDefOf.SelectNextInCell.KeyDownEvent)
         {
             pane.SelectNextInCell();
         }
         if (Current.ProgramState == ProgramState.Playing)
         {
             pane.DrawInspectGizmos();
         }
         InspectPaneUtility.DoTabs(pane);
     }
 }
Пример #4
0
        public static void OnGUI(Rect inRect, IInspectPane pane)
        {
            Theme.CheckFontChange();

            var model = PawnModel.Selected;

            pane.RecentHeight = Theme.InspectPaneHeight.Value - 35f;

            if (model == null)
            {
                return;
            }
            if (!pane.AnythingSelected)
            {
                return;
            }

            var rect = inRect.ContractedBy(12f);

            rect.yMin -= 4f;
            rect.yMax += 6f;

            try
            {
                GUI.BeginGroup(rect.ExpandedBy(1f));

                var lineEndWidth = 0f;

                if (pane.ShouldShowSelectNextInCellButton)
                {
                    var selectOverlappingNextRect = new Rect(rect.width - ButtonSize, 0f, ButtonSize, ButtonSize);
                    if (Widgets.ButtonImage(selectOverlappingNextRect, Textures.SelectOverlappingNext))
                    {
                        pane.SelectNextInCell();
                    }
                    lineEndWidth += ButtonSize;
                    TooltipHandler.TipRegion(selectOverlappingNextRect, "SelectNextInSquareTip".Translate(KeyBindingDefOf.SelectNextInCell.MainKeyLabel));
                }

                DrawButtons(rect, ref lineEndWidth);

                var previousAnchor = Text.Anchor;
                Text.Anchor = TextAnchor.UpperLeft;
                GUIPlus.SetFont(GameFont.Medium);
                GUIPlus.SetColor(model.FactionRelationColor);

                var labelRect = new Rect(0f, 0f, rect.width - lineEndWidth, Text.LineHeight);
                var label     = model.Name;

                Widgets.Label(labelRect, label);
                if (Widgets.ButtonInvisible(labelRect))
                {
                    ToggleSocialTab();
                }

                GUIPlus.ResetFont();
                GUIPlus.ResetColor();
                Text.Anchor = previousAnchor;
                GUIPlus.DrawTooltip(labelRect, model.BioTooltip, false);

                if (!pane.ShouldShowPaneContents)
                {
                    return;
                }

                var contentRect = rect.AtZero();
                contentRect.yMin += 26f;
                DrawContent(contentRect, model, null);
            }
            catch (Exception exception) { Mod.HandleError(exception); }
            finally { GUI.EndGroup(); }
        }