private PersuadeData GetDataByNodes(List <BaseNode> nodes, int id, PersuadeData persuadeData) { //PersuadeData persuadeData = new PersuadeData(); //chatData.m_chatBG = BG; m_nodes = nodes; persuadeData.id = id; for (int i = 0; i < nodes.Count; i++) { PersuadeItemData itemData = GetItemDataByBaseNode(nodes[i]); persuadeData.m_items.Add(itemData); } return(persuadeData); }
public void SetCurrentValue(int currentIndex) { this.m_currentItemIndex = currentIndex; PresuadeRecordData recordData = null; this.m_currentItemData = this.m_persuadeData.m_items[currentIndex]; if ((PersuadeType)this.m_currentItemData.persuadeType == PersuadeType.PersuadeTalk) { if (m_persuadeIndex >= 0) { this.m_serialIconGrid.GetChild <SerialToggle>(m_persuadeIndex).CheckMark = false; } recordData = this.m_serialIndexDic[this.m_currentItemIndex]; if (m_serialIndexDic.ContainsKey(this.m_currentItemIndex)) { m_persuadeIndex = recordData.serialIndex; } else { Debug.LogError("error m_persuadeIndex : " + m_persuadeIndex); } if (!m_isInPersuadeTalk) { m_isInPersuadeTalk = true; this.m_serialIconGrid.Visible = true; m_persuadeIndex = 0; this.m_startItemIndex = this.m_currentItemIndex; } GameEvents.UIEvents.UI_Presuade_Event.OnNoticProgressFillEffect.SafeInvoke(true); this.m_serialIconGrid.GetChild <SerialToggle>(m_persuadeIndex).CheckMark = true; this.m_currentSelfIcon.Visible = false; m_needShowRefut = !recordData.isRecord; if (Widget.sizeDelta.x / 2f != this.m_currentNpcIcon.Widget.anchoredPosition.x) { this.m_currentNpcIcon.Widget.DOLocalMoveX(Widget.sizeDelta.x / 2f, 0.4f).SetEase(Ease.InOutQuad).OnComplete(() => { //this.m_confutBtn.Visible = !recordData.isRecord; }); } if (this.m_currentItemData.forwardIndex >= 0 && (PersuadeType)this.m_persuadeData.m_items[this.m_currentItemData.forwardIndex].persuadeType == PersuadeType.PersuadeTalk) { this.m_leftBtn.Visible = true; } else { this.m_leftBtn.Visible = false; } } else { this.m_leftBtn.Visible = false; if (this.m_lastItemIndex >= 0 && (PersuadeType)this.m_persuadeData.m_items[this.m_lastItemIndex].persuadeType == PersuadeType.PersuadeTalk) { m_needShowRefut = false; this.m_confutBtn.Visible = false; this.m_currentNpcIcon.Widget.DOAnchorPos3D(this.m_npcTween.To, 0.4f).SetEase(Ease.InOutQuad); } if ((PersuadeTalkType)this.m_currentItemData.talkType == PersuadeTalkType.NPC) { if (!this.m_currentNpcIcon.Visible) { this.m_currentNpcIcon.Visible = true; } } if ((PersuadeTalkType)this.m_currentItemData.talkType == PersuadeTalkType.Self) { if (!this.m_currentSelfIcon.Visible) { this.m_currentSelfIcon.Visible = true; } if (this.m_needShowIcon) { this.m_needShowIcon = false; this.m_iconCom.Visible = true; } } } if (!this.m_Image_chat.Visible) { this.m_Image_chat.Visible = true; } SetContentLab(m_currentItemData.content, recordData != null && recordData.isRecord); }
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); }