public void Awake() { if (Instance == null) { Instance = this; SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; DontDestroyOnLoad(gameObject); } else { Destroy(this); } }
private void CreatUI() { var subMenu = SettingsUI.CreateSubMenu("Random Song"); var min = subMenu.AddList("Min Song Difficulty", Difficulties()); min.GetValue += delegate { return((float)minDiff); }; min.SetValue += delegate(float value) { minDiff = (LevelDifficulty)value; ModPrefs.SetInt(Plugin.PluginName, minDiffSetting, (int)minDiff); }; min.FormatValue += delegate(float value) { return(LevelDifficultyMethods.Name((LevelDifficulty)value)); }; var max = subMenu.AddList("Max Song Difficulty", Difficulties()); max.GetValue += delegate { return((float)maxDiff); }; max.SetValue += delegate(float value) { maxDiff = (LevelDifficulty)value; ModPrefs.SetInt(Plugin.PluginName, maxDiffSetting, (int)maxDiff); }; max.FormatValue += delegate(float value) { return(LevelDifficultyMethods.Name((LevelDifficulty)value)); }; var exclude = subMenu.AddBool("Exclude Standard Songs"); exclude.GetValue += delegate { return(excludeStandard); }; exclude.SetValue += delegate(bool value) { excludeStandard = value; ModPrefs.SetBool(Plugin.PluginName, excludeStandardSetting, excludeStandard); }; var autoPlayMenu = subMenu.AddBool("Auto Play"); autoPlayMenu.GetValue += delegate { return(autoPlay); }; autoPlayMenu.SetValue += delegate(bool value) { autoPlay = value; ModPrefs.SetBool(Plugin.PluginName, autoPlaySetting, autoPlay); }; }