예제 #1
0
 private void Start()
 {
     dS = new DialogueTree();
     dS.Add(new Message("Lamp oil? Rope? Bombs?", "Cherry", "",
                        Message.DialogueSprite.Cherry, Message.DialogueSprite.NegativeCherry));
     dS.Add(new Message("You want it?", "Cherry", "", Message.DialogueSprite.Cherry,
                        Message.DialogueSprite.Cherry));
     dS.Add(new Message("It's yours my friend, as long as you have enough rupees.", "Cherry", "",
                        Message.DialogueSprite.Cherry,
                        Message.DialogueSprite.Cherry));
 }
예제 #2
0
 private void Start()
 {
     dS = new DialogueTree();
     dS.Add(new Message("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor",
                        "Cherry", "",
                        Message.DialogueSprite.Cherry, Message.DialogueSprite.NegativeCherry));
     dS.Add(new Message(
                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation", "",
                "Negative Cherry",
                Message.DialogueSprite.Cherry, Message.DialogueSprite.NegativeCherryMad, false));
     dS.Add(new Message("ullamco laboris nisi ut aliquip ex ea commodo consequat.", "Cherry", "",
                        Message.DialogueSprite.CherryMad, Message.DialogueSprite.NegativeCherry));
     dS.Add(new Message("Duis aute irure dolor in reprehenderit in voluptate velit esse cillum", "",
                        "Negative Cherry",
                        Message.DialogueSprite.Cherry, Message.DialogueSprite.NegativeCherry, false));
     dS.Add(new Message("dolore eu fugiat nulla pariatur.", "Cherry", "",
                        Message.DialogueSprite.CherryMad, Message.DialogueSprite.NegativeCherry));
     dS.Add(new Message(
                "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                "", "Negative Cherry",
                Message.DialogueSprite.Cherry, Message.DialogueSprite.NegativeCherryMad, false));
 }
