You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5 KiB

  1. using IPA;
  2. using UnityEngine.SceneManagement;
  3. using IPALogger = IPA.Logging.Logger;
  4. using CustomUI.BeatSaber;
  5. using BSIPA_ModList.UI;
  6. using CustomUI.MenuButton;
  7. using UnityEngine.Events;
  8. namespace BSIPA_ModList
  9. {
  10. internal static class Logger
  11. {
  12. internal static IPALogger log { get; set; }
  13. }
  14. public class Plugin : IBeatSaberPlugin
  15. {
  16. public void Init(IPALogger logger)
  17. {
  18. Logger.log = logger;
  19. Logger.log.Debug("Init");
  20. }
  21. public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
  22. {
  23. }
  24. public void OnApplicationQuit()
  25. {
  26. }
  27. private ModListMenu menu;
  28. private MenuButton button;
  29. public void OnApplicationStart()
  30. {
  31. Logger.log.Debug("Creating Menu");
  32. }
  33. public void OnFixedUpdate()
  34. {
  35. }
  36. public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
  37. {
  38. if (scene.name == "MenuCore" && button == null)
  39. {
  40. menu = BeatSaberUI.CreateCustomMenu<ModListMenu>("Installed Mods");
  41. button = MenuButtonUI.AddButton("All Mods", "Shows all installed mods, along with controls for updating them.", () =>
  42. {
  43. Logger.log.Debug("Presenting menu");
  44. menu.Present();
  45. });
  46. }
  47. }
  48. public void OnSceneUnloaded(Scene scene)
  49. {
  50. }
  51. public void OnUpdate()
  52. {
  53. }
  54. }
  55. }