Inheritance: UnityEngine.Audio.AudioMixerGroup
 public void SetSingleChannelStrip(AudioMixerGroupController group)
 {
   Selection.objects = (Object[]) new AudioMixerGroupController[1]
   {
     group
   };
 }
			public EffectContext(AudioMixerController controller, AudioMixerGroupController group, int index, string name)
			{
				this.controller = controller;
				this.group = group;
				this.index = index;
				this.name = name;
			}
 public static void VisitGroupsRecursivly(AudioMixerGroupController group, System.Action<AudioMixerGroupController> visitorCallback)
 {
   foreach (AudioMixerGroupController child in group.children)
     AudioMixerUtility.VisitGroupsRecursivly(child, visitorCallback);
   if (visitorCallback == null)
     return;
   visitorCallback(group);
 }
		public AudioMixerGroupPopupContext(AudioMixerController controller, AudioMixerGroupController group)
		{
			this.controller = controller;
			this.groups = new AudioMixerGroupController[]
			{
				group
			};
		}
 public void ToggleChannelStrip(AudioMixerGroupController group)
 {
   List<Object> objectList = new List<Object>((IEnumerable<Object>) Selection.objects);
   if (objectList.Contains((Object) group))
     objectList.Remove((Object) group);
   else
     objectList.Add((Object) group);
   Selection.objects = objectList.ToArray();
 }
 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();
 }
示例#7
0
 public static void VisitGroupsRecursivly(AudioMixerGroupController group, Action<AudioMixerGroupController> visitorCallback)
 {
     foreach (AudioMixerGroupController controller in group.children)
     {
         VisitGroupsRecursivly(controller, visitorCallback);
     }
     if (visitorCallback != null)
     {
         visitorCallback(group);
     }
 }
 private void AddNodesRecursively(AudioMixerGroupController group, TreeViewItem parent, int depth)
 {
   List<TreeViewItem> treeViewItemList = new List<TreeViewItem>();
   for (int index = 0; index < group.children.Length; ++index)
   {
     AudioMixerTreeViewNode mixerTreeViewNode = new AudioMixerTreeViewNode(AudioGroupDataSource.GetUniqueNodeID(group.children[index]), depth, parent, group.children[index].name, group.children[index]);
     mixerTreeViewNode.parent = parent;
     treeViewItemList.Add((TreeViewItem) mixerTreeViewNode);
     this.AddNodesRecursively(group.children[index], (TreeViewItem) mixerTreeViewNode, depth + 1);
   }
   parent.children = treeViewItemList;
 }
		public static void AddColorItemsToGenericMenu(GenericMenu menu, AudioMixerGroupController group)
		{
			Color[] colors = AudioMixerColorCodes.GetColors();
			string[] array = AudioMixerColorCodes.GetColorNames();
			for (int i = 0; i < colors.Length; i++)
			{
				menu.AddItem(new GUIContent(array[i]), i == group.userColorIndex, new GenericMenu.MenuFunction2(AudioMixerColorCodes.ItemCallback), new AudioMixerColorCodes.ItemData
				{
					group = group,
					index = i
				});
			}
		}
