12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using UnityEngine.SceneManagement;
- using SongBrowser.UI;
- using Logger = SongBrowser.Logging.Logger;
- using SongBrowser.DataAccess;
- using System.Collections.Generic;
- using SongBrowser.Internals;
- using System;
- using IPA;
- namespace SongBrowser
- {
- public class Plugin : IBeatSaberPlugin
- {
- public const string VERSION_NUMBER = "5.5.0";
- public static Plugin Instance;
- public static IPA.Logging.Logger Log;
- public void Init(object nullObject, IPA.Logging.Logger logger)
- {
- Log = logger;
- }
- public void OnApplicationStart()
- {
- Instance = this;
- PluginConfig.LoadOrCreateConfig();
- Base64Sprites.Init();
- PlaylistsCollection.ReloadPlaylists();
- SongCore.Loader.SongsLoadedEvent += SongCore_SongsLoadedEvent;
- BSEvents.OnLoad();
- BSEvents.menuSceneLoadedFresh += OnMenuSceneLoadedFresh;
- }
- public void OnApplicationQuit()
- {
- }
- private void OnMenuSceneLoadedFresh()
- {
- try
- {
- SongBrowserApplication.OnLoad();
- }
- catch (Exception e)
- {
- Logger.Exception("Exception on fresh menu scene change: " + e);
- }
- }
- public void SongCore_SongsLoadedEvent(SongCore.Loader sender, Dictionary<string, CustomPreviewBeatmapLevel> levels)
- {
- try
- {
- PlaylistsCollection.MatchSongsForAllPlaylists(true);
- }
- catch (Exception e)
- {
- Logger.Exception("Unable to match songs for all playlists! Exception: " + e);
- }
- }
- public void OnUpdate()
- {
- }
- public void OnFixedUpdate()
- {
- }
- public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
- {
-
- }
- public void OnSceneUnloaded(Scene scene)
- {
- }
- public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
- {
- }
- }
- }
|