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 Enable() { instance = this; BS_Utils.Utilities.BSEvents.OnLoad(); BS_Utils.Utilities.BSEvents.menuSceneLoadedFresh += MenuSceneLoadedFresh; BS_Utils.Utilities.BSEvents.menuSceneLoaded += MenuSceneLoaded; BS_Utils.Utilities.BSEvents.gameSceneLoaded += GameSceneLoaded; if (Config.Load()) { log.Info("Loaded config!"); } else { Config.Create(); } try { PresetsCollection.ReloadPresets(); } catch (Exception e) { log.Warn("Unable to load presets! Exception: " + e); } try { AvatarsHashCache.Load(); } catch (Exception e) { log.Warn("Unable to load avatar hashes! Exception: " + e); } Sprites.ConvertSprites(); ScrappedData.Instance.DownloadScrappedData(null); try { HarmonyPatcher.Patch(); } catch (Exception e) { Plugin.log.Error("Unable to patch assembly! Exception: " + e); } if (IPA.Loader.PluginManager.GetPluginFromId("BeatSaverDownloader") != null) { DownloaderExists = true; } discord = DiscordManager.instance.CreateInstance(new DiscordSettings() { modId = "BeatSaberMultiplayer", modName = "Beat Saber Multiplayer", modIcon = Sprites.onlineIcon, handleInvites = true, appId = 661577830919962645 }); discord.OnActivityJoin += OnActivityJoin; discord.OnActivityJoinRequest += ActivityManager_OnActivityJoinRequest; discord.OnActivityInvite += ActivityManager_OnActivityInvite; if (SteamManager.Initialized) { SteamRichPresence.Init(); } }