コード例 #1
0
    public void DrawPoints()
    {
        if (inPoint != null && outPoint != null)
        {
            switch (nodeType)
            {
            case (NodeType)0:
                inPoint.Draw();
                outPoint.Draw();
                break;

            case (NodeType)1:
                inPoint.Draw();
                if (answers != null)
                {
                    foreach (string answer in answers)
                    {
                        points = new ConnectionPoint[answers.Length];
                        for (int i = 0; i < points.Length; i++)
                        {
                            points[i] = outPoint;
                        }
                    }
                    DrawMultiplePoints(points);
                }
                break;

            case (NodeType)2:
                inPoint.Draw();
                outPoint.Draw();
                break;
            }
        }
    }
コード例 #2
0
    private void DrawInterrupt()
    {
        if (childContainer != null)
        {
            childContainer.Draw();
        }

        if (outPoint != null)
        {
            outPoint.Draw();
        }
    }
コード例 #3
0
    public void Draw()
    {
        inPoint.Draw();
        for (int i = 0; i < outPoints.Length; i++)
        {
            outPoints[i].Draw();
        }



        Rect baseRect = new Rect(10f, 30f, nodeRect.size.x - 30f, 30f);


        var topOffset = 55f;


        float marginLeft  = 5.5f;
        float marginRight = marginLeft - 0f;

        GUI.Box(new Rect(nodeRect.x, nodeRect.y, nodeRect.width, nodeRect.height + topOffset), "", style);



        EditorGUI.LabelField(nodeRect, title, style);
        title = EditorGUI.TextField(new Rect(nodeRect.position.x + marginRight * 4f, nodeRect.position.y + topOffset, nodeRect.width - (marginRight * 4f * 2f), nodeRect.size.y / 2f), "Scene Name:", title);
    }
コード例 #4
0
ファイル: StoryNode.cs プロジェクト: Regoradin/murdermystery
    public void LoadInteractionConnections()
    {
        outPoints = new List <ConnectionPoint>();

        for (int i = 0; i < story.interactions.Count; i++)
        {
            ConnectionPoint point = new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, 0.15f * (i + 1), story.interactions[i].name);
            point.Draw();

            outPoints.Add(point);
        }



        for (int i = 0; i < story.interactions.Count; i++)
        {
            if (story.interactions[i].nextStory != null)
            {
                ConnectionPoint outPoint = outPoints[i];
                ConnectionPoint inPoint  = null;
                foreach (StoryNode node in editor.nodes)
                {
                    if (node.story == story.interactions[i].nextStory)
                    {
                        inPoint = node.inPoint;
                    }
                }
                outPoints.Add(outPoint);
                editor.CreateConnection(outPoint, inPoint);
            }
        }
    }
コード例 #5
0
 public void Draw()
 {
     inPoint.Draw();
     outPoint.Draw();
     //GUI.Box(rect, title);
     rect = GUILayout.Window(0, rect, OnWindow, title);
 }
コード例 #6
0
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();

        GUI.Box(rect, title, style);
    }
コード例 #7
0
ファイル: BaseNode.cs プロジェクト: bigstupidx/Halfway-Home
 public virtual void Draw()
 {
     inPoint.Draw();
     outPoint.Draw();
     GUI.Box(rect, title, style);
     title = GUI.TextField(new Rect(rect.position + new Vector2(25, 15), new Vector2(150, 20)), title);
 }
