private void Start() { this.EnableDebug = false; string[] commandLineArgs = Environment.GetCommandLineArgs(); string[] array = commandLineArgs; for (int i = 0; i < array.Length; i++) { string a = array[i]; if (a == "-FMODDebug") { this.EnableDebug = true; } } if (this.EnableDebug) { FMOD_Listener.progressValueTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); FMOD_Listener.Fill(FMOD_Listener.progressValueTexture, new Color(0f, 1f, 0f, 0.5f)); FMOD_Listener.progressValueTexture.Apply(); FMOD_Listener.instanceLabelTexture = new Texture2D(64, 64, TextureFormat.ARGB32, false); FMOD_Listener.Fill(FMOD_Listener.instanceLabelTexture, new Color(0f, 0f, 0f, 0.5f)); FMOD_Listener.DrawBorder(FMOD_Listener.instanceLabelTexture, new Color(0f, 0f, 0f, 0.75f)); FMOD_Listener.instanceLabelTexture.Apply(); } this.Preload(); }
private static void CreateDebugTextures() { WaterOnTerrainSFX.cellTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); WaterOnTerrainSFX.cellTexture.SetPixel(0, 0, Color.white); WaterOnTerrainSFX.cellTexture.Apply(); Color color = new Color(1f, 1f, 1f, 0.125f); Color color2 = new Color(0f, 0f, 0f, 0f); WaterOnTerrainSFX.sourceTexture = new Texture2D(5, 5, TextureFormat.ARGB32, false); FMOD_Listener.Fill(WaterOnTerrainSFX.sourceTexture, new Color(1f, 1f, 1f, 0.5f)); WaterOnTerrainSFX.sourceTexture.SetPixel(0, 0, color); WaterOnTerrainSFX.sourceTexture.SetPixel(0, 4, color); WaterOnTerrainSFX.sourceTexture.SetPixel(4, 0, color); WaterOnTerrainSFX.sourceTexture.SetPixel(4, 4, color); WaterOnTerrainSFX.sourceTexture.SetPixel(1, 2, color); WaterOnTerrainSFX.sourceTexture.SetPixel(2, 1, color); WaterOnTerrainSFX.sourceTexture.SetPixel(3, 2, color); WaterOnTerrainSFX.sourceTexture.SetPixel(2, 3, color); WaterOnTerrainSFX.sourceTexture.SetPixel(2, 2, color2); WaterOnTerrainSFX.sourceTexture.Apply(); WaterOnTerrainSFX.eventTexture = new Texture2D(3, 3, TextureFormat.ARGB32, false); FMOD_Listener.Fill(WaterOnTerrainSFX.eventTexture, new Color(1f, 1f, 1f, 0.5f)); WaterOnTerrainSFX.eventTexture.SetPixel(0, 0, color); WaterOnTerrainSFX.eventTexture.SetPixel(0, 2, color); WaterOnTerrainSFX.eventTexture.SetPixel(2, 0, color); WaterOnTerrainSFX.eventTexture.SetPixel(2, 2, color); WaterOnTerrainSFX.eventTexture.Apply(); }
void Initialize() { FMOD.Studio.UnityUtil.Log("Initialize Listener"); if (sListener != null) { FMOD.Studio.UnityUtil.LogError("Too many listeners"); } sListener = this; LoadPlugins(); const string listFileName = "FMOD_bank_list.txt"; string bankListPath = getStreamingAsset(listFileName); if (!System.IO.File.Exists(bankListPath)) { FMOD.Studio.UnityUtil.LogError(bankListPath + " not found, no banks loaded."); } else { FMOD.Studio.UnityUtil.Log("Loading Banks"); var bankList = System.IO.File.ReadAllLines(bankListPath); foreach (var bankName in bankList) { FMOD.Studio.UnityUtil.Log("Load " + bankName); loadBank(bankName); } } cachedRigidBody = rigidbody; Update3DAttributes(); }
void OnDisable() { if (sListener == this) { sListener = null; } }
private IEnumerator LoadBanks() { while (!FMOD_Listener.HasLoadedBanks) { yield return(null); } string fullPath = Application.streamingAssetsPath + "/" + this.folderToLoad; string[] banks = Directory.GetFiles(fullPath, "*.bank"); for (int i = 0; i < banks.Length; i++) { banks[i] = FMOD_Listener.LoadBank(banks[i]); } this.loadedBanks = banks; FMOD_BankLoader.sPendingLoads--; if (FMOD_BankLoader.sPendingLoads == 0) { FMOD_StudioEventEmitter[] array = FMOD_StudioEventEmitter.sAwaitingBankLoad.ToArray(); for (int j = array.Length - 1; j >= 0; j--) { array[j].Activate(); } LinearEmitter[] array2 = LinearEmitter.sAwaitingBankLoad.ToArray(); for (int k = array2.Length - 1; k >= 0; k--) { array2[k].Activate(); } FMOD_Listener.ProcessPreloadRequests(); } yield break; }
private static bool IsEventInstancePlaying(EventInstance instance) { PLAYBACK_STATE pLAYBACK_STATE; FMOD_Listener.THROW_ERRORS(instance.getPlaybackState(out pLAYBACK_STATE)); return(pLAYBACK_STATE != PLAYBACK_STATE.STOPPED); }
private void OnDestroy() { if (FMOD_Listener.sListener == this) { FMOD_Listener.sListener = null; FMOD_Listener.sPreloadComplete = false; } }
private void Update3DAttributes() { FMOD.Studio.System system = FMOD_StudioSystem.instance.System; if (system != null && system.isValid()) { FMOD.Studio.ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(base.gameObject, this.cachedRigidBody); FMOD_Listener.ERRCHECK(system.setListenerAttributes(0, attributes)); } }
private void OnDisable() { if (FMOD_Listener.HasLoadedBanks && this.loadedBanks != null) { for (int i = 0; i < this.loadedBanks.Length; i++) { FMOD_Listener.UnloadBank(this.loadedBanks[i]); } } }
public static void UnloadEvents(params string[] paths) { foreach (string text in paths) { if (text != null) { FMOD_Listener.UnPreload(text); } } }
void Initialize() #endif { FMOD.Studio.UnityUtil.Log("Initialize Listener"); if (sListener != null) { FMOD.Studio.UnityUtil.LogError("Too many listeners"); } sListener = this; LoadPlugins(); const string listFileName = "FMOD_bank_list.txt"; #if UNITY_ANDROID && !UNITY_EDITOR string bankListPath = Application.streamingAssetsPath + "/" + listFileName; #else string bankListPath = getStreamingAsset(listFileName); #endif FMOD.Studio.UnityUtil.Log("Loading Banks"); try { #if UNITY_METRO && NETFX_CORE var reader = Windows.Storage.PathIO.ReadLinesAsync(bankListPath, Windows.Storage.Streams.UnicodeEncoding.Utf8); await reader.AsTask().ConfigureAwait(true); var bankList = reader.GetResults(); #elif UNITY_ANDROID && !UNITY_EDITOR var reader = new WWW(bankListPath); while (!reader.isDone) { } var bankList = reader.text.Split(new Char[] { '\n' }); reader.Dispose(); #else var bankList = System.IO.File.ReadAllLines(bankListPath); #endif foreach (var bankName in bankList) { FMOD.Studio.UnityUtil.Log("Load " + bankName); loadBank(bankName); } } catch (Exception e) { FMOD.Studio.UnityUtil.LogError("Cannot read " + bankListPath + ": " + e.Message + " : No banks loaded."); } cachedRigidBody = GetComponent <Rigidbody>(); Update3DAttributes(); }
public static void UnloadEvents(params string[] paths) { for (int i = 0; i < paths.Length; i++) { string text = paths[i]; if (text != null) { FMOD_Listener.UnPreload(text); } } }
// Use this for initialization void Start() { fCrumbleTimerReset = fCrumbleTimer; fRespawnTimerReset = fRespawnTimer; platform = GetComponentsInChildren <MeshRenderer>(); platformCollider = GetComponentsInChildren <MeshCollider>(); FListener = Camera.main.GetComponent <FMOD_Listener>(); vOriginalRotation = transform.eulerAngles; vOriginalPosition = transform.position; rockParticles = GetComponentInChildren <ParticleSystem>(); }
private Transform GetListener() { if (this._listener != null) { return(this._listener); } FMOD_Listener componentInChildren = base.GetComponentInChildren <FMOD_Listener>(); this._listener = ((!(componentInChildren != null)) ? null : componentInChildren.transform); return(this._listener); }
// Use this for initialization void Start() { fCrumbleTimerReset = fCrumbleTimer; fRespawnTimerReset = fRespawnTimer; platform = GetComponentsInChildren<MeshRenderer>(); platformCollider = GetComponentsInChildren<MeshCollider>(); FListener = Camera.main.GetComponent<FMOD_Listener>(); vOriginalRotation = transform.eulerAngles; vOriginalPosition = transform.position; rockParticles = GetComponentInChildren<ParticleSystem>(); }
public static void UnloadBank(string path) { foreach (KeyValuePair <string, Bank> current in FMOD_Listener.sLoadedBanks) { string a; FMOD_Listener.ERRCHECK(current.Value.getPath(out a)); if (a == path) { UnityUtil.Log("Unloading " + current.Key); FMOD_Listener.ERRCHECK(current.Value.unload()); FMOD_Listener.sLoadedBanks.Remove(current.Key); break; } } }
private void CreateDebugTextures() { AreaEmitter.lineTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.lineTexture.SetPixel(0, 0, Color.white); AreaEmitter.lineTexture.Apply(); AreaEmitter.voidLineTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.voidLineTexture.SetPixel(0, 0, new Color(0.5f, 0f, 0f)); AreaEmitter.voidLineTexture.Apply(); AreaEmitter.occludedLineTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.occludedLineTexture.SetPixel(0, 0, Color.black); AreaEmitter.occludedLineTexture.Apply(); AreaEmitter.occludedVoidLineTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.occludedVoidLineTexture.SetPixel(0, 0, new Color(0.125f, 0f, 0f)); AreaEmitter.occludedVoidLineTexture.Apply(); AreaEmitter.occluderBorderTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.occluderBorderTexture.SetPixel(0, 0, new Color(1f, 1f, 1f, 0.25f)); AreaEmitter.occluderBorderTexture.Apply(); AreaEmitter.occluderCentreTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.occluderCentreTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.25f)); AreaEmitter.occluderCentreTexture.Apply(); AreaEmitter.activeAreaTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false); AreaEmitter.activeAreaTexture.SetPixel(0, 0, Color.green); AreaEmitter.activeAreaTexture.Apply(); AreaEmitter.sourceTexture = new Texture2D(10, 10, TextureFormat.ARGB32, false); FMOD_Listener.Fill(AreaEmitter.sourceTexture, new Color(0f, 0f, 0f, 0f)); AreaEmitter.DrawCross(AreaEmitter.sourceTexture, new Color(1f, 1f, 1f, 0.5f)); AreaEmitter.sourceTexture.Apply(); AreaEmitter.pointTexture = new Texture2D(5, 5, TextureFormat.ARGB32, false); FMOD_Listener.Fill(AreaEmitter.pointTexture, new Color(1f, 1f, 1f, 0.5f)); Color color = new Color(1f, 1f, 1f, 0.25f); AreaEmitter.pointTexture.SetPixel(0, 0, color); AreaEmitter.pointTexture.SetPixel(0, 4, color); AreaEmitter.pointTexture.SetPixel(4, 0, color); AreaEmitter.pointTexture.SetPixel(4, 4, color); AreaEmitter.pointTexture.Apply(); AreaEmitter.occludedPointTexture = new Texture2D(5, 5, TextureFormat.ARGB32, false); FMOD_Listener.Fill(AreaEmitter.occludedPointTexture, new Color(0f, 0f, 0f, 0.5f)); color = new Color(0f, 0f, 0f, 0.25f); AreaEmitter.occludedPointTexture.SetPixel(0, 0, color); AreaEmitter.occludedPointTexture.SetPixel(0, 4, color); AreaEmitter.occludedPointTexture.SetPixel(4, 0, color); AreaEmitter.occludedPointTexture.SetPixel(4, 4, color); AreaEmitter.occludedPointTexture.Apply(); }
void Initialize() { //Debug.Log("Initialize Listener: BEGIN"); if (sListener != null) { Debug.LogError("Too many listeners"); } sListener = this; LoadPlugins(); string bankListPath = getStreamingAsset("FMOD_bank_list.txt"); var bankList = System.IO.File.ReadAllLines(bankListPath); foreach (var bankName in bankList) { loadBank(bankName); } }
private void Initialize() { if (FMOD_StudioSystem.instance) { UnityUtil.Log("Initialize Listener"); if (FMOD_Listener.sListener != null) { UnityUtil.Log("Too many listeners; destroying " + FMOD_Listener.sListener.ToString()); UnityEngine.Object.Destroy(FMOD_Listener.sListener); } FMOD_Listener.sListener = this; this.LoadPlugins(); this.LoadBanks(); this.cachedRigidBody = base.GetComponent <Rigidbody>(); this.Update3DAttributes(); } else { UnityEngine.Debug.LogError("FMOD_StudioSystem.instance is null, failed to initialize listener"); base.enabled = false; } }
private void Update() { this.Update3DAttributes(); if (FMOD_Listener.FMODCommonUpdate != null) { FMOD_Listener.FMODCommonUpdate(); } if (this.EnableDebug) { if (Input.GetKeyDown(KeyCode.RightControl)) { if (!this.showEventList) { this.showEventList = true; this.DrawExtraDebug = FMOD_Listener.DrawTreeDebug; } else if (this.DrawExtraDebug == FMOD_Listener.DrawTreeDebug) { this.DrawExtraDebug = new Action(this.DrawLinearEmitters); } else if (this.DrawExtraDebug == new Action(this.DrawLinearEmitters)) { this.DrawExtraDebug = new Action(this.DrawAreaEmitters); } else { this.showEventList = false; } } if (Input.GetKeyDown(KeyCode.RightShift)) { this.showInstanceLabelsInWorld = !this.showInstanceLabelsInWorld; } if (this.showEventList || this.showInstanceLabelsInWorld) { this.UpdateEventInfoList(); } } }
private void LoadPlugins() { FMOD.System system = null; FMOD_Listener.ERRCHECK(FMOD_StudioSystem.instance.System.getLowLevelSystem(out system)); if (Application.platform == RuntimePlatform.IPhonePlayer && this.pluginPaths.Length != 0) { UnityUtil.LogError("DSP Plugins not currently supported on iOS, contact [email protected] for more information"); return; } string[] array = this.pluginPaths; for (int i = 0; i < array.Length; i++) { string rawName = array[i]; string text = this.pluginPath + "/" + this.GetPluginFileName(rawName); UnityUtil.Log("Loading plugin: " + text); if (!File.Exists(text)) { UnityUtil.LogWarning("plugin not found: " + text); } uint num; FMOD_Listener.ERRCHECK(system.loadPlugin(text, out num)); } }
private void DrawInstanceLabels() { foreach (FMOD_Listener.EventInfo current in this.eventInfoList) { if (current.is3D) { foreach (FMOD_Listener.EventInstanceInfo current2 in current.instances) { Vector3 position = current2.attributes3D.position.toUnityVector(); Vector3 vector = base.GetComponent <Camera>().WorldToScreenPoint(position); if (vector.z > 0f) { Vector2 vector2 = FMOD_Listener.InstanceLabelStyle.CalcSize(new GUIContent(current.path)); Rect screenRect = new Rect(vector.x, (float)base.GetComponent <Camera>().pixelHeight - vector.y - vector2.y, vector2.x, vector2.y * (float)(current2.ParameterCount + 2)); GUILayout.BeginArea(screenRect); FMOD_Listener.ValueBox(current.path, current2.normalizedPosition); FMOD_Listener.ValueBox(string.Format("distance {0:G3}", current2.distance), current2.normalizedDistance); if (current2.parameters != null) { foreach (FMOD_Listener.ParameterInfo current3 in current2.parameters) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label(current3.name, FMOD_Listener.InstanceLabelStyle, new GUILayoutOption[] { GUILayout.ExpandWidth(false) }); FMOD_Listener.ValueBox(current3.value.ToString("G3"), current3.normalizedValue); GUILayout.EndHorizontal(); } } GUILayout.EndArea(); } } } } }
void Initialize() #endif { FMOD.Studio.UnityUtil.Log("Initialize Listener"); if (sListener != null) { FMOD.Studio.UnityUtil.LogError("Too many listeners"); } sListener = this; LoadPlugins(); const string listFileName = "FMOD_bank_list.txt"; #if UNITY_ANDROID && !UNITY_EDITOR string bankListPath = Application.streamingAssetsPath + "/" + listFileName; #else string bankListPath = getStreamingAsset(listFileName); #endif FMOD.Studio.UnityUtil.Log("Loading Banks"); try { #if UNITY_METRO && NETFX_CORE var reader = Windows.Storage.PathIO.ReadLinesAsync(bankListPath, Windows.Storage.Streams.UnicodeEncoding.Utf8); await reader.AsTask().ConfigureAwait(true); var bankList = reader.GetResults(); #elif UNITY_ANDROID && !UNITY_EDITOR var reader = new WWW(bankListPath); while (!reader.isDone) { } var bankList = reader.text.Split(new Char[] { '\n' }); reader.Dispose(); #else var bankList = System.IO.File.ReadAllLines(bankListPath); #endif foreach (var bankName in bankList) { FMOD.Studio.UnityUtil.Log("Load " + bankName); loadBank(bankName); } } catch (Exception e) { FMOD.Studio.UnityUtil.LogError("Cannot read " + bankListPath + ": " + e.Message + " : No banks loaded."); } cachedRigidBody = GetComponent<Rigidbody>(); Update3DAttributes(); }
void OnDisable() { if (sListener == this) sListener = null; }
private void UpdateEventInfoList() { this.eventInfoList.Clear(); try { FMOD.Studio.ATTRIBUTES_3D aTTRIBUTES_3D; FMOD_Listener.THROW_ERRORS(FMOD_StudioSystem.instance.System.getListenerAttributes(0, out aTTRIBUTES_3D)); Vector3 b2 = aTTRIBUTES_3D.position.toUnityVector(); Bank[] array = null; FMOD_Listener.THROW_ERRORS(FMOD_StudioSystem.instance.System.getBankList(out array)); Bank[] array2 = array; for (int i = 0; i < array2.Length; i++) { Bank bank = array2[i]; try { EventDescription[] array3 = null; FMOD_Listener.THROW_ERRORS(bank.getEventList(out array3)); if (array3 != null) { EventDescription[] array4 = array3; for (int j = 0; j < array4.Length; j++) { EventDescription eventDescription = array4[j]; int num = 0; FMOD_Listener.THROW_ERRORS(eventDescription.getInstanceCount(out num)); if (num > 0) { FMOD_Listener.EventInfo item = default(FMOD_Listener.EventInfo); item.streamCount = 0; FMOD_Listener.THROW_ERRORS(eventDescription.getPath(out item.path)); if (FMOD_Listener.PathFilter.Length > 0) { bool flag = false; string[] pathFilter = FMOD_Listener.PathFilter; for (int k = 0; k < pathFilter.Length; k++) { string value = pathFilter[k]; if (!item.path.ToLowerInvariant().Contains(value)) { flag = true; break; } } if (flag) { goto IL_3F4; } } FMOD_Listener.THROW_ERRORS(eventDescription.getLength(out item.timelineLength)); FMOD_Listener.THROW_ERRORS(eventDescription.is3D(out item.is3D)); float num2 = 0f; FMOD_Listener.THROW_ERRORS(eventDescription.getMinimumDistance(out num2)); float num3 = 0f; FMOD_Listener.THROW_ERRORS(eventDescription.getMaximumDistance(out num3)); float num4 = num3 - num2; if (item.timelineLength > 0) { item.normalizedPositions = new List <float>(num); } else { item.normalizedPositions = null; } EventInstance[] array5 = null; FMOD_Listener.THROW_ERRORS(eventDescription.getInstanceList(out array5)); item.instances = new List <FMOD_Listener.EventInstanceInfo>(num); EventInstance[] array6 = array5; for (int l = 0; l < array6.Length; l++) { EventInstance eventInstance = array6[l]; try { if (FMOD_Listener.IsEventInstancePlaying(eventInstance)) { FMOD_Listener.EventInstanceInfo item2 = default(FMOD_Listener.EventInstanceInfo); float num5 = 0f; FMOD_Listener.THROW_ERRORS(eventInstance.getProperty(EVENT_PROPERTY.STREAM_COUNT, out num5)); item2.streamCount = (int)num5; item.streamCount += item2.streamCount; FMOD_Listener.THROW_ERRORS(eventInstance.get3DAttributes(out item2.attributes3D)); Vector3 a2 = item2.attributes3D.position.toUnityVector(); float num6 = Vector3.Distance(a2, b2); item2.distance = num6; item2.normalizedDistance = Mathf.Clamp01((num6 - num2) / num4); if (item.timelineLength > 0) { int num7 = 0; FMOD_Listener.THROW_ERRORS(eventInstance.getTimelinePosition(out num7)); item2.normalizedPosition = Mathf.Clamp01((float)num7 / (float)item.timelineLength); } else { item2.normalizedPosition = 0f; } int num8 = 0; FMOD_Listener.THROW_ERRORS(eventInstance.getParameterCount(out num8)); if (num8 > 0) { item2.parameters = new List <FMOD_Listener.ParameterInfo>(num8); for (int m = 0; m < num8; m++) { ParameterInstance parameterInstance; FMOD_Listener.THROW_ERRORS(eventInstance.getParameterByIndex(m, out parameterInstance)); PARAMETER_DESCRIPTION pARAMETER_DESCRIPTION; FMOD_Listener.THROW_ERRORS(parameterInstance.getDescription(out pARAMETER_DESCRIPTION)); float num9 = 0f; FMOD_Listener.THROW_ERRORS(parameterInstance.getValue(out num9)); float num10 = pARAMETER_DESCRIPTION.maximum - pARAMETER_DESCRIPTION.minimum; FMOD_Listener.ParameterInfo item3; item3.name = pARAMETER_DESCRIPTION.name; item3.value = num9; item3.normalizedValue = (num9 - pARAMETER_DESCRIPTION.minimum) / num10; item2.parameters.Add(item3); } item2.parameters.Sort(); } else { item2.parameters = null; } item.instances.Add(item2); if (item.normalizedPositions != null) { item.normalizedPositions.Add(item2.normalizedPosition); } } } catch (FMOD_Listener.FMODErrorException ex) { if (ex.Error != RESULT.ERR_INVALID_HANDLE) { UnityEngine.Debug.LogWarning(ex); } } } this.eventInfoList.Add(item); } IL_3F4 :; } } } catch (FMOD_Listener.FMODErrorException ex2) { if (ex2.Error != RESULT.ERR_INVALID_HANDLE) { UnityEngine.Debug.LogWarning(ex2); } } } this.eventInfoList.Sort((FMOD_Listener.EventInfo a, FMOD_Listener.EventInfo b) => string.Compare(a.path, b.path, StringComparison.InvariantCultureIgnoreCase)); } catch (FMOD_Listener.FMODErrorException message) { UnityEngine.Debug.LogWarning(message); } }
void Initialize() { FMOD.Studio.UnityUtil.Log("Initialize Listener"); if (sListener != null) { FMOD.Studio.UnityUtil.LogError("Too many listeners"); } sListener = this; LoadPlugins(); const string listFileName = "FMOD_bank_list.txt"; string bankListPath = getStreamingAsset(listFileName); if (!System.IO.File.Exists(bankListPath)) { FMOD.Studio.UnityUtil.LogError(bankListPath + " not found, no banks loaded."); } else { FMOD.Studio.UnityUtil.Log("Loading Banks"); var bankList = System.IO.File.ReadAllLines(bankListPath); foreach (var bankName in bankList) { FMOD.Studio.UnityUtil.Log("Load " + bankName); loadBank(bankName); } } }
private static void ValueBox(string label, float progress) { FMOD_Listener.ValueBox(label, progress, FMOD_Listener.InstanceLabelStyle, FMOD_Listener.ProgressValueStyle); }
private void DrawEventList() { GUIStyle gUIStyle = new GUIStyle(GUI.skin.label); gUIStyle.alignment = TextAnchor.MiddleLeft; gUIStyle.fontSize = 10; GUIStyle gUIStyle2 = new GUIStyle(gUIStyle); gUIStyle2.alignment = TextAnchor.MiddleRight; GUIStyle gUIStyle3 = new GUIStyle(gUIStyle); gUIStyle3.alignment = TextAnchor.MiddleRight; GUILayout.Space(25f); GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); if (FMOD_Listener.PathFilter.Length > 0) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("Path Filter:", gUIStyle, new GUILayoutOption[0]); GUILayout.Label(string.Join(" AND ", FMOD_Listener.PathFilter), gUIStyle3, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.Space(10f); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("Instances", gUIStyle, new GUILayoutOption[] { GUILayout.Width(50f) }); GUILayout.Label("Streams", gUIStyle, new GUILayoutOption[] { GUILayout.Width(40f) }); GUILayout.Label("Event Path", gUIStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); int num = 0; int num2 = 0; foreach (FMOD_Listener.EventInfo current in this.eventInfoList) { if (current.instances.Count > 0) { List <FMOD_Listener.EventInstanceInfo> instances = current.instances; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label(instances.Count.ToString(), gUIStyle2, new GUILayoutOption[] { GUILayout.Width(50f) }); GUILayout.Label(current.streamCount.ToString(), gUIStyle2, new GUILayoutOption[] { GUILayout.Width(40f) }); num += instances.Count; num2 += current.streamCount; if (current.normalizedPositions != null) { FMOD_Listener.MultiValueBox(current.path, current.normalizedPositions, gUIStyle, FMOD_Listener.ProgressValueStyle); } else { GUILayout.Label(current.path, gUIStyle, new GUILayoutOption[0]); } GUILayout.EndHorizontal(); } } GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label(num.ToString(), gUIStyle2, new GUILayoutOption[] { GUILayout.Width(50f) }); GUILayout.Label(num2.ToString(), gUIStyle2, new GUILayoutOption[] { GUILayout.Width(40f) }); GUILayout.Label("Totals", gUIStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginArea(new Rect((float)(base.GetComponent <Camera>().pixelWidth - 155), 0f, 150f, 550f)); BUFFER_USAGE bUFFER_USAGE; if (UnityUtil.ERRCHECK(FMOD_StudioSystem.instance.System.getBufferUsage(out bUFFER_USAGE))) { GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); GUILayout.Label("Command Buffer Usage", gUIStyle, new GUILayoutOption[0]); FMOD_Listener.NumberField("Current:", bUFFER_USAGE.studioCommandQueue.currentUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Peak:", bUFFER_USAGE.studioCommandQueue.peakUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Capacity:", bUFFER_USAGE.studioCommandQueue.capacity, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Stalls:", bUFFER_USAGE.studioCommandQueue.stallCount, gUIStyle, 50f, gUIStyle3, 50f); GUILayout.EndVertical(); } int value = 0; int value2 = 0; if (UnityUtil.ERRCHECK(Memory.GetStats(out value, out value2))) { GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); GUILayout.Label("Memory Usage", gUIStyle, new GUILayoutOption[0]); FMOD_Listener.NumberField("Current:", value, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Peak:", value2, gUIStyle, 50f, gUIStyle3, 50f); GUILayout.EndVertical(); } CPU_USAGE cPU_USAGE; if (UnityUtil.ERRCHECK(FMOD_StudioSystem.instance.System.getCPUUsage(out cPU_USAGE))) { GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); GUILayout.Label("CPU Usage", gUIStyle, new GUILayoutOption[0]); GUILayout.Label("Current", gUIStyle, new GUILayoutOption[0]); FMOD_Listener.NumberField("DSP:", cPU_USAGE.dspUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Stream:", cPU_USAGE.streamUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Update:", cPU_USAGE.updateUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Studio:", cPU_USAGE.studioUsage, gUIStyle, 50f, gUIStyle3, 50f); this.peakCPUUsage.dspUsage = Math.Max(this.peakCPUUsage.dspUsage, cPU_USAGE.dspUsage); this.peakCPUUsage.streamUsage = Math.Max(this.peakCPUUsage.streamUsage, cPU_USAGE.streamUsage); this.peakCPUUsage.updateUsage = Math.Max(this.peakCPUUsage.updateUsage, cPU_USAGE.updateUsage); this.peakCPUUsage.studioUsage = Math.Max(this.peakCPUUsage.studioUsage, cPU_USAGE.studioUsage); GUILayout.Space(10f); GUILayout.Label("Peak", gUIStyle, new GUILayoutOption[0]); FMOD_Listener.NumberField("DSP:", this.peakCPUUsage.dspUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Stream:", this.peakCPUUsage.streamUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Update:", this.peakCPUUsage.updateUsage, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Studio:", this.peakCPUUsage.studioUsage, gUIStyle, 50f, gUIStyle3, 50f); GUILayout.EndVertical(); } FMOD.System system = null; if (UnityUtil.ERRCHECK(FMOD_StudioSystem.instance.System.getLowLevelSystem(out system))) { int num3 = 0; int num4 = 0; for (int i = 0; i < 1024; i++) { Channel channel; if (UnityUtil.ERRCHECK(system.getChannel(i, out channel))) { bool flag = false; RESULT rESULT = channel.isPlaying(out flag); if (rESULT != RESULT.ERR_INVALID_HANDLE) { FMOD_Listener.ERRCHECK(rESULT); } if (flag) { num3++; bool flag2 = false; UnityUtil.ERRCHECK(channel.isVirtual(out flag2)); if (!flag2) { num4++; } } } } GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); GUILayout.Label("Channels", gUIStyle, new GUILayoutOption[0]); FMOD_Listener.NumberField("Playing:", num3, gUIStyle, 50f, gUIStyle3, 50f); FMOD_Listener.NumberField("Real:", num4, gUIStyle, 50f, gUIStyle3, 50f); GUILayout.EndVertical(); } GUILayout.BeginVertical(GUI.skin.button, new GUILayoutOption[0]); FMOD_Listener.NumberField("Streams:", num2, gUIStyle, 50f, gUIStyle3, 50f); GUILayout.EndVertical(); GUILayout.EndArea(); }
private void ConvertToVR() { if (ForestVR.Enabled) { Debug.LogWarning("ENABLING VR"); for (int i = 0; i < this.MainCamera.transform.childCount; i++) { this.MainCamera.transform.GetChild(i).SetParent(this.cameraChildOffsetTranform, false); } this.mouthPiece.transform.parent = this.VREyeCamera.transform; this.mouthPiece.transform.localEulerAngles = Vector3.zero; this.mouthPiece.transform.localPosition = new Vector3(0f, -1.78f, 0.008f); AudioListener componentInChildren = this.MainCamera.GetComponentInChildren <AudioListener>(true); if (componentInChildren) { UnityEngine.Object.Destroy(componentInChildren); } FMOD_Listener componentInChildren2 = this.MainCamera.GetComponentInChildren <FMOD_Listener>(true); if (componentInChildren2) { UnityEngine.Object.Destroy(componentInChildren2); } this.MainCamera.SetActive(false); this.VRCameraRig.SetActive(true); this.Player.GetComponent <FirstPersonHeadBob>().enabled = false; this.Player.GetComponent <SimpleMouseRotator>().enabled = false; camFollowHead componentInChildren3 = this.PlayerBase.GetComponentInChildren <camFollowHead>(true); foreach (GameObject gameObject in this.PlayerMeshesToDisable) { SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren) { skinnedMeshRenderer.shadowCastingMode = ShadowCastingMode.ShadowsOnly; } } CoopArmorReplicator component = LocalPlayer.Transform.GetComponent <CoopArmorReplicator>(); foreach (GameObject gameObject2 in component.Bones) { MeshRenderer component2 = gameObject2.GetComponent <MeshRenderer>(); if (component2) { component2.enabled = false; } } this.VRPlayerHands.gameObject.SetActive(true); this.VRPlayerHands.shadowCastingMode = ShadowCastingMode.On; this.defaultPlayerArms.gameObject.SetActive(false); LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("vrBool").Value = true; this.JointsOffsetTransform.parent = LocalPlayer.vrPlayerControl.VROffsetTransform; this.heldLogsParentTransform.parent = LocalPlayer.vrAdapter.VREyeCamera.transform; this.heldLogsParentTransform.localPosition = new Vector3(0.053f, -0.409f, -0.0181f); this.heldLogsParentTransform.localEulerAngles = new Vector3(9.855f, -1.221f, 0.205f); this.grassDisplacementGo.SetActive(false); this.heldDeadBodyGo.transform.localPosition = new Vector3(1.22f, -2.99f, 0.49f); } else { this.VRWatchParentGo.SetActive(false); this.HeightScaleGo.SetActive(false); } }