public override string ResolveStringPath(bool getOnlyBasePath) { if (getOnlyBasePath) { return(GetBasePath(group.GetDisplayString(), effect.effectName)); } if (effect.GetGUIDForMixLevel() == parameter) { if (effect.IsSend()) { var allGroups = group.controller.GetAllAudioGroupsSlow(); var effectMap = AudioMixerGroupController.GetEffectMapSlow(allGroups); return($"Send level{GetBasePath(group.GetDisplayString(), null)} to {effect.sendTarget.GetDisplayString(effectMap)}"); } return($"Mix Level{GetBasePath(group.GetDisplayString(), effect.effectName)}"); } MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName); for (int i = 0; i < paramDefs.Length; i++) { GUID guid = effect.GetGUIDForParameter(paramDefs[i].name); if (guid == parameter) { return(paramDefs[i].name + GetBasePath(group.GetDisplayString(), effect.effectName)); } } return("Error finding Parameter path."); }
public static Color GetEffectColor(AudioMixerEffectController effect) { if (effect.IsSend()) { if ((Object) effect.sendTarget != (Object) null) return AudioMixerDrawUtils.kSendColor; return Color.gray; } if (effect.IsReceive()) return AudioMixerDrawUtils.kReceiveColor; if (effect.IsDuckVolume()) return AudioMixerDrawUtils.kDuckVolumeColor; if (effect.IsAttenuation()) return AudioMixerDrawUtils.kAttenuationColor; return AudioMixerDrawUtils.kEffectColor; }
private void EffectSlotDragging(Rect r, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, bool showLevel, float level, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p) { Event current = Event.current; switch (current.GetTypeForControl(this.m_EffectInteractionControlID)) { case EventType.MouseDown: if (r.Contains(current.mousePosition) && current.button == 0 && GUIUtility.hotControl == 0) { GUIUtility.hotControl = this.m_EffectInteractionControlID; this.m_MouseDragStartX = current.mousePosition.x; this.m_MouseDragStartValue = level; highlightEffectIndex = effectIndex; this.m_MovingEffectSrcIndex = -1; this.m_MovingEffectDstIndex = -1; this.m_WaitingForDragEvent = true; this.m_MovingSrcRect = r; this.m_MovingDstRect = r; this.m_MovingSrcGroup = p.group; this.m_MovingDstGroup = p.group; this.m_MovingEffectAllowed = true; this.SetFocus(); Event.current.Use(); EditorGUIUtility.SetWantsMouseJumping(1); InspectorWindow.RepaintAllInspectors(); } break; case EventType.MouseUp: if (GUIUtility.hotControl == this.m_EffectInteractionControlID && current.button == 0 && p.stripRect.Contains(current.mousePosition)) { if (this.m_MovingEffectDstIndex != -1 && this.m_MovingEffectAllowed) { if (this.IsDuplicateKeyPressed() && this.CanDuplicateDraggedEffect()) { AudioMixerEffectController sourceEffect = this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex]; AudioMixerEffectController effect2 = this.m_MovingSrcGroup.controller.CopyEffect(sourceEffect); List<AudioMixerEffectController> list = this.m_MovingDstGroup.effects.ToList<AudioMixerEffectController>(); if (AudioMixerController.InsertEffect(effect2, ref list, this.m_MovingEffectDstIndex)) { this.m_MovingDstGroup.effects = list.ToArray(); } } else { if (this.m_MovingSrcGroup == this.m_MovingDstGroup) { List<AudioMixerEffectController> list2 = this.m_MovingSrcGroup.effects.ToList<AudioMixerEffectController>(); if (AudioMixerController.MoveEffect(ref list2, this.m_MovingEffectSrcIndex, ref list2, this.m_MovingEffectDstIndex)) { this.m_MovingSrcGroup.effects = list2.ToArray(); } } else { if (!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation()) { List<AudioMixerEffectController> list3 = this.m_MovingSrcGroup.effects.ToList<AudioMixerEffectController>(); List<AudioMixerEffectController> list4 = this.m_MovingDstGroup.effects.ToList<AudioMixerEffectController>(); if (AudioMixerController.MoveEffect(ref list3, this.m_MovingEffectSrcIndex, ref list4, this.m_MovingEffectDstIndex)) { this.m_MovingSrcGroup.effects = list3.ToArray(); this.m_MovingDstGroup.effects = list4.ToArray(); } } } } } this.ClearEffectDragging(ref highlightEffectIndex); current.Use(); EditorGUIUtility.SetWantsMouseJumping(0); GUIUtility.ExitGUI(); } break; case EventType.MouseDrag: if (GUIUtility.hotControl == this.m_EffectInteractionControlID) { if (this.HasFocus() && this.m_WaitingForDragEvent) { this.m_ChangingWetMixIndex = -1; if (effectIndex < p.group.effects.Length) { if (Mathf.Abs(current.delta.y) > Mathf.Abs(current.delta.x)) { this.m_MovingEffectSrcIndex = effectIndex; this.ClearFocus(); } else { this.m_ChangingWetMixIndex = this.m_IndexCounter; } } this.m_WaitingForDragEvent = false; } if (this.IsMovingEffect() && p.stripRect.Contains(current.mousePosition)) { float num = r.height * 0.5f; float num2 = (effectIndex != 0) ? 0f : (-num); float num3 = (effectIndex != p.group.effects.Length - 1) ? r.height : (r.height + num); float num4 = current.mousePosition.y - r.y; if (num4 >= num2 && num4 <= num3 && effectIndex < p.group.effects.Length) { int num5 = (num4 >= num) ? (effectIndex + 1) : effectIndex; if (num5 != this.m_MovingEffectDstIndex || this.m_MovingDstGroup != p.group) { this.m_MovingDstRect.x = r.x; this.m_MovingDstRect.width = r.width; this.m_MovingDstRect.y = ((num4 >= num) ? (r.y + r.height) : r.y) - 1f; this.m_MovingEffectDstIndex = num5; this.m_MovingDstGroup = p.group; this.m_MovingEffectAllowed = ((!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation() || !(this.m_MovingSrcGroup != this.m_MovingDstGroup)) && !AudioMixerController.WillMovingEffectCauseFeedback(p.allGroups, this.m_MovingSrcGroup, this.m_MovingEffectSrcIndex, this.m_MovingDstGroup, num5, null) && (!this.IsDuplicateKeyPressed() || this.CanDuplicateDraggedEffect())); } current.Use(); } } if (this.IsAdjustingWetMix() && this.HasFocus() && showLevel) { this.m_WaitingForDragEvent = false; float value = AudioMixerChannelStripView.kEffectScaleMouseDrag * HandleUtility.niceMouseDelta + level; float num6 = Mathf.Clamp(value, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect) - level; if (num6 != 0f) { Undo.RecordObject(this.m_Controller.TargetSnapshot, "Change effect level"); if (effect.IsSend() && this.m_Controller.CachedSelection.Count > 1 && this.m_Controller.CachedSelection.Contains(p.group)) { List<AudioMixerEffectController> list5 = new List<AudioMixerEffectController>(); foreach (AudioMixerGroupController current2 in this.m_Controller.CachedSelection) { AudioMixerEffectController[] effects = current2.effects; for (int i = 0; i < effects.Length; i++) { AudioMixerEffectController audioMixerEffectController = effects[i]; if (audioMixerEffectController.effectName == effect.effectName && audioMixerEffectController.sendTarget == effect.sendTarget) { list5.Add(audioMixerEffectController); } } } foreach (AudioMixerEffectController current3 in list5) { if (!current3.IsSend() || current3.sendTarget != null) { current3.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(current3.GetValueForMixLevel(this.m_Controller, snapshot) + num6, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect)); } } } else { if (!effect.IsSend() || effect.sendTarget != null) { effect.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(level + num6, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect)); } } InspectorWindow.RepaintAllInspectors(); } current.Use(); } } break; } }
public static Color GetEffectColor(AudioMixerEffectController effect) { if (effect.IsSend()) { return ((effect.sendTarget == null) ? Color.gray : kSendColor); } if (effect.IsReceive()) { return kReceiveColor; } if (effect.IsDuckVolume()) { return kDuckVolumeColor; } if (effect.IsAttenuation()) { return kAttenuationColor; } return kEffectColor; }
private string GetEffectSlotName(AudioMixerEffectController effect, bool showLevel, AudioMixerSnapshotController snapshot, AudioMixerChannelStripView.ChannelStripParams p) { if (this.m_ChangingWetMixIndex == this.m_IndexCounter && showLevel) { return string.Format("{0:F1} dB", effect.GetValueForMixLevel(this.m_Controller, snapshot)); } if (effect.IsSend() && effect.sendTarget != null) { return effect.GetSendTargetDisplayString(p.effectMap); } return effect.effectName; }
private string GetEffectSlotTooltip(AudioMixerEffectController effect, Rect effectRect, AudioMixerChannelStripView.ChannelStripParams p) { if (!effectRect.Contains(Event.current.mousePosition)) { return string.Empty; } if (effect.IsSend()) { if (effect.sendTarget != null) { string sendTargetDisplayString = effect.GetSendTargetDisplayString(p.effectMap); return "Send to: " + sendTargetDisplayString; } return this.styles.emptySendSlotGUIContent.tooltip; } else { if (effect.IsReceive()) { return this.styles.returnSlotGUIContent.tooltip; } if (effect.IsDuckVolume()) { return this.styles.duckVolumeSlotGUIContent.tooltip; } if (effect.IsAttenuation()) { return this.styles.attenuationSlotGUIContent.tooltip; } return this.styles.effectSlotGUIContent.tooltip; } }
private void EffectSlot(Rect effectRect, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p, ref Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> patchslots) { if (effect == null) { return; } Rect rect = effectRect; Event current = Event.current; if (current.type == EventType.Repaint && patchslots != null && (effect.IsSend() || MixerEffectDefinitions.EffectCanBeSidechainTarget(effect))) { AudioMixerChannelStripView.PatchSlot patchSlot = new AudioMixerChannelStripView.PatchSlot(); patchSlot.group = p.group; patchSlot.x = rect.xMax - (rect.yMax - rect.yMin) * 0.5f; patchSlot.y = (rect.yMin + rect.yMax) * 0.5f; patchslots[effect] = patchSlot; } bool flag = !effect.DisallowsBypass(); Rect position = rect; position.width = 10f; rect.xMin += 10f; if (flag && GUI.Button(position, this.bypassButtonContent, GUIStyle.none)) { effect.bypass = !effect.bypass; this.m_Controller.UpdateBypass(); InspectorWindow.RepaintAllInspectors(); } this.m_IndexCounter++; float num = (!(effect != null)) ? AudioMixerController.kMinVolume : Mathf.Clamp(effect.GetValueForMixLevel(this.m_Controller, snapshot), AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect); bool flag2 = effect != null && ((effect.IsSend() && effect.sendTarget != null) || effect.enableWetMix); if (current.type == EventType.Repaint) { GUIStyle effectBarStyle = this.GetEffectBarStyle(effect); float num2 = (!flag2) ? 1f : ((num - AudioMixerController.kMinVolume) / (AudioMixerController.kMaxEffect - AudioMixerController.kMinVolume)); bool flag3 = (!p.group.bypassEffects && (effect == null || !effect.bypass)) || (effect != null && effect.DisallowsBypass()); Color color = (!(effect != null)) ? new Color(0f, 0f, 0f, 0.5f) : AudioMixerDrawUtils.GetEffectColor(effect); if (!flag3) { color = new Color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f); } if (flag3) { if (num2 < 1f) { float num3 = rect.width * num2; if (num3 < 4f) { num3 = Mathf.Max(num3, 2f); float num4 = 1f - num3 / 4f; Color color2 = GUI.color; if (!GUI.enabled) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } GUI.DrawTextureWithTexCoords(new Rect(rect.x, rect.y, num3, rect.height), effectBarStyle.focused.background, new Rect(num4, 0f, 1f - num4, 1f)); GUI.color = color2; } else { effectBarStyle.Draw(new Rect(rect.x, rect.y, num3, rect.height), false, false, false, true); } GUI.DrawTexture(new Rect(rect.x + num3, rect.y, rect.width - num3, rect.height), effectBarStyle.onFocused.background, ScaleMode.StretchToFill); } else { effectBarStyle.Draw(rect, !flag2, false, false, flag2); } } else { effectBarStyle.Draw(rect, false, false, false, false); } if (flag) { this.styles.circularToggle.Draw(new Rect(position.x + 2f, position.y + 5f, position.width - 2f, position.width - 2f), false, false, !effect.bypass, false); } if (effect.IsSend() && effect.sendTarget != null) { position.y -= 1f; GUI.Label(position, this.styles.sendString, EditorStyles.miniLabel); } EditorGUI.BeginDisabledGroup(!flag3); string effectSlotName = this.GetEffectSlotName(effect, flag2, snapshot, p); string effectSlotTooltip = this.GetEffectSlotTooltip(effect, rect, p); GUI.Label(new Rect(rect.x, rect.y, rect.width - 10f, rect.height), GUIContent.Temp(effectSlotName, effectSlotTooltip), this.styles.effectName); EditorGUI.EndDisabledGroup(); } else { this.EffectSlotDragging(effectRect, snapshot, effect, flag2, num, effectIndex, ref highlightEffectIndex, p); } }
public GUIStyle GetEffectBarStyle(AudioMixerEffectController effect) { if (effect.IsSend() || effect.IsReceive() || effect.IsDuckVolume()) { return this.styles.sendReturnBar; } if (effect.IsAttenuation()) { return this.styles.attenuationBar; } return this.styles.effectBar; }
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 void EffectSlotDragging(Rect r, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, bool showLevel, float level, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p) { Event current1 = Event.current; switch (current1.GetTypeForControl(this.m_EffectInteractionControlID)) { case EventType.MouseDown: if (!r.Contains(current1.mousePosition) || current1.button != 0 || GUIUtility.hotControl != 0) break; GUIUtility.hotControl = this.m_EffectInteractionControlID; this.m_MouseDragStartX = current1.mousePosition.x; this.m_MouseDragStartValue = level; highlightEffectIndex = effectIndex; this.m_MovingEffectSrcIndex = -1; this.m_MovingEffectDstIndex = -1; this.m_WaitingForDragEvent = true; this.m_MovingSrcRect = r; this.m_MovingDstRect = r; this.m_MovingSrcGroup = p.group; this.m_MovingDstGroup = p.group; this.m_MovingEffectAllowed = true; this.SetFocus(); Event.current.Use(); EditorGUIUtility.SetWantsMouseJumping(1); InspectorWindow.RepaintAllInspectors(); break; case EventType.MouseUp: if (GUIUtility.hotControl != this.m_EffectInteractionControlID || current1.button != 0 || !p.stripRect.Contains(current1.mousePosition)) break; if (this.m_MovingEffectDstIndex != -1 && this.m_MovingEffectAllowed) { if (this.IsDuplicateKeyPressed() && this.CanDuplicateDraggedEffect()) { AudioMixerEffectController effect1 = this.m_MovingSrcGroup.controller.CopyEffect(this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex]); List<AudioMixerEffectController> list = ((IEnumerable<AudioMixerEffectController>) this.m_MovingDstGroup.effects).ToList<AudioMixerEffectController>(); if (AudioMixerController.InsertEffect(effect1, ref list, this.m_MovingEffectDstIndex)) this.m_MovingDstGroup.effects = list.ToArray(); } else if ((UnityEngine.Object) this.m_MovingSrcGroup == (UnityEngine.Object) this.m_MovingDstGroup) { List<AudioMixerEffectController> list = ((IEnumerable<AudioMixerEffectController>) this.m_MovingSrcGroup.effects).ToList<AudioMixerEffectController>(); if (AudioMixerController.MoveEffect(ref list, this.m_MovingEffectSrcIndex, ref list, this.m_MovingEffectDstIndex)) this.m_MovingSrcGroup.effects = list.ToArray(); } else if (!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation()) { List<AudioMixerEffectController> list1 = ((IEnumerable<AudioMixerEffectController>) this.m_MovingSrcGroup.effects).ToList<AudioMixerEffectController>(); List<AudioMixerEffectController> list2 = ((IEnumerable<AudioMixerEffectController>) this.m_MovingDstGroup.effects).ToList<AudioMixerEffectController>(); if (AudioMixerController.MoveEffect(ref list1, this.m_MovingEffectSrcIndex, ref list2, this.m_MovingEffectDstIndex)) { this.m_MovingSrcGroup.effects = list1.ToArray(); this.m_MovingDstGroup.effects = list2.ToArray(); } } } this.ClearEffectDragging(ref highlightEffectIndex); current1.Use(); EditorGUIUtility.SetWantsMouseJumping(0); GUIUtility.ExitGUI(); break; case EventType.MouseDrag: if (GUIUtility.hotControl != this.m_EffectInteractionControlID) break; if (this.HasFocus() && this.m_WaitingForDragEvent) { this.m_ChangingWetMixIndex = -1; if (effectIndex < p.group.effects.Length) { if ((double) Mathf.Abs(current1.delta.y) > (double) Mathf.Abs(current1.delta.x)) { this.m_MovingEffectSrcIndex = effectIndex; this.ClearFocus(); } else this.m_ChangingWetMixIndex = this.m_IndexCounter; } this.m_WaitingForDragEvent = false; } if (this.IsMovingEffect() && p.stripRect.Contains(current1.mousePosition)) { float num1 = r.height * 0.5f; float num2 = effectIndex != 0 ? 0.0f : -num1; float num3 = effectIndex != p.group.effects.Length - 1 ? r.height : r.height + num1; float num4 = current1.mousePosition.y - r.y; if ((double) num4 >= (double) num2 && (double) num4 <= (double) num3 && effectIndex < p.group.effects.Length) { int targetIndex = (double) num4 >= (double) num1 ? effectIndex + 1 : effectIndex; if (targetIndex != this.m_MovingEffectDstIndex || (UnityEngine.Object) this.m_MovingDstGroup != (UnityEngine.Object) p.group) { this.m_MovingDstRect.x = r.x; this.m_MovingDstRect.width = r.width; this.m_MovingDstRect.y = (float) (((double) num4 >= (double) num1 ? (double) r.y + (double) r.height : (double) r.y) - 1.0); this.m_MovingEffectDstIndex = targetIndex; this.m_MovingDstGroup = p.group; this.m_MovingEffectAllowed = (!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation() || !((UnityEngine.Object) this.m_MovingSrcGroup != (UnityEngine.Object) this.m_MovingDstGroup)) && !AudioMixerController.WillMovingEffectCauseFeedback(p.allGroups, this.m_MovingSrcGroup, this.m_MovingEffectSrcIndex, this.m_MovingDstGroup, targetIndex, (List<AudioMixerController.ConnectionNode>) null) && (!this.IsDuplicateKeyPressed() || this.CanDuplicateDraggedEffect()); } current1.Use(); } } if (!this.IsAdjustingWetMix() || !this.HasFocus() || !showLevel) break; this.m_WaitingForDragEvent = false; float num = Mathf.Clamp(AudioMixerChannelStripView.kEffectScaleMouseDrag * HandleUtility.niceMouseDelta + level, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect) - level; if ((double) num != 0.0) { Undo.RecordObject((UnityEngine.Object) this.m_Controller.TargetSnapshot, "Change effect level"); if (effect.IsSend() && this.m_Controller.CachedSelection.Count > 1 && this.m_Controller.CachedSelection.Contains(p.group)) { List<AudioMixerEffectController> effectControllerList = new List<AudioMixerEffectController>(); using (List<AudioMixerGroupController>.Enumerator enumerator = this.m_Controller.CachedSelection.GetEnumerator()) { while (enumerator.MoveNext()) { foreach (AudioMixerEffectController effect1 in enumerator.Current.effects) { if (effect1.effectName == effect.effectName && (UnityEngine.Object) effect1.sendTarget == (UnityEngine.Object) effect.sendTarget) effectControllerList.Add(effect1); } } } using (List<AudioMixerEffectController>.Enumerator enumerator = effectControllerList.GetEnumerator()) { while (enumerator.MoveNext()) { AudioMixerEffectController current2 = enumerator.Current; if (!current2.IsSend() || (UnityEngine.Object) current2.sendTarget != (UnityEngine.Object) null) current2.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(current2.GetValueForMixLevel(this.m_Controller, snapshot) + num, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect)); } } } else if (!effect.IsSend() || (UnityEngine.Object) effect.sendTarget != (UnityEngine.Object) null) effect.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(level + num, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect)); InspectorWindow.RepaintAllInspectors(); } current1.Use(); break; } }
private void EffectSlot(Rect effectRect, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p, ref Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> patchslots) { if ((UnityEngine.Object) effect == (UnityEngine.Object) null) return; Rect rect = effectRect; Event current = Event.current; if (current.type == EventType.Repaint && patchslots != null && (effect.IsSend() || MixerEffectDefinitions.EffectCanBeSidechainTarget(effect))) patchslots[effect] = new AudioMixerChannelStripView.PatchSlot() { group = p.group, x = rect.xMax - (float) (((double) rect.yMax - (double) rect.yMin) * 0.5), y = (float) (((double) rect.yMin + (double) rect.yMax) * 0.5) }; bool flag1 = !effect.DisallowsBypass(); Rect position = rect; position.width = 10f; rect.xMin += 10f; if (flag1 && GUI.Button(position, this.bypassButtonContent, GUIStyle.none)) { effect.bypass = !effect.bypass; this.m_Controller.UpdateBypass(); InspectorWindow.RepaintAllInspectors(); } ++this.m_IndexCounter; float level = !((UnityEngine.Object) effect != (UnityEngine.Object) null) ? AudioMixerController.kMinVolume : Mathf.Clamp(effect.GetValueForMixLevel(this.m_Controller, snapshot), AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect); bool flag2 = (UnityEngine.Object) effect != (UnityEngine.Object) null && (effect.IsSend() && (UnityEngine.Object) effect.sendTarget != (UnityEngine.Object) null || effect.enableWetMix); if (current.type == EventType.Repaint) { GUIStyle effectBarStyle = this.GetEffectBarStyle(effect); float num1 = !flag2 ? 1f : (float) (((double) level - (double) AudioMixerController.kMinVolume) / ((double) AudioMixerController.kMaxEffect - (double) AudioMixerController.kMinVolume)); bool flag3 = !p.group.bypassEffects && ((UnityEngine.Object) effect == (UnityEngine.Object) null || !effect.bypass) || (UnityEngine.Object) effect != (UnityEngine.Object) null && effect.DisallowsBypass(); Color color1 = !((UnityEngine.Object) effect != (UnityEngine.Object) null) ? new Color(0.0f, 0.0f, 0.0f, 0.5f) : AudioMixerDrawUtils.GetEffectColor(effect); if (!flag3) color1 = new Color(color1.r * 0.5f, color1.g * 0.5f, color1.b * 0.5f); if (flag3) { if ((double) num1 < 1.0) { float num2 = rect.width * num1; if ((double) num2 < 4.0) { num2 = Mathf.Max(num2, 2f); float x = (float) (1.0 - (double) num2 / 4.0); Color color2 = GUI.color; if (!GUI.enabled) GUI.color = new Color(1f, 1f, 1f, 0.5f); GUI.DrawTextureWithTexCoords(new Rect(rect.x, rect.y, num2, rect.height), (Texture) effectBarStyle.focused.background, new Rect(x, 0.0f, 1f - x, 1f)); GUI.color = color2; } else effectBarStyle.Draw(new Rect(rect.x, rect.y, num2, rect.height), false, false, false, true); GUI.DrawTexture(new Rect(rect.x + num2, rect.y, rect.width - num2, rect.height), (Texture) effectBarStyle.onFocused.background, ScaleMode.StretchToFill); } else effectBarStyle.Draw(rect, !flag2, false, false, flag2); } else effectBarStyle.Draw(rect, false, false, false, false); if (flag1) this.styles.circularToggle.Draw(new Rect(position.x + 2f, position.y + 5f, position.width - 2f, position.width - 2f), false, false, !effect.bypass, false); if (effect.IsSend() && (UnityEngine.Object) effect.sendTarget != (UnityEngine.Object) null) { --position.y; GUI.Label(position, this.styles.sendString, EditorStyles.miniLabel); } EditorGUI.BeginDisabledGroup(!flag3); string effectSlotName = this.GetEffectSlotName(effect, flag2, snapshot, p); string effectSlotTooltip = this.GetEffectSlotTooltip(effect, rect, p); GUI.Label(new Rect(rect.x, rect.y, rect.width - 10f, rect.height), GUIContent.Temp(effectSlotName, effectSlotTooltip), this.styles.effectName); EditorGUI.EndDisabledGroup(); } else this.EffectSlotDragging(effectRect, snapshot, effect, flag2, level, effectIndex, ref highlightEffectIndex, p); }