コード例 #1
0
 private static void InterfaceToggleTab(InspectTabBase tab, IInspectPane pane)
 {
     if (!TutorSystem.TutorialMode || InspectPaneUtility.IsOpen(tab, pane) || TutorSystem.AllowAction("ITab-" + tab.tutorTag + "-Open"))
     {
         InspectPaneUtility.ToggleTab(tab, pane);
     }
 }
コード例 #2
0
 public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo)
 {
     mouseoverGizmo = null;
     try
     {
         objList.Clear();
         objList.AddRange(selectedObjects);
         gizmoList.Clear();
         for (int i = 0; i < objList.Count; i++)
         {
             ISelectable selectable = objList[i] as ISelectable;
             if (selectable != null)
             {
                 gizmoList.AddRange(selectable.GetGizmos());
             }
         }
         for (int j = 0; j < objList.Count; j++)
         {
             Thing t = objList[j] as Thing;
             if (t == null)
             {
                 continue;
             }
             List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators;
             for (int k = 0; k < allDesignators.Count; k++)
             {
                 Designator des = allDesignators[k];
                 if (!des.CanDesignateThing(t).Accepted)
                 {
                     continue;
                 }
                 Command_Action command_Action = new Command_Action();
                 command_Action.defaultLabel = des.LabelCapReverseDesignating(t);
                 command_Action.icon         = des.IconReverseDesignating(t, out var angle, out var offset);
                 command_Action.iconAngle    = angle;
                 command_Action.iconOffset   = offset;
                 command_Action.defaultDesc  = des.DescReverseDesignating(t);
                 command_Action.order        = ((des is Designator_Uninstall) ? (-11f) : (-20f));
                 command_Action.action       = delegate
                 {
                     if (TutorSystem.AllowAction(des.TutorTagDesignate))
                     {
                         des.DesignateThing(t);
                         des.Finalize(somethingSucceeded: true);
                     }
                 };
                 command_Action.hotKey   = des.hotKey;
                 command_Action.groupKey = des.groupKey;
                 gizmoList.Add(command_Action);
             }
         }
         objList.Clear();
         GizmoGridDrawer.DrawGizmoGrid(gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + GizmoGridDrawer.GizmoSpacing.y, out mouseoverGizmo);
         gizmoList.Clear();
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(ex.ToString(), 3427734);
     }
 }
コード例 #3
0
 public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo)
 {
     mouseoverGizmo = null;
     try
     {
         InspectGizmoGrid.objList.Clear();
         InspectGizmoGrid.objList.AddRange(selectedObjects);
         InspectGizmoGrid.gizmoList.Clear();
         for (int i = 0; i < InspectGizmoGrid.objList.Count; i++)
         {
             ISelectable selectable = InspectGizmoGrid.objList[i] as ISelectable;
             if (selectable != null)
             {
                 InspectGizmoGrid.gizmoList.AddRange(selectable.GetGizmos());
             }
         }
         for (int j = 0; j < InspectGizmoGrid.objList.Count; j++)
         {
             Thing t = InspectGizmoGrid.objList[j] as Thing;
             if (t != null)
             {
                 List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators;
                 for (int k = 0; k < allDesignators.Count; k++)
                 {
                     Designator des = allDesignators[k];
                     if (des.CanDesignateThing(t).Accepted)
                     {
                         Command_Action command_Action = new Command_Action();
                         command_Action.defaultLabel = des.LabelCapReverseDesignating(t);
                         float   iconAngle;
                         Vector2 iconOffset;
                         command_Action.icon        = des.IconReverseDesignating(t, out iconAngle, out iconOffset);
                         command_Action.iconAngle   = iconAngle;
                         command_Action.iconOffset  = iconOffset;
                         command_Action.defaultDesc = des.DescReverseDesignating(t);
                         command_Action.order       = ((!(des is Designator_Uninstall)) ? -20f : -11f);
                         command_Action.action      = delegate()
                         {
                             if (TutorSystem.AllowAction(des.TutorTagDesignate))
                             {
                                 des.DesignateThing(t);
                                 des.Finalize(true);
                             }
                         };
                         command_Action.hotKey   = des.hotKey;
                         command_Action.groupKey = des.groupKey;
                         InspectGizmoGrid.gizmoList.Add(command_Action);
                     }
                 }
             }
         }
         InspectGizmoGrid.objList.Clear();
         GizmoGridDrawer.DrawGizmoGrid(InspectGizmoGrid.gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + 20f, out mouseoverGizmo);
         InspectGizmoGrid.gizmoList.Clear();
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(ex.ToString(), 3427734, false);
     }
 }
