예제 #1
0
        /// <summary>
        /// Goes to the next message and returns its ID and type. Base if there is no next message, but otherwise Message or Choice.
        /// </summary>
        /// <param name="choice">The choice, if the current message is a choice. By default -1, meaning the current node is a message node.</param>
        /// <returns></returns>
        public QD_MessageInfo NextMessage(int choice = -1)
        {
            if (currentMessageInfo.NextID < 0 && choice == -1)
            {
                currentMessageInfo = new QD_MessageInfo(-1, -1, QD_NodeType.Base);
                return(currentMessageInfo);
            }

            QD_NodeType type   = GetMessageType(currentMessageInfo.NextID);
            int         id     = -1;
            int         nextID = -1;

            if (currentMessageInfo.Type == QD_NodeType.Message)
            {
                id = currentMessageInfo.NextID;

                if (type == QD_NodeType.Message && id >= 0)
                {
                    QD_Message m = dialogue.GetMessage(id);
                    nextID = m.NextMessage;
                }
            }
            else if (currentMessageInfo.Type == QD_NodeType.Choice && choice >= 0)
            {
                QD_Choice c = dialogue.GetChoice(currentMessageInfo.ID);
                currentMessageInfo.NextID = c.NextMessages[choice];
                id   = currentMessageInfo.NextID;
                type = QD_NodeType.Message;
                QD_Message m = dialogue.GetMessage(id);
                nextID = m.NextMessage;
            }

            currentMessageInfo = new QD_MessageInfo(id, nextID, type);
            return(currentMessageInfo);
        }
예제 #2
0
 /// <summary>
 /// Sets the current conversation based on the name of it.
 /// </summary>
 /// <param name="name">The name of the conversation.</param>
 public void SetConversation(string name)
 {
     currentConversationIndex = dialogue.GetConversationIndex(name);
     if (currentConversationIndex < 0 || currentConversationIndex >= dialogue.Conversations.Count)
     {
         return;
     }
     currentConversation = dialogue.Conversations[currentConversationIndex];
     currentMessageInfo  = new QD_MessageInfo(currentConversation.FirstMessage, GetNextID(currentConversation.FirstMessage), QD_NodeType.Message);
 }