Example #1
0
        private void SceneLoaded(Scene to, LoadSceneMode mode)
        {
            Logger.Debug($"Scene loaded: \"{to.name}\"");

            if (to.name == "MenuCore")
            {
                PluginUI.Init();

                GameController.Init(to);
                LeaderboardController.Init(to);
                Controllers.PlayerController.Init(to);
                VoiceChatWorker.Init();
            }

            try
            {
                if (to.name == "MenuCore" && SteamAPI.getLobbyID().m_SteamID > 0)
                {
                    Logger.Debug("Creating new lobby");
                    SteamAPI.CreateLobby(!Config.Instance.IsPublic);
                    Controllers.PlayerController.Instance.DestroyAvatars();
                }
            } catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Example #2
0
        private void ActiveSceneChanged(Scene from, Scene to)
        {
            Logger.Debug($"Active scene changed from \"{from.name}\" to \"{to.name}\"");
            CurrentScene = to.name;
            if (from.name == "EmptyTransition" && to.name == "Menu")
            {
                PluginUI.Init();

                GameController.Init(to);
                LeaderboardController.Init(to);
                Controllers.PlayerController.Init(to);
                VoiceChatWorker.Init();
            }
            else
            {
                GameController.Instance?.ActiveSceneChanged(from, to);
                LeaderboardController.Instance?.ActiveSceneChanged(from, to);
            }
        }