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); }
private static void ShowBusPopupMenu(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, AudioMixerEffectController effect, Rect buttonRect) { GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("None"), false, new GenericMenu.MenuFunction2(AudioMixerChannelStripView.ConnectSendPopupCallback), new AudioMixerChannelStripView.ConnectSendContext(effect, null)); genericMenu.AddSeparator(string.Empty); AudioMixerChannelStripView.AddMenuItemsForReturns(genericMenu, string.Empty, effectIndex, group, allGroups, effectMap, effect, true); if (genericMenu.GetItemCount() == 2) { genericMenu.AddDisabledItem(new GUIContent("No valid Receive targets found")); } genericMenu.DropDown(buttonRect); }
private static void ShowBusPopupMenu(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, AudioMixerEffectController effect, Rect buttonRect) { GenericMenu pm = new GenericMenu(); pm.AddItem(EditorGUIUtility.TrTextContent("None"), false, AudioMixerChannelStripView.ConnectSendPopupCallback, new AudioMixerChannelStripView.ConnectSendContext(effect, null)); pm.AddSeparator(""); AudioMixerChannelStripView.AddMenuItemsForReturns(pm, string.Empty, effectIndex, group, allGroups, effectMap, effect, true); if (pm.GetItemCount() == 2) { pm.AddDisabledItem(EditorGUIUtility.TrTextContent("No valid Receive targets found")); } pm.DropDown(buttonRect); }
private static void ShowBusPopupMenu(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, AudioMixerEffectController effect, Rect buttonRect) { GenericMenu genericMenu = new GenericMenu(); GenericMenu arg_3A_0 = genericMenu; GUIContent arg_3A_1 = EditorGUIUtility.TrTextContent("None", null, null); bool arg_3A_2 = false; if (AudioMixerEffectView.< > f__mg$cache0 == null) { AudioMixerEffectView.< > f__mg$cache0 = new GenericMenu.MenuFunction2(AudioMixerChannelStripView.ConnectSendPopupCallback); } arg_3A_0.AddItem(arg_3A_1, arg_3A_2, AudioMixerEffectView.< > f__mg$cache0, new AudioMixerChannelStripView.ConnectSendContext(effect, null)); genericMenu.AddSeparator(""); AudioMixerChannelStripView.AddMenuItemsForReturns(genericMenu, string.Empty, effectIndex, group, allGroups, effectMap, effect, true); if (genericMenu.GetItemCount() == 2) { genericMenu.AddDisabledItem(EditorGUIUtility.TrTextContent("No valid Receive targets found", null, null)); } genericMenu.DropDown(buttonRect); }
private void Init() { if (!this.m_Initialized) { if (this.m_LayoutStripsOnTop == null) { this.m_LayoutStripsOnTop = new AudioMixerWindow.Layout(); } if (this.m_LayoutStripsOnTop.m_VerticalSplitter == null || this.m_LayoutStripsOnTop.m_VerticalSplitter.realSizes.Length != 2) { this.m_LayoutStripsOnTop.m_VerticalSplitter = new SplitterState(new int[] { 65, 35 }, new int[] { 85, 105 }, null); } if (this.m_LayoutStripsOnTop.m_HorizontalSplitter == null || this.m_LayoutStripsOnTop.m_HorizontalSplitter.realSizes.Length != 4) { this.m_LayoutStripsOnTop.m_HorizontalSplitter = new SplitterState(new int[] { 60, 60, 60, 60 }, new int[] { 85, 85, 85, 85 }, null); } if (this.m_LayoutStripsOnRight == null) { this.m_LayoutStripsOnRight = new AudioMixerWindow.Layout(); } if (this.m_LayoutStripsOnRight.m_HorizontalSplitter == null || this.m_LayoutStripsOnRight.m_HorizontalSplitter.realSizes.Length != 2) { this.m_LayoutStripsOnRight.m_HorizontalSplitter = new SplitterState(new int[] { 30, 70 }, new int[] { 160, 160 }, null); } if (this.m_LayoutStripsOnRight.m_VerticalSplitter == null || this.m_LayoutStripsOnRight.m_VerticalSplitter.realSizes.Length != 4) { this.m_LayoutStripsOnRight.m_VerticalSplitter = new SplitterState(new int[] { 60, 60, 60, 60 }, new int[] { 100, 85, 85, 85 }, null); } if (this.m_AudioGroupTreeState == null) { this.m_AudioGroupTreeState = new TreeViewState(); } this.m_GroupTree = new AudioMixerGroupTreeView(this, this.m_AudioGroupTreeState); if (this.m_MixersTreeState == null) { this.m_MixersTreeState = new TreeViewStateWithAssetUtility(); } this.m_MixersTree = new AudioMixersTreeView(this, this.m_MixersTreeState, new Func <List <AudioMixerController> >(this.GetAllControllers)); if (this.m_ViewsState == null) { this.m_ViewsState = new ReorderableListWithRenameAndScrollView.State(); } this.m_GroupViews = new AudioMixerGroupViewList(this.m_ViewsState); if (this.m_SnapshotState == null) { this.m_SnapshotState = new ReorderableListWithRenameAndScrollView.State(); } this.m_SnapshotListView = new AudioMixerSnapshotListView(this.m_SnapshotState); if (this.m_ChannelStripViewState == null) { this.m_ChannelStripViewState = new AudioMixerChannelStripView.State(); } this.m_ChannelStripView = new AudioMixerChannelStripView(this.m_ChannelStripViewState); this.OnMixerControllerChanged(); this.m_Initialized = true; } }
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(); }
void Init() { if (m_Initialized) { return; } if (m_LayoutStripsOnTop == null) { m_LayoutStripsOnTop = new Layout(); } if (m_LayoutStripsOnTop.m_VerticalSplitter == null || m_LayoutStripsOnTop.m_VerticalSplitter.realSizes.Length != 2) { m_LayoutStripsOnTop.m_VerticalSplitter = SplitterState.FromAbsolute(new float[] { 65, 35 }, new float[] { 85, 105 }, null); } if (m_LayoutStripsOnTop.m_HorizontalSplitter == null || m_LayoutStripsOnTop.m_HorizontalSplitter.realSizes.Length != 4) { m_LayoutStripsOnTop.m_HorizontalSplitter = SplitterState.FromAbsolute(new float[] { 60, 60, 60, 60 }, new float[] { 85, 85, 85, 85 }, null); } if (m_LayoutStripsOnRight == null) { m_LayoutStripsOnRight = new Layout(); } if (m_LayoutStripsOnRight.m_HorizontalSplitter == null || m_LayoutStripsOnRight.m_HorizontalSplitter.realSizes.Length != 2) { m_LayoutStripsOnRight.m_HorizontalSplitter = SplitterState.FromAbsolute(new float[] { 30, 70 }, new float[] { 160, 160 }, null); } if (m_LayoutStripsOnRight.m_VerticalSplitter == null || m_LayoutStripsOnRight.m_VerticalSplitter.realSizes.Length != 4) { m_LayoutStripsOnRight.m_VerticalSplitter = SplitterState.FromAbsolute(new float[] { 60, 60, 60, 60 }, new float[] { 100, 85, 85, 85 }, null); } if (m_AudioGroupTreeState == null) { m_AudioGroupTreeState = new TreeViewState(); } m_GroupTree = new AudioMixerGroupTreeView(this, m_AudioGroupTreeState); if (m_MixersTreeState == null) { m_MixersTreeState = new TreeViewStateWithAssetUtility(); } m_MixersTree = new AudioMixersTreeView(this, m_MixersTreeState, GetAllControllers); if (m_ViewsState == null) { m_ViewsState = new ReorderableListWithRenameAndScrollView.State(); } m_GroupViews = new AudioMixerGroupViewList(m_ViewsState); if (m_SnapshotState == null) { m_SnapshotState = new ReorderableListWithRenameAndScrollView.State(); } m_SnapshotListView = new AudioMixerSnapshotListView(m_SnapshotState); if (m_ChannelStripViewState == null) { m_ChannelStripViewState = new AudioMixerChannelStripView.State(); } m_ChannelStripView = new AudioMixerChannelStripView(m_ChannelStripViewState); OnMixerControllerChanged(); m_Initialized = true; }