Ejemplo n.º 1
0
        public void HookProcessSwitch(On.ProcessManager.orig_SwitchMainProcess orig, ProcessManager instance, ProcessManager.ProcessID id)
        {
            if (instance.currentMainLoop != null)
            {
                if (instance.currentMainLoop.ID == ProcessManager.ProcessID.Game)
                {
                    Debug.Log("Switching off of game");

                    if (playerObject != null)
                    {
                        playerObject.Destroy();
                    }
                }
            }

            orig(instance, id);

            if (id == ProcessManager.ProcessID.SlugcatSelect)
            {
                currentMenu = (instance.currentMainLoop as SlugcatSelectMenu);
                newCharacterMenuContainer = new MenuContainer(currentMenu, currentMenu.pages[0], Vector2.zero);
                CreateMenu();
                currentMenu.pages[0].subObjects.Add(newCharacterMenuContainer);
                newCharacterMenuContainer.menu = currentMenu;
                UpdateMenu();
            }
            else if (isMenuInitialized)
            {
                DestroyMenu();
            }
        }
Ejemplo n.º 2
0
 private void ProcessManager_SwitchMainProcess(On.ProcessManager.orig_SwitchMainProcess orig, ProcessManager self, ProcessManager.ProcessID ID)
 {
     orig(self, ID);
     active = false;
     if (self.currentMainLoop is RainWorldGame game)
     {
         UpdateActive(game);
     }
 }
Ejemplo n.º 3
0
        private static void SwitchMainProcessHK(On.ProcessManager.orig_SwitchMainProcess orig, ProcessManager self, ProcessManager.ProcessID ID)
        {
            if (self.currentMainLoop?.ID == ProcessManager.ProcessID.Game && ID != ProcessManager.ProcessID.Game)
            {
                InGameClear();
            }
            if (!MonklandSteamManager.isInGame)
            {
                orig(self, ID);
                return;
            }

            ProcessManager.ProcessID newID = ID;

            switch (ID)
            {
            case ProcessManager.ProcessID.SleepScreen:
            case ProcessManager.ProcessID.DeathScreen:
            case ProcessManager.ProcessID.StarveScreen:
                break;

            case ProcessManager.ProcessID.GhostScreen:
            case ProcessManager.ProcessID.KarmaToMaxScreen:
            case ProcessManager.ProcessID.SlideShow:
            case ProcessManager.ProcessID.FastTravelScreen:
            case ProcessManager.ProcessID.RegionsOverviewScreen:
            case ProcessManager.ProcessID.Credits:
            case ProcessManager.ProcessID.Statistics:
                newID = ProcessManager.ProcessID.SleepScreen;
                break;

            default: orig(self, ID); return;
            }

            MainLoopProcess mainLoopProcess = self.currentMainLoop;

            self.shadersTime = 0f;
            if (ID == ProcessManager.ProcessID.Game && self.menuMic != null)
            {
                self.menuMic = null;
                self.sideProcesses.Remove(self.menuMic);
            }
            else if (ID != ProcessManager.ProcessID.Game && self.menuMic == null)
            {
                self.menuMic = new MenuMicrophone(self, self.soundLoader);
                self.sideProcesses.Add(self.menuMic);
            }
            if (self.currentMainLoop != null)
            {
                self.currentMainLoop.ShutDownProcess();
                self.currentMainLoop.processActive = false;
                self.currentMainLoop = null;
                self.soundLoader.ReleaseAllUnityAudio();
                HeavyTexturesCache.ClearRegisteredFutileAtlases();
                GC.Collect();
                Resources.UnloadUnusedAssets();
            }
            if (ID != ProcessManager.ProcessID.SleepScreen && ID != ProcessManager.ProcessID.GhostScreen &&
                ID != ProcessManager.ProcessID.DeathScreen && ID != ProcessManager.ProcessID.KarmaToMaxScreen)
            {
                self.rainWorld.progression.Revert();
            }

            self.currentMainLoop = new MultiplayerSleepAndDeathScreen(self, newID);

            if (mainLoopProcess != null)
            {
                mainLoopProcess.CommunicateWithUpcomingProcess(self.currentMainLoop);
            }
            self.blackFadeTime = self.currentMainLoop.FadeInTime;
            self.blackDelay    = self.currentMainLoop.InitialBlackSeconds;
            if (self.fadeSprite != null)
            {
                self.fadeSprite.RemoveFromContainer();
                Futile.stage.AddChild(self.fadeSprite);
            }
            if (self.loadingLabel != null)
            {
                self.loadingLabel.RemoveFromContainer();
                Futile.stage.AddChild(self.loadingLabel);
            }
            if (self.musicPlayer != null)
            {
                self.musicPlayer.UpdateMusicContext(self.currentMainLoop);
            }
            self.pauseFadeUpdate = true;
        }