Ejemplo n.º 1
0
        public void AddTalkingPoint(float x, float y, float w, float h)
        {
            TalkingPoint tp = new TalkingPoint(x, y, h, w);

            tp.SetID(GetNewID());
            talkingPoints.Add(tp);
        }
Ejemplo n.º 2
0
        void DrawLinks()
        {
            if (currentDialogue == null || currentDialogue.talkingPoints == null)
            {
                return;
            }
            Vector3 end = Vector3.zero;

            for (int a = 0; a < currentDialogue.talkingPoints.Count; a++)
            {
                TalkingPoint tp = currentDialogue.talkingPoints[a];
                if (tp.responses == null)
                {
                    return;
                }
                for (int b = 0; b < tp.responses.Count; b++)
                {
                    Vector3      start = new Vector3(tp.x + tp.w, tp.y + 185 + 40 * b);
                    TalkingPoint link  = currentDialogue.FindViaID(tp.responses[b].responseID);
                    if (link != null)
                    {
                        end = new Vector3(link.x + link.w / 2, link.y + link.h / 2);
                        Handles.DrawLine(start, end);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 void ChangePortrait(object p)
 {
     if (tempTP != null)
     {
         tempTP.currentPortrait = (int)p;
         tempTP = null;
     }
 }
Ejemplo n.º 4
0
 void ChangeStartingPoint(TalkingPoint tp)
 {
     foreach (TalkingPoint t in currentDialogue.talkingPoints)
     {
         if (t != tp)
         {
             t.startingPoint = false;
         }
     }
 }
Ejemplo n.º 5
0
        void AssignProfile(object p)
        {
            NPCProfile a = (NPCProfile)p;

            if (tempTP != null)
            {
                tempTP.npc = a;
                tempTP     = null;
            }
        }
Ejemplo n.º 6
0
 int CheckForWindowClick(Vector2 pos)
 {
     if (currentDialogue != null && currentDialogue.talkingPoints.Count > 0)
     {
         for (int i = 0; i < currentDialogue.talkingPoints.Count; i++)
         {
             TalkingPoint tp   = currentDialogue.talkingPoints[i];
             Rect         rect = new Rect(tp.x, tp.y, tp.w, tp.h);
             if (rect.Contains(pos))
             {
                 clickedOnWindow = true;
                 return(i);
             }
         }
     }
     return(-1);
 }
Ejemplo n.º 7
0
        void Nodes()
        {
            GUILayout.BeginArea(DialogueBoxes);
            if (currentDialogue != null && currentDialogue.talkingPoints.Count > 0)
            {
                BeginWindows();
                for (int i = 0; i < currentDialogue.talkingPoints.Count; i++)
                {
                    TalkingPoint tp = currentDialogue.talkingPoints[i];

                    Rect rect = new Rect(tp.x, tp.y, tp.w, tp.h);

                    rect = GUI.Window(i, rect, DisplayTalkingPoint, "");
                    tp.x = rect.x;
                    tp.y = rect.y;
                }
                EndWindows();
            }
            GUILayout.EndArea();
        }
Ejemplo n.º 8
0
        void DisplayTalkingPoint(int id)
        {
            if (id >= currentDialogue.talkingPoints.Count)
            {
                return;
            }
            TalkingPoint tp = currentDialogue.talkingPoints[id];

            GUILayout.BeginHorizontal();

            //NPC name
            GUILayout.Label(tp.npc == null ? "Select Profile" : tp.npc.characterName /*+ "(" + tp.m_ID.ToString() + ")"*/, EditorStyles.boldLabel);

            //Starting point toggle
            bool sp = tp.startingPoint;

            tp.startingPoint = GUILayout.Toggle(sp, "Starting Point");
            if (sp != tp.startingPoint)
            {
                ChangeStartingPoint(tp);
            }

            //Profile Change Dropdown
            if (GUILayout.Button("V", GUILayout.Width(25)))
            {
                GenericMenu profiles = new GenericMenu();
                if (availableProfiles == null)
                {
                    RefreshProfiles();
                }
                foreach (NPCProfile p in availableProfiles)
                {
                    profiles.AddItem(new GUIContent(p.name.ToString()), false, AssignProfile, p);
                }
                tempTP = tp;
                profiles.ShowAsContext();
            }

            GUILayout.EndHorizontal();

            //GUILayout.Space(7);
            GUILayout.BeginHorizontal();

            //Portrais and text
            if (tp.npc != null && tp.npc.portraits != null && tp.npc.portraits[tp.currentPortrait].image != null)
            {
                GUILayout.Label(tp.npc.portraits[tp.currentPortrait].image.texture, GUILayout.Width(64), GUILayout.Height(64));
                tp.text = GUILayout.TextArea(tp.text, GUILayout.Width(250 - 64 - 14), GUILayout.Height(64));
            }
            else
            {
                GUILayout.Label("NPC Profiles are broken again...");
            }
            GUILayout.EndHorizontal();

            //Portrait Changer
            if (tp.npc != null)
            {
                if (GUILayout.Button("V", GUILayout.Width(25)))
                {
                    GenericMenu portraits = new GenericMenu();
                    for (int i = 0; i < tp.npc.portraits.Count; i++)
                    {
                        if (tp.currentPortrait == i)
                        {
                            portraits.AddDisabledItem(new GUIContent(i.ToString() + ". " + tp.npc.portraits[i].mood.ToString()));
                        }
                        else
                        {
                            portraits.AddItem(new GUIContent(i.ToString() + ". " + tp.npc.portraits[i].mood.ToString()), false, ChangePortrait, i);
                        }
                    }
                    tempTP = tp;
                    portraits.ShowAsContext();
                }
            }
            //Events

            /*
             * GUILayout.BeginHorizontal();
             * GUILayout.Button("+", GUILayout.Width(25));
             * GUILayout.Label("Event");
             * GUILayout.FlexibleSpace();
             * GUILayout.Button("-", GUILayout.Width(25));
             * GUILayout.EndHorizontal();
             */
            //Responses
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("+", GUILayout.Width(25)))
            {
                if (tp.responses == null)
                {
                    tp.responses = new List <TalkingResponse>();
                }
                tp.responses.Add(new TalkingResponse());
                tp.h += heightChangePerResponse;
            }
            GUILayout.BeginVertical();
            if (tp.responses != null)
            {
                foreach (var link in tp.responses)
                {
                    GUILayout.BeginHorizontal();
                    //text
                    link.text = GUILayout.TextField(link.text, GUILayout.Width(250 - 64 - 14));
                    GUILayout.FlexibleSpace();
                    GUILayout.BeginVertical();
                    if (GUILayout.Button("-", GUILayout.Width(25)))
                    {
                        tp.responses.Remove(link);
                        tp.h -= heightChangePerResponse;
                        break;
                    }
                    if (GUILayout.Button("L", GUILayout.Width(25)))
                    {
                        linkingTalkingPoints     = true;
                        currentlyLinkingResponse = link;
                    }
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                    //GUILayout.Label(link.responseID.ToString());
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUI.DragWindow();
        }