IEnumerator WaitForControllers() { Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Waiting for game controllers..."); yield return(new WaitUntil(delegate() { return FindObjectOfType <ScoreController>() != null; })); Console.WriteLine("Controllers found!"); _gameManager = Resources.FindObjectsOfTypeAll <GameplayManager>().First(); if (_gameManager != null) { try { if (ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger") != null) { ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").SetCallback(delegate() { }); } if (ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper") != null) { ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent -= _gameManager.HandleInputFocusWasCaptured; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } Console.WriteLine("Disabled pause button"); _scoreController = FindObjectOfType <ScoreController>(); if (_scoreController != null) { _scoreController.scoreDidChangeEvent += ScoreChanged; _scoreController.noteWasCutEvent += noteWasCutEvent; _scoreController.comboDidChangeEvent += comboDidChangeEvent; } Console.WriteLine("Found score controller"); _energyController = FindObjectOfType <GameEnergyCounter>(); if (_energyController != null) { _energyController.gameEnergyDidChangeEvent += EnergyDidChangeEvent; } Console.WriteLine("Found energy controller"); _roomAdjust = FindObjectOfType <VRCenterAdjust>(); if (_roomAdjust != null) { roomPositionOffset = _roomAdjust.transform.position; roomRotationOffset = _roomAdjust.transform.rotation; } }
IEnumerator WaitForControllers() { Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Waiting for game controllers..."); yield return(new WaitUntil(delegate() { return FindObjectOfType <ScoreController>() != null; })); Console.WriteLine("Controllers found!"); _gameManager = Resources.FindObjectsOfTypeAll <GameplayManager>().First(); if (_gameManager != null) { try { if (ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger") != null) { ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").SetCallback(delegate() { }); } if (ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper") != null) { ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent -= _gameManager.HandleInputFocusWasCaptured; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } Console.WriteLine("Disabled pause button"); _scoreController = FindObjectOfType <ScoreController>(); if (_scoreController != null) { _scoreController.scoreDidChangeEvent += ScoreChanged; _scoreController.comboDidChangeEvent += ComboChanged; } }
private void AvatarLoaded() { if (bodyManager == null) { bodyManager = avatar.GetBodyManager(); } if (ReflectionUtil.GetPrivateField <GameObject>(avatar, "_fpsAvatarInstance") != null) { Destroy(ReflectionUtil.GetPrivateField <GameObject>(avatar, "_fpsAvatarInstance")); Console.WriteLine("Destroyed fps avatar instance"); } if (playerNameText == null) { playerNameText = BSMultiplayerUI._instance.CreateWorldText(bodyManager.GetHeadTransform(), "INVALID"); playerNameText.rectTransform.anchoredPosition3D = new Vector3(0f, 0.25f, 0f); playerNameText.alignment = TextAlignmentOptions.Center; playerNameText.fontSize = 2.5f; } Console.WriteLine("Avatar loaded"); }
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; }