private void SavePreset(RoomSettings settings, string name)
        {
            RoomPreset preset = new RoomPreset(settings);

            preset.SavePreset("UserData/RoomPresets/" + name + ".json");
            PresetsCollection.ReloadPresets();
        }
Esempio n. 2
0
        public void OnApplicationStart()
        {
#if DEBUG
            if (Environment.CommandLine.Contains("fpfc"))
            {
                QualitySettings.vSyncCount  = 2;
                Application.targetFrameRate = 60;
            }
#endif

            instance = this;

#if DEBUG
            DebugForm.OnLoad();
#endif

            BSEvents.OnLoad();
            BSEvents.menuSceneLoadedFresh += MenuSceneLoadedFresh;
            BSEvents.menuSceneLoaded      += MenuSceneLoaded;
            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);
            }

            Sprites.ConvertSprites();

            ScrappedData.Instance.DownloadScrappedData(null);

            try
            {
                var harmony = HarmonyInstance.Create("com.andruzzzhka.BeatSaberMultiplayer");
                harmony.PatchAll(Assembly.GetExecutingAssembly());
            }
            catch (Exception e)
            {
                Plugin.log.Info("Unable to patch assembly! Exception: " + e);
            }
        }
Esempio n. 3
0
        public void OnApplicationStart()
        {
#if DEBUG
            if (Environment.CommandLine.Contains("fpfc"))
            {
                QualitySettings.vSyncCount = 1;
            }
#endif

            if (File.Exists("MPLog.txt"))
            {
                File.Delete("MPLog.txt");
            }

            instance = this;

#if DEBUG
            DebugForm.OnLoad();
#endif

            BSEvents.OnLoad();
            BSEvents.menuSceneLoadedFresh += MenuSceneLoadedFresh;
            BSEvents.menuSceneLoaded      += MenuSceneLoaded;
            BSEvents.gameSceneLoaded      += GameSceneLoaded;

            if (Config.Load())
            {
                Misc.Logger.Info("Loaded config!");
            }
            else
            {
                Config.Create();
            }
            try
            {
                PresetsCollection.ReloadPresets();
            }
            catch (Exception e)
            {
                Misc.Logger.Warning("Unable to load presets! Exception: " + e);
            }
            Sprites.ConvertSprites();

            ScrappedData.Instance.DownloadScrappedData(null);
        }
Esempio n. 4
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;
        }