public static IEnumerator Pause() { yield return(new WaitForSeconds(0f)); StandardLevelGameplayManager pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); pauseManager.HandlePauseTriggered(); }
private void Update() { if (Input.GetKeyDown(KeyCode.Escape) && isGameScene(SceneManager.GetActiveScene())) { pauseMenuManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().First(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); gameplayManager.HandlePauseTriggered(); pauseMenuManager.MenuButtonPressed(); } }
internal static void setupStuff() { SpawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); PauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); PlayerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); SaberManager = PlayerController.GetField("_saberManager") as SaberManager; leftSaber = SaberManager.GetPrivateField <Saber>("_leftSaber") as Saber; rightSaber = SaberManager.GetPrivateField <Saber>("_rightSaber") as Saber; }
public void Awake() { iniModEnable = ModPrefs.GetBool(name, "Enabled", iniModEnable, true); threshold = ModPrefs.GetFloat(name, "FPSThreshold", threshold, true); fpsCheckEnable = ModPrefs.GetBool(name, "FPSCheckerOn", fpsCheckEnable, true); updatePeriod = ModPrefs.GetFloat(name, "ResponseTime", updatePeriod, true); _playerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); _gamePlayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); System.Console.WriteLine("[AutoPause] Pauser Awakened"); }
internal static void ResetHell() { SpawnController.noteWasMissedEvent -= MissHell_noteWasMissedEvent; SpawnController.noteWasCutEvent -= MissHell_noteWasCutEvent; SpawnController = null; PauseManager = null; SaberManager = null; PlayerController.transform.position = StartPosition; }
IEnumerator InitControllers() { yield return(new WaitUntil(delegate() { return FindObjectOfType <ScoreController>() != null && FindObjectOfType <GameEnergyCounter>() != null; })); StandardLevelGameplayManager _gameManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); _gameplayModifiersSO = Resources.FindObjectsOfTypeAll <GameplayModifiersModelSO>().FirstOrDefault(); if (_gameManager != null) { try { if (ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger") != null) { ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").pauseTriggeredEvent -= _gameManager.HandlePauseTriggered; ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").pauseTriggeredEvent += ShowPauseMenu; } if (ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper") != null) { ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent -= _gameManager.HandleInputFocusWasCaptured; ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent += ShowPauseMenu; } } catch (Exception e) { Data.Logger.Error(e.ToString()); } } _scoreController = FindObjectOfType <ScoreController>(); _energyController = FindObjectOfType <GameEnergyCounter>(); if (_scoreController != null) { _scoreController.scoreDidChangeEvent += ScoreChanged; _scoreController.noteWasCutEvent += NoteWasCutEvent; _scoreController.comboDidChangeEvent += ComboDidChangeEvent; _scoreController.noteWasMissedEvent += NoteWasMissedEvent; } if (_energyController != null) { _energyController.gameEnergyDidChangeEvent += EnergyDidChangeEvent; } _pauseMenuManager = FindObjectsOfType <PauseMenuManager>().First(); if (_pauseMenuManager != null) { _pauseMenuManager.GetPrivateField <Button>("_restartButton").interactable = false; } }
void Awake() { Instance = this; DontDestroyOnLoad(this); //Will actually be destroyed when the main game scene is loaded again, but unfortunately this //object is created before the game scene loads, so we need to do this to prevent the game scene //load from destroying it standardLevelGameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); StartCoroutine(DoOnLevelStart()); }
private void Update() { if (loadSong && isMenuScene(SceneManager.GetActiveScene())) { try { SongLoader.Instance.RefreshSongs(true); } catch (Exception e) { Console.WriteLine("Can't refresh songs! EXCEPTION: " + e); } playSong = true; loadSong = false; } if (playSong && SongLoader.AreSongsLoaded && isMenuScene(SceneManager.GetActiveScene())) { Console.WriteLine("attempting song load"); playSong = false; getSong(songName, author, subName, difficulty); autoPlay = autoPlayBuffer; } if (!autoPlay && isGameScene(SceneManager.GetActiveScene())) { pauseMenuManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().First(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); gameplayManager.HandlePauseTriggered(); if (pauseMenuManager.isActiveAndEnabled) { autoPlay = true; } } if (Input.GetKeyDown(KeyCode.Escape) && isGameScene(SceneManager.GetActiveScene())) { pauseMenuManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().First(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); gameplayManager.HandlePauseTriggered(); pauseMenuManager.MenuButtonPressed(); } if (SceneManager.GetActiveScene().name == "HealthWarning") { fuckthis = Resources.FindObjectsOfTypeAll <HealthWarningMenuController>().FirstOrDefault(); fuckthis.ContinueButtonPressed(); } }
static bool Prefix(StandardLevelGameplayManager __instance, PauseMenuManager ____pauseMenuManager) { try { if (Client.Instance.connected) { ____pauseMenuManager.ShowMenu(); return(false); } return(true); } catch (Exception e) { Plugin.log.Error("Exception in Harmony patch StandardLevelGameplayManager.Pause: " + e); return(true); } }
public void Awake() { iniVoicesEnabled = ModPrefs.GetBool(name, "Voices", iniVoicesEnabled, true); iniModEnable = ModPrefs.GetBool(name, "Enabled", iniModEnable, true); threshold = ModPrefs.GetFloat(name, "FPSThreshold", threshold, true); fpsCheckEnable = ModPrefs.GetBool(name, "FPSCheckerOn", fpsCheckEnable, true); updatePeriod = ModPrefs.GetFloat(name, "ResponseTime", updatePeriod, true); gameStateCheck = BS_Utils.Gameplay.Gamemode.GameMode; _playerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); _gamePlayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); Log.AutoPause("Pauser Awakened"); FPSTracker = new SoundPlayer(Properties.Resources.fps); ReaxtsNerfGun = new SoundPlayer(Properties.Resources.tracking); Setup(); }
public static IEnumerator FetchObjects() { yield return(new WaitForSeconds(0.1f)); soundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault(); beatmapObjectManager = Resources.FindObjectsOfTypeAll <BeatmapObjectExecutionRatingsRecorder>().LastOrDefault().GetPrivateField <BeatmapObjectManager>("_beatmapObjectManager") as BasicBeatmapObjectManager; spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().LastOrDefault(); energyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().LastOrDefault(); ColorManager = Resources.FindObjectsOfTypeAll <ColorManager>().LastOrDefault(); pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().LastOrDefault(); AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault(); if (AudioTimeSync != null) { songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource"); if (songAudio == null) { Plugin.Log("Audio null"); } } Mixer = soundEffectManager.GetField <AudioManagerSO>("_audioManager"); GameModifiersController.SetupSpawnCallbacks(); }
IEnumerator WaitForLoad() { bool loaded = false; while (!loaded) { scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); if (scoreController == null || gameplayManager == null) { yield return(new WaitForSeconds(0.1f)); } else { loaded = true; } } yield return(new WaitForSeconds(0.1f)); Init(); }
static bool MessageReceived(string ipPort, byte[] data) { string msg = ""; if (data != null && data.Length > 0) { msg = Encoding.UTF8.GetString(data); } var info = msg.Split(new string[] { ":::" }, StringSplitOptions.None); songName = info[0]; author = info[1]; subName = info[2]; difficulty = info[3]; time = float.Parse(info[4]); autoPlay = bool.Parse(info[5]); playbackSpeed = float.Parse(info[6]); if (isGameScene(SceneManager.GetActiveScene())) { pauseMenuManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().First(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); gameplayManager.Pause(); pauseMenuManager.MenuButtonPressed(); } loadSong = true; autoPlayBuffer = autoPlay; //try //{ // SongLoader.Instance.RefreshSongs(true); //} //catch (Exception e) //{ // Console.WriteLine("Can't refresh songs! EXCEPTION: " + e); //} return(true); }
internal static void SetupHell() { TrackingError = false; SpawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); PauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); PlayerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); SaberManager = PlayerController.GetField("_saberManager") as SaberManager; leftSaber = SaberManager.GetPrivateField <Saber>("_leftSaber") as Saber; rightSaber = SaberManager.GetPrivateField <Saber>("_rightSaber") as Saber; if (SpawnController) { SpawnController.noteWasMissedEvent += MissHell_noteWasMissedEvent; SpawnController.noteWasCutEvent += MissHell_noteWasCutEvent; } StartPosition = PlayerController.transform.position; timer = new Timer(3000); timer.Elapsed += Timer_Elapsed; }
public void Awake() { _standardLevelGameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); // Use the appropriate level failed event if (_standardLevelGameplayManager) { _standardLevelGameplayManager.levelFailedEvent += this.OnLevelFail; _standardLevel = true; } else { _missionLevelGameplayManager = Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().FirstOrDefault(); _missionLevelGameplayManager.levelFailedEvent += this.OnLevelFail; _standardLevel = false; } // Get all the necessary fields _standardLevelFailedController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().FirstOrDefault(); if (_standardLevelFailedController) { _standardLevelSceneSetupData = _standardLevelFailedController.GetField <StandardLevelScenesTransitionSetupDataSO, StandardLevelFailedController>("_standardLevelSceneSetupData"); _standardInitData = _standardLevelFailedController.GetField <StandardLevelFailedController.InitData, StandardLevelFailedController>("_initData"); _prepareLevelCompletionResults = _standardLevelFailedController.GetField <PrepareLevelCompletionResults, StandardLevelFailedController>("_prepareLevelCompletionResults"); } else { _missionLevelFailedController = Resources.FindObjectsOfTypeAll <MissionLevelFailedController>().FirstOrDefault(); _missionLevelSceneSetupData = _missionLevelFailedController.GetField <MissionLevelScenesTransitionSetupDataSO, MissionLevelFailedController>("_missionLevelSceneSetupData"); _missionInitData = _missionLevelFailedController.GetField <MissionLevelFailedController.InitData, MissionLevelFailedController>("_initData"); _missionObjectiveCheckersManager = _missionLevelFailedController.GetField <MissionObjectiveCheckersManager, MissionLevelFailedController>("_missionObjectiveCheckersManager"); _prepareLevelCompletionResults = _missionLevelFailedController.GetField <PrepareLevelCompletionResults, MissionLevelFailedController>("_prepareLevelCompletionResults"); } _vrControllersInputManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().FirstOrDefault() .GetField <VRControllersInputManager, PauseMenuManager>("_vrControllersInputManager"); }
static bool Prefix(StandardLevelGameplayManager __instance, ref StandardLevelGameplayManager.GameState ____gameState) { //Logger.Trace("In StandardLevelGameplayManager.HandleSongDidFinish()"); try { if (BailOutController.instance == null) { return(true); } if (BailOutController.instance.numFails > 0) { Logger.log.Debug("Fail detected in BailOutController, forcing level failed"); __instance.HandleGameEnergyDidReach0(); return(false); } } catch (Exception ex) { Logger.log.Error($"Error in StandardLevelGameplayManagerHandleSongDidFinish: {ex.Message}"); Logger.log.Debug(ex); } return(true); }
private void Awake() { playerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); }
IEnumerator WaitForControllers() { #if DEBUG Misc.Logger.Info("Waiting for game controllers..."); #endif yield return(new WaitUntil(delegate() { return FindObjectOfType <ScoreController>() != null; })); #if DEBUG Misc.Logger.Info("Game controllers found!"); #endif _gameManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); if (_gameManager != null) { try { if (ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger") != null) { ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").pauseTriggeredEvent -= _gameManager.HandlePauseTriggered; ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").pauseTriggeredEvent += ShowMenu; } if (ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper") != null) { ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent -= _gameManager.HandleInputFocusWasCaptured; ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent += ShowMenu; } } catch (Exception e) { Misc.Logger.Exception(e.ToString()); } } #if DEBUG Misc.Logger.Info("Disabled pause button!"); #endif _scoreController = FindObjectOfType <ScoreController>(); if (_scoreController != null) { _scoreController.scoreDidChangeEvent += ScoreChanged; _scoreController.noteWasCutEvent += NoteWasCutEvent; _scoreController.comboDidChangeEvent += ComboDidChangeEvent; _scoreController.noteWasMissedEvent += NoteWasMissedEvent; } #if DEBUG Misc.Logger.Info("Found score controller"); #endif _energyController = FindObjectOfType <GameEnergyCounter>(); if (_energyController != null) { _energyController.gameEnergyDidChangeEvent += EnergyDidChangeEvent; } #if DEBUG Misc.Logger.Info("Found energy controller"); #endif audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault(); _pauseMenuManager = FindObjectsOfType <PauseMenuManager>().First(); if (_pauseMenuManager != null) { _pauseMenuManager.GetPrivateField <Button>("_restartButton").interactable = false; } #if DEBUG Misc.Logger.Info("Found pause manager"); #endif loaded = true; }
public void OnActiveSceneChanged(Scene oldScene, Scene newScene) { Data.scene = newScene.name; if (newScene.name == "MenuCore") { // Menu Data.scene = "Menu"; Gamemode.Init(); // TODO: get the current song, mode and mods while in menu Data.ResetMapInfo(); Data.ResetPerformance(); // Release references for AfterCutScoreBuffers that don't resolve due to player leaving the map before finishing. noteCutMapping.Clear(); Data.StatusChange(ChangedProperties.AllButNoteCut, "menu"); } else if (newScene.name == "GameCore") { // In game Data.scene = "Song"; gamePauseManager = FindFirstOrDefault <GamePauseManager>(); scoreController = FindFirstOrDefault <ScoreController>(); gameplayManager = FindFirstOrDefault <StandardLevelGameplayManager>(); beatmapObjectCallbackController = FindFirstOrDefault <BeatmapObjectCallbackController>(); gameplayModifiersSO = FindFirstOrDefault <GameplayModifiersModelSO>(); audioTimeSyncController = FindFirstOrDefault <AudioTimeSyncController>(); playerHeadAndObstacleInteraction = FindFirstOrDefault <PlayerHeadAndObstacleInteraction>(); gameEnergyCounter = FindFirstOrDefault <GameEnergyCounter>(); gameplayCoreSceneSetupData = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData; // Register event listeners // private GameEvent GamePauseManager#_gameDidPauseSignal AddSubscriber(gamePauseManager, "_gameDidPauseSignal", OnGamePause); // private GameEvent GamePauseManager#_gameDidResumeSignal AddSubscriber(gamePauseManager, "_gameDidResumeSignal", OnGameResume); // public ScoreController#noteWasCutEvent<NoteData, NoteCutInfo, int multiplier> // called after AfterCutScoreBuffer is created scoreController.noteWasCutEvent += OnNoteWasCut; // public ScoreController#noteWasMissedEvent<NoteData, int multiplier> scoreController.noteWasMissedEvent += OnNoteWasMissed; // public ScoreController#scoreDidChangeEvent<int> // score scoreController.scoreDidChangeEvent += OnScoreDidChange; // public ScoreController#comboDidChangeEvent<int> // combo scoreController.comboDidChangeEvent += OnComboDidChange; // public ScoreController#multiplierDidChangeEvent<int, float> // multiplier, progress [0..1] scoreController.multiplierDidChangeEvent += OnMultiplierDidChange; // private GameEvent GameplayManager#_levelFinishedSignal AddSubscriber(gameplayManager, "_levelFinishedSignal", OnLevelFinished); // private GameEvent GameplayManager#_levelFailedSignal AddSubscriber(gameplayManager, "_levelFailedSignal", OnLevelFailed); // public event Action<BeatmapEventData> BeatmapObjectCallbackController#beatmapEventDidTriggerEvent beatmapObjectCallbackController.beatmapEventDidTriggerEvent += OnBeatmapEventDidTrigger; IDifficultyBeatmap diff = gameplayCoreSceneSetupData.difficultyBeatmap; IBeatmapLevel level = diff.level; GameplayModifiers gameplayModifiers = gameplayCoreSceneSetupData.gameplayModifiers; PlayerSpecificSettings playerSettings = gameplayCoreSceneSetupData.playerSpecificSettings; PracticeSettings practiceSettings = gameplayCoreSceneSetupData.practiceSettings; float songSpeedMul = gameplayModifiers.songSpeedMul; if (practiceSettings != null) { songSpeedMul = practiceSettings.songSpeedMul; } float modifierMultiplier = gameplayModifiersSO.GetTotalMultiplier(gameplayModifiers); Data.songName = level.songName; Data.songSubName = level.songSubName; Data.songAuthorName = level.songAuthorName; Data.levelAuthorName = level.levelAuthorName; Data.songBPM = level.beatsPerMinute; Data.noteJumpSpeed = diff.noteJumpMovementSpeed; Data.songHash = level.levelID.Substring(0, Math.Min(32, level.levelID.Length)); Data.songTimeOffset = (long)(level.songTimeOffset * 1000f / songSpeedMul); Data.length = (long)(level.beatmapLevelData.audioClip.length * 1000f / songSpeedMul); Data.start = GetCurrentTime() - (long)(audioTimeSyncController.songTime * 1000f / songSpeedMul); if (practiceSettings != null) { Data.start -= (long)(practiceSettings.startSongTime * 1000f / songSpeedMul); } Data.paused = 0; Data.difficulty = diff.difficulty.Name(); Data.notesCount = diff.beatmapData.notesCount; Data.bombsCount = diff.beatmapData.bombsCount; Data.obstaclesCount = diff.beatmapData.obstaclesCount; Data.environmentName = level.environmentSceneInfo.sceneName; Data.maxScore = ScoreController.GetScoreForGameplayModifiersScoreMultiplier(ScoreController.MaxScoreForNumberOfNotes(diff.beatmapData.notesCount), modifierMultiplier); Data.maxRank = RankModel.MaxRankForGameplayModifiers(gameplayModifiers, gameplayModifiersSO).ToString(); try { // From https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures- var texture = level.coverImage.texture; var active = RenderTexture.active; var temporary = RenderTexture.GetTemporary( texture.width, texture.height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear ); Graphics.Blit(texture, temporary); RenderTexture.active = temporary; var cover = new Texture2D(texture.width, texture.height); cover.ReadPixels(new Rect(0, 0, temporary.width, temporary.height), 0, 0); cover.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Data.songCover = Convert.ToBase64String( ImageConversion.EncodeToPNG(cover) ); } catch { Data.songCover = null; } Data.ResetPerformance(); Data.modifierMultiplier = modifierMultiplier; Data.songSpeedMultiplier = songSpeedMul; Data.batteryLives = gameEnergyCounter.batteryLives; Data.modObstacles = gameplayModifiers.enabledObstacleType.ToString(); Data.modInstaFail = gameplayModifiers.instaFail; Data.modNoFail = gameplayModifiers.noFail; Data.modBatteryEnergy = gameplayModifiers.batteryEnergy; Data.modDisappearingArrows = gameplayModifiers.disappearingArrows; Data.modNoBombs = gameplayModifiers.noBombs; Data.modSongSpeed = gameplayModifiers.songSpeed.ToString(); Data.modNoArrows = gameplayModifiers.noArrows; Data.modGhostNotes = gameplayModifiers.ghostNotes; Data.modFailOnSaberClash = gameplayModifiers.failOnSaberClash; Data.modStrictAngles = gameplayModifiers.strictAngles; Data.modFastNotes = gameplayModifiers.fastNotes; Data.staticLights = playerSettings.staticLights; Data.leftHanded = playerSettings.leftHanded; Data.swapColors = playerSettings.swapColors; Data.playerHeight = playerSettings.playerHeight; Data.disableSFX = playerSettings.disableSFX; Data.noHUD = playerSettings.noTextsAndHuds; Data.advancedHUD = playerSettings.advancedHud; Data.StatusChange(ChangedProperties.AllButNoteCut, "songStart"); } }
public void OnActiveSceneChanged(Scene arg0, Scene scene) { if (scene.name == "MenuViewControllers") { activateDuringIsolated = false; Log("Switched to Menu"); SharedCoroutineStarter.instance.StartCoroutine(GrabPP()); var controllers = Resources.FindObjectsOfTypeAll <VRController>(); if (controllers != null) { foreach (VRController controller in controllers) { if (controller != null) { if (controller.ToString() == "ControllerLeft (VRController)") { leftController = controller; } if (controller.ToString() == "ControllerRight (VRController)") { rightController = controller; } } // Log(controller.ToString()); } // Log("Left:" + leftController.ToString()); // Log("Right: " + rightController.ToString()); } } if (scene.name == "GameCore") { RemovePatches(); } if (_mainSettingsModel == null) { var menu = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().FirstOrDefault(); if (menu != null) { _mainSettingsModel = menu.GetField <MainSettingsModelSO>("_mainSettingsModel"); _mainSettingsModel.Load(true); Log("RUMBLE: " + _mainSettingsModel.controllersRumbleEnabled.ToString()); if (!setDefaultRumble) { defaultRumble = _mainSettingsModel.controllersRumbleEnabled; ModPrefs.SetInt("GameplayModifiersPlus", "GameRumbleSetting", _mainSettingsModel.controllersRumbleEnabled ? 1 : 0); setDefaultRumble = true; Log("Set Default Rumble Value"); } } } if (_mainSettingsModel != null) { defaultRumble = ModPrefs.GetInt("GameplayModifiersPlus", "GameRumbleSetting", -1, false) != 1 ? false : true; _mainSettingsModel.controllersRumbleEnabled.value = defaultRumble; _mainSettingsModel.Save(); } paused = false; if (!customColorsInstalled) { if (colorA != null) { colorA.SetColor(defColorA); } if (colorB != null) { colorB.SetColor(defColorB); } } // try // { if (scene.name == "EmptyTransition") { Log("Resetting Chat Powers Object"); if (chatPowers != null) { GameObject.Destroy(chatPowers); } } if (chatPowers == null) { Log("Null Creation of Chat Powers Object"); chatPowers = new GameObject("Chat Powers"); GameObject.DontDestroyOnLoad(chatPowers); twitchPowers = chatPowers.AddComponent <TwitchPowers>(); } // } // catch(Exception ex) // { // Log(ex.ToString()); // } GMPDisplay display = chatPowers.GetComponent <GMPDisplay>(); if (display != null) { display.Destroy(); GameObject.Destroy(display); } ReadPrefs(); if (GMPUI.chatIntegration && twitchPluginInstalled) { if (twitchPowers != null) { cooldowns.ResetCooldowns(); TwitchPowers.ResetPowers(false); twitchPowers.StopAllCoroutines(); } if (ChatConfig.resetChargesEachLevel) { charges = 0; } } // twitchCommands.StopAllCoroutines(); haveSongNJS = false; if (soundIsPlaying == true) { gnomeSound.Stop(); } soundIsPlaying = false; isValidScene = false; playerInfo = false; modifiersInit = false; if (arg0.name == "EmpyTransition" && chatPowers != null) { GameObject.Destroy(chatPowers); } if (scene.name == "GameCore") { Log("Isolated: " + BS_Utils.Gameplay.Gamemode.IsIsolatedLevel); isValidScene = true; if (BS_Utils.Gameplay.Gamemode.IsIsolatedLevel && !activateDuringIsolated) { Log("Isolated Level, not activating"); return; } // Log("Pre GrabGrab"); GameObject.Destroy(GameObject.Find("Color Setter")); soundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().FirstOrDefault(); spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); energyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First(); energyPanel = Resources.FindObjectsOfTypeAll <GameEnergyUIPanel>().First(); ColorManager = Resources.FindObjectsOfTypeAll <ColorManager>().First(); levelData = BS_Utils.Plugin.LevelData; // Log("Post GrabGrab"); if (spawnController != null) { spawnController.noteDidStartJumpEvent += SpawnController_ModifiedJump; spawnController.noteWasCutEvent += SpawnController_ScaleRemoveCut; spawnController.noteWasMissedEvent += SpawnController_ScaleRemoveMiss; } else { Log("Spawn Controller Null"); } // Log("Post GrabGrab 2"); currentSongSpeed = levelData.GameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul; BS_Utils.Plugin.LevelDidFinishEvent += LevelData_didFinishEvent; // Log("Post GrabGrab 3"); if (!Multiplayer.MultiMain.multiActive.Value) { if (GMPUI.chatIntegration && ChatConfig.maxCharges > 0 && twitchPluginInstalled) { chatPowers.AddComponent <GMPDisplay>(); } if (GMPUI.chatIntegration && ChatConfig.timeForCharges > 0 && twitchPluginInstalled) { twitchPowers.StartCoroutine(TwitchPowers.ChargeOverTime()); } } // Log("Post GrabGrab 4"); pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); var colors = Resources.FindObjectsOfTypeAll <SimpleColorSO>(); // Log("Pre Color"); foreach (SimpleColorSO color in colors) { // Log(color.name); if (color.name == "BaseNoteColor1") { colorA = color; } if (color.name == "BaseNoteColor0") { colorB = color; } } oldColorA.SetColor(colorA); oldColorB.SetColor(colorB); // Log("Pre ChatInt"); // Log(colorA.color.ToString()); if (GMPUI.chatIntegration && charges <= ChatConfig.maxCharges && twitchPluginInstalled) { charges += ChatConfig.chargesPerLevel; if (charges > ChatConfig.maxCharges) { charges = ChatConfig.maxCharges; } // TryAsyncMessage("Current Charges: " + charges); } // Log("Pre Audio/Player"); // ReflectionUtil.SetProperty(typeof(PracticePlugin.Plugin), "TimeScale", 1f); AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault(); if (AudioTimeSync != null) { songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource"); if (songAudio == null) { Log("Audio null"); } // Log("Object Found"); } //Get Sabers player = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); if (player != null) { playerInfo = true; } else { playerInfo = false; Log("Player is null"); } CheckGMPModifiers(); } }
//private BeatmapObjectCallbackController beatmapObjectCallbackController; public void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) { if (newScene.name == "GameCore") { gameStatus = new GameStatus(); levelSceneSetupData = FindFirstOrDefault <StandardLevelSceneSetupDataSO>(); //gamePauseManager = FindFirstOrDefault<GamePauseManager>(); scoreController = FindFirstOrDefault <ScoreController>(); gameplayModifiersSO = FindFirstOrDefault <GameplayModifiersModelSO>(); audioTimeSyncController = FindFirstOrDefault <AudioTimeSyncController>(); //playerHeadAndObstacleInteraction = FindFirstOrDefault<PlayerHeadAndObstacleInteraction>(); gameEnergyCounter = FindFirstOrDefault <GameEnergyCounter>(); gameplayManager = FindFirstOrDefault <StandardLevelGameplayManager>(); //beatmapObjectCallbackController = FindFirstOrDefault<BeatmapObjectCallbackController>(); // Register event listeners // private GameEvent GamePauseManager#_gameDidPauseSignal //AddSubscriber(gamePauseManager, "_gameDidPauseSignal", OnGamePause); // private GameEvent GamePauseManager#_gameDidResumeSignal //AddSubscriber(gamePauseManager, "_gameDidResumeSignal", OnGameResume); // public ScoreController#noteWasCutEvent<NoteData, NoteCutInfo, int multiplier> // called after AfterCutScoreBuffer is created scoreController.noteWasCutEvent += OnNoteWasCut; // public ScoreController#noteWasMissedEvent<NoteData, int multiplier> scoreController.noteWasMissedEvent += OnNoteWasMissed; // public ScoreController#scoreDidChangeEvent<int> // score scoreController.scoreDidChangeEvent += OnScoreDidChange; // public ScoreController#comboDidChangeEvent<int> // combo scoreController.comboDidChangeEvent += OnComboDidChange; // public ScoreController#multiplierDidChangeEvent<int, float> // multiplier, progress [0..1] scoreController.multiplierDidChangeEvent += OnMultiplierDidChange; // private GameEvent GameplayManager#_levelFinishedSignal AddSubscriber(gameplayManager, "_levelFinishedSignal", OnLevelFinished); // private GameEvent GameplayManager#_levelFailedSignal AddSubscriber(gameplayManager, "_levelFailedSignal", OnLevelFailed); // public event Action<BeatmapEventData> BeatmapObjectCallbackController#beatmapEventDidTriggerEvent //beatmapObjectCallbackController.beatmapEventDidTriggerEvent += OnBeatmapEventDidTrigger; IDifficultyBeatmap diff = levelSceneSetupData.difficultyBeatmap; IBeatmapLevel level = diff.level; GameplayModifiers gameplayModifiers = levelSceneSetupData.gameplayCoreSetupData.gameplayModifiers; PlayerSpecificSettings playerSettings = levelSceneSetupData.gameplayCoreSetupData.playerSpecificSettings; PracticeSettings practiceSettings = levelSceneSetupData.gameplayCoreSetupData.practiceSettings; float songSpeedMul = gameplayModifiers.songSpeedMul; if (practiceSettings != null) { songSpeedMul = practiceSettings.songSpeedMul; } float modifierMultiplier = gameplayModifiersSO.GetTotalMultiplier(gameplayModifiers); var songInfo = FindLevelInfancyWay(levelSceneSetupData.difficultyBeatmap.level.levelID); gameStatus.songHash = level.levelID.Substring(0, Math.Max(0, level.levelID.IndexOf('∎'))); gameStatus.songBeatSaverID = songInfo == null ? null : ParseIdFromSongPath(songInfo); gameStatus.songFilePath = songInfo?.path; gameStatus.songName = level.songName; gameStatus.songSubName = level.songSubName; gameStatus.songAuthorName = level.songAuthorName; gameStatus.songBPM = level.beatsPerMinute; gameStatus.noteJumpSpeed = diff.noteJumpMovementSpeed; gameStatus.songTimeOffset = (long)(level.songTimeOffset * 1000f / songSpeedMul); gameStatus.length = (long)(level.audioClip.length * 1000f / songSpeedMul); gameStatus.start = GetCurrentTime() - (long)(audioTimeSyncController.songTime * 1000f / songSpeedMul); if (practiceSettings != null) { gameStatus.start -= (long)(practiceSettings.startSongTime * 1000f / songSpeedMul); } gameStatus.paused = 0; gameStatus.difficulty = diff.difficulty.Name(); gameStatus.notesCount = diff.beatmapData.notesCount; gameStatus.bombsCount = diff.beatmapData.bombsCount; gameStatus.obstaclesCount = diff.beatmapData.obstaclesCount; gameStatus.maxScore = ScoreController.GetScoreForGameplayModifiersScoreMultiplier(ScoreController.MaxScoreForNumberOfNotes(diff.beatmapData.notesCount), modifierMultiplier); gameStatus.maxPossibleScore = ScoreController.MaxScoreForNumberOfNotes(diff.beatmapData.notesCount); gameStatus.maxRank = RankModel.MaxRankForGameplayModifiers(gameplayModifiers, gameplayModifiersSO).ToString(); gameStatus.ResetPerformance(); gameStatus.modifierMultiplier = modifierMultiplier; gameStatus.songSpeedMultiplier = songSpeedMul; gameStatus.batteryLives = gameEnergyCounter.batteryLives; gameStatus.modObstacles = gameplayModifiers.enabledObstacleType.ToString(); gameStatus.modInstaFail = gameplayModifiers.instaFail; gameStatus.modNoFail = gameplayModifiers.noFail; gameStatus.modBatteryEnergy = gameplayModifiers.batteryEnergy; gameStatus.modDisappearingArrows = gameplayModifiers.disappearingArrows; gameStatus.modNoBombs = gameplayModifiers.noBombs; gameStatus.modSongSpeed = gameplayModifiers.songSpeed.ToString(); gameStatus.modFailOnSaberClash = gameplayModifiers.failOnSaberClash; gameStatus.modStrictAngles = gameplayModifiers.strictAngles; } }
public async void OnActiveSceneChanged(Scene oldScene, Scene newScene) { GameStatus gameStatus = statusManager.gameStatus; gameStatus.scene = newScene.name; if (newScene.name == "MenuCore") { // Menu gameStatus.scene = "Menu"; Gamemode.Init(); // TODO: get the current song, mode and mods while in menu gameStatus.ResetMapInfo(); gameStatus.ResetPerformance(); // Release references for AfterCutScoreBuffers that don't resolve due to player leaving the map before finishing. noteCutMapping.Clear(); statusManager.EmitStatusUpdate(ChangedProperties.AllButNoteCut, "menu"); } else if (newScene.name == "GameCore") { // In game gameStatus.scene = "Song"; gamePause = FindFirstOrDefault <GamePause>(); scoreController = FindFirstOrDefault <ScoreController>(); gameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault() as MonoBehaviour ?? Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().FirstOrDefault(); beatmapObjectCallbackController = FindFirstOrDefault <BeatmapObjectCallbackController>(); gameplayModifiersSO = FindFirstOrDefault <GameplayModifiersModelSO>(); audioTimeSyncController = FindFirstOrDefault <AudioTimeSyncController>(); playerHeadAndObstacleInteraction = FindFirstOrDefault <PlayerHeadAndObstacleInteraction>(); gameEnergyCounter = FindFirstOrDefault <GameEnergyCounter>(); if (gameplayManager.GetType() == typeof(StandardLevelGameplayManager)) { Plugin.log.Info("Standard Level loaded"); standardLevelGameplayManager = FindFirstOrDefault <StandardLevelGameplayManager>(); // public event Action StandardLevelGameplayManager#levelFailedEvent; standardLevelGameplayManager.levelFailedEvent += OnLevelFailed; // public event Action StandardLevelGameplayManager#levelFinishedEvent; standardLevelGameplayManager.levelFinishedEvent += OnLevelFinished; } else if (gameplayManager.GetType() == typeof(MissionLevelGameplayManager)) { Plugin.log.Info("Mission Level loaded"); missionLevelGameplayManager = FindFirstOrDefault <MissionLevelGameplayManager>(); // public event Action StandardLevelGameplayManager#levelFailedEvent; missionLevelGameplayManager.levelFailedEvent += OnLevelFailed; // public event Action StandardLevelGameplayManager#levelFinishedEvent; missionLevelGameplayManager.levelFinishedEvent += OnLevelFinished; } gameplayCoreSceneSetupData = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData; // Register event listeners // public event Action GamePause#didPauseEvent; gamePause.didPauseEvent += OnGamePause; // public event Action GamePause#didResumeEvent; gamePause.didResumeEvent += OnGameResume; // public ScoreController#noteWasCutEvent<NoteData, NoteCutInfo, int multiplier> // called after AfterCutScoreBuffer is created scoreController.noteWasCutEvent += OnNoteWasCut; // public ScoreController#noteWasMissedEvent<NoteData, int multiplier> scoreController.noteWasMissedEvent += OnNoteWasMissed; // public ScoreController#scoreDidChangeEvent<int, int> // score scoreController.scoreDidChangeEvent += OnScoreDidChange; // public ScoreController#comboDidChangeEvent<int> // combo scoreController.comboDidChangeEvent += OnComboDidChange; // public ScoreController#multiplierDidChangeEvent<int, float> // multiplier, progress [0..1] scoreController.multiplierDidChangeEvent += OnMultiplierDidChange; // public event Action<BeatmapEventData> BeatmapObjectCallbackController#beatmapEventDidTriggerEvent beatmapObjectCallbackController.beatmapEventDidTriggerEvent += OnBeatmapEventDidTrigger; IDifficultyBeatmap diff = gameplayCoreSceneSetupData.difficultyBeatmap; IBeatmapLevel level = diff.level; gameStatus.partyMode = Gamemode.IsPartyActive; gameStatus.mode = Gamemode.GameMode; gameplayModifiers = gameplayCoreSceneSetupData.gameplayModifiers; PlayerSpecificSettings playerSettings = gameplayCoreSceneSetupData.playerSpecificSettings; PracticeSettings practiceSettings = gameplayCoreSceneSetupData.practiceSettings; float songSpeedMul = gameplayModifiers.songSpeedMul; if (practiceSettings != null) { songSpeedMul = practiceSettings.songSpeedMul; } float modifierMultiplier = gameplayModifiersSO.GetTotalMultiplier(gameplayModifiers); gameStatus.songName = level.songName; gameStatus.songSubName = level.songSubName; gameStatus.songAuthorName = level.songAuthorName; gameStatus.levelAuthorName = level.levelAuthorName; gameStatus.songBPM = level.beatsPerMinute; gameStatus.noteJumpSpeed = diff.noteJumpMovementSpeed; // 13 is "custom_level_" and 40 is the magic number for the length of the SHA-1 hash gameStatus.songHash = level.levelID.StartsWith("custom_level_") && !level.levelID.EndsWith(" WIP") ? level.levelID.Substring(13, 40) : null; gameStatus.levelId = level.levelID; gameStatus.songTimeOffset = (long)(level.songTimeOffset * 1000f / songSpeedMul); gameStatus.length = (long)(level.beatmapLevelData.audioClip.length * 1000f / songSpeedMul); gameStatus.start = GetCurrentTime() - (long)(audioTimeSyncController.songTime * 1000f / songSpeedMul); if (practiceSettings != null) { gameStatus.start -= (long)(practiceSettings.startSongTime * 1000f / songSpeedMul); } gameStatus.paused = 0; gameStatus.difficulty = diff.difficulty.Name(); gameStatus.notesCount = diff.beatmapData.notesCount; gameStatus.bombsCount = diff.beatmapData.bombsCount; gameStatus.obstaclesCount = diff.beatmapData.obstaclesCount; gameStatus.environmentName = level.environmentInfo.sceneInfo.sceneName; gameStatus.maxScore = gameplayModifiersSO.MaxModifiedScoreForMaxRawScore(ScoreModel.MaxRawScoreForNumberOfNotes(diff.beatmapData.notesCount), gameplayModifiers, gameplayModifiersSO); gameStatus.maxRank = RankModel.MaxRankForGameplayModifiers(gameplayModifiers, gameplayModifiersSO).ToString(); try { // From https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures- var texture = await level.GetCoverImageTexture2DAsync(CancellationToken.None); var active = RenderTexture.active; var temporary = RenderTexture.GetTemporary( texture.width, texture.height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear ); Graphics.Blit(texture, temporary); RenderTexture.active = temporary; var cover = new Texture2D(texture.width, texture.height); cover.ReadPixels(new Rect(0, 0, temporary.width, temporary.height), 0, 0); cover.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); gameStatus.songCover = System.Convert.ToBase64String( ImageConversion.EncodeToPNG(cover) ); } catch { gameStatus.songCover = null; } gameStatus.ResetPerformance(); gameStatus.modifierMultiplier = modifierMultiplier; gameStatus.songSpeedMultiplier = songSpeedMul; gameStatus.batteryLives = gameEnergyCounter.batteryLives; gameStatus.modObstacles = gameplayModifiers.enabledObstacleType.ToString(); gameStatus.modInstaFail = gameplayModifiers.instaFail; gameStatus.modNoFail = gameplayModifiers.noFail; gameStatus.modBatteryEnergy = gameplayModifiers.batteryEnergy; gameStatus.modDisappearingArrows = gameplayModifiers.disappearingArrows; gameStatus.modNoBombs = gameplayModifiers.noBombs; gameStatus.modSongSpeed = gameplayModifiers.songSpeed.ToString(); gameStatus.modNoArrows = gameplayModifiers.noArrows; gameStatus.modGhostNotes = gameplayModifiers.ghostNotes; gameStatus.modFailOnSaberClash = gameplayModifiers.failOnSaberClash; gameStatus.modStrictAngles = gameplayModifiers.strictAngles; gameStatus.modFastNotes = gameplayModifiers.fastNotes; gameStatus.staticLights = playerSettings.staticLights; gameStatus.leftHanded = playerSettings.leftHanded; gameStatus.playerHeight = playerSettings.playerHeight; gameStatus.sfxVolume = playerSettings.sfxVolume; gameStatus.reduceDebris = playerSettings.reduceDebris; gameStatus.noHUD = playerSettings.noTextsAndHuds; gameStatus.advancedHUD = playerSettings.advancedHud; gameStatus.autoRestart = playerSettings.autoRestart; statusManager.EmitStatusUpdate(ChangedProperties.AllButNoteCut, "songStart"); } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { paused = false; if (!customColorsInstalled) { if (colorA != null) { colorA.SetColor(defColorA); } if (colorB != null) { colorB.SetColor(defColorB); } } // try // { if (scene.name == "EmptyTransition") { Log("Resetting Chat Powers Object"); if (chatPowers != null) { GameObject.Destroy(chatPowers); } } if (chatPowers == null) { Log("Null Creation of Chat Powers Object"); chatPowers = new GameObject("Chat Powers"); twitchPowers = chatPowers.AddComponent <TwitchPowers>(); GameObject.DontDestroyOnLoad(chatPowers); } // } // catch(Exception ex) // { // Log(ex.ToString()); // } GMPDisplay display = chatPowers.GetComponent <GMPDisplay>(); if (display != null) { display.Destroy(); GameObject.Destroy(display); } ReadPrefs(); if (GMPUI.chatIntegration) { if (twitchPowers != null) { cooldowns.ResetCooldowns(); TwitchPowers.ResetPowers(false); twitchPowers.StopAllCoroutines(); } if (Config.resetChargesperLevel) { charges = 0; } } // twitchCommands.StopAllCoroutines(); haveSongNJS = false; invalidForScoring = false; if (soundIsPlaying == true) { gnomeSound.Stop(); } soundIsPlaying = false; isValidScene = false; playerInfo = false; if (arg0.name == "EmpyTransition" && chatPowers != null) { GameObject.Destroy(chatPowers); } if (scene.name == ("Menu")) { Log("Switched to Menu"); SharedCoroutineStarter.instance.StartCoroutine(GrabPP()); if (_hasRegistered == false) { TwitchConnection.Instance.StartConnection(); TwitchConnection.Instance.RegisterOnMessageReceived(TwitchConnection_OnMessageReceived); _hasRegistered = true; } var controllers = Resources.FindObjectsOfTypeAll <VRController>(); if (controllers != null) { foreach (VRController controller in controllers) { if (controller != null) { if (controller.ToString() == "ControllerLeft (VRController)") { leftController = controller; } if (controller.ToString() == "ControllerRight (VRController)") { rightController = controller; } } // Log(controller.ToString()); } Log("Left:" + leftController.ToString()); Log("Right: " + rightController.ToString()); } } if (scene.name == "GameCore") { environmentColorsSetter = Resources.FindObjectsOfTypeAll <EnvironmentColorsSetter>().FirstOrDefault(); soundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().First(); levelData = Resources.FindObjectsOfTypeAll <StandardLevelSceneSetupDataSO>().First(); spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().First(); energyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First(); energyPanel = Resources.FindObjectsOfTypeAll <GameEnergyUIPanel>().First(); spawnController.noteDidStartJumpEvent += SpawnController_ModifiedJump; spawnController.noteWasCutEvent += SpawnController_ScaleRemoveCut; spawnController.noteWasMissedEvent += SpawnController_ScaleRemoveMiss; currentSongSpeed = levelData.gameplayCoreSetupData.gameplayModifiers.songSpeedMul; levelData.didFinishEvent += LevelData_didFinishEvent; if (GMPUI.njsRandom) { twitchPowers.StartCoroutine(TwitchPowers.RandomNJS()); } Log(GMPUI.swapSabers.ToString()); if (GMPUI.noArrows) { twitchPowers.StartCoroutine(TwitchPowers.NoArrows()); } if (GMPUI.chatIntegration && Config.maxCharges > 0) { chatPowers.AddComponent <GMPDisplay>(); } if (Config.timeForCharges > 0) { twitchPowers.StartCoroutine(TwitchPowers.ChargeOverTime()); } pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First(); var colors = Resources.FindObjectsOfTypeAll <SimpleColorSO>(); foreach (SimpleColorSO color in colors) { Log(color.name); if (color.name == "Color0") { colorA = color; } if (color.name == "Color1") { colorB = color; } } oldColorA.SetColor(colorA); oldColorB.SetColor(colorB); Log(colorA.color.ToString()); if (GMPUI.chatIntegration && charges <= Config.maxCharges) { charges += Config.chargesPerLevel; if (charges > Config.maxCharges) { charges = Config.maxCharges; } // TwitchConnection.Instance.SendChatMessage("Current Charges: " + charges); } // ReflectionUtil.SetProperty(typeof(PracticePlugin.Plugin), "TimeScale", 1f); isValidScene = true; AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault(); if (AudioTimeSync != null) { songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource"); if (songAudio != null) { Log("Audio not null"); } Log("Object Found"); } //Get Sabers player = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault(); if (player != null) { leftSaber = player.leftSaber; rightSaber = player.rightSaber; playerInfo = true; } else { playerInfo = false; Log("Player is null"); } Log(leftSaber.handlePos.ToString()); Log(leftSaber.saberBladeTopPos.ToString()); if (GMPUI.swapSabers) { Log("Testing Ground Active"); try { SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.TestingGround(5f)); } catch (Exception ex) { Log(ex.ToString()); } } // SharedCoroutineStarter.instance.StartCoroutine(SwapSabers(leftSaber, rightSaber)); if (GMPUI.gnomeOnMiss == true) { invalidForScoring = true; if (spawnController != null) { spawnController.noteWasMissedEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, NoteController noteController) { if (noteController.noteData.noteType != NoteType.Bomb) { try { twitchPowers.StartCoroutine(TwitchPowers.SpecialEvent()); Log("Gnoming"); } catch (Exception ex) { Log(ex.ToString()); } } }; spawnController.noteWasCutEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, NoteController noteController, NoteCutInfo noteCutInfo) { if (!noteCutInfo.allIsOK) { twitchPowers.StartCoroutine(TwitchPowers.SpecialEvent()); Log("Gnoming"); } }; } } if (GMPUI.bulletTime || GMPUI.chatIntegration || GMPUI.fixedNoteScale != 1f) { invalidForScoring = true; } /* * if(GMPUI.superHot == true) * { * startGMPUI.superHot = false; * SharedCoroutineStarter.instance.StartCoroutine(Wait(1f)); * * } * */ } }
private void Cleanup() { playerController = null; gameplayManager = null; Destroy(this); }