コード例 #1
0
 public static void Draw(AudioNode node)
 {
     UndoHandler.CheckUndo(new UnityEngine.Object[] { node, node.NodeData });
     node.Name = EditorGUILayout.TextField("Name", node.Name);
     NodeTypeDataDrawer.Draw(node);
     UndoHandler.CheckGUIChange();
 }
コード例 #2
0
    public static void Draw(AudioNode node)
    {
        UndoHandler.CheckUndo(new UnityEngine.Object[] { node, node.NodeData }, "Random Data Node Change");
        node.Name = EditorGUILayout.TextField("Name", node.Name);
        NodeTypeDataDrawer.Draw(node);
        EditorGUILayout.Separator();

        if (node.NodeData.SelectedArea == 0)
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField("Weights");

            for (int i = 0; i < node.Children.Count; ++i)
            {
                var child   = node.Children[i];
                var weights = (node.NodeData as RandomData).weights;
                EditorGUILayout.BeginHorizontal();

                weights[i] = EditorGUILayout.IntSlider(child.Name, weights[i], 0, 100);

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();
        }
        UndoHandler.CheckGUIChange();
    }
コード例 #3
0
    public static void Draw(AudioBankLink node)
    {
        UndoHandler.CheckUndo(node);
        //UndoCheck.Instance.CheckUndo(node, "Audio Bank:" + node.Name);
        EditorGUILayout.BeginVertical();
        node.Name = EditorGUILayout.TextField("Name", node.Name);
        if (node.Type != AudioBankTypes.Folder)
        {
            EditorGUILayout.IntField("ID", node.GUID);
            EditorGUILayout.Separator();
            node.AutoLoad = EditorGUILayout.Toggle("Auto load", node.AutoLoad);
        }


        Rect lastArea = GUILayoutUtility.GetLastRect();

        lastArea.y    += 28;
        lastArea.width = 200;
        if (GUI.Button(lastArea, "Find Folders using this bank"))
        {
            EditorWindow.GetWindow <AudioWindow>().Find(audioNode => AudioBankWorker.GetParentBank(audioNode) != node);
        }

        EditorGUILayout.EndVertical();
        //UndoCheck.Instance.CheckDirty(node);
        UndoHandler.CheckGUIChange();
    }
コード例 #4
0
    public static void Draw(AudioNode node)
    {
        UndoHandler.CheckUndo(new Object[] { node, node.NodeData });
        node.Name = EditorGUILayout.TextField("Name", node.Name);
        UndoHandler.CheckGUIChange();
        EditorGUILayout.Separator();
        AudioData audio = node.NodeData as AudioData;
        var       clip  = (AudioClip)EditorGUILayout.ObjectField(audio.Clip, typeof(AudioClip), false);

        if (clip != audio.EditorClip) //Assign new clip
        {
            Undo.RegisterUndo(new Object[] { node.NodeData, AudioBankWorker.GetParentBank(node).LazyBankFetch }, "Changed " + node.Name + " Clip");
            audio.EditorClip = clip;
            AudioBankWorker.SwapClipInBank(node, clip);
        }

        NodeTypeDataDrawer.Draw(node);
    }
コード例 #5
0
    public static void Draw(AudioNode node)
    {
        EditorGUILayout.BeginVertical();
        UndoHandler.CheckUndo(new UnityEngine.Object[] { node, node.NodeData });
        node.Name = EditorGUILayout.TextField("Name", node.Name);
        UndoHandler.CheckGUIChange();

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

        EditorGUILayout.BeginHorizontal();

        var parentLink = FindParentBank(node);

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

        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 = HandleDragging(GUILayoutUtility.GetLastRect());

        if (newBank != null)
        {
            if (node.OverrideParentBank)
            {
                AudioBankWorker.SetNewBank(node, newBank);
            }
            else
            {
                node.BankLink = newBank;
            }
        }
        GUI.enabled = true;
        EditorGUILayout.EndHorizontal();
        GUI.enabled = false;
        EditorGUILayout.LabelField("Node Bank", node.BankLink.GetName);
        GUI.enabled = true;
        EditorGUILayout.EndVertical();
    }