コード例 #1
0
    void ShowContainers()
    {
        if (audioPlayer.containers == null)
        {
            return;
        }

        SerializedProperty containersProperty = serializedObject.FindProperty("containers");

        if (AddElementFoldOut(containersProperty, "Containers".ToGUIContent()))
        {
            audioPlayer.containers[audioPlayer.containers.Length - 1]               = new AudioPlayerOld.Container();
            audioPlayer.containers[audioPlayer.containers.Length - 1].name          = AudioPlayerOld.GetUniqueName(audioPlayer.containers, "default");
            audioPlayer.containers[audioPlayer.containers.Length - 1].subContainers = new List <AudioPlayerOld.SubContainer>();
        }

        if (containersProperty.isExpanded)
        {
            EditorGUI.indentLevel += 1;

            for (int i = 0; i < audioPlayer.containers.Length; i++)
            {
                AudioPlayerOld.Container container = audioPlayer.containers[i];
                currentContainer = container;
                SerializedProperty containerProperty = containersProperty.GetArrayElementAtIndex(i);

                if (DeleteElementFoldOutWithArrows(containersProperty, i, container.name.ToGUIContent()))
                {
                    break;
                }

                if (container.showing)
                {
                    EditorGUI.indentLevel += 1;

                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                    container.name = EditorGUILayout.TextField(container.name);
                    EditorGUI.EndDisabledGroup();
                    container.containerType = (AudioPlayerOld.Container.ContainerTypes)EditorGUILayout.EnumPopup(container.containerType);
                    ShowSources(container, containerProperty);

                    EditorGUI.indentLevel -= 1;
                }
            }
            EditorGUI.indentLevel -= 1;
        }
    }
コード例 #2
0
    void ShowRTPCs()
    {
        if (audioPlayer.rTPCs == null)
        {
            return;
        }

        SerializedProperty rTPCsProperty = serializedObject.FindProperty("rTPCs");

        if (AddElementFoldOut(rTPCsProperty, "RTPCs".ToGUIContent()))
        {
            audioPlayer.rTPCs[audioPlayer.rTPCs.Length - 1]      = new AudioPlayerOld.RTPC();
            audioPlayer.rTPCs[audioPlayer.rTPCs.Length - 1].name = AudioPlayerOld.GetUniqueName(audioPlayer.rTPCs, "default");
        }

        if (rTPCsProperty.isExpanded)
        {
            EditorGUI.indentLevel += 1;

            for (int i = 0; i < audioPlayer.rTPCs.Length; i++)
            {
                AudioPlayerOld.RTPC rtpc         = audioPlayer.rTPCs[i];
                SerializedProperty  rtpcProperty = rTPCsProperty.GetArrayElementAtIndex(i);

                EditorGUILayout.BeginHorizontal();
                rtpc.showing = EditorGUILayout.Foldout(rtpc.showing, rtpc.name);
                GUILayout.Space(30);
                if (!rtpc.showing)
                {
                    rtpc.defaultValue = EditorGUILayout.Slider(rtpc.defaultValue, rtpc.minValue, rtpc.maxValue);
                }
                GUILayout.Space(10);
                DeleteElementButtonWithArrows(rTPCsProperty, i);
                if (deleteBreak)
                {
                    break;
                }
                EditorGUILayout.EndHorizontal();

                if (rtpc.showing)
                {
                    EditorGUI.indentLevel += 1;

                    EditorGUI.BeginChangeCheck();
                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                    rtpc.name = EditorGUILayout.TextField(rtpc.name);
                    EditorGUI.EndDisabledGroup();
                    rtpc.defaultValue = EditorGUILayout.Slider("Value", rtpc.defaultValue, rtpc.minValue, rtpc.maxValue);
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(rtpcProperty.FindPropertyRelative("minValue"));
                    if (EditorGUI.EndChangeCheck())
                    {
                        rtpcProperty.FindPropertyRelative("maxValue").floatValue = Mathf.Max(rtpcProperty.FindPropertyRelative("maxValue").floatValue, rtpcProperty.FindPropertyRelative("minValue").floatValue);
                    }
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(rtpcProperty.FindPropertyRelative("maxValue"));
                    if (EditorGUI.EndChangeCheck())
                    {
                        rtpcProperty.FindPropertyRelative("minValue").floatValue = Mathf.Clamp(rtpcProperty.FindPropertyRelative("minValue").floatValue, 0, rtpcProperty.FindPropertyRelative("maxValue").floatValue);
                    }
                    rtpcProperty.FindPropertyRelative("minValue").floatValue = Mathf.Max(rtpcProperty.FindPropertyRelative("minValue").floatValue, 0);
                    rtpcProperty.FindPropertyRelative("maxValue").floatValue = Mathf.Max(rtpcProperty.FindPropertyRelative("maxValue").floatValue, 0);
                    if (EditorGUI.EndChangeCheck())
                    {
                        rtpcProperty.FindPropertyRelative("changed").boolValue = true;
                    }
                    Separator();

                    EditorGUI.indentLevel -= 1;
                }
            }
            EditorGUI.indentLevel -= 1;
        }
    }
コード例 #3
0
    void ShowBuses()
    {
        if (audioPlayer.buses == null)
        {
            return;
        }

        SerializedProperty busesProperty = serializedObject.FindProperty("buses");

        if (AddElementFoldOut(busesProperty, "Buses".ToGUIContent()))
        {
            audioPlayer.buses[audioPlayer.buses.Length - 1]      = new AudioPlayerOld.AudioBus();
            audioPlayer.buses[audioPlayer.buses.Length - 1].name = AudioPlayerOld.GetUniqueName(audioPlayer.buses, "default");
        }

        if (busesProperty.isExpanded)
        {
            EditorGUI.indentLevel += 1;

            for (int i = 0; i < audioPlayer.buses.Length; i++)
            {
                AudioPlayerOld.AudioBus bus         = audioPlayer.buses[i];
                SerializedProperty      busProperty = busesProperty.GetArrayElementAtIndex(i);

                EditorGUILayout.BeginHorizontal();
                bus.showing = EditorGUILayout.Foldout(bus.showing, bus.name);
                GUILayout.Space(30);
                if (!bus.showing)
                {
                    bus.volume = EditorGUILayout.Slider(bus.volume, 0, 100);
                }
                GUILayout.Space(10);
                DeleteElementButtonWithArrows(busesProperty, i);
                if (deleteBreak)
                {
                    break;
                }
                EditorGUILayout.EndHorizontal();

                if (bus.showing)
                {
                    EditorGUI.indentLevel += 1;

                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                    bus.name = EditorGUILayout.TextField(bus.name);
                    EditorGUI.EndDisabledGroup();
                    EditorGUILayout.PropertyField(busProperty.FindPropertyRelative("volume"));
                    Separator();

                    EditorGUI.indentLevel -= 1;
                }

                if (bus.pVolume != bus.volume)
                {
                    bus.changed = true;
                    bus.pVolume = bus.volume;
                }
            }
            EditorGUI.indentLevel -= 1;
        }
    }