public void Awake() { if (Instance != this) { Instance = this; DontDestroyOnLoad(gameObject); Client.Instance.MessageReceived -= PacketReceived; Client.Instance.MessageReceived += PacketReceived; _currentScene = SceneManager.GetActiveScene().name; _messageDisplayText = CustomExtensions.CreateWorldText(transform, ""); transform.position = new Vector3(40f, -43.75f, 3.75f); transform.rotation = Quaternion.Euler(-30f, 0f, 0f); _messageDisplayText.overflowMode = TextOverflowModes.Overflow; _messageDisplayText.enableWordWrapping = false; _messageDisplayText.alignment = TextAlignmentOptions.Center; DontDestroyOnLoad(_messageDisplayText.gameObject); CustomAvatar.Plugin.Instance.PlayerAvatarManager.AvatarChanged += PlayerAvatarManager_AvatarChanged; if (Config.Instance.EnableVoiceChat) { voiceChatListener = new GameObject("Voice Chat Listener").AddComponent <VoipListener>(); voiceChatListener.OnAudioGenerated += ProcesVoiceFragment; DontDestroyOnLoad(voiceChatListener.gameObject); isVoiceChatActive = true; } } }
private void MenuSceneLoadedFresh() { ModelSaberAPI.HashAllAvatars(); PluginUI.OnLoad(); InGameOnlineController.OnLoad(); SpectatingController.OnLoad(); GetUserInfo.UpdateUserInfo(); }
private void MenuSceneLoadedFresh() { ModelSaberAPI.HashAllAvatars(); PluginUI.OnLoad(); InGameOnlineController.OnLoad(); SpectatingController.OnLoad(); GetUserInfo.UpdateUserInfo(); if (joinAfterRestart) { joinAfterRestart = false; SharedCoroutineStarter.instance.StartCoroutine(PluginUI.instance.JoinGameWithSecret(joinSecret)); joinSecret = string.Empty; } }
public void Awake() { if (Instance != this) { Instance = this; DontDestroyOnLoad(gameObject); Client.ClientCreated += ClientCreated; _currentScene = SceneManager.GetActiveScene().name; _messageDisplayText = CustomExtensions.CreateWorldText(transform, ""); transform.position = new Vector3(0f, 3.75f, 3.75f); transform.rotation = Quaternion.Euler(-30f, 0f, 0f); _messageDisplayText.overflowMode = TextOverflowModes.Overflow; _messageDisplayText.enableWordWrapping = false; _messageDisplayText.alignment = TextAlignmentOptions.Center; DontDestroyOnLoad(_messageDisplayText.gameObject); } }
private void ActiveSceneChanged(Scene from, Scene to) { #if DEBUG Misc.Logger.Info($"Active scene changed from \"{from.name}\" to \"{to.name}\""); #endif if (from.name == "EmptyTransition" && to.name == "Menu") { PluginUI.OnLoad(); InGameOnlineController.OnLoad(to); SpectatingController.OnLoad(); } else { InGameOnlineController.Instance?.ActiveSceneChanged(from, to); if (Config.Instance.SpectatorMode) { SpectatingController.Instance?.ActiveSceneChanged(from, to); } } }
void Update() { try { if (playerNameText != null) { if (IllusionInjector.PluginManager.Plugins.Any(x => x.Name == "CameraPlus") && _camera == null) { _camera = FindObjectsOfType <Camera>().FirstOrDefault(x => x.name.StartsWith("CamPlus_")); } if (_camera != null) { if (Config.Instance.SpectatorMode) { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - _camera.transform.position); playerSpeakerIcon.rectTransform.rotation = Quaternion.LookRotation(playerSpeakerIcon.rectTransform.position - _camera.transform.position); } } else { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - InGameOnlineController.GetXRNodeWorldPosRot(XRNode.Head).Position); playerSpeakerIcon.rectTransform.rotation = Quaternion.LookRotation(playerSpeakerIcon.rectTransform.position - InGameOnlineController.GetXRNodeWorldPosRot(XRNode.Head).Position); } } } catch (Exception e) { Misc.Logger.Warning($"Unable to rotate text to the camera! Exception: {e}"); } }
void Update() { try { if (avatar != null && !forcePlayerInfo) { if (Client.Instance.Tickrate < (1f / Time.smoothDeltaTime)) { interpolationProgress += Time.deltaTime * Client.Instance.Tickrate; } else { interpolationProgress = 1f; } if (interpolationProgress > 1f) { interpolationProgress = 1f; } interpHeadPos = Vector3.Lerp(lastHeadPos, targetHeadPos, interpolationProgress); interpLeftHandPos = Vector3.Lerp(lastLeftHandPos, targetLeftHandPos, interpolationProgress); interpRightHandPos = Vector3.Lerp(lastRightHandPos, targetRightHandPos, interpolationProgress); interpHeadRot = Quaternion.Lerp(lastHeadRot, targetHeadRot, interpolationProgress); interpLeftHandRot = Quaternion.Lerp(lastLeftHandRot, targetLeftHandRot, interpolationProgress); interpRightHandRot = Quaternion.Lerp(lastRightHandRot, targetRightHandRot, interpolationProgress); transform.position = interpHeadPos; } }catch (Exception e) { Misc.Logger.Error("Unable to lerp avatar position! Exception: " + e); } try { if (IllusionInjector.PluginManager.Plugins.Any(x => x.Name == "CameraPlus") && _camera == null) { _camera = FindObjectsOfType <Camera>().FirstOrDefault(x => x.name == "Camera Plus"); } if (_camera != null) { if (Config.Instance.SpectatorMode) { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - _camera.transform.position); } } else { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - InGameOnlineController.GetXRNodeWorldPosRot(XRNode.Head).Position); } } catch (Exception e) { Misc.Logger.Warning("Unable to rotate text to the camera! Exception: " + e); } }
void Update() { try { if (playerNameText != null) { if (IPA.Loader.PluginManager.AllPlugins.Select(x => x.Metadata.Name) //BSIPA Plugins .Concat(IPA.Loader.PluginManager.Plugins.Select(x => x.Name)) //Old IPA Plugins .Any(x => x == "CameraPlus") && (_camera == null || !_camera.isActiveAndEnabled)) { _camera = FindObjectsOfType <Camera>().FirstOrDefault(x => (x.name.StartsWith("CamPlus_") || x.name.Contains("cameraplus")) && x.isActiveAndEnabled); } if (_camera != null) { if (Config.Instance.SpectatorMode) { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - _camera.transform.position); playerSpeakerIcon.rectTransform.rotation = Quaternion.LookRotation(playerSpeakerIcon.rectTransform.position - _camera.transform.position); } } else { playerNameText.rectTransform.rotation = Quaternion.LookRotation(playerNameText.rectTransform.position - InGameOnlineController.GetXRNodeWorldPosRot(XRNode.Head).Position); playerSpeakerIcon.rectTransform.rotation = Quaternion.LookRotation(playerSpeakerIcon.rectTransform.position - InGameOnlineController.GetXRNodeWorldPosRot(XRNode.Head).Position); } } } catch (Exception e) { Plugin.log.Warn($"Unable to rotate text to the camera! Exception: {e}"); } }