Plugin.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using UnityEngine.SceneManagement;
  2. using IllusionPlugin;
  3. using UnityEngine;
  4. using SongBrowserPlugin.UI;
  5. using Logger = SongBrowserPlugin.Logging.Logger;
  6. using SongBrowserPlugin.DataAccess;
  7. using System.Collections.Generic;
  8. namespace SongBrowserPlugin
  9. {
  10. public class Plugin : IPlugin
  11. {
  12. public const string VERSION_NUMBER = "v2.4.6";
  13. public string Name
  14. {
  15. get { return "Song Browser"; }
  16. }
  17. public string Version
  18. {
  19. get { return VERSION_NUMBER; }
  20. }
  21. public void OnApplicationStart()
  22. {
  23. SceneManager.sceneLoaded += SceneManager_sceneLoaded;
  24. SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
  25. Base64Sprites.Init();
  26. }
  27. private void SceneManager_activeSceneChanged(Scene from, Scene to)
  28. {
  29. Logger.Info($"Active scene changed from \"{from.name}\" to \"{to.name}\"");
  30. if (from.name == "EmptyTransition" && to.name.Contains("Menu"))
  31. {
  32. OnMenuSceneEnabled();
  33. }
  34. }
  35. private void SceneManager_sceneLoaded(Scene to, LoadSceneMode loadMode)
  36. {
  37. Logger.Debug($"Loaded scene \"{to.name}\"");
  38. }
  39. private void OnMenuSceneEnabled()
  40. {
  41. SongBrowserApplication.OnLoad();
  42. }
  43. public void OnApplicationQuit()
  44. {
  45. }
  46. public void OnLevelWasLoaded(int level)
  47. {
  48. }
  49. public void OnLevelWasInitialized(int level)
  50. {
  51. }
  52. public void OnUpdate()
  53. {
  54. }
  55. public void OnFixedUpdate()
  56. {
  57. }
  58. }
  59. }