private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode arg1) { if (scene.name == "MenuCore") { NotesLeftCounterUI.CreateUI(); } }
public void OnApplicationStart() { SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded += SceneManager_sceneLoaded; NotesLeftCounterUI.ReadPrefs(); if (IPA.Loader.PluginManager.Plugins.Any(x => x.Name == "Counters+") || IPA.Loader.PluginManager.AllPlugins.Any(x => x.Metadata.Id == "Counters+")) { CountersPlusInstalled = true; AddCustomCounter(); } }
private void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) { NotesLeftCounterUI.ReadPrefs(); if (newScene.name == "GameCore") { if (_spawnController == null) { _spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); } if (_spawnController == null) { return; } _spawnController.noteWasCutEvent -= _spawnController_noteWasCutEvent; _spawnController.noteWasMissedEvent -= _spawnController_noteWasMissedEvent; if (LevelData == null) { LevelData = BS_Utils.Plugin.LevelData; } if (LevelData == null) { return; } if (NotesLeftCounterUI.ShowNoteCounter && LevelData?.GameplayCoreSceneSetupData?.practiceSettings == null) { Log("Attempting to Create Note Counter"); _spawnController.noteWasCutEvent += _spawnController_noteWasCutEvent; _spawnController.noteWasMissedEvent += _spawnController_noteWasMissedEvent; _notesLeftCounter = new GameObject("NotesLeftCounter").AddComponent <NotesLeftCounter>(); } } }