コード例 #4
0
 public override void WindowUpdate()
 {
     base.WindowUpdate();
     InspectPaneUtility.UpdateTabs(this);
     if (this.mouseoverGizmo != null)
     {
         this.mouseoverGizmo.GizmoUpdateOnMouseover();
     }
 }
コード例 #5
0
 public override void ExtraOnGUI()
 {
     base.ExtraOnGUI();
     InspectPaneUtility.ExtraOnGUI(this);
     if (this.AnythingSelected && Find.DesignatorManager.SelectedDesignator != null)
     {
         Find.DesignatorManager.SelectedDesignator.DoExtraGuiControls(0f, this.PaneTopY);
     }
 }
コード例 #6
0
        private void DoCustomBottomButtons()
        {
            int              num              = TutorSystem.TutorialMode ? 4 : 5;
            int              num2             = (num < 4 || !((float)UI.screenWidth < 1340f)) ? 1 : 2;
            int              num3             = Mathf.CeilToInt((float)num / (float)num2);
            float            num4             = Page.BottomButSize.x * (float)num3 + 10f * (float)(num3 + 1);
            float            num5             = (float)num2 * Page.BottomButSize.y + 10f * (float)(num2 + 1);
            Rect             rect             = new Rect(((float)UI.screenWidth - num4) / 2f, (float)UI.screenHeight - num5 - 4f, num4, num5);
            WorldInspectPane worldInspectPane = Find.WindowStack.WindowOfType <WorldInspectPane>();

            if (worldInspectPane != null && rect.x < InspectPaneUtility.PaneWidthFor(worldInspectPane) + 4f)
            {
                rect.x = InspectPaneUtility.PaneWidthFor(worldInspectPane) + 4f;
            }
            Widgets.DrawWindowBackground(rect);
            float num6 = rect.xMin + 10f;
            float num7 = rect.yMin + 10f;

            Text.Font = GameFont.Small;
            if (Widgets.ButtonText(new Rect(num6, num7, Page.BottomButSize.x, Page.BottomButSize.y), "Back".Translate()) && CanDoBack())
            {
                DoBack();
            }
            num6 += Page.BottomButSize.x + 10f;
            if (!TutorSystem.TutorialMode)
            {
                if (Widgets.ButtonText(new Rect(num6, num7, Page.BottomButSize.x, Page.BottomButSize.y), "Advanced".Translate()))
                {
                    Find.WindowStack.Add(new Dialog_AdvancedGameConfig(Find.WorldInterface.SelectedTile));
                }
                num6 += Page.BottomButSize.x + 10f;
            }
            if (Widgets.ButtonText(new Rect(num6, num7, Page.BottomButSize.x, Page.BottomButSize.y), "SelectRandomSite".Translate()))
            {
                SoundDefOf.Click.PlayOneShotOnCamera();
                Find.WorldInterface.SelectedTile = TileFinder.RandomStartingTile();
                Find.WorldCameraDriver.JumpTo(Find.WorldGrid.GetTileCenter(Find.WorldInterface.SelectedTile));
            }
            num6 += Page.BottomButSize.x + 10f;
            if (num2 == 2)
            {
                num6  = rect.xMin + 10f;
                num7 += Page.BottomButSize.y + 10f;
            }
            if (Widgets.ButtonText(new Rect(num6, num7, Page.BottomButSize.x, Page.BottomButSize.y), "WorldFactionsTab".Translate()))
            {
                Find.WindowStack.Add(new Dialog_FactionDuringLanding());
            }
            num6 += Page.BottomButSize.x + 10f;
            if (Widgets.ButtonText(new Rect(num6, num7, Page.BottomButSize.x, Page.BottomButSize.y), "Next".Translate()) && CanDoNext())
            {
                DoNext();
            }
            num6 += Page.BottomButSize.x + 10f;
            GenUI.AbsorbClicksInRect(rect);
        }
コード例 #7
0
 private static void EntryClicked(IEnumerable <Hediff> diffs, Pawn pawn)
 {
     if (GetCombatLogInfo(diffs, out var _, out var combatLogEntry) && combatLogEntry != null && Find.BattleLog.Battles.Any((Battle b) => b.Concerns(pawn) && b.Entries.Any((LogEntry e) => e == combatLogEntry)))
     {
         ITab_Pawn_Log tab_Pawn_Log = InspectPaneUtility.OpenTab(typeof(ITab_Pawn_Log)) as ITab_Pawn_Log;
         if (tab_Pawn_Log != null)
         {
             tab_Pawn_Log.SeekTo(combatLogEntry);
             tab_Pawn_Log.Highlight(combatLogEntry);
         }
     }
 }
