示例#1
0
        public static void Draw(InAudioNode node)
        {
            EditorGUILayout.BeginVertical();

            #region Bank

            UndoHelper.GUIUndo(node, "Name Change", ref node.Name, () =>
                               EditorGUILayout.TextField("Name", node.Name));
            var data = node.NodeData as InFolderData;
            if (node.Type == AudioNodeType.Folder)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", data.OverrideParentBank);
                if (overrideparent != data.OverrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node, InAudioInstanceFinder.DataManager.BankLinkTree, InAudioInstanceFinder.DataManager.AudioTree);
                }
            }
            else
            {
                EditorGUILayout.LabelField(""); //To fill out the area from the toggle
            }
            if (data.OverrideParentBank == false && node.Type != AudioNodeType.Root)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = FindParentBank(node);
            if (data.OverrideParentBank)
            {
                if (data.BankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", data.BankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(data.BankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = HandleDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeBank(node, newBank, InAudioInstanceFinder.DataManager.BankLinkTree, InAudioInstanceFinder.DataManager.AudioTree);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (data.BankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", data.BankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }
            GUI.enabled = true;
            #endregion

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            #region Bus
            DataDrawerHelper.DrawBus(node);
            #endregion

            EditorGUILayout.EndVertical();
        }
        public static void Draw(InMusicFolder node)
        {
            node.ScrollPosition = EditorGUILayout.BeginScrollView(node.ScrollPosition);
            var prop = new SerializedObject(node);

            prop.Update();
            EditorGUILayout.BeginVertical();

            #region Bank

            InUndoHelper.GUIUndo(node, "Name Change", ref node._name, () =>
                                 EditorGUILayout.TextField("Name", node._name));


            if (!node.IsRoot)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", node._overrideParentBank);
                if (overrideparent != node._overrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node);
                }
            }
            else
            {
                EditorGUILayout.Separator();
            }

            if (node._overrideParentBank == false && !node.IsRoot)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = node.GetBank();
            if (node._overrideParentBank)
            {
                if (node._bankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", node._bankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(node._bankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = OnDragging.BusDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeMusicNodeBank(node, newBank);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (node._bankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", node._bankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }
            GUI.enabled = true;
            if (Application.isPlaying)
            {
                EditorGUILayout.Toggle("Is Loaded", BankLoader.IsLoaded(parentLink));
            }

            #endregion

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            #region Mixer

            DataDrawerHelper.DrawMixer(node, prop.FindProperty("_mixerGroup"));

            #endregion
            EditorGUILayout.Separator();
            #region Volume & Pitch
            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node._minVolume, () => EditorGUILayout.Slider("Initial Volume", node._minVolume, 0f, 1f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node.runtimeVolume, () => EditorGUILayout.Slider("Current Volume", node.runtimeVolume, 0f, 1f));
            }

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node._minPitch, () => EditorGUILayout.Slider("Initial Pitch", node._minPitch, 0f, 3f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node.runtimePitch, () => EditorGUILayout.Slider("Current Pitch", node.runtimePitch, 0f, 3f));
            }
            #endregion

            EditorGUILayout.EndVertical();
            prop.ApplyModifiedProperties();

            EditorGUILayout.EndScrollView();
        }
        public static void Draw(InAudioNode node)
        {
            var nodeData = node._nodeData;

            EditorGUILayout.BeginVertical();
            var data = node._nodeData as InFolderData;

            #region Bank

            InUndoHelper.GUIUndo(node, "Name Change", ref node.Name, () =>
                                 EditorGUILayout.TextField("Name", node.Name));

            if (node._type == AudioNodeType.Folder)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", data.OverrideParentBank);
                if (overrideparent != data.OverrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node);
                }
            }
            else
            {
                EditorGUILayout.LabelField(""); //To fill out the area from the toggle
            }
            if (data.OverrideParentBank == false && node._type != AudioNodeType.Root)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = FindParentBank(node);
            if (data.OverrideParentBank)
            {
                if (data.BankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", data.BankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(data.BankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = OnDragging.BusDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeAudioNodeBank(node, newBank);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (data.BankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", data.BankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }

            GUI.enabled = true;
            if (Application.isPlaying)
            {
                EditorGUILayout.Toggle("Is Loaded", BankLoader.IsLoaded(parentLink));
            }
            #endregion

            if (data.ExternalPlacement)
            {
                EditorGUILayout.Separator();

                GUI.enabled = false;
                EditorGUILayout.ObjectField("Placed on", node.gameObject, typeof(GameObject), false);
                GUI.enabled = true;

                EditorGUILayout.Separator();
            }

            #region Mixer
            DataDrawerHelper.DrawMixer(node);
            #endregion
            EditorGUILayout.Separator();
            #region Volume
            if (Application.isPlaying)
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.runtimeVolume, () => EditorGUILayout.Slider("Runtime Volume", data.runtimeVolume, 0, 1));
            }
            else
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.VolumeMin, () => EditorGUILayout.Slider("Initial Volume", data.VolumeMin, 0, 1));
            }
            #endregion

            EditorGUILayout.EndVertical();
        }