コード例 #8
0
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();
        GUI.Box(rect, title, style);

        // Print the title
        //GUI.Label(rectID, nodeTitle.ToString(), styleID);
        GUI.Label(rectIDLabel, "ID: ", styleField);
        skill.id = int.Parse(GUI.TextField(rectID, skill.id.ToString()));

        // Print the unlock field
        GUI.Label(rectUnlockLabel, "Unlocked: ", styleField);
        if (GUI.Toggle(rectUnlocked, unlocked, ""))
        {
            unlocked = true;
        }
        else
        {
            unlocked = false;
        }

        skill.unlocked = unlocked;

        // Print the cost field
        GUI.Label(rectNameLabel, "Name: ", styleField);
        skill.name = GUI.TextField(rectName, skill.name);

        GUI.Label(rectCostLabel, "Cost: ", styleField);
        skill.cost = int.Parse(GUI.TextField(rectCost, skill.cost.ToString()));

        GUI.Label(rectDescLabel, "Description: ", styleField);
        skill.description = GUI.TextArea(rectDesc, skill.description);
    }
コード例 #9
0
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();
        GUI.Box(rect, title, style);

        // 제목 출력
        GUI.Label(rectID, nodeTitle.ToString(), styleID);

        // 언락필드 출력
        GUI.Label(rectUnlockLabel, "Unlocked: ", styleField);
        if (GUI.Toggle(rectUnlocked, unlocked, ""))
        {
            unlocked = true;
        }
        else
        {
            unlocked = false;
        }

        skill.unlocked = unlocked;

        // 코스트필드 출력
        GUI.Label(rectCostLabel, "Cost: ", styleField);
        skill.cost = int.Parse(GUI.TextField(rectCost, skill.cost.ToString()));
    }
コード例 #10
0
ファイル: BaseNode.cs プロジェクト: mengtest/LuaBTreeEditor
 public virtual void Draw()
 {
     //连接点
     inPoint.Draw();
     outPoint.Draw();
     //节点框
     GUI.Box(rect, name.ToString(), style);
 }
コード例 #11
0
    public void DrawConnections()
    {
        inPoint.Draw();

        foreach (OptionNode node in optionNodes)
        {
            node.DrawConnections();
        }
    }
コード例 #12
0
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();


        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Start:", GUILayout.Width(70));
        Start = EditorGUILayout.Toggle(Start);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Finish:", GUILayout.Width(70));
        Finish = EditorGUILayout.Toggle(Finish);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Condition:", GUILayout.Width(70));
        Condition = EditorGUILayout.Toggle(Condition);
        EditorGUILayout.EndHorizontal();

        if (Finish == false && Condition == false)
        {
            Quest        = (QuestData)EditorGUILayout.ObjectField(Quest, typeof(QuestData), true);
            Param        = (ParamsData)EditorGUILayout.ObjectField(Param, typeof(ParamsData), true);
            currentQuest = EditorGUILayout.Toggle("Current Quest", currentQuest);
        }
        if (Start == true)
        {
            Finish    = false;
            Condition = false;
        }
        if (Condition == true)
        {
            Start  = false;
            Finish = false;
            EditorGUILayout.LabelField("Condicion:", GUILayout.Width(70));
            level   = EditorGUILayout.IntField("Level", level);
            killed  = EditorGUILayout.TextField("Killed", killed);
            item    = EditorGUILayout.TextField("Item", item);
            explore = EditorGUILayout.TextField("Explored", explore);
            know    = EditorGUILayout.TextField("Know", know);
            if (GUILayout.Button("CheckParams"))
            {
                CheckParams(level, killed, item, explore, know);
            }
        }
        if (Finish == true)
        {
            Start     = false;
            Condition = false;
            Param     = (ParamsData)EditorGUILayout.ObjectField(Param, typeof(ParamsData), true);
        }
    }
コード例 #13
0
ファイル: Node.cs プロジェクト: wolfewolf/wwf_unity_tools
    public void Draw(NodeBasedEditor window)
    {
        inPoint.Draw(window);
        outPoint.Draw(window);

        Rect zoomRect = new Rect(rect);

        zoomRect.center = window._zoomCoordsOrigin + rect.center;

        GUI.Box(zoomRect, title, style);
    }