示例#10
0
 public void ToggleChannelStrip(AudioMixerGroupController group)
 {
     List<UnityEngine.Object> list = new List<UnityEngine.Object>(Selection.objects);
     if (list.Contains(group))
     {
         list.Remove(group);
     }
     else
     {
         list.Add(group);
     }
     Selection.objects = list.ToArray();
 }
		private void AddNodesRecursively(AudioMixerGroupController group, TreeViewItem parent, int depth)
		{
			List<TreeViewItem> list = new List<TreeViewItem>();
			for (int i = 0; i < group.children.Length; i++)
			{
				int uniqueNodeID = AudioGroupDataSource.GetUniqueNodeID(group.children[i]);
				AudioMixerTreeViewNode audioMixerTreeViewNode = new AudioMixerTreeViewNode(uniqueNodeID, depth, parent, group.children[i].name, group.children[i]);
				audioMixerTreeViewNode.parent = parent;
				list.Add(audioMixerTreeViewNode);
				this.AddNodesRecursively(group.children[i], audioMixerTreeViewNode, depth + 1);
			}
			parent.children = list;
		}
 private void AddNodesRecursively(AudioMixerGroupController group, TreeViewItem parent, int depth)
 {
     List<TreeViewItem> list = new List<TreeViewItem>();
     for (int i = 0; i < group.children.Length; i++)
     {
         AudioMixerTreeViewNode item = new AudioMixerTreeViewNode(GetUniqueNodeID(group.children[i]), depth, parent, group.children[i].name, group.children[i]) {
             parent = parent
         };
         list.Add(item);
         this.AddNodesRecursively(group.children[i], item, depth + 1);
     }
     parent.children = list;
 }
		public static void VisitGroupsRecursivly(AudioMixerGroupController group, Action<AudioMixerGroupController> visitorCallback)
		{
			AudioMixerGroupController[] children = group.children;
			for (int i = 0; i < children.Length; i++)
			{
				AudioMixerGroupController group2 = children[i];
				AudioMixerUtility.VisitGroupsRecursivly(group2, visitorCallback);
			}
			if (visitorCallback != null)
			{
				visitorCallback(group);
			}
		}
 public static void AddColorItemsToGenericMenu(GenericMenu menu, AudioMixerGroupController[] groups)
 {
   Color[] colors = AudioMixerColorCodes.GetColors();
   string[] colorNames = AudioMixerColorCodes.GetColorNames();
   for (int index = 0; index < colors.Length; ++index)
   {
     bool flag = groups.Length == 1 && index == groups[0].userColorIndex;
     menu.AddItem(new GUIContent(colorNames[index]), (flag ? 1 : 0) != 0, new GenericMenu.MenuFunction2(AudioMixerColorCodes.ItemCallback), (object) new AudioMixerColorCodes.ItemData()
     {
       groups = groups,
       index = index
     });
   }
 }
示例#15
0
 public static void AddColorItemsToGenericMenu(GenericMenu menu, AudioMixerGroupController[] groups)
 {
     Color[] colors = GetColors();
     string[] colorNames = GetColorNames();
     for (int i = 0; i < colors.Length; i++)
     {
         bool on = (groups.Length == 1) && (i == groups[0].userColorIndex);
         ItemData userData = new ItemData {
             groups = groups,
             index = i
         };
         menu.AddItem(new GUIContent(colorNames[i]), on, new GenericMenu.MenuFunction2(AudioMixerColorCodes.ItemCallback), userData);
     }
 }
			public void HandleDragElement(int effectIndex, Rect effectRect, Rect dragRect, AudioMixerGroupController group, List<AudioMixerGroupController> allGroups)
			{
				Event current = Event.current;
				EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);
				if (typeForControl != EventType.MouseDown)
				{
					if (typeForControl == EventType.Repaint)
					{
						if (effectIndex == this.m_MovingSrcIndex)
						{
							EditorGUI.BeginDisabledGroup(true);
							AudioMixerDrawUtils.styles.channelStripAreaBackground.Draw(effectRect, false, false, false, false);
							EditorGUI.EndDisabledGroup();
						}
					}
				}
				else
				{
					if (current.button == 0 && dragRect.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
					{
						this.m_MovingSrcIndex = effectIndex;
						this.m_MovingPos = current.mousePosition.y;
						this.m_MovingRect = new Rect(effectRect.x, effectRect.y - this.m_MovingPos, effectRect.width, effectRect.height);
						GUIUtility.hotControl = this.m_DragControlID;
						EditorGUIUtility.SetWantsMouseJumping(1);
						current.Use();
					}
				}
				if (this.isDragging)
				{
					float num = effectRect.height * 0.5f;
					float num2 = current.mousePosition.y - effectRect.y - num;
					if (Mathf.Abs(num2) <= num)
					{
						int num3 = (num2 >= 0f) ? (effectIndex + 1) : effectIndex;
						if (num3 != this.m_MovingDstIndex)
						{
							this.m_DragHighlightPos = ((num2 >= 0f) ? (effectRect.y + effectRect.height) : effectRect.y);
							this.m_MovingDstIndex = num3;
							this.m_MovingEffectAllowed = !AudioMixerController.WillMovingEffectCauseFeedback(allGroups, group, this.m_MovingSrcIndex, group, num3, null);
						}
					}
					if (this.m_MovingDstIndex == this.m_MovingSrcIndex || this.m_MovingDstIndex == this.m_MovingSrcIndex + 1)
					{
						this.m_DragHighlightPos = 0f;
					}
				}
			}
 public void AddAudioMixerGroup(AudioMixerGroupController parent)
 {
     if ((parent != null) && (this.m_Controller != null))
     {
         UnityEngine.Object[] objectsToUndo = new UnityEngine.Object[] { this.m_Controller, parent };
         Undo.RecordObjects(objectsToUndo, "Add Child Group");
         AudioMixerGroupController child = this.m_Controller.CreateNewGroup("New Group", true);
         this.m_Controller.AddChildToParent(child, parent);
         this.m_Controller.AddGroupToCurrentView(child);
         AudioMixerGroupController[] controllerArray1 = new AudioMixerGroupController[] { child };
         Selection.objects = controllerArray1;
         this.m_Controller.OnUnitySelectionChanged();
         int[] selectedIDs = new int[] { child.GetInstanceID() };
         this.m_AudioGroupTree.SetSelection(selectedIDs, true);
         this.ReloadTree();
         this.m_AudioGroupTree.BeginNameEditing(0f);
     }
 }
 private void OpenGroupContextMenu(AudioMixerTreeViewNode audioNode, bool visible)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AudioGroupTreeViewGUI.\u003COpenGroupContextMenu\u003Ec__AnonStorey64 menuCAnonStorey64 = new AudioGroupTreeViewGUI.\u003COpenGroupContextMenu\u003Ec__AnonStorey64();
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey64.audioNode = audioNode;
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey64.visible = visible;
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey64.\u003C\u003Ef__this = this;
   GenericMenu menu = new GenericMenu();
   if (this.NodeWasToggled != null)
   {
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     menu.AddItem(new GUIContent(!menuCAnonStorey64.visible ? "Show Group" : "Hide group"), false, new GenericMenu.MenuFunction(menuCAnonStorey64.\u003C\u003Em__B2));
   }
   menu.AddSeparator(string.Empty);
   AudioMixerGroupController[] groups;
   // ISSUE: reference to a compiler-generated field
   if (this.m_Controller.CachedSelection.Contains(menuCAnonStorey64.audioNode.group))
   {
     groups = this.m_Controller.CachedSelection.ToArray();
   }
   else
   {
     // ISSUE: reference to a compiler-generated field
     groups = new AudioMixerGroupController[1]
     {
       menuCAnonStorey64.audioNode.group
     };
   }
   AudioMixerColorCodes.AddColorItemsToGenericMenu(menu, groups);
   menu.ShowAsContext();
 }
 public void HandleDragElement(int effectIndex, Rect effectRect, Rect dragRect, AudioMixerGroupController group, List<AudioMixerGroupController> allGroups)
 {
   Event current = Event.current;
   switch (current.GetTypeForControl(this.m_DragControlID))
   {
     case EventType.MouseDown:
       if (current.button == 0 && dragRect.Contains(current.mousePosition) && GUIUtility.hotControl == 0)
       {
         this.m_MovingSrcIndex = effectIndex;
         this.m_MovingPos = current.mousePosition.y;
         this.m_MovingRect = new Rect(effectRect.x, effectRect.y - this.m_MovingPos, effectRect.width, effectRect.height);
         GUIUtility.hotControl = this.m_DragControlID;
         EditorGUIUtility.SetWantsMouseJumping(1);
         current.Use();
         break;
       }
       break;
     case EventType.Repaint:
       if (effectIndex == this.m_MovingSrcIndex)
       {
         EditorGUI.BeginDisabledGroup(true);
         AudioMixerDrawUtils.styles.channelStripAreaBackground.Draw(effectRect, false, false, false, false);
         EditorGUI.EndDisabledGroup();
         break;
       }
       break;
   }
   if (!this.isDragging)
     return;
   float num = effectRect.height * 0.5f;
   float f = current.mousePosition.y - effectRect.y - num;
   if ((double) Mathf.Abs(f) <= (double) num)
   {
     int targetIndex = (double) f >= 0.0 ? effectIndex + 1 : effectIndex;
     if (targetIndex != this.m_MovingDstIndex)
     {
       this.m_DragHighlightPos = (double) f >= 0.0 ? effectRect.y + effectRect.height : effectRect.y;
       this.m_MovingDstIndex = targetIndex;
       this.m_MovingEffectAllowed = !AudioMixerController.WillMovingEffectCauseFeedback(allGroups, group, this.m_MovingSrcIndex, group, targetIndex, (List<AudioMixerController.ConnectionNode>) null);
     }
   }
   if (this.m_MovingDstIndex != this.m_MovingSrcIndex && this.m_MovingDstIndex != this.m_MovingSrcIndex + 1)
     return;
   this.m_DragHighlightPos = 0.0f;
 }
 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(new GUIContent("None"), false, new GenericMenu.MenuFunction2(AudioMixerChannelStripView.ConnectSendPopupCallback), (object) new AudioMixerChannelStripView.ConnectSendContext(effect, (AudioMixerEffectController) null));
   pm.AddSeparator(string.Empty);
   AudioMixerChannelStripView.AddMenuItemsForReturns(pm, string.Empty, effectIndex, group, allGroups, effectMap, effect, true);
   if (pm.GetItemCount() == 2)
     pm.AddDisabledItem(new GUIContent("No valid Receive targets found"));
   pm.DropDown(buttonRect);
 }
 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);
 }
