// Thanks Loukylor and Knah private static IEnumerator LoadAudioClip(NotificationType notificationType) { UnityWebRequest request = UnityWebRequest.Get(GetAudioPath(notificationType)); request.SendWebRequest(); while (!request.isDone) { yield return(null); } AudioClip audioClip = WebRequestWWW.InternalCreateAudioClipUsingDH(request.downloadHandler, request.url, false, false, AudioType.UNKNOWN); request.Dispose(); if (audioClip.loadState == AudioDataLoadState.Loaded) { instance.audioClipDictionary.Add(notificationType, audioClip); instance.audioClipDictionary[notificationType].hideFlags = HideFlags.HideAndDontSave; Utilities.LoggerInstance.Msg($"{notificationType} Notification Sound Loaded"); } else if (audioClip.loadState == AudioDataLoadState.Failed) { Utilities.LoggerInstance.Error($"Failed To Load {notificationType} Notification Sound"); } }
internal object GetMovieTextureInternal() { return(WebRequestWWW.InternalCreateMovieTextureUsingDH(_uwr.downloadHandler)); }
internal Object GetAudioClipInternal(bool threeD, bool stream, bool compressed, AudioType audioType) { return(WebRequestWWW.InternalCreateAudioClipUsingDH(_uwr.downloadHandler, _uwr.url, stream, compressed, audioType)); }
public IEnumerator InitThings() { MelonLogger.Log("Waiting for init"); while (ReferenceEquals(NetworkManager.field_Internal_Static_NetworkManager_0, null)) { yield return(null); } while (ReferenceEquals(VRCAudioManager.field_Private_Static_VRCAudioManager_0, null)) { yield return(null); } while (ReferenceEquals(VRCUiManager.prop_VRCUiManager_0, null)) { yield return(null); } var audioManager = VRCAudioManager.field_Private_Static_VRCAudioManager_0; myUIGroup = new[] { audioManager.field_Public_AudioMixerGroup_0, audioManager.field_Public_AudioMixerGroup_1, audioManager.field_Public_AudioMixerGroup_2 }.Single(it => it.name == "UI"); MelonLogger.Log("Start init"); NetworkManagerHooks.Initialize(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("JoinNotifier.joinnotifier.assetbundle")) using (var tempStream = new MemoryStream((int)stream.Length)) { stream.CopyTo(tempStream); myAssetBundle = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0); myAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; } myJoinSprite = myAssetBundle.LoadAsset_Internal("Assets/JoinNotifier/JoinIcon.png", Il2CppType.Of <Sprite>()).Cast <Sprite>(); myJoinSprite.hideFlags |= HideFlags.DontUnloadUnusedAsset; if (File.Exists(CustomJoinSoundFileName)) { MelonLogger.Msg("Loading custom join sound"); var uwr = UnityWebRequest.Get($"file://{Path.Combine(Environment.CurrentDirectory, CustomJoinSoundFileName)}"); var asyncOp = uwr.SendWebRequest(); while (uwr.isDone) { yield return(null); } myJoinClip = WebRequestWWW.InternalCreateAudioClipUsingDH(uwr.downloadHandler, uwr.url, false, false, AudioType.UNKNOWN); } if (myJoinClip == null) { myJoinClip = myAssetBundle.LoadAsset_Internal("Assets/JoinNotifier/Chime.ogg", Il2CppType.Of <AudioClip>()).Cast <AudioClip>(); } myJoinClip.hideFlags |= HideFlags.DontUnloadUnusedAsset; if (File.Exists(CustomLeaveSoundFileName)) { MelonLogger.Msg("Loading custom leave sound"); var uwr = UnityWebRequest.Get($"file://{Path.Combine(Environment.CurrentDirectory, CustomLeaveSoundFileName)}"); var asyncOp = uwr.SendWebRequest(); while (uwr.isDone) { yield return(null); } myLeaveClip = WebRequestWWW.InternalCreateAudioClipUsingDH(uwr.downloadHandler, uwr.url, false, false, AudioType.UNKNOWN); } if (myLeaveClip == null) { myLeaveClip = myAssetBundle.LoadAsset_Internal("Assets/JoinNotifier/DoorClose.ogg", Il2CppType.Of <AudioClip>()).Cast <AudioClip>(); } myLeaveClip.hideFlags |= HideFlags.DontUnloadUnusedAsset; CreateGameObjects(); NetworkManagerHooks.OnJoin += OnPlayerJoined; NetworkManagerHooks.OnLeave += OnPlayerLeft; }