Ejemplo n.º 1
0
 private void OnEnable()
 {
     GUIDialogueNode.initStylesAndSizes();
     ConnectionPoint.initStyles();
     InitEditor();
     ReadLevels();
 }
 public GUIDialogueReply(DialogueReply data, GUIDialogueNode parent, int replyID, int verticalPos = -1)
 {
     replyData    = data;
     this.replyID = replyID;
     this.parent  = parent;
     outPoint     = new ConnectionPoint(parent, ConnectionPointType.Out, this, verticalPos);
     if (verticalPos != -1)
     {
         UpdateVerticalPos(verticalPos);
     }
 }
Ejemplo n.º 3
0
    public void RemoveNode(GUIDialogueNode node)
    {
        List <Connection> connectionsToRemove = new List <Connection>();

        // TODO optimize removing connections
        foreach (Connection connection in connections)
        {
            if (node.ConnectedTo(connection))
            {
                connectionsToRemove.Add(connection);
            }
        }
        foreach (Connection connection in connectionsToRemove)
        {
            connections.Remove(connection);
        }
        connectionsToRemove = null;
        lines.Remove(node);
    }
Ejemplo n.º 4
0
 // TODO splint into two classses
 public ConnectionPoint(
     GUIDialogueNode parent,
     ConnectionPointType type,
     GUIDialogueReply replyParent = null,
     int verticalPos = 0
     )
 {
     this.parent      = parent;
     this.replyParent = replyParent;
     this.type        = type;
     connections      = new HashSet <Connection>();
     if (type == ConnectionPointType.In)
     {
         style = inPointStyle;
     }
     else
     {
         style = outPointStyle;
     }
     rect             = new Rect(0, 0, 10f, 20f);
     this.verticalPos = verticalPos;
 }
Ejemplo n.º 5
0
    void LoadDialogue(string UID)
    {
        if (!levelChoosen())
        {
            return;
        }
        ClearEditor();
        this.speakerUID = UID;
        string      path = "Assets/DialoguesData/" + levelUID + "/" + UID + ".xml";
        XmlDocument doc  = new XmlDocument();

        doc.Load(path);
        XmlNode root = doc.DocumentElement.SelectSingleNode("/conversation");

        speakerName = root.SelectSingleNode("fullName").InnerText;

        XmlSerializer nodeSerializer = new XmlSerializer(typeof(DialogueNode));
        XmlNode       xmlLines       = root.SelectSingleNode("lines");

        foreach (XmlNode lineXmlData in xmlLines.ChildNodes)
        {
            DialogueNode    lineData = nodeSerializer.Deserialize(new XmlNodeReader(lineXmlData)) as DialogueNode;
            GUIDialogueNode node     = new GUIDialogueNode(this, lineData);
            lines.Add(node);
        }
        foreach (GUIDialogueNode node in lines)
        {
            foreach (GUIDialogueReply reply in node.replies)
            {
                int lineID = reply.nextLineID;
                if (lineID != -1)
                {
                    CreateConnection(lines[lineID].inPoint, reply.outPoint);
                }
            }
        }
    }