コード例 #14
0
 public override void Draw()
 {
     inPoint.Draw();
     outPoint.Draw();
     BranchOutPoint.Draw();
     GUI.Box(rect, "", style);
     title = GUI.TextField(new Rect(rect.position + new Vector2(25, 15), new Vector2(150, 20)), title);
     GUI.Label(new Rect(rect.position + new Vector2(25, 40), new Vector2(150, 20)), "ID: " + ID);
     TypeOfProgress = (ProgressType)EditorGUI.EnumPopup(new Rect(rect.position + new Vector2(25, 65), new Vector2(150, 20)), TypeOfProgress);
     AddDisplay();
 }
コード例 #15
0
    public void Draw()
    {
        // set the positions
        positiveOutpoint.SetPosition(rect.x + 16, rect.y - 1);
        negativeOutpoint.SetPosition(rect.x + 16, rect.y + 17);

        positiveOutpoint.Draw();
        negativeOutpoint.Draw();

        GUI.DrawTexture(rect, image);
    }
コード例 #16
0
ファイル: Node.cs プロジェクト: Laoil1/Volarela
 public void DrawCine()
 {
     inPoint.Draw();
     if (outPoint[0] != null)
     {
         outPoint[0].Draw();
     }
     GUI.Box(rect, title, style);
     EditorGUI.LabelField(labelRect, name, labelStyle);
 }
コード例 #17
0
    public void Draw()
    {
        GUI.Box(rect, title, style);
        var rect2 = rect;

        rect2.y      += 10;
        rect2.x      += 10;
        rect2.width  -= 20;
        rect2.height -= 23;
        EditorGUI.TextField(rect2, "");
        inPoint.Draw();
        outPoint.Draw();
    }
コード例 #18
0
    /*
     * Draw() draws the Node in the window, and all child components.
     */
    public override void Draw()
    {
        inPoint.Draw();

        switch (nodeType)
        {
        case NodeType.Nothing:
            DrawStartOptions();
            break;

        case NodeType.Dialog:
            DrawDialog();
            break;

        case NodeType.Decision:
            DrawDecision();
            break;

        case NodeType.SetLocalFlag:
            DrawSetLocalFlag();
            break;

        case NodeType.CheckLocalFlag:
            DrawCheckLocalFlag();
            break;

        case NodeType.SetGlobalFlag:
            DrawSetGlobalFlag();
            break;

        case NodeType.CheckGlobalFlag:
            DrawCheckGlobalFlag();
            break;

        case NodeType.SetGlobalVariable:
            DrawSetGlobalVariable();
            break;

        case NodeType.CheckGlobalVariable:
            DrawCheckGlobalVariable();
            break;

        case NodeType.Interrupt:
            DrawInterrupt();
            break;
        }

        GUI.Box(rect, title, style);
    }
コード例 #19
0
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();

        UpdateSize();
        rect.width  = width;
        rect.height = height;

        GUILayout.BeginArea(rect, style);
        inspector.OnInspectorGUI();
        GUILayout.EndArea();

        dataNode.SetUIRect(rect);
    }
コード例 #20
0
ファイル: Node.cs プロジェクト: JeremyRies/GraphVisualizer
        public void Draw()
        {
            InPoint.Draw();
            OutPoint.Draw();

            GUI.Box(Rect, "");
            GUI.Label(new Rect(Rect.x + 8, Rect.y + 5, 80, 20), Title);

            GUI.Label(new Rect(Rect.x + 4, Rect.y + 30, 80, 20), "Comp: " + _logicNode.CompleteFactor.Value);

            GUI.Label(new Rect(Rect.x + 4, Rect.y + 50, 36, 20), "Own: ");
            var tex = GUI.TextField(new Rect(Rect.x + 4 + 36, Rect.y + 50, 20, 20), "" + _logicNode.OwnFactor.Value);

            _logicNode.OwnFactor.Value = Double.Parse(tex);
        }
