private static void ShowEffectContextMenu(AudioMixerGroupController group, AudioMixerEffectController effect, int effectIndex, AudioMixerController controller, Rect buttonRect) { GenericMenu genericMenu = new GenericMenu(); if (!effect.IsReceive()) { if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume()) { genericMenu.AddItem(new GUIContent("Allow Wet Mixing (causes higher memory usage)"), effect.enableWetMix, delegate { effect.enableWetMix = !effect.enableWetMix; }); genericMenu.AddItem(new GUIContent("Bypass"), effect.bypass, delegate { effect.bypass = !effect.bypass; controller.UpdateBypass(); AudioMixerUtility.RepaintAudioMixerAndInspectors(); }); genericMenu.AddSeparator(string.Empty); } genericMenu.AddItem(new GUIContent("Copy effect settings to all snapshots"), false, delegate { Undo.RecordObject(controller, "Copy effect settings to all snapshots"); if (effect.IsAttenuation()) { controller.CopyAttenuationToAllSnapshots(group, controller.TargetSnapshot); } else { controller.CopyEffectSettingsToAllSnapshots(group, effectIndex, controller.TargetSnapshot, effect.IsSend()); } AudioMixerUtility.RepaintAudioMixerAndInspectors(); }); if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume() && effect.enableWetMix) { genericMenu.AddItem(new GUIContent("Copy effect settings to all snapshots, including wet level"), false, delegate { Undo.RecordObject(controller, "Copy effect settings to all snapshots, including wet level"); controller.CopyEffectSettingsToAllSnapshots(group, effectIndex, controller.TargetSnapshot, true); AudioMixerUtility.RepaintAudioMixerAndInspectors(); }); } genericMenu.AddSeparator(string.Empty); } AudioMixerChannelStripView.AddEffectItemsToMenu(controller, group, effectIndex, "Add effect before/", genericMenu); AudioMixerChannelStripView.AddEffectItemsToMenu(controller, group, effectIndex + 1, "Add effect after/", genericMenu); if (!effect.IsAttenuation()) { genericMenu.AddSeparator(string.Empty); genericMenu.AddItem(new GUIContent("Remove this effect"), false, delegate { controller.ClearSendConnectionsTo(effect); controller.RemoveEffect(effect, group); AudioMixerUtility.RepaintAudioMixerAndInspectors(); }); } genericMenu.DropDown(buttonRect); }
public void OnGUI(AudioMixerGroupController group) { if (group == null) { return; } AudioMixerController controller = group.controller; List <AudioMixerGroupController> allAudioGroupsSlow = controller.GetAllAudioGroupsSlow(); Dictionary <AudioMixerEffectController, AudioMixerGroupController> dictionary = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>(); foreach (AudioMixerGroupController current in allAudioGroupsSlow) { AudioMixerEffectController[] effects = current.effects; for (int i = 0; i < effects.Length; i++) { AudioMixerEffectController key = effects[i]; dictionary[key] = current; } } Rect totalRect = EditorGUILayout.BeginVertical(new GUILayoutOption[0]); if (EditorApplication.isPlaying) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); GUILayout.Toggle(AudioSettings.editingInPlaymode, AudioMixerEffectView.Texts.editInPlaymode, EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.Width(120f) }); if (EditorGUI.EndChangeCheck()) { AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } using (new EditorGUI.DisabledScope(!AudioMixerController.EditingTargetSnapshot())) { if (group != this.m_PrevGroup) { this.m_PrevGroup = group; controller.m_HighlightEffectIndex = -1; AudioMixerUtility.RepaintAudioMixerAndInspectors(); } AudioMixerEffectView.DoInitialModule(group, controller, allAudioGroupsSlow); for (int j = 0; j < group.effects.Length; j++) { this.DoEffectGUI(j, group, allAudioGroupsSlow, dictionary, ref controller.m_HighlightEffectIndex); } this.m_EffectDragging.HandleDragging(totalRect, group, controller); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (EditorGUILayout.ButtonMouseDown(AudioMixerEffectView.Texts.addEffect, FocusType.Passive, GUISkin.current.button, new GUILayoutOption[0])) { GenericMenu genericMenu = new GenericMenu(); Rect last = GUILayoutUtility.topLevel.GetLast(); AudioMixerGroupController[] groups = new AudioMixerGroupController[] { group }; AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groups, group.effects.Length, string.Empty, genericMenu); genericMenu.DropDown(last); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
public void OnGUI(AudioMixerGroupController group) { if ((UnityEngine.Object)group == (UnityEngine.Object)null) { return; } AudioMixerController controller = group.controller; List <AudioMixerGroupController> allAudioGroupsSlow = controller.GetAllAudioGroupsSlow(); Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>(); using (List <AudioMixerGroupController> .Enumerator enumerator = allAudioGroupsSlow.GetEnumerator()) { while (enumerator.MoveNext()) { AudioMixerGroupController current = enumerator.Current; foreach (AudioMixerEffectController effect in current.effects) { effectMap[effect] = current; } } } Rect totalRect = EditorGUILayout.BeginVertical(); if (EditorApplication.isPlaying) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); GUILayout.Toggle((AudioSettings.editingInPlaymode ? 1 : 0) != 0, AudioMixerEffectView.Texts.editInPlaymode, EditorStyles.miniButton, new GUILayoutOption[1] { GUILayout.Width(120f) }); if (EditorGUI.EndChangeCheck()) { AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } EditorGUI.BeginDisabledGroup(!AudioMixerController.EditingTargetSnapshot()); if ((UnityEngine.Object)group != (UnityEngine.Object) this.m_PrevGroup) { this.m_PrevGroup = group; controller.m_HighlightEffectIndex = -1; AudioMixerUtility.RepaintAudioMixerAndInspectors(); } double num = (double)AudioMixerEffectView.DoInitialModule(group, controller, allAudioGroupsSlow); for (int effectIndex = 0; effectIndex < group.effects.Length; ++effectIndex) { this.DoEffectGUI(effectIndex, group, allAudioGroupsSlow, effectMap, ref controller.m_HighlightEffectIndex); } this.m_EffectDragging.HandleDragging(totalRect, group, controller); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (EditorGUILayout.ButtonMouseDown(AudioMixerEffectView.Texts.addEffect, FocusType.Passive, GUISkin.current.button)) { GenericMenu pm = new GenericMenu(); Rect last = GUILayoutUtility.topLevel.GetLast(); AudioMixerGroupController[] groups = new AudioMixerGroupController[1] { group }; AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groups, group.effects.Length, string.Empty, pm); pm.DropDown(last); } EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); }
private static void ShowEffectContextMenu(AudioMixerGroupController group, AudioMixerEffectController effect, int effectIndex, AudioMixerController controller, Rect buttonRect) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type AudioMixerEffectView.\u003CShowEffectContextMenu\u003Ec__AnonStorey63 menuCAnonStorey63 = new AudioMixerEffectView.\u003CShowEffectContextMenu\u003Ec__AnonStorey63(); // ISSUE: reference to a compiler-generated field menuCAnonStorey63.effect = effect; // ISSUE: reference to a compiler-generated field menuCAnonStorey63.controller = controller; // ISSUE: reference to a compiler-generated field menuCAnonStorey63.group = group; // ISSUE: reference to a compiler-generated field menuCAnonStorey63.effectIndex = effectIndex; GenericMenu pm = new GenericMenu(); // ISSUE: reference to a compiler-generated field if (!menuCAnonStorey63.effect.IsReceive()) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field if (!menuCAnonStorey63.effect.IsAttenuation() && !menuCAnonStorey63.effect.IsSend() && !menuCAnonStorey63.effect.IsDuckVolume()) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method pm.AddItem(new GUIContent("Allow Wet Mixing (causes higher memory usage)"), menuCAnonStorey63.effect.enableWetMix, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AA)); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method pm.AddItem(new GUIContent("Bypass"), menuCAnonStorey63.effect.bypass, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AB)); pm.AddSeparator(string.Empty); } // ISSUE: reference to a compiler-generated method pm.AddItem(new GUIContent("Copy effect settings to all snapshots"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AC)); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field if (!menuCAnonStorey63.effect.IsAttenuation() && !menuCAnonStorey63.effect.IsSend() && (!menuCAnonStorey63.effect.IsDuckVolume() && menuCAnonStorey63.effect.enableWetMix)) { // ISSUE: reference to a compiler-generated method pm.AddItem(new GUIContent("Copy effect settings to all snapshots, including wet level"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AD)); } pm.AddSeparator(string.Empty); } // ISSUE: reference to a compiler-generated field AudioMixerGroupController[] groups = new AudioMixerGroupController[1] { menuCAnonStorey63.group }; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field AudioMixerChannelStripView.AddEffectItemsToMenu(menuCAnonStorey63.controller, groups, menuCAnonStorey63.effectIndex, "Add effect before/", pm); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field AudioMixerChannelStripView.AddEffectItemsToMenu(menuCAnonStorey63.controller, groups, menuCAnonStorey63.effectIndex + 1, "Add effect after/", pm); // ISSUE: reference to a compiler-generated field if (!menuCAnonStorey63.effect.IsAttenuation()) { pm.AddSeparator(string.Empty); // ISSUE: reference to a compiler-generated method pm.AddItem(new GUIContent("Remove this effect"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AE)); } pm.DropDown(buttonRect); }
public void OnGUI(AudioMixerGroupController group) { if (group == null) { return; } var controller = group.controller; var allGroups = controller.GetAllAudioGroupsSlow(); var effectMap = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>(); foreach (var g in allGroups) { foreach (var e in g.effects) { effectMap[e] = g; } } Rect totalRect = EditorGUILayout.BeginVertical(); if (EditorApplication.isPlaying) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); GUILayout.Toggle(AudioSettings.editingInPlaymode, Texts.editInPlaymode, EditorStyles.miniButton, GUILayout.Width(120)); if (EditorGUI.EndChangeCheck()) { AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } using (new EditorGUI.DisabledScope(!AudioMixerController.EditingTargetSnapshot())) { if (group != m_PrevGroup) { m_PrevGroup = group; controller.m_HighlightEffectIndex = -1; AudioMixerUtility.RepaintAudioMixerAndInspectors(); } // Do Effect modules DoInitialModule(group, controller, allGroups); for (int effectIndex = 0; effectIndex < group.effects.Length; effectIndex++) { DoEffectGUI(effectIndex, group, allGroups, effectMap, ref controller.m_HighlightEffectIndex); } m_EffectDragging.HandleDragging(totalRect, group, controller); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (EditorGUILayout.DropdownButton(Texts.addEffect, FocusType.Passive, GUISkin.current.button)) { GenericMenu pm = new GenericMenu(); Rect buttonRect = GUILayoutUtility.topLevel.GetLast(); AudioMixerGroupController[] groupArray = new AudioMixerGroupController[] { group }; AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groupArray, group.effects.Length, string.Empty, pm); pm.DropDown(buttonRect); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }