public void OnGUI(Rect rect, bool showReferencedBuses, bool showBusConnections, bool showBusConnectionsOfSelection, List<AudioMixerGroupController> allGroups, Dictionary<AudioMixerEffectController, AudioMixerGroupController> effectMap, bool sortGroupsAlphabetically, bool showDeveloperOverlays, AudioMixerGroupController scrollToItem) { if (this.m_Controller == null) { this.DrawAreaBackground(rect); return; } if (Event.current.type == EventType.Layout) { return; } this.m_RectSelectionControlID = GUIUtility.GetControlID(AudioMixerChannelStripView.kRectSelectionHashCode, FocusType.Passive); this.m_EffectInteractionControlID = GUIUtility.GetControlID(AudioMixerChannelStripView.kEffectDraggingHashCode, FocusType.Passive); this.m_IndexCounter = 0; Event current = Event.current; List<AudioMixerGroupController> list = this.m_Controller.GetCurrentViewGroupList().ToList<AudioMixerGroupController>(); if (sortGroupsAlphabetically) { list.Sort(this.m_GroupComparer); } Rect rect2 = new Rect(this.channelStripsOffset.x, this.channelStripsOffset.y, 90f, 300f); if (scrollToItem != null) { int num = list.IndexOf(scrollToItem); if (num >= 0) { float num2 = (rect2.width + 4f) * (float)num - this.m_State.m_ScrollPos.x; if (num2 < -20f || num2 > rect.width) { AudioMixerChannelStripView.State expr_111_cp_0 = this.m_State; expr_111_cp_0.m_ScrollPos.x = expr_111_cp_0.m_ScrollPos.x + num2; } } } List<AudioMixerGroupController> list2 = new List<AudioMixerGroupController>(); foreach (AudioMixerGroupController current2 in list) { AudioMixerEffectController[] effects = current2.effects; for (int i = 0; i < effects.Length; i++) { AudioMixerEffectController audioMixerEffectController = effects[i]; if (audioMixerEffectController.sendTarget != null) { AudioMixerGroupController item = effectMap[audioMixerEffectController.sendTarget]; if (!list2.Contains(item) && !list.Contains(item)) { list2.Add(item); } } } } List<AudioMixerGroupController> list3 = list2.ToList<AudioMixerGroupController>(); list3.Sort(this.m_GroupComparer); int count = list.Count; if (showReferencedBuses && list3.Count > 0) { list.AddRange(list3); } int num3 = 1; foreach (AudioMixerGroupController current3 in list) { num3 = Mathf.Max(num3, current3.effects.Length); } bool isShowingReferencedGroups = list.Count != count; Rect contentRect = this.GetContentRect(list, isShowingReferencedGroups, num3); this.m_State.m_ScrollPos = GUI.BeginScrollView(rect, this.m_State.m_ScrollPos, contentRect); this.DrawAreaBackground(new Rect(0f, 0f, 10000f, 10000f)); AudioMixerChannelStripView.ChannelStripParams channelStripParams = new AudioMixerChannelStripView.ChannelStripParams(); channelStripParams.effectMap = effectMap; channelStripParams.allGroups = allGroups; channelStripParams.shownGroups = list; channelStripParams.anySoloActive = allGroups.Any((AudioMixerGroupController g) => g.solo); channelStripParams.visibleRect = new Rect(this.m_State.m_ScrollPos.x, this.m_State.m_ScrollPos.y, rect.width, rect.height); AudioMixerChannelStripView.ChannelStripParams channelStripParams2 = channelStripParams; Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> dictionary = (!showBusConnections) ? null : new Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot>(); for (int j = 0; j < list.Count; j++) { AudioMixerGroupController group = list[j]; channelStripParams2.index = j; channelStripParams2.group = group; channelStripParams2.drawingBuses = false; channelStripParams2.visible = AudioMixerChannelStripView.RectOverlaps(channelStripParams2.visibleRect, rect2); channelStripParams2.Init(this.m_Controller, rect2, num3); this.DrawChannelStrip(channelStripParams2, ref this.m_Controller.m_HighlightEffectIndex, ref dictionary, showBusConnectionsOfSelection); if (current.type == EventType.MouseDown && current.button == 0 && channelStripParams2.stripRect.Contains(current.mousePosition)) { current.Use(); } if (this.IsMovingEffect() && current.type == EventType.MouseDrag && channelStripParams2.stripRect.Contains(current.mousePosition) && GUIUtility.hotControl == this.m_EffectInteractionControlID) { this.m_MovingEffectDstIndex = -1; current.Use(); } rect2.x += channelStripParams2.stripRect.width + 4f; if (showReferencedBuses && j == count - 1 && list.Count > count) { rect2.x += 50f; EditorGUI.BeginDisabledGroup(true); GUI.Label(new Rect(rect2.x, channelStripParams2.stripRect.yMax, 130f, 22f), this.styles.referencedGroups, this.styles.channelStripHeaderStyle); EditorGUI.EndDisabledGroup(); } } this.UnhandledEffectDraggingEvents(ref this.m_Controller.m_HighlightEffectIndex); if (current.type == EventType.Repaint && dictionary != null) { foreach (KeyValuePair<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> current4 in dictionary) { AudioMixerChannelStripView.PatchSlot value = current4.Value; bool flag = !showBusConnectionsOfSelection || this.m_Controller.CachedSelection.Contains(value.group); if (flag) { this.styles.circularToggle.Draw(new Rect(value.x - 3f, value.y - 3f, 6f, 6f), false, false, flag, false); } } float num4 = Mathf.Exp(-0.03f * Time.time * Time.time) * 0.1f; Color color = new Color(0f, 0f, 0f, (!AudioMixerController.EditingTargetSnapshot()) ? 0.05f : 0.1f); Color color2 = new Color(0f, 0f, 0f, (!AudioMixerController.EditingTargetSnapshot()) ? 0.5f : 1f); foreach (KeyValuePair<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> current5 in dictionary) { AudioMixerEffectController key = current5.Key; AudioMixerEffectController sendTarget = key.sendTarget; if (!(sendTarget == null)) { AudioMixerChannelStripView.PatchSlot value2 = current5.Value; if (dictionary.ContainsKey(sendTarget)) { AudioMixerChannelStripView.PatchSlot patchSlot = dictionary[sendTarget]; int num5 = key.GetInstanceID() ^ sendTarget.GetInstanceID(); float num6 = (float)(num5 & 63) * 0.1f; float x = Mathf.Abs(patchSlot.x - value2.x) * Mathf.Sin(Time.time * 5f + num6) * num4 + (value2.x + patchSlot.x) * 0.5f; float y = Mathf.Abs(patchSlot.y - value2.y) * Mathf.Cos(Time.time * 5f + num6) * num4 + Math.Max(value2.y, patchSlot.y) + Mathf.Max(Mathf.Min(0.5f * Math.Abs(patchSlot.y - value2.y), 50f), 50f); for (int k = 0; k < this.cablepoints.Length; k++) { AudioMixerChannelStripView.GetCableVertex(value2.x, value2.y, x, y, patchSlot.x, patchSlot.y, (float)k / (float)(this.cablepoints.Length - 1), out this.cablepoints[k].x, out this.cablepoints[k].y); } bool flag2 = showBusConnectionsOfSelection && !this.m_Controller.CachedSelection.Contains(value2.group) && !this.m_Controller.CachedSelection.Contains(patchSlot.group); Handles.color = ((!flag2) ? color2 : color); Handles.DrawAAPolyLine(7f, this.cablepoints.Length, this.cablepoints); if (!flag2) { num5 ^= (num5 >> 6 ^ num5 >> 12 ^ num5 >> 18); Handles.color = new Color((float)(num5 & 3) * 0.15f + 0.55f, (float)(num5 >> 2 & 3) * 0.15f + 0.55f, (float)(num5 >> 4 & 3) * 0.15f + 0.55f, (!AudioMixerController.EditingTargetSnapshot()) ? 0.5f : 1f); Handles.DrawAAPolyLine(4f, this.cablepoints.Length, this.cablepoints); Handles.color = new Color(1f, 1f, 1f, (!AudioMixerController.EditingTargetSnapshot()) ? 0.25f : 0.5f); Handles.DrawAAPolyLine(3f, this.cablepoints.Length, this.cablepoints); } } } } } this.RectSelection(channelStripParams2); GUI.EndScrollView(true); AudioMixerDrawUtils.DrawScrollDropShadow(rect, this.m_State.m_ScrollPos.y, contentRect.height); this.WarningOverlay(allGroups, rect, contentRect); this.ShowDeveloperOverlays(rect, current, showDeveloperOverlays); if (!EditorApplication.isPlaying && !this.m_Controller.isSuspended) { this.m_RequiresRepaint = true; } }
public void OnGUI(Rect rect, bool showReferencedBuses, bool showBusConnections, bool showBusConnectionsOfSelection, List<AudioMixerGroupController> allGroups, Dictionary<AudioMixerEffectController, AudioMixerGroupController> effectMap, bool sortGroupsAlphabetically, bool showDeveloperOverlays, AudioMixerGroupController scrollToItem) { if ((UnityEngine.Object) this.m_Controller == (UnityEngine.Object) null) { this.DrawAreaBackground(rect); } else { if (Event.current.type == EventType.Layout) return; this.m_RectSelectionControlID = GUIUtility.GetControlID(AudioMixerChannelStripView.kRectSelectionHashCode, FocusType.Passive); this.m_EffectInteractionControlID = GUIUtility.GetControlID(AudioMixerChannelStripView.kEffectDraggingHashCode, FocusType.Passive); this.m_IndexCounter = 0; Event current1 = Event.current; List<AudioMixerGroupController> list1 = ((IEnumerable<AudioMixerGroupController>) this.m_Controller.GetCurrentViewGroupList()).ToList<AudioMixerGroupController>(); if (sortGroupsAlphabetically) list1.Sort((IComparer<AudioMixerGroupController>) this.m_GroupComparer); Rect rect1 = new Rect(this.channelStripsOffset.x, this.channelStripsOffset.y, 90f, 300f); if ((UnityEngine.Object) scrollToItem != (UnityEngine.Object) null) { int num1 = list1.IndexOf(scrollToItem); if (num1 >= 0) { float num2 = (rect1.width + 4f) * (float) num1 - this.m_State.m_ScrollPos.x; if ((double) num2 < -20.0 || (double) num2 > (double) rect.width) this.m_State.m_ScrollPos.x += num2; } } List<AudioMixerGroupController> source = new List<AudioMixerGroupController>(); using (List<AudioMixerGroupController>.Enumerator enumerator = list1.GetEnumerator()) { while (enumerator.MoveNext()) { foreach (AudioMixerEffectController effect1 in enumerator.Current.effects) { if ((UnityEngine.Object) effect1.sendTarget != (UnityEngine.Object) null) { AudioMixerGroupController effect2 = effectMap[effect1.sendTarget]; if (!source.Contains(effect2) && !list1.Contains(effect2)) source.Add(effect2); } } } } List<AudioMixerGroupController> list2 = source.ToList<AudioMixerGroupController>(); list2.Sort((IComparer<AudioMixerGroupController>) this.m_GroupComparer); int count = list1.Count; if (showReferencedBuses && list2.Count > 0) list1.AddRange((IEnumerable<AudioMixerGroupController>) list2); int num3 = 1; using (List<AudioMixerGroupController>.Enumerator enumerator = list1.GetEnumerator()) { while (enumerator.MoveNext()) { AudioMixerGroupController current2 = enumerator.Current; num3 = Mathf.Max(num3, current2.effects.Length); } } bool isShowingReferencedGroups = list1.Count != count; Rect contentRect = this.GetContentRect(list1, isShowingReferencedGroups, num3); this.m_State.m_ScrollPos = GUI.BeginScrollView(rect, this.m_State.m_ScrollPos, contentRect); this.DrawAreaBackground(new Rect(0.0f, 0.0f, 10000f, 10000f)); AudioMixerChannelStripView.ChannelStripParams channelStripParams = new AudioMixerChannelStripView.ChannelStripParams() { effectMap = effectMap, allGroups = allGroups, shownGroups = list1, anySoloActive = allGroups.Any<AudioMixerGroupController>((Func<AudioMixerGroupController, bool>) (g => g.solo)), visibleRect = new Rect(this.m_State.m_ScrollPos.x, this.m_State.m_ScrollPos.y, rect.width, rect.height) }; Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> patchslots = !showBusConnections ? (Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot>) null : new Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot>(); for (int index = 0; index < list1.Count; ++index) { AudioMixerGroupController mixerGroupController = list1[index]; channelStripParams.index = index; channelStripParams.group = mixerGroupController; channelStripParams.drawingBuses = false; channelStripParams.visible = AudioMixerChannelStripView.RectOverlaps(channelStripParams.visibleRect, rect1); channelStripParams.Init(this.m_Controller, rect1, num3); this.DrawChannelStrip(channelStripParams, ref this.m_Controller.m_HighlightEffectIndex, ref patchslots, showBusConnectionsOfSelection); if (current1.type == EventType.MouseDown && current1.button == 0 && channelStripParams.stripRect.Contains(current1.mousePosition)) current1.Use(); if (this.IsMovingEffect() && current1.type == EventType.MouseDrag && (channelStripParams.stripRect.Contains(current1.mousePosition) && GUIUtility.hotControl == this.m_EffectInteractionControlID)) { this.m_MovingEffectDstIndex = -1; current1.Use(); } rect1.x += channelStripParams.stripRect.width + 4f; if (showReferencedBuses && index == count - 1 && list1.Count > count) { rect1.x += 50f; EditorGUI.BeginDisabledGroup(true); GUI.Label(new Rect(rect1.x, channelStripParams.stripRect.yMax, 130f, 22f), this.styles.referencedGroups, this.styles.channelStripHeaderStyle); EditorGUI.EndDisabledGroup(); } } this.UnhandledEffectDraggingEvents(ref this.m_Controller.m_HighlightEffectIndex); if (current1.type == EventType.Repaint && patchslots != null) { using (Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot>.Enumerator enumerator = patchslots.GetEnumerator()) { while (enumerator.MoveNext()) { AudioMixerChannelStripView.PatchSlot patchSlot = enumerator.Current.Value; bool on = !showBusConnectionsOfSelection || this.m_Controller.CachedSelection.Contains(patchSlot.group); if (on) this.styles.circularToggle.Draw(new Rect(patchSlot.x - 3f, patchSlot.y - 3f, 6f, 6f), false, false, on, false); } } float num1 = Mathf.Exp(-0.03f * Time.time * Time.time) * 0.1f; Color color1 = new Color(0.0f, 0.0f, 0.0f, !AudioMixerController.EditingTargetSnapshot() ? 0.05f : 0.1f); Color color2 = new Color(0.0f, 0.0f, 0.0f, !AudioMixerController.EditingTargetSnapshot() ? 0.5f : 1f); using (Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot>.Enumerator enumerator = patchslots.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> current2 = enumerator.Current; AudioMixerEffectController key = current2.Key; AudioMixerEffectController sendTarget = key.sendTarget; if (!((UnityEngine.Object) sendTarget == (UnityEngine.Object) null)) { AudioMixerChannelStripView.PatchSlot patchSlot1 = current2.Value; if (patchslots.ContainsKey(sendTarget)) { AudioMixerChannelStripView.PatchSlot patchSlot2 = patchslots[sendTarget]; int num2 = key.GetInstanceID() ^ sendTarget.GetInstanceID(); float num4 = (float) (num2 & 63) * 0.1f; float x2 = (float) ((double) Mathf.Abs(patchSlot2.x - patchSlot1.x) * (double) Mathf.Sin(Time.time * 5f + num4) * (double) num1 + ((double) patchSlot1.x + (double) patchSlot2.x) * 0.5); float y2 = Mathf.Abs(patchSlot2.y - patchSlot1.y) * Mathf.Cos(Time.time * 5f + num4) * num1 + Math.Max(patchSlot1.y, patchSlot2.y) + Mathf.Max(Mathf.Min(0.5f * Math.Abs(patchSlot2.y - patchSlot1.y), 50f), 50f); for (int index = 0; index < this.cablepoints.Length; ++index) AudioMixerChannelStripView.GetCableVertex(patchSlot1.x, patchSlot1.y, x2, y2, patchSlot2.x, patchSlot2.y, (float) index / (float) (this.cablepoints.Length - 1), out this.cablepoints[index].x, out this.cablepoints[index].y); bool flag = showBusConnectionsOfSelection && !this.m_Controller.CachedSelection.Contains(patchSlot1.group) && !this.m_Controller.CachedSelection.Contains(patchSlot2.group); Handles.color = !flag ? color2 : color1; Handles.DrawAAPolyLine(7f, this.cablepoints.Length, this.cablepoints); if (!flag) { int num5 = num2 ^ (num2 >> 6 ^ num2 >> 12 ^ num2 >> 18); Handles.color = new Color((float) ((double) (num5 & 3) * 0.150000005960464 + 0.550000011920929), (float) ((double) (num5 >> 2 & 3) * 0.150000005960464 + 0.550000011920929), (float) ((double) (num5 >> 4 & 3) * 0.150000005960464 + 0.550000011920929), !AudioMixerController.EditingTargetSnapshot() ? 0.5f : 1f); Handles.DrawAAPolyLine(4f, this.cablepoints.Length, this.cablepoints); Handles.color = new Color(1f, 1f, 1f, !AudioMixerController.EditingTargetSnapshot() ? 0.25f : 0.5f); Handles.DrawAAPolyLine(3f, this.cablepoints.Length, this.cablepoints); } } } } } } this.RectSelection(channelStripParams); GUI.EndScrollView(true); AudioMixerDrawUtils.DrawScrollDropShadow(rect, this.m_State.m_ScrollPos.y, contentRect.height); this.WarningOverlay(allGroups, rect, contentRect); this.ShowDeveloperOverlays(rect, current1, showDeveloperOverlays); if (EditorApplication.isPlaying || this.m_Controller.isSuspended) return; this.m_RequiresRepaint = true; } }