Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadnix-was-taken committed May 28, 2021
1 parent 425d9fb commit 598f29b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class Plugin
{
public static string PluginName => "SaberTailor";
public static SemVer.Version PluginVersion { get; private set; } = new SemVer.Version("0.0.0"); // Default
internal static bool IsBSMLMenuLoaded = false;

[Init]
public void Init(IPALogger logger, PluginMetadata metadata)
Expand All @@ -40,19 +39,13 @@ public void Init(IPALogger logger, PluginMetadata metadata)

public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
{
Logger.log.Info("Switching scene. Prev scene name is '" + prevScene.name + "' and next scene name is '" + nextScene.name + "'");
if (nextScene.name == "GameCore")
{
if (Configuration.Scale.TweakEnabled)
{
new GameObject(PluginName).AddComponent<SaberLength>();
}
}
else if (nextScene.name == "MainMenu" && !IsBSMLMenuLoaded)
{
BSMLSettings.instance.AddSettingsMenu("SaberTailor", "SaberTailor.Settings.UI.Views.mainsettings.bsml", MainSettings.instance);
IsBSMLMenuLoaded = true;
}
}

private void Load()
Expand All @@ -62,6 +55,7 @@ private void Load()

AddEvents();

BSMLSettings.instance.AddSettingsMenu("SaberTailor", "SaberTailor.Settings.UI.Views.mainsettings.bsml", MainSettings.instance);
Logger.log.Info($"{PluginName} v.{PluginVersion} has started.");
}

Expand All @@ -70,6 +64,8 @@ private void Unload()
SaberTailorPatches.RemoveHarmonyPatches();
Configuration.Save();
RemoveEvents();

BSMLSettings.instance.RemoveSettingsMenu(MainSettings.instance);
}

private void AddEvents()
Expand Down

0 comments on commit 598f29b

Please sign in to comment.