Beispiel #1
0
 public void SetCurrentTab(MainButtonDef tab, bool playSound = true)
 {
     if (tab != OpenTab)
     {
         ToggleTab(tab, playSound);
     }
 }
 public void SetCurrentTab(MainButtonDef tab, bool playSound = true)
 {
     if (tab == this.OpenTab)
     {
         return;
     }
     this.ToggleTab(tab, playSound);
 }
 public void ToggleTab(MainButtonDef newTab, bool playSound = true)
 {
     if (this.OpenTab == null && newTab == null)
     {
         return;
     }
     if (this.OpenTab == newTab)
     {
         Find.WindowStack.TryRemove(this.OpenTab.TabWindow, true);
         if (playSound)
         {
             SoundDefOf.TabClose.PlayOneShotOnCamera(null);
         }
     }
     else
     {
         if (this.OpenTab != null)
         {
             Find.WindowStack.TryRemove(this.OpenTab.TabWindow, true);
         }
         if (newTab != null)
         {
             Find.WindowStack.Add(newTab.TabWindow);
         }
         if (playSound)
         {
             if (newTab == null)
             {
                 SoundDefOf.TabClose.PlayOneShotOnCamera(null);
             }
             else
             {
                 SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
             }
         }
         if (TutorSystem.TutorialMode && newTab != null)
         {
             TutorSystem.Notify_Event("Open-MainTab-" + newTab.defName);
         }
     }
 }
        public void Notify_SwitchedMap()
        {
            designatorManager.Deselect();
            reverseDesignatorDatabase.Reinit();
            selector.ClearSelection();
            selector.dragBox.active = false;
            targeter.StopTargeting();
            MainButtonDef        openTab = Find.MainTabsRoot.OpenTab;
            List <MainButtonDef> allDefsListForReading = DefDatabase <MainButtonDef> .AllDefsListForReading;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                allDefsListForReading[i].Notify_SwitchedMap();
            }
            if (openTab != null && openTab != MainButtonDefOf.Inspect)
            {
                Find.MainTabsRoot.SetCurrentTab(openTab, playSound: false);
            }
            if (Find.CurrentMap != null)
            {
                RememberedCameraPos rememberedCameraPos = Find.CurrentMap.rememberedCameraPos;
                Find.CameraDriver.SetRootPosAndSize(rememberedCameraPos.rootPos, rememberedCameraPos.rootSize);
            }
        }
 private static int <MainButtonsRoot> m__0(MainButtonDef x)
 {
     return(x.order);
 }
 private static bool <DoButtons> m__1(MainButtonDef x)
 {
     return(x.buttonVisible);
 }