コード例 #21
0
ファイル: Node.cs プロジェクト: LasseAafeldt/SkaterHaters-TD
    public void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();

        GUI.BeginGroup(new Rect(nodeRect.position.x + 5f, nodeRect.position.y + nodeRect.size.y / 2f, nodeRect.size.x - 10f, nodeRect.size.y + myInfo.GetHeight()), style);
        myInfo.Draw(collectiveRect, style);
        GUI.EndGroup();

        style.alignment = TextAnchor.MiddleCenter;
        style.richText  = true;
        string titelText = colorBegin + myInfo.title + colorEnd;

        GUI.Box(nodeRect, titelText, style);
        style.alignment = TextAnchor.UpperLeft;
    }
コード例 #22
0
 public void Draw()
 {
     if (skilltree == null)
     {
         return;
     }
     inPoint.Draw();
     outPoint.Draw();
     GUI.Box(rect, title, style);
     spell = (Spell)EditorGUI.ObjectField(new Rect(rect.x + rect.width / 10, rect.y + rect.height / 10, 100, 20), spell, typeof(Spell), allowSceneObjects: true);
     if (spell != null && skilltree.allSpells.Contains(spell))
     {
         EditorGUI.ObjectField(new Rect(rect.x + rect.width / 10, rect.y + rect.height / 10 + 30, 50, 50), spell.SpellSprite, typeof(Sprite), allowSceneObjects: true);
         skilltree.AddEditorSpell(spell.SpellId, rect.position);
     }
     else
     {
         EditorGUI.HelpBox(new Rect(rect.x + rect.width / 10, rect.y + rect.height / 10 + 30, 150, 50), "Spell not in skilltree", MessageType.Error);
     }
 }
コード例 #23
0
ファイル: StoryNode.cs プロジェクト: Regoradin/murdermystery
    public void Draw()
    {
        rect.height = 170 +
                      (50 * (story.animSnippets.Count + story.audioSnippets.Count)) +
                      (30 * story.interactions.Count);
        GUI.Box(rect, title, style);
        DrawContents();

        inPoint.Draw();
        if (outPoints != null)
        {
            foreach (ConnectionPoint point in outPoints)
            {
                point.Draw();
            }
        }

        if (GUI.changed)
        {
            EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
        }
    }
コード例 #24
0
    public virtual void Draw()
    {
        inPoint.Draw();
        outPoint.Draw();

        GUI.BeginGroup(new Rect(nodeRect.position.x + 5f, nodeRect.position.y + nodeRect.size.y / 2f, nodeRect.size.x - 10f, nodeRect.size.y + myInfo.GetHeight()), style);
        //GUILayout.BeginArea ( collectiveRect );

        myInfo.Draw(collectiveRect, style);

        //GUI.Box ( new Rect ( 0, 0, collectiveRect.size.x - 10f, myInfo.height ), "I am box!", style );
        //GUI.Button ( new Rect ( 0, myInfo.height, 100f, myInfo.height ), "I am button!", style );

        //GUILayout.Button ( "", style );
        //myInfo.Draw ( nodeRect, style );

        //GUILayout.EndArea ();
        GUI.EndGroup();

        GUI.Box(nodeRect, "", style);
        EditorGUI.LabelField(nodeRect, myInfo.title, style);
    }
コード例 #25
0
    public void Draw()
    {
        inPoint.Draw();
        foreach (GUIDialogueReply reply in replies)
        {
            reply.outPoint.Draw();
        }
        GUI.Box(rect, "", style);

        if (EditorGUI.Toggle(initialLineToggleRect, "Is first line", isInitialLine) != isInitialLine)
        {
            editor.SetInitialLine(lineID);
        }
        EditorGUI.LabelField(nameLabelRect, "Name:");
        if (GUI.Button(nameRect, speakerUID))
        {
            GenericMenu toolsMenu = new GenericMenu();
            foreach (string uid in editor.allSpeakersUIDs)
            {
                toolsMenu.AddItem(new GUIContent(uid), false, () => speakerUID = uid);
            }
            toolsMenu.DropDown(new Rect(nameRect.x, nameRect.y, 0, 0));
        }

        EditorGUI.LabelField(textLabelRect, "Text:");
        text = EditorGUI.TextArea(textRect, text);

        foreach (GUIDialogueReply reply in replies)
        {
            reply.text = EditorGUI.TextArea(reply.rect, reply.text);
            if (GUI.Button(reply.removeButtonRect, "X") && replies.Count > 1)
            {
                repliesToRemove.Add(reply);
            }
        }
        CleanReplies();
    }