示例#22
0
 public AudioMixerGroupController(AudioMixer owner)
 {
     AudioMixerGroupController.Internal_CreateAudioMixerGroupController(this, owner);
 }
		public void OnGUI(Rect rect)
		{
			int controlID = GUIUtility.GetControlID(FocusType.Keyboard);
			this.m_ScrollToItem = null;
			if (AudioMixerGroupTreeView.s_Styles == null)
			{
				AudioMixerGroupTreeView.s_Styles = new AudioMixerGroupTreeView.Styles();
			}
			this.m_AudioGroupTree.OnEvent();
			EditorGUI.BeginDisabledGroup(this.m_Controller == null);
			Rect r;
			Rect rect2;
			AudioMixerDrawUtils.DrawRegionBg(rect, out r, out rect2);
			AudioMixerDrawUtils.HeaderLabel(r, AudioMixerGroupTreeView.s_Styles.header, AudioMixerGroupTreeView.s_Styles.audioMixerGroupIcon);
			EditorGUI.EndDisabledGroup();
			if (this.m_Controller != null)
			{
				AudioMixerGroupController parent = (this.m_Controller.CachedSelection.Count != 1) ? this.m_Controller.masterGroup : this.m_Controller.CachedSelection[0];
				EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);
				if (GUI.Button(new Rect(r.xMax - 15f, r.y + 3f, 15f, 15f), AudioMixerGroupTreeView.s_Styles.addText, EditorStyles.label))
				{
					this.AddAudioMixerGroup(parent);
				}
				EditorGUI.EndDisabledGroup();
				this.m_AudioGroupTree.OnGUI(rect2, controlID);
				AudioMixerDrawUtils.DrawScrollDropShadow(rect2, this.m_AudioGroupTree.state.scrollPos.y, this.m_AudioGroupTree.gui.GetTotalSize(this.m_AudioGroupTree.data.GetVisibleRows()).y);
				this.HandleKeyboardEvents(controlID);
				this.HandleCommandEvents(controlID);
			}
		}
 public static int GetUniqueNodeID(AudioMixerGroupController group)
 {
     return group.GetInstanceID();
 }
 public AudioMixerGroupController FindParentGroup(AudioMixerGroupController node, AudioMixerGroupController group)
 {
     for (int n = 0; n < node.children.Length; n++)
     {
         if (node.children[n] == group)
         {
             return(node);
         }
         var g = FindParentGroup(node.children[n], group);
         if (g != null)
         {
             return(g);
         }
     }
     return(null);
 }
示例#26
0
 public AudioEffectParameterPath(AudioMixerGroupController group, AudioMixerEffectController effect, GUID parameter) : base(group, parameter)
 {
     this.effect = effect;
 }
		public AudioMixerGroupPopupContext(AudioMixerController controller, AudioMixerGroupController[] groups)
		{
			this.controller = controller;
			this.groups = groups;
		}
