Ejemplo n.º 1
0
        private EditorPersuadeItemData GetEditorItemDataByBaseNode(BaseNode node)
        {
            EditorPersuadeItemData itemData = new EditorPersuadeItemData();

            itemData.itemId     = node.Id;
            itemData.m_Position = new EditorVector2(node.Position);
            for (int i = 0; i < node.Lets.Count; i++)
            {
                if (node.Lets[i].Type == LetTypes.OUTLET)
                {
                    for (int j = 0; j < node.Lets[i].Connections.Count; j++)
                    {
                        Connection           con          = node.Lets[i].Connections[j];
                        EditorConnectionData connectPoint = new EditorConnectionData();
                        connectPoint.m_connectPoint = new EditorVector2[con.Points.Length];
                        for (int k = 0; k < con.Points.Length; k++)
                        {
                            connectPoint.m_connectPoint[k] = new EditorVector2(con.Points[k]);
                        }
                        connectPoint.m_nextItemID = con.Inlet.Owner.Id;
                        itemData.m_nextChatItemID.Add(connectPoint);
                    }
                }
            }
            if (node is PersuadeBaseNode)
            {
                PersuadeBaseNode persuadeNode = node as PersuadeBaseNode;
                itemData.talkType     = (int)persuadeNode.m_talkType;
                itemData.persuadeType = (int)persuadeNode.m_type;
                itemData.content      = persuadeNode.content;
                itemData.evidenceID   = persuadeNode.evidenceID;
                //itemData.feedbackID = persuadeNode.feedbackID;
            }
            return(itemData);
        }
Ejemplo n.º 2
0
        public void CreateChatNodeByEditorData(EditorPersuadeData chatData)
        {
            OnDestroy();
            Clear();

            m_describeLab = chatData.m_describe;
            npcId         = chatData.npcId;
            persuadeName  = chatData.name;
            introduce     = chatData.introduce;
            evidenceIds   = string.Empty;
            for (int i = 0; i < chatData.evidenceIds.Length; i++)
            {
                evidenceIds += chatData.evidenceIds[i];
                if (i != chatData.evidenceIds.Length - 1)
                {
                    evidenceIds += ",";
                }
            }
            //evidenceIds = chat
            chatID = chatData.id;
            for (int i = 0; i < chatData.m_editorItems.Count; i++)
            {
                EditorPersuadeItemData chatItemData = chatData.m_editorItems[i];
                System.Type            type         = typeof(PersuadeBaseNode);
                PersuadeBaseNode       contentNode  = CreateNode(new Vector2(chatItemData.m_Position.x, chatItemData.m_Position.y), type, chatItemData.itemId) as PersuadeBaseNode;
                contentNode.m_talkType = (PersuadeTalkType)chatItemData.talkType;
                contentNode.m_type     = (PersuadeType)chatItemData.persuadeType;
                contentNode.content    = chatItemData.content;
                contentNode.evidenceID = chatItemData.evidenceID;
            }
            CreateConnectLine(chatData);
            Repaint();
        }
Ejemplo n.º 3
0
        private PersuadeItemData GetItemDataByBaseNode(BaseNode node)
        {
            PersuadeItemData itemData = new PersuadeItemData();

            itemData.itemId        = node.Id;
            itemData.nextIndex     = -1;
            itemData.forwardIndex  = -1;
            itemData.feedbackIndex = -1;
            for (int i = 0; i < node.Lets.Count; i++)
            {
                if (node.Lets[i].Type == LetTypes.OUTLET)
                {
                    for (int j = 0; j < node.Lets[i].Connections.Count; j++)
                    {
                        Connection con       = node.Lets[i].Connections[j];
                        int        nextIndex = -1;
                        for (int m = 0; m < m_nodes.Count; m++)
                        {
                            if (m_nodes[m].Id == con.Inlet.Owner.Id)
                            {
                                nextIndex = m;
                                break;
                            }
                        }
                        if (nextIndex == -1)
                        {
                            Debug.LogError("error nextindex");
                        }
                        if (con.Outlet.type == 0)
                        {
                            itemData.nextIndex = nextIndex;
                        }
                        else
                        {
                            itemData.feedbackIndex = nextIndex;
                        }
                        //itemData.m_nextChatItemID.Add(con.Inlet.Owner.Id);
                    }
                }
                else if (node.Lets[i].Type == LetTypes.INLET)
                {
                    for (int j = 0; j < node.Lets[i].Connections.Count; j++)
                    {
                        Connection con = node.Lets[i].Connections[j];
                        for (int m = 0; m < m_nodes.Count; m++)
                        {
                            if (m_nodes[m].Id == con.Outlet.Owner.Id)
                            {
                                itemData.forwardIndex = m;
                                break;
                            }
                        }
                    }
                }
            }
            if (node is PersuadeBaseNode)
            {
                PersuadeBaseNode persuadeNode = node as PersuadeBaseNode;
                itemData.talkType     = (int)persuadeNode.m_talkType;
                itemData.persuadeType = (int)persuadeNode.m_type;
                itemData.content      = persuadeNode.content;
                itemData.evidenceID   = persuadeNode.evidenceID;
                //itemData.feedbackID = persuadeNode.feedbackID;
            }

            return(itemData);
        }