Esempio n. 1
0
        public void CreateUI()
        {
            try
            {
                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform  = _mainMenuViewController.transform as RectTransform;

                if (serverHubFlowCoordinator == null)
                {
                    serverHubFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <ServerHubFlowCoordinator>();
                }
                if (roomCreationFlowCoordinator == null)
                {
                    roomCreationFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <RoomCreationFlowCoordinator>();
                }
                if (roomFlowCoordinator == null)
                {
                    roomFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <RoomFlowCoordinator>();
                }
                if (modeSelectionFlowCoordinator == null)
                {
                    modeSelectionFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <ModeSelectionFlowCoordinator>();
                    modeSelectionFlowCoordinator.didFinishEvent += () =>
                    {
                        Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First().InvokeMethod("DismissFlowCoordinator", modeSelectionFlowCoordinator, null, false);

                        Plugin.discordActivity = default;
                        Plugin.discord?.ClearActivity();
                        if (SteamManager.Initialized)
                        {
                            SteamRichPresence.ClearSteamRichPresence();
                        }
                    };
                }

                /*
                 * if (channelSelectionFlowCoordinator == null)
                 * {
                 *  channelSelectionFlowCoordinator = BeatSaberUI.CreateFlowCoordinator<ChannelSelectionFlowCoordinator>();
                 * }
                 * if (radioFlowCoordinator == null)
                 * {
                 *  radioFlowCoordinator = BeatSaberUI.CreateFlowCoordinator<RadioFlowCoordinator>();
                 * }*/

                CreateOnlineButton();

                StartCoroutine(CheckVersion());

                _settings = new GameObject("Multiplayer Settings").AddComponent <Settings>();
                BSMLSettings.instance.AddSettingsMenu("Multiplayer", "BeatSaberMultiplayer.UI.Settings", _settings);
            }
            catch (Exception e)
            {
                Plugin.log.Critical($"Unable to create UI! Exception: {e}");
            }
        }
        public void CreateUI()
        {
            try
            {
                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform  = _mainMenuViewController.transform as RectTransform;

                if (serverHubFlowCoordinator == null)
                {
                    serverHubFlowCoordinator = new GameObject("ServerHubFlow").AddComponent <ServerHubFlowCoordinator>();
                }
                if (roomCreationFlowCoordinator == null)
                {
                    roomCreationFlowCoordinator = new GameObject("RoomCreationFlow").AddComponent <RoomCreationFlowCoordinator>();
                }
                if (roomFlowCoordinator == null)
                {
                    roomFlowCoordinator = new GameObject("RoomFlow").AddComponent <RoomFlowCoordinator>();
                }
                if (modeSelectionFlowCoordinator == null)
                {
                    modeSelectionFlowCoordinator = new GameObject("ModeSelectFlow").AddComponent <ModeSelectionFlowCoordinator>();
                }
                if (channelSelectionFlowCoordinator == null)
                {
                    channelSelectionFlowCoordinator = new GameObject("ChannelSelectFlow").AddComponent <ChannelSelectionFlowCoordinator>();
                }
                if (radioFlowCoordinator == null)
                {
                    radioFlowCoordinator = new GameObject("RadioFlow").AddComponent <RadioFlowCoordinator>();
                }

                CreateOnlineButton();
                SongCore.Loader.SongsLoadedEvent += SongsLoaded;

                StartCoroutine(CheckVersion());

                CreateMenu();
            }
            catch (Exception e)
            {
                Plugin.log.Critical($"Unable to create UI! Exception: {e}");
            }
        }