コード例 #8
0
 public static void ExtraOnGUI(IInspectPane pane)
 {
     if (pane.AnythingSelected)
     {
         if (KeyBindingDefOf.SelectNextInCell.KeyDownEvent)
         {
             pane.SelectNextInCell();
         }
         pane.DrawInspectGizmos();
         InspectPaneUtility.DoTabs(pane);
     }
 }
コード例 #9
0
 private static void ToggleTab(InspectTabBase tab, IInspectPane pane)
 {
     if (InspectPaneUtility.IsOpen(tab, pane) || (tab == null && pane.OpenTabType == null))
     {
         pane.OpenTabType = null;
         SoundDefOf.TabClose.PlayOneShotOnCamera(null);
     }
     else
     {
         tab.OnOpen();
         pane.OpenTabType = tab.GetType();
         SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
     }
 }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
 private static void DoTabs(IInspectPane pane)
 {
     try
     {
         float y     = (float)(pane.PaneTopY - 30.0);
         float num   = (float)(InspectPaneUtility.PaneWidthFor(pane) - 72.0);
         float width = 0f;
         bool  flag  = false;
         foreach (InspectTabBase curTab in pane.CurTabs)
         {
             if (curTab.IsVisible)
             {
                 Rect rect = new Rect(num, y, 72f, 30f);
                 width     = num;
                 Text.Font = GameFont.Small;
                 if (Widgets.ButtonText(rect, curTab.labelKey.Translate(), true, false, true))
                 {
                     InspectPaneUtility.InterfaceToggleTab(curTab, pane);
                 }
                 bool flag2 = curTab.GetType() == pane.OpenTabType;
                 if (!flag2 && !curTab.TutorHighlightTagClosed.NullOrEmpty())
                 {
                     UIHighlighter.HighlightOpportunity(rect, curTab.TutorHighlightTagClosed);
                 }
                 if (flag2)
                 {
                     curTab.DoTabGUI();
                     pane.RecentHeight = 700f;
                     flag = true;
                 }
                 num = (float)(num - 72.0);
             }
         }
         if (flag)
         {
             GUI.DrawTexture(new Rect(0f, y, width, 30f), InspectPaneUtility.InspectTabButtonFillTex);
         }
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(ex.ToString(), 742783);
     }
 }
コード例 #12
0
        public static InspectTabBase OpenTab(Type inspectTabType)
        {
            MainTabWindow_Inspect mainTabWindow_Inspect = (MainTabWindow_Inspect)MainButtonDefOf.Inspect.TabWindow;
            InspectTabBase        inspectTabBase        = (from t in mainTabWindow_Inspect.CurTabs
                                                           where inspectTabType.IsAssignableFrom(t.GetType())
                                                           select t).FirstOrDefault <InspectTabBase>();

            if (inspectTabBase != null)
            {
                if (Find.MainTabsRoot.OpenTab != MainButtonDefOf.Inspect)
                {
                    Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Inspect, true);
                }
                if (!InspectPaneUtility.IsOpen(inspectTabBase, mainTabWindow_Inspect))
                {
                    InspectPaneUtility.ToggleTab(inspectTabBase, mainTabWindow_Inspect);
                }
            }
            return(inspectTabBase);
        }
コード例 #13
0
 public override void WindowUpdate()
 {
     base.WindowUpdate();
     InspectPaneUtility.UpdateTabs(this);
 }
コード例 #14
0
 public string GetLabel(Rect rect)
 {
     return(InspectPaneUtility.AdjustedLabelFor(this.Selected, rect));
 }
コード例 #15
0
 public override void DoWindowContents(Rect inRect)
 {
     base.DoWindowContents(inRect);
     InspectPaneUtility.InspectPaneOnGUI(inRect, this);
 }