示例#28
0
 extern private static void Internal_CreateAudioMixerGroupController(AudioMixerGroupController mono, AudioMixer owner);
 public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
 {
   if (!this.isDragging)
     return;
   Event current = Event.current;
   EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);
   switch (typeForControl)
   {
     case EventType.MouseUp:
       current.Use();
       if (this.m_MovingSrcIndex == -1)
         break;
       if (this.m_MovingDstIndex != -1 && this.m_MovingEffectAllowed)
       {
         List<AudioMixerEffectController> list = ((IEnumerable<AudioMixerEffectController>) group.effects).ToList<AudioMixerEffectController>();
         if (AudioMixerController.MoveEffect(ref list, this.m_MovingSrcIndex, ref list, this.m_MovingDstIndex))
           group.effects = list.ToArray();
       }
       this.m_MovingSrcIndex = -1;
       this.m_MovingDstIndex = -1;
       controller.m_HighlightEffectIndex = -1;
       if (GUIUtility.hotControl == this.m_DragControlID)
         GUIUtility.hotControl = 0;
       EditorGUIUtility.SetWantsMouseJumping(0);
       AudioMixerUtility.RepaintAudioMixerAndInspectors();
       GUIUtility.ExitGUI();
       break;
     case EventType.MouseDrag:
       this.m_MovingPos = current.mousePosition.y;
       current.Use();
       break;
     default:
       if (typeForControl != EventType.Repaint || (double) this.m_DragHighlightPos <= 0.0)
         break;
       float width = totalRect.width;
       Color color1 = !this.m_MovingEffectAllowed ? this.kMoveColorLoDisallowed : this.kMoveColorLoAllowed;
       Color color2 = !this.m_MovingEffectAllowed ? this.kMoveColorHiDisallowed : this.kMoveColorHiAllowed;
       Color color3 = !this.m_MovingEffectAllowed ? this.kMoveColorBorderDisallowed : this.kMoveColorBorderAllowed;
       AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - 15f, width, 15f), color1, color2);
       AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos, width, 15f), color2, color1);
       AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - this.m_DragHighlightHeight / 2f, width, this.m_DragHighlightHeight), color3, color3);
       break;
   }
 }
        static public bool WillMovingEffectCauseFeedback(List <AudioMixerGroupController> allGroups, AudioMixerGroupController sourceGroup, int sourceIndex, AudioMixerGroupController targetGroup, int targetIndex, List <ConnectionNode> identifiedLoop)
        {
            Dictionary <object, ConnectionNode> graph;

            if (sourceGroup == targetGroup)
            {
                var modifiedEffects = sourceGroup.effects.ToList();
                if (!MoveEffect(ref modifiedEffects, sourceIndex, ref modifiedEffects, targetIndex))
                {
                    return(false);
                }
                graph = BuildTemporaryGraph(allGroups, null, null, null, sourceGroup, modifiedEffects, null, null);
            }
            else
            {
                var modifiedSourceEffects = sourceGroup.effects.ToList();
                var modifiedTargetEffects = targetGroup.effects.ToList();
                if (!MoveEffect(ref modifiedSourceEffects, sourceIndex, ref modifiedTargetEffects, targetIndex))
                {
                    return(false);
                }
                graph = BuildTemporaryGraph(allGroups, null, null, null, sourceGroup, modifiedSourceEffects, targetGroup, modifiedTargetEffects);
            }

            // Connect the chains up using the group hierarchy
            foreach (var group in allGroups)
            {
                foreach (var childGroup in group.children)
                {
                    var tailOfChildGroup = graph[childGroup].groupTail;
                    if (!graph[tailOfChildGroup].targets.Contains(group))
                    {
                        graph[tailOfChildGroup].targets.Add(group);
                    }
                }
            }

            //ListTemporaryGraph(graph);

            return(DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, graph));
        }
        static public bool WillChangeOfEffectTargetCauseFeedback(List <AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, int effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, List <ConnectionNode> identifiedLoop)
        {
            var graph = BuildTemporaryGraph(allGroups, groupWhoseEffectIsChanged, groupWhoseEffectIsChanged.effects[effectWhoseTargetIsChanged], targetToTest, null, null, null, null);

            // Connect the chains up using the group hierarchy
            foreach (var group in allGroups)
            {
                foreach (var childGroup in group.children)
                {
                    var tailOfChildGroup = graph[childGroup].groupTail;
                    if (!graph[tailOfChildGroup].targets.Contains(group))
                    {
                        graph[tailOfChildGroup].targets.Add(group);
                    }
                }
            }

            //ListTemporaryGraph(graph);

            return(DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, graph));
        }
        static public bool WillModificationOfTopologyCauseFeedback(List <AudioMixerGroupController> allGroups, List <AudioMixerGroupController> groupsToBeMoved, AudioMixerGroupController newParentForMovedGroups, List <ConnectionNode> identifiedLoop)
        {
            var graph = BuildTemporaryGraph(allGroups, null, null, null, null, null, null, null);

            // Connect the chains up using the group hierarchy, pretending that the groups in the list groupsToBeMoved belong to newParentForMovedGroups
            foreach (var group in allGroups)
            {
                foreach (var childGroup in group.children)
                {
                    var parentGroup      = (groupsToBeMoved.Contains(childGroup)) ? newParentForMovedGroups : group;
                    var tailOfChildGroup = graph[childGroup].groupTail;
                    if (!graph[tailOfChildGroup].targets.Contains(parentGroup))
                    {
                        graph[tailOfChildGroup].targets.Add(parentGroup);
                    }
                }
            }

            //ListTemporaryGraph(graph);

            return(DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, graph));
        }
		public void OnTreeSelectionChanged(int[] selection)
		{
			List<AudioMixerGroupController> audioMixerGroupsFromNodeIDs = this.GetAudioMixerGroupsFromNodeIDs(selection);
			Selection.objects = audioMixerGroupsFromNodeIDs.ToArray();
			this.m_Controller.OnUnitySelectionChanged();
			if (audioMixerGroupsFromNodeIDs.Count == 1)
			{
				this.m_ScrollToItem = audioMixerGroupsFromNodeIDs[0];
			}
			InspectorWindow.RepaintAllInspectors();
		}
 public static float DoInitialModule(AudioMixerGroupController group, AudioMixerController controller, List<AudioMixerGroupController> allGroups)
 {
   Rect rect = EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
   float valueForPitch = group.GetValueForPitch(controller, controller.TargetSnapshot);
   if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.pitch, ref valueForPitch, 100f, 1f, AudioMixerEffectView.Texts.percentage, 0.01f, 10f, controller, (AudioParameterPath) new AudioGroupParameterPath(group, group.GetGUIDForPitch())))
   {
     Undo.RecordObject((UnityEngine.Object) controller.TargetSnapshot, "Change Pitch");
     group.SetValueForPitch(controller, controller.TargetSnapshot, valueForPitch);
   }
   GUILayout.Space(5f);
   EditorGUILayout.EndVertical();
   AudioMixerDrawUtils.DrawSplitter();
   return rect.height;
 }
		public void AddAudioMixerGroup(AudioMixerGroupController parent)
		{
			if (parent == null || this.m_Controller == null)
			{
				return;
			}
			Undo.RecordObjects(new UnityEngine.Object[]
			{
				this.m_Controller,
				parent
			}, "Add Child Group");
			AudioMixerGroupController audioMixerGroupController = this.m_Controller.CreateNewGroup("New Group", true);
			this.m_Controller.AddChildToParent(audioMixerGroupController, parent);
			this.m_Controller.AddGroupToCurrentView(audioMixerGroupController);
			Selection.objects = new AudioMixerGroupController[]
			{
				audioMixerGroupController
			};
			this.m_Controller.OnUnitySelectionChanged();
			this.m_AudioGroupTree.SetSelection(new int[]
			{
				audioMixerGroupController.GetInstanceID()
			}, true);
			this.ReloadTree();
			this.m_AudioGroupTree.BeginNameEditing(0f);
		}
 public void DoEffectGUI(int effectIndex, AudioMixerGroupController group, List<AudioMixerGroupController> allGroups, Dictionary<AudioMixerEffectController, AudioMixerGroupController> effectMap, ref int highlightEffectIndex)
 {
   Event current = Event.current;
   AudioMixerController controller = group.controller;
   AudioMixerEffectController effect1 = group.effects[effectIndex];
   MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(effect1.effectName);
   Rect effectRect = EditorGUILayout.BeginVertical();
   bool flag1 = effectRect.Contains(current.mousePosition);
   EventType typeForControl = current.GetTypeForControl(this.m_EffectDragging.dragControlID);
   if (typeForControl == EventType.MouseMove && flag1 && highlightEffectIndex != effectIndex)
   {
     highlightEffectIndex = effectIndex;
     AudioMixerUtility.RepaintAudioMixerAndInspectors();
   }
   Rect rect1 = GUILayoutUtility.GetRect(1f, 17f);
   Rect rect2 = new Rect(rect1.x + 6f, rect1.y + 5f, 6f, 6f);
   Rect position = new Rect((float) ((double) rect1.x + 8.0 + 6.0), rect1.y, (float) ((double) rect1.width - 8.0 - 6.0 - 14.0 - 5.0), rect1.height);
   Rect rect3 = new Rect(position.xMax, rect1.y, 14f, 14f);
   Rect rect4 = new Rect(rect1.x, rect1.y, (float) ((double) rect1.width - 14.0 - 5.0), rect1.height);
   bool flag2 = EditorPrefs.GetBool(AudioMixerGroupEditor.kPrefKeyForShowCpuUsage, false) && EditorUtility.audioProfilingEnabled;
   float num1 = !EditorGUIUtility.isProSkin ? 1f : 0.1f;
   Color color1 = new Color(num1, num1, num1, 0.2f);
   Color color2 = GUI.color;
   GUI.color = color1;
   GUI.DrawTexture(rect1, (Texture) EditorGUIUtility.whiteTexture);
   GUI.color = color2;
   Color effectColor = AudioMixerDrawUtils.GetEffectColor(effect1);
   EditorGUI.DrawRect(rect2, effectColor);
   GUI.Label(position, !flag2 ? effect1.effectName : effect1.effectName + string.Format(AudioMixerEffectView.Texts.cpuFormatString, (object) effect1.GetCPUUsage(controller)), EditorStyles.boldLabel);
   if (EditorGUI.ButtonMouseDown(rect3, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText))
     AudioMixerEffectView.ShowEffectContextMenu(group, effect1, effectIndex, controller, rect3);
   if (current.type == EventType.ContextClick && rect1.Contains(current.mousePosition))
   {
     AudioMixerEffectView.ShowEffectContextMenu(group, effect1, effectIndex, controller, new Rect(current.mousePosition.x, rect1.y, 1f, rect1.height));
     current.Use();
   }
   if (typeForControl == EventType.Repaint)
     EditorGUIUtility.AddCursorRect(rect4, MouseCursor.ResizeVertical, this.m_EffectDragging.dragControlID);
   EditorGUI.BeginDisabledGroup(effect1.bypass || group.bypassEffects);
   EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
   if (effect1.IsAttenuation())
   {
     EditorGUILayout.BeginVertical();
     float valueForVolume = group.GetValueForVolume(controller, controller.TargetSnapshot);
     if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.volume, ref valueForVolume, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume(), controller, (AudioParameterPath) new AudioGroupParameterPath(group, group.GetGUIDForVolume())))
     {
       Undo.RecordObject((UnityEngine.Object) controller.TargetSnapshot, "Change Volume Fader");
       group.SetValueForVolume(controller, controller.TargetSnapshot, valueForVolume);
       AudioMixerUtility.RepaintAudioMixerAndInspectors();
     }
     float[] vuLevel = new float[9];
     float[] vuPeak = new float[9];
     int num2 = group.controller.GetGroupVUInfo(group.groupID, true, ref vuLevel, ref vuPeak);
     if (current.type == EventType.Layout)
     {
       this.m_LastNumChannels = num2;
     }
     else
     {
       if (num2 != this.m_LastNumChannels)
         HandleUtility.Repaint();
       num2 = this.m_LastNumChannels;
     }
     GUILayout.Space(4f);
     for (int index = 0; index < num2; ++index)
     {
       float num3 = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuLevel[index], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
       float peak = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuPeak[index], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
       EditorGUILayout.VUMeterHorizontal(num3, peak, new GUILayoutOption[1]
       {
         GUILayout.Height(10f)
       });
       if (!EditorApplication.isPlaying && (double) peak > 0.0)
         AudioMixerUtility.RepaintAudioMixerAndInspectors();
     }
     GUILayout.Space(4f);
     EditorGUILayout.EndVertical();
   }
   if (effect1.IsSend())
   {
     GUIContent buttonContent = !((UnityEngine.Object) effect1.sendTarget == (UnityEngine.Object) null) ? GUIContent.Temp(effect1.GetSendTargetDisplayString(effectMap)) : AudioMixerEffectView.Texts.none;
     Rect buttonRect;
     if (AudioMixerEffectGUI.PopupButton(AudioMixerEffectView.Texts.bus, buttonContent, EditorStyles.popup, out buttonRect))
       AudioMixerEffectView.ShowBusPopupMenu(effectIndex, group, allGroups, effectMap, effect1, buttonRect);
     if ((UnityEngine.Object) effect1.sendTarget != (UnityEngine.Object) null)
     {
       float valueForMixLevel = effect1.GetValueForMixLevel(controller, controller.TargetSnapshot);
       if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.sendLevel, ref valueForMixLevel, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForMixLevel())))
       {
         Undo.RecordObject((UnityEngine.Object) controller.TargetSnapshot, "Change Send Level");
         effect1.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel);
         AudioMixerUtility.RepaintAudioMixerAndInspectors();
       }
     }
   }
   if (MixerEffectDefinitions.EffectCanBeSidechainTarget(effect1))
   {
     bool flag3 = false;
     using (List<AudioMixerGroupController>.Enumerator enumerator = allGroups.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         foreach (AudioMixerEffectController effect2 in enumerator.Current.effects)
         {
           if (effect2.IsSend() && (UnityEngine.Object) effect2.sendTarget == (UnityEngine.Object) effect1)
           {
             flag3 = true;
             break;
           }
           if (flag3)
             break;
         }
         if (flag3)
           break;
       }
     }
     if (!flag3)
       GUILayout.Label(new GUIContent("No Send sources connected.", (Texture) EditorGUIUtility.warningIcon));
   }
   if (effect1.enableWetMix && !effect1.IsReceive() && (!effect1.IsDuckVolume() && !effect1.IsAttenuation()) && !effect1.IsSend())
   {
     float valueForMixLevel = effect1.GetValueForMixLevel(controller, controller.TargetSnapshot);
     if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.wet, ref valueForMixLevel, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForMixLevel())))
     {
       Undo.RecordObject((UnityEngine.Object) controller.TargetSnapshot, "Change Mix Level");
       effect1.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel);
       AudioMixerUtility.RepaintAudioMixerAndInspectors();
     }
   }
   bool flag4 = true;
   if (this.m_CustomEffectGUIs.ContainsKey(effect1.effectName))
   {
     IAudioEffectPluginGUI customEffectGuI = this.m_CustomEffectGUIs[effect1.effectName];
     this.m_SharedPlugin.m_Controller = controller;
     this.m_SharedPlugin.m_Effect = effect1;
     this.m_SharedPlugin.m_ParamDefs = effectParameters;
     flag4 = customEffectGuI.OnGUI((IAudioEffectPlugin) this.m_SharedPlugin);
   }
   if (flag4)
   {
     foreach (MixerParameterDefinition parameterDefinition in effectParameters)
     {
       float valueForParameter = effect1.GetValueForParameter(controller, controller.TargetSnapshot, parameterDefinition.name);
       if (AudioMixerEffectGUI.Slider(GUIContent.Temp(parameterDefinition.name, parameterDefinition.description), ref valueForParameter, parameterDefinition.displayScale, parameterDefinition.displayExponent, parameterDefinition.units, parameterDefinition.minRange, parameterDefinition.maxRange, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForParameter(parameterDefinition.name))))
       {
         Undo.RecordObject((UnityEngine.Object) controller.TargetSnapshot, "Change " + parameterDefinition.name);
         effect1.SetValueForParameter(controller, controller.TargetSnapshot, parameterDefinition.name, valueForParameter);
       }
     }
     if (effectParameters.Length > 0)
       GUILayout.Space(6f);
   }
   EditorGUI.EndDisabledGroup();
   this.m_EffectDragging.HandleDragElement(effectIndex, effectRect, rect4, group, allGroups);
   EditorGUILayout.EndVertical();
   EditorGUILayout.EndVertical();
   AudioMixerDrawUtils.DrawSplitter();
 }
 private void AddChildrenRecursive(AudioMixerGroupController group, TreeViewItem item)
 {
     item.children = new List<TreeViewItem>(group.children.Length);
     for (int i = 0; i < group.children.Length; i++)
     {
         item.children.Add(new TreeViewItem(group.children[i].GetInstanceID(), item.depth + 1, item, group.children[i].name));
         item.children[i].userData = group.children[i];
         this.AddChildrenRecursive(group.children[i], item.children[i]);
     }
 }
示例#38
0
 public AudioGroupParameterPath(AudioMixerGroupController group, GUID parameter)
 {
     this.group     = group;
     base.parameter = parameter;
 }