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); } }
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); }