コード例 #16
0
        private void DoCustomBottomButtons()
        {
            int              num              = (!TutorSystem.TutorialMode) ? 5 : 4;
            int              num2             = (num < 4 || !((float)UI.screenWidth < 1340f)) ? 1 : 2;
            int              num3             = Mathf.CeilToInt((float)num / (float)num2);
            Vector2          bottomButSize    = Page.BottomButSize;
            float            num4             = bottomButSize.x * (float)num3 + 10f * (float)(num3 + 1);
            float            num5             = (float)num2;
            Vector2          bottomButSize2   = Page.BottomButSize;
            float            num6             = num5 * bottomButSize2.y + 10f * (float)(num2 + 1);
            Rect             rect             = new Rect(((float)UI.screenWidth - num4) / 2f, (float)UI.screenHeight - num6 - 4f, num4, num6);
            WorldInspectPane worldInspectPane = Find.WindowStack.WindowOfType <WorldInspectPane>();

            if (worldInspectPane != null && rect.x < InspectPaneUtility.PaneWidthFor(worldInspectPane) + 4f)
            {
                rect.x = InspectPaneUtility.PaneWidthFor(worldInspectPane) + 4f;
            }
            Widgets.DrawWindowBackground(rect);
            float num7 = rect.xMin + 10f;
            float num8 = rect.yMin + 10f;

            Text.Font = GameFont.Small;
            float   x = num7;
            float   y = num8;
            Vector2 bottomButSize3 = Page.BottomButSize;
            float   x2             = bottomButSize3.x;
            Vector2 bottomButSize4 = Page.BottomButSize;

            if (Widgets.ButtonText(new Rect(x, y, x2, bottomButSize4.y), "Back".Translate()) && CanDoBack())
            {
                DoBack();
            }
            float   num9           = num7;
            Vector2 bottomButSize5 = Page.BottomButSize;

            num7 = num9 + (bottomButSize5.x + 10f);
            if (!TutorSystem.TutorialMode)
            {
                float   x3             = num7;
                float   y2             = num8;
                Vector2 bottomButSize6 = Page.BottomButSize;
                float   x4             = bottomButSize6.x;
                Vector2 bottomButSize7 = Page.BottomButSize;
                if (Widgets.ButtonText(new Rect(x3, y2, x4, bottomButSize7.y), "Advanced".Translate()))
                {
                    Find.WindowStack.Add(new Dialog_AdvancedGameConfig(Find.WorldInterface.SelectedTile));
                }
                float   num10          = num7;
                Vector2 bottomButSize8 = Page.BottomButSize;
                num7 = num10 + (bottomButSize8.x + 10f);
            }
            float   x5              = num7;
            float   y3              = num8;
            Vector2 bottomButSize9  = Page.BottomButSize;
            float   x6              = bottomButSize9.x;
            Vector2 bottomButSize10 = Page.BottomButSize;

            if (Widgets.ButtonText(new Rect(x5, y3, x6, bottomButSize10.y), "SelectRandomSite".Translate()))
            {
                SoundDefOf.Click.PlayOneShotOnCamera();
                Find.WorldInterface.SelectedTile = TileFinder.RandomStartingTile();
                Find.WorldCameraDriver.JumpTo(Find.WorldGrid.GetTileCenter(Find.WorldInterface.SelectedTile));
            }
            float   num11           = num7;
            Vector2 bottomButSize11 = Page.BottomButSize;

            num7 = num11 + (bottomButSize11.x + 10f);
            if (num2 == 2)
            {
                num7 = rect.xMin + 10f;
                float   num12           = num8;
                Vector2 bottomButSize12 = Page.BottomButSize;
                num8 = num12 + (bottomButSize12.y + 10f);
            }
            float   x7 = num7;
            float   y4 = num8;
            Vector2 bottomButSize13 = Page.BottomButSize;
            float   x8 = bottomButSize13.x;
            Vector2 bottomButSize14 = Page.BottomButSize;

            if (Widgets.ButtonText(new Rect(x7, y4, x8, bottomButSize14.y), "WorldFactionsTab".Translate()))
            {
                Find.WindowStack.Add(new Dialog_FactionDuringLanding());
            }
            float   num13           = num7;
            Vector2 bottomButSize15 = Page.BottomButSize;

            num7 = num13 + (bottomButSize15.x + 10f);
            float   x9 = num7;
            float   y5 = num8;
            Vector2 bottomButSize16 = Page.BottomButSize;
            float   x10             = bottomButSize16.x;
            Vector2 bottomButSize17 = Page.BottomButSize;

            if (Widgets.ButtonText(new Rect(x9, y5, x10, bottomButSize17.y), "Next".Translate()) && CanDoNext())
            {
                DoNext();
            }
            float   num14           = num7;
            Vector2 bottomButSize18 = Page.BottomButSize;

            num7 = num14 + (bottomButSize18.x + 10f);
            GenUI.AbsorbClicksInRect(rect);
        }
コード例 #17
0
 public static Vector2 PaneSizeFor(IInspectPane pane)
 {
     return(new Vector2(InspectPaneUtility.PaneWidthFor(pane), 165f));
 }