Exemplo n.º 1
0
        public void OnApplicationStart()
        {
            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;
        }