コード例 #26
0
ファイル: Node.cs プロジェクト: fabYkun/Schnitzel
    public void Draw()
    {
        inPoint.Draw();
        if (dialogBox != null && outPoints != null && dialogBox.next != null)
        {
            while (outPoints.Count > dialogBox.next.Length)
            {
                outPoints.RemoveAt(outPoints.Count - 1);
            }
            while (outPoints.Count < dialogBox.next.Length)
            {
                outPoints.Add(new ConnectionPoint(this, ConnectionPointType.Out, _outPointStyle, _OnClickOutPoint));
            }
            rect.height = initialHeight + outPoints.Count * 20;
            foreach (ConnectionPoint connection in outPoints)
            {
                connection.Draw();
            }
        }
        GUI.Box(rect, title, isEntryPoint ? entryStyle : style);
        string label = !string.IsNullOrEmpty(dialogBox.content) ? dialogBox.content.Substring(0, Math.Min(20, dialogBox.content.Length)) : dialogBox.id;

        GUI.Label(rect, label, EditorStyles.centeredGreyMiniLabel);
    }
コード例 #27
0
    public void Draw()
    {
        in_point.Draw();
        out_point.Draw();
        //GUI.Box(rect, title, style);
        GUILayout.BeginArea(rect, style);
        GUILayout.Box("Attack Object");

        //NAME
        GUILayout.BeginHorizontal();
        GUILayout.Label("Name:");
        string new_name = EditorGUILayout.TextField(attack_object.name);

        AssetDatabase.RenameAsset("Assets/Attack Objects/" + attack_object.name + ".asset", new_name);
        attack_object.name = new_name;
        GUILayout.EndHorizontal();

        //BUTTON
        GUILayout.BeginHorizontal();
        GUILayout.Label("Button:");
        attack_object.button = EditorGUILayout.TextField(attack_object.button);
        GUILayout.EndHorizontal();

        //SPRITE
        GUILayout.BeginHorizontal();
        GUILayout.Label("Sprite:");
        attack_object.attack_animation = (Sprite)EditorGUILayout.ObjectField(attack_object.attack_animation, typeof(Sprite), allowSceneObjects: true);
        GUILayout.EndHorizontal();

        //COMBO DROP TIMER
        GUILayout.BeginHorizontal();
        GUILayout.Label("Combo Drop Timer:");
        attack_object.combo_drop_timer = EditorGUILayout.FloatField(attack_object.combo_drop_timer);
        GUILayout.EndHorizontal();

        //INPUT DELAY
        GUILayout.BeginHorizontal();
        GUILayout.Label("Input Delay Timer:");
        attack_object.input_delay = EditorGUILayout.FloatField(attack_object.input_delay);
        GUILayout.EndHorizontal();

        //SPAWN HITBOX TIMER
        GUILayout.BeginHorizontal();
        GUILayout.Label("Hitbox Spawn Timer:");
        attack_object.spawn_hitbox_timer = EditorGUILayout.FloatField(attack_object.spawn_hitbox_timer);
        GUILayout.EndHorizontal();

        //DAMAGE
        GUILayout.BeginHorizontal();
        GUILayout.Label("Damage:");
        attack_object.damage = EditorGUILayout.IntField(attack_object.damage);
        GUILayout.EndHorizontal();

        //COLLIDER TYPE
        GUILayout.BeginHorizontal();
        int selected = 0;

        if (attack_object.collider_type == AttackObject.ColliderType.Circle)
        {
            selected = 0;
        }
        else if (attack_object.collider_type == AttackObject.ColliderType.Box)
        {
            selected = 1;
        }

        string[] collider_options = new string[]
        {
            "Circle", "Box"
        };
        GUILayout.Label("Collider Type:");
        selected = EditorGUILayout.Popup(selected, collider_options);

        if (selected == 0)
        {
            attack_object.collider_type = AttackObject.ColliderType.Circle;
        }
        else if (selected == 1)
        {
            attack_object.collider_type = AttackObject.ColliderType.Box;
        }
        GUILayout.EndHorizontal();

        //CENTER DISTANCE
        GUILayout.Label("Center Distance:");
        GUILayout.BeginHorizontal();
        Vector2 new_dist = new Vector2();

        GUILayout.Label("X");
        new_dist.x = EditorGUILayout.FloatField(attack_object.center_distance.x);
        GUILayout.Label("Y");
        new_dist.y = EditorGUILayout.FloatField(attack_object.center_distance.y);

        attack_object.center_distance = new_dist;
        GUILayout.EndHorizontal();


        if (attack_object.collider_type == AttackObject.ColliderType.Box)
        {
            //BOX SIZE
            GUILayout.Label("Box Size:");
            GUILayout.BeginHorizontal();
            Vector2 new_size = new Vector2();

            GUILayout.Label("X");
            new_dist.x = EditorGUILayout.FloatField(attack_object.size.x);
            GUILayout.Label("Y");
            new_dist.y = EditorGUILayout.FloatField(attack_object.size.y);

            attack_object.size = new_size;
            GUILayout.EndHorizontal();

            //BOX ANGLE
            GUILayout.BeginHorizontal();
            GUILayout.Label("Box Angle:");
            attack_object.angle = EditorGUILayout.FloatField(attack_object.angle);
            GUILayout.EndHorizontal();
        }
        else if (attack_object.collider_type == AttackObject.ColliderType.Circle)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Circle Radius:");
            attack_object.radius = EditorGUILayout.FloatField(attack_object.radius);
            GUILayout.EndHorizontal();
        }


        GUILayout.EndArea();
    }
コード例 #28
0
 public void DrawConnections()
 {
     inPoint.Draw();
     outPoint.Draw();
 }
コード例 #29
0
    public override void Draw()
    {
        inPoint.Draw();

        List <string> scripsList  = new List <string>();
        List <string> methodsList = new List <string>();

        scripsList.Add("");
        methodsList.Add("");

        if (_isOpen)
        {
            Rect extra = new Rect(rect);
            extra.x     += _offset;
            extra.y     += rect.height - _offset;
            extra.width -= 2 * _offset;
            extra.height = 80f;
            GUILayout.BeginArea(extra);
            {
                EditorGUI.DrawRect(new Rect(0, 0, extra.width, extra.height), new Color(0, 0, 0, .5f));

                EditorGUILayout.BeginVertical();
                {
                    GUILayout.Space(5);
                    EditorGUIUtility.labelWidth = 40;
                    title = EditorGUILayout.TextField(new GUIContent("Title", "Node title."), title);

                    _goSource = (GameObject)EditorGUILayout.ObjectField(_goSource, typeof(GameObject), true);

                    if (_goSource != null)
                    {
                        goName = _goSource.name;
                        List <object> targets = _goSource.GetComponents <Component>().ToList <object>();

                        foreach (var components in targets)
                        {
                            if (components.GetType().Name != "Transform")
                            {
                                if (!unityDictionary.ContainsKey(components.GetType().Name))
                                {
                                    unityDictionary.Add(components.GetType().Name, components);
                                }

                                scripsList.Add(components.GetType().Name);
                            }
                        }
                    }

                    string[] options = scripsList.ToArray();

                    EditorGUI.BeginDisabledGroup(_goSource == null);
                    {
                        EditorGUIUtility.labelWidth = 50;
                        _scriptIndex = EditorGUILayout.Popup("Script", _scriptIndex, options, EditorStyles.popup);

                        if (_scriptIndex != 0)
                        {
                            scriptName  = scripsList[_scriptIndex];
                            methodInfos = GetMethod(unityDictionary[scripsList[_scriptIndex]]);

                            foreach (var methodsComp in GetMethod(unityDictionary[scripsList[_scriptIndex]]))
                            {
                                methodsList.Add(methodsComp.Name);
                            }
                        }

                        string[] optionsMethod = methodsList.ToArray();

                        EditorGUI.BeginDisabledGroup(_scriptIndex == 0);
                        {
                            _methodIndex = EditorGUILayout.Popup("Method", _methodIndex, optionsMethod, EditorStyles.popup);

                            if (_methodIndex != 0)
                            {
                                methodName = methodInfos[_methodIndex - 1].Name;
                                try
                                {
                                    action = (Action)Delegate.CreateDelegate(typeof(Action), GameObject.Find(goName).GetComponent(scriptName) as MonoBehaviour, methodName);
                                }
                                catch (Exception)
                                {
                                    EditorGUILayout.HelpBox(methodName + " is not a Method", MessageType.Error);
                                    _methodIndex = 0;
                                }
                            }
                        }
                        EditorGUI.EndDisabledGroup();
                    }
                    EditorGUI.EndDisabledGroup();
                }
                EditorGUILayout.EndVertical();
            }
            GUILayout.EndArea();
        }

        base.Draw();

        Rect btn = new Rect(rect);

        btn.x     += 8f;
        btn.y     += rect.height - 16f;
        btn.width -= 16f;
        btn.height = 8f;

        if (GUI.Button(btn, (_isOpen) ? _openIcon : _closedIcon))
        {
            _isOpen = !_isOpen;
        }
    }
コード例 #30
0
ファイル: Node.cs プロジェクト: JoshMosk/BreadCrumbsOld
    public void Draw()
    {
        if (inPoint != null)
        {
            inPoint.Draw();
        }
        if (outPoint != null)
        {
            outPoint.Draw();
        }
        if (type == "Boolean")
        {
            outPoint2.Draw();
        }
        if (type == "Multiple Choice")
        {
            outPoint2.Draw();
            outPoint3.Draw();
            outPoint4.Draw();
        }

        string tooltipString = "";

        if (type == "Conversation")
        {
            tooltipString = "Begins a new thread of dialogue nodes";
        }
        else if (type == "Dialogue")
        {
            tooltipString = "Defines a speach bubble in a conversation";
        }
        else if (type == "Random")
        {
            tooltipString = "Picks a random node";
        }
        else if (type == "Boolean")
        {
            tooltipString = "Returns true or false based on a blackboard value";
        }
        else if (type == "End Conversation")
        {
            tooltipString = "Concludes the preceding conversation";
        }
        else if (type == "Set Variable")
        {
            tooltipString = "Changes a variable on the specified blackboard";
        }
        else if (type == "Multiple Choice")
        {
            tooltipString = "Allows different options for the player to choose from";
        }

        GUIContent content = new GUIContent("", tooltipString);

        GUI.Box(rect, content, style);

        float insets = 20f;

        GUILayout.BeginArea(new Rect(rect.x + insets, rect.y + insets, rect.width - (insets * 2), rect.height - (insets * 2)));

        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(rect.width - (insets * 2)), GUILayout.Height(rect.height - (insets * 2)));

        GUIStyle titleStyle = new GUIStyle();

        titleStyle.fontSize         = 10;
        titleStyle.fontStyle        = FontStyle.Bold;
        titleStyle.normal.textColor = Color.white;

        GUIStyle bodyStyle = new GUIStyle();

        bodyStyle.fontSize         = 10;
        bodyStyle.fontStyle        = FontStyle.Normal;
        bodyStyle.normal.textColor = Color.white;

        GUILayout.Label(" " + type, titleStyle);
        GUILayout.Space(5);

        if (type == "Conversation")
        {
            GUILayout.Space(5);
            GUILayout.Label(" Unique ID", bodyStyle);
            uniqueIDString = GUILayout.TextField(uniqueIDString, 10);
            if (GUILayout.Button("Generate"))
            {
                uniqueIDString = "";
                string glyphs = "abcdefghijklmnopqrstuvwxyz0123456789";
                for (int i = 0; i < 10; i++)
                {
                    uniqueIDString += glyphs[Random.Range(0, glyphs.Length)];
                }
            }
        }
        else if (type == "Dialogue")
        {
            GUILayout.Space(5);
            GUILayout.Label(" Speaker", bodyStyle);
            titleString = GUILayout.TextField(titleString, 25);

            GUILayout.Space(5);
            GUILayout.Label(" Speech", bodyStyle);
            bodyString = GUILayout.TextArea(bodyString, GUILayout.ExpandHeight(true));
            GUILayout.Space(5);
        }
        else if (type == "Multiple Choice")
        {
            GUILayout.Space(5);
            GUILayout.Label(" Speaker", bodyStyle);
            titleString = GUILayout.TextField(titleString, 25);

            GUILayout.Space(5);
            GUILayout.Label(" Speech", bodyStyle);
            bodyString = GUILayout.TextArea(bodyString, GUILayout.ExpandHeight(true));
            GUILayout.Space(5);

            GUILayout.Space(5);
            GUILayout.Label(" Option 1", bodyStyle);
            option1String = GUILayout.TextArea(option1String, GUILayout.ExpandHeight(false));
            GUILayout.Space(5);

            GUILayout.Space(5);
            GUILayout.Label(" Option 2", bodyStyle);
            option2String = GUILayout.TextArea(option2String, GUILayout.ExpandHeight(false));
            GUILayout.Space(5);

            GUILayout.Space(5);
            GUILayout.Label(" Option 3", bodyStyle);
            option3String = GUILayout.TextArea(option3String, GUILayout.ExpandHeight(false));
            GUILayout.Space(5);

            GUILayout.Space(5);
            GUILayout.Label(" Option 4", bodyStyle);
            option4String = GUILayout.TextArea(option4String, GUILayout.ExpandHeight(false));
            GUILayout.Space(5);
        }
        else if (type == "Random")
        {
        }
        else if (type == "End Conversation")
        {
        }
        else if (type == "Comment")
        {
            bodyString = GUILayout.TextArea(bodyString, GUILayout.ExpandHeight(true));
            GUILayout.Space(5);
        }
        else if (type == "Boolean")
        {
            GUILayout.Space(5);
            GUILayout.Label(" Blackboard", bodyStyle);
            blackboardString = GUILayout.TextField(blackboardString, 25);

            GUILayout.Space(5);
            GUILayout.Label(" Variable", bodyStyle);
            variableString = GUILayout.TextField(variableString, 25);
        }
        else if (type == "Set Variable")
        {
            GUILayout.Space(5);
            GUILayout.Label(" Blackboard", bodyStyle);
            blackboardString = GUILayout.TextField(blackboardString, 25);

            GUILayout.Space(5);
            GUILayout.Label(" Variable", bodyStyle);
            variableString = GUILayout.TextField(variableString, 25);

            GUILayout.Space(5);
            GUILayout.Label(" Value", bodyStyle);
            valueBool = GUILayout.Toggle(valueBool, new GUIContent());
        }

        GUILayout.EndScrollView();
        GUILayout.EndArea();

        // GUILayout.Box("This is an sized label");
    }