private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { try { Console.WriteLine("scene.name == " + scene.name); if (scene.name == "Menu") { if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent; } //panelBehavior = new GameObject("panelBehavior").AddComponent<PanelBehavior>(); } else if (scene.name == "GameCore") { //if (!loader) // loader = Resources.FindObjectsOfTypeAll<AsyncScenesLoader>().FirstOrDefault(); //loader.loadingDidFinishEvent += OnLoadingDidFinishGame; SharedCoroutineStarter.instance.StartCoroutine(OnLoadingDidFinishGame()); } } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); } }
public static void Init() { Plugin.ApplyHarmonyPatches(); if (CharacteristicSelectionViewController == null) { CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (CharacteristicSelectionViewController == null) { Utilities.Logger.Log("Characteristic View Controller null"); return; } CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent; } if (MainMenuViewController == null) { SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); PartyFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); if (MainMenuViewController == null) { return; } MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent; } }
private void SceneManager_activeSceneChanged(UnityEngine.SceneManagement.Scene arg0, UnityEngine.SceneManagement.Scene arg1) { if (arg1.name == "Menu") { if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent; } if (_soloFlowCoordinator == null) { _soloFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); if (_soloFlowCoordinator == null) { return; } _soloDetailView = _soloFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); _practiceViewController = _soloFlowCoordinator.GetPrivateField <PracticeViewController>("_practiceViewController"); if (_soloDetailView != null) { _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent; } else { Log("Detail View Null", Plugin.LogLevel.Info); } if (_practiceViewController != null) { _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent; } else { Log("Practice View Null", Plugin.LogLevel.Info); } } if (_partyFlowCoordinator == null) { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); } if (saveRequested) { Settings.Save(); saveRequested = false; } } }
private void OnDidSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController viewController, BeatmapCharacteristicSO characteristic) { switch (characteristic.characteristicName) { case "No Arrows": _gamemode = GameMode.NoArrows; break; case "One Saber": _gamemode = GameMode.OneSaber; break; default: _gamemode = GameMode.Standard; break; } }
public static void InitializeCoordinators() { if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent; } if (_soloFlowCoordinator == null) { _soloFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); if (_soloFlowCoordinator == null) { return; } _soloDetailView = _soloFlowCoordinator.GetField <StandardLevelDetailViewController>("_levelDetailViewController"); _practiceViewController = _soloFlowCoordinator.GetField <PracticeViewController>("_practiceViewController"); if (_soloDetailView != null) { _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent; } else { ChromaLogger.Log("Detail View Null", ChromaLogger.Level.WARNING); } if (_practiceViewController != null) { _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent; } else { ChromaLogger.Log("Practice View Null", ChromaLogger.Level.WARNING); } } if (_partyFlowCoordinator == null) { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); } }
private static void CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO arg2) { GameMode = arg2.characteristicName; }
private void _characteristicViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO arg2) { _gameplayMode = arg2.characteristicName; }
private void OnSceneLoaded(Scene newScene, LoadSceneMode mode) { string templateText; if (!File.Exists(_templatePath)) { templateText = _defaultTemplate; File.WriteAllText(_templatePath, templateText); } else { templateText = File.ReadAllText(_templatePath); } if (newScene.name == MenuSceneName) { //Menu scene loaded File.WriteAllText(_statusPath, string.Empty); _beatmapCharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_beatmapCharacteristicSelectionViewController == null) { return; } _beatmapCharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += this.OnDidSelectBeatmapCharacteristicEvent; } else if (newScene.name != MenuSceneName) { _mainSetupData = Resources.FindObjectsOfTypeAll <StandardLevelSceneSetupDataSO>().FirstOrDefault(); if (_mainSetupData == null) { Console.WriteLine("Song Status: Error finding the scriptable objects required to update presence."); return; } //Main game scene loaded var diff = _mainSetupData.difficultyBeatmap; var song = diff.level; var mods = _mainSetupData.gameplayCoreSetupData.gameplayModifiers; var modsList = string.Empty; if (!mods.IsWithoutModifiers()) { modsList += mods.instaFail ? "Instant Fail, " : string.Empty; modsList += mods.batteryEnergy ? "Battery Energy, " : string.Empty; modsList += mods.disappearingArrows ? "Disappearing Arrows, " : string.Empty; modsList += mods.noBombs ? "No Bombs, " : string.Empty; modsList += mods.noObstacles ? "No Walls, " : string.Empty; modsList += mods.songSpeedMul != 1.0f ? "Speed " + mods.songSpeedMul + "x" : string.Empty; modsList = modsList.Trim(new char[] { ' ', ',' }); } var gameplayModeText = _gamemode == GameMode.OneSaber ? "One Saber" : _gamemode == GameMode.NoArrows ? "No Arrow" : "Standard"; var keywords = templateText.Split('{', '}'); templateText = ReplaceKeyword("songName", song.songName, keywords, templateText); templateText = ReplaceKeyword("songSubName", song.songSubName, keywords, templateText); templateText = ReplaceKeyword("authorName", song.songAuthorName, keywords, templateText); templateText = ReplaceKeyword("gamemode", gameplayModeText, keywords, templateText); templateText = ReplaceKeyword("difficulty", diff.difficulty.Name(), keywords, templateText); templateText = ReplaceKeyword("isNoFail", mods.noFail ? "No Fail" : string.Empty, keywords, templateText); templateText = ReplaceKeyword("modifiers", modsList, keywords, templateText); templateText = ReplaceKeyword("beatsPerMinute", song.beatsPerMinute.ToString(CultureInfo.InvariantCulture), keywords, templateText); templateText = ReplaceKeyword("notesCount", diff.beatmapData.notesCount.ToString(CultureInfo.InvariantCulture), keywords, templateText); templateText = ReplaceKeyword("obstaclesCount", diff.beatmapData.obstaclesCount.ToString(CultureInfo.InvariantCulture), keywords, templateText); File.WriteAllText(_statusPath, templateText); } }
private void _characteristicViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO characteristic) { // Standard, One Saber, No Arrows selectedCharacteristic = characteristic.characteristicName; }
private static void _characteristicViewController_didSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController arg1, BeatmapCharacteristicSO arg2) { currentGameplayModeString = arg2.characteristicName; ChromaLogger.Log("Gameplaymode Change : |" + currentGameplayModeString + "|"); }
private void OnDidSelectBeatmapCharacteristicEvent(BeatmapCharacteristicSelectionViewController viewController, BeatmapCharacteristicSO characteristic) { _noArrowsSelected = characteristic.characteristicName == "No Arrows"; }
private void OnSceneTransitioned(Scene activeScene) { GameObject.Destroy(GameObject.Find("SongLoader Color Setter")); customSongColors = IllusionPlugin.ModPrefs.GetBool("Songloader", "customSongColors", true, true); customSongPlatforms = IllusionPlugin.ModPrefs.GetBool("Songloader", "customSongPlatforms", true, true); if (AreSongsLoading) { //Scene changing while songs are loading. Since we are using a separate thread while loading, this is bad and could cause a crash. //So we have to stop loading. if (_loadingTask != null) { _loadingTask.Cancel(); _loadingCancelled = true; AreSongsLoading = false; LoadingProgress = 0; StopAllCoroutines(); _progressBar.ShowMessage("Loading cancelled\n<size=80%>Press Ctrl+R to refresh</size>"); Log("Loading was cancelled by player since they loaded another scene."); } } StartCoroutine(WaitRemoveScores()); if (activeScene.name == MenuSceneName) { CurrentLevelPlaying = null; if (CustomLevelCollectionSO == null) { var levelCollectionSO = Resources.FindObjectsOfTypeAll <LevelCollectionSO>().FirstOrDefault(); CustomLevelCollectionSO = CustomLevelCollectionSO.ReplaceOriginal(levelCollectionSO); } else { CustomLevelCollectionSO.ReplaceReferences(); } if (_standardLevelDetailViewController == null) { _standardLevelDetailViewController = Resources.FindObjectsOfTypeAll <StandardLevelDetailViewController>().FirstOrDefault(); if (_standardLevelDetailViewController == null) { return; } _standardLevelDetailViewController.didPressPlayButtonEvent += StandardLevelDetailControllerOnDidPressPlayButtonEvent; } if (_LevelListViewController == null) { _LevelListViewController = Resources.FindObjectsOfTypeAll <LevelListViewController>().FirstOrDefault(); if (_LevelListViewController == null) { return; } _LevelListViewController.didSelectLevelEvent += StandardLevelListViewControllerOnDidSelectLevelEvent; } if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += OnDidSelectBeatmapCharacteristicEvent; } if (CustomPlatformsPresent) { CheckForPreviousPlatform(); } } else if (activeScene.name == GameSceneName) { _standardLevelSceneSetupData = Resources.FindObjectsOfTypeAll <StandardLevelSceneSetupDataSO>().FirstOrDefault(); if (_standardLevelSceneSetupData == null) { return; } var level = _standardLevelSceneSetupData.difficultyBeatmap; var beatmap = level as CustomLevel.CustomDifficultyBeatmap; if (beatmap != null) { CurrentLevelPlaying = beatmap; //The note jump movement speed now gets set in the Start method, so we're too early here. We have to wait a bit before overriding. Invoke(nameof(DelayedNoteJumpMovementSpeedFix), 0.1f); } if (NoteHitVolumeChanger.PrefabFound) { return; } var song = CustomLevels.FirstOrDefault(x => x.levelID == level.level.levelID); if (song == null) { return; } NoteHitVolumeChanger.SetVolume(song.customSongInfo.noteHitVolume, song.customSongInfo.noteMissVolume); //Set environment if the song has customEnvironment if (CustomPlatformsPresent) { CheckCustomSongEnvironment(song); } //Set enviroment colors for the song if it has song specific colors if (customSongColors) { song.SetSongColors(CurrentLevelPlaying.colorLeft, CurrentLevelPlaying.colorRight, CurrentLevelPlaying.hasCustomColors); } } }