예제 #3
0
    void DrawNodeForm(float startX, float startY, int boxNum, DialogueNode givenNode, DialogueNode[] followNodes)
    {
        //strings to save text boxed to
        string dialogue  = "";
        string response1 = "";
        string response2 = "";
        string response3 = "";

        //convenience
        DialogueNode givenR1 = followNodes[0];
        DialogueNode givenR2 = followNodes[1];
        DialogueNode givenR3 = followNodes[2];


        if (givenNode.GetDialogue() != null)
        {
            dialogue = givenNode.GetDialogue();
        }

        //set position of node graphic
        r.x = startX;
        r.y = startY;

        GUI.color = Color.cyan;
        dialogue  = GUI.TextArea(r, dialogue);
        givenNode.SetDialogue(dialogue);

        //set position of follow node graphics
        r1.x = startX;
        r1.y = startY + 50 + 16 - 10;

        r2.x = startX;
        r2.y = startY + 100 + 32 - 20;

        r3.x = startX;
        r3.y = startY + 150 + 48 - 30;

        ra.x = startX + 50;
        ra.y = startY - 16;

        ra1.x = r1.x + 50;
        ra1.y = r1.y - 16;

        ra2.x = r2.x + 50;
        ra2.y = r2.y - 16;

        ra3.x = r3.x + 50;
        ra3.y = r3.y - 16;

        rab.x = startX;
        rab.y = startY - 16;

        rab1.x = r1.x;
        rab1.y = r1.y - 16;

        rab2.x = r2.x;
        rab2.y = r2.y - 16;

        rab3.x = r3.x;
        rab3.y = r3.y - 16;

        //DIALOGUE AUDIO
        EditorGUI.BeginChangeCheck();

        if (audioObjects[boxNum][0] == null)
        {
            audioObjects[boxNum][0] = EditorGUI.ObjectField(ra, givenNode.GetAudioDialogue(), typeof(UnityEngine.Object), true);
        }
        else
        {
            audioObjects[boxNum][0] = EditorGUI.ObjectField(ra, audioObjects[boxNum][0], typeof(UnityEngine.Object), true);
        }

        if (EditorGUI.EndChangeCheck())
        {
            givenNode.SetAudioDialogue(((AudioClip)audioObjects[boxNum][0]).name);
        }

        if (GUI.Button(rab, "Play") && audioObjects[boxNum][0] != null)
        {
            PlayAudioClip((AudioClip)audioObjects[boxNum][0]);
        }


        //set responses to saved response (null checks might not be necessary anymore)
        if (givenR1 != null && givenR1.GetResponse() != null)
        {
            response1 = givenR1.GetResponse();
        }

        if (givenR2 != null && givenR2.GetResponse() != null)
        {
            response2 = givenR2.GetResponse();
        }

        if (givenR3 != null && givenR3.GetResponse() != null)
        {
            response3 = givenR3.GetResponse();
        }

        //get user updates to responses
        GUI.color = Color.grey;
        response1 = GUI.TextArea(r1, response1);
        response2 = GUI.TextArea(r2, response2);
        response3 = GUI.TextArea(r3, response3);

        //RESPONSE 1 AUDIO OBJ
        EditorGUI.BeginChangeCheck();
        //Debug.Log(givenR1.GetAudioResponse());
        if (audioObjects[boxNum][1] == null && givenR1 != null)
        {
            audioObjects[boxNum][1] = EditorGUI.ObjectField(ra1, givenR1.GetAudioResponse(), typeof(UnityEngine.Object), true);
        }
        else
        {
            audioObjects[boxNum][1] = EditorGUI.ObjectField(ra1, audioObjects[boxNum][1], typeof(UnityEngine.Object), true);
        }

        if (EditorGUI.EndChangeCheck())
        {
            givenR1.SetAudioResponse(((AudioClip)audioObjects[boxNum][1]).name);
        }

        if (GUI.Button(rab1, "Play") && audioObjects[boxNum][1] != null)
        {
            PlayAudioClip((AudioClip)audioObjects[boxNum][1]);
        }

        //RESPONSE 2 AUDIO OBJ
        EditorGUI.BeginChangeCheck();
        if (audioObjects[boxNum][2] == null && givenR2 != null)
        {
            audioObjects[boxNum][2] = EditorGUI.ObjectField(ra2, givenR2.GetAudioResponse(), typeof(UnityEngine.Object), true);
        }
        else
        {
            audioObjects[boxNum][2] = EditorGUI.ObjectField(ra2, audioObjects[boxNum][2], typeof(UnityEngine.Object), true);
        }

        if (EditorGUI.EndChangeCheck())
        {
            givenR2.SetAudioResponse(((AudioClip)audioObjects[boxNum][2]).name);
        }

        if (GUI.Button(rab2, "Play") && audioObjects[boxNum][2] != null)
        {
            PlayAudioClip((AudioClip)audioObjects[boxNum][2]);
        }

        //RESPONSE 3 AUDIO OBJ
        EditorGUI.BeginChangeCheck();
        if (audioObjects[boxNum][3] == null && givenR3 != null)
        {
            audioObjects[boxNum][3] = EditorGUI.ObjectField(ra3, givenR3.GetAudioResponse(), typeof(UnityEngine.Object), true);
        }
        else
        {
            audioObjects[boxNum][3] = EditorGUI.ObjectField(ra3, audioObjects[boxNum][3], typeof(UnityEngine.Object), true);
        }

        if (EditorGUI.EndChangeCheck())
        {
            givenR3.SetAudioResponse(((AudioClip)audioObjects[boxNum][3]).name);
        }

        if (GUI.Button(rab3, "Play") && audioObjects[boxNum][3] != null)
        {
            PlayAudioClip((AudioClip)audioObjects[boxNum][3]);
        }


        //set response to user updated values (null checks may not be necessary anymore)
        if (givenR1 != null)
        {
            givenR1.SetResponse(response1);
        }

        if (givenR2 != null)
        {
            givenR2.SetResponse(response2);
        }

        if (givenR3 != null)
        {
            givenR3.SetResponse(response3);
        }

        //if dialogue exists, check if we need to add follow nodes to tree
        if (givenNode.GetDialogue() != null && givenNode.GetDialogue() != "")
        {
            if (givenR1 == null)
            {
                tree.Add(response1, null, givenNode, 0);
            }

            if (givenR2 == null)
            {
                tree.Add(response2, null, givenNode, 1);
            }

            if (givenR3 == null)
            {
                tree.Add(response3, null, givenNode, 2);
            }
        }

        //draw connecting lines
        if (givenR1 != null && response1 != "")
        {
            DrawLine(0);
        }

        if (givenR2 != null && response2 != "")
        {
            DrawLine(1);
        }

        if (givenR3 != null && response3 != "")
        {
            DrawLine(2);
        }
    }