protected virtual void ProcessCurrentNode() { switch (currentConversationNode.type) { case DialogueDataNode.Type.Text: ConversationUI.instance.ShowTextNode(currentConversationNode, OnNext); ConversationUI.instance.Show(); break; case DialogueDataNode.Type.Question: ConversationUI.instance.ShowQuestionNode(currentConversationNode, FilterConditionalAnswers(dialog.GetNodeConnections(currentConversationNode)), OnAnswer); ConversationUI.instance.Show(); break; case DialogueDataNode.Type.Condition: OnConditionNode(ProcessCondition(currentConversationNode)); break; case DialogueDataNode.Type.EndDialogue: ConversationUI.instance.Hide(); conversationStarted = false; break; } }
public override bool IsConnectionAllowed(Node other, bool isNewConnection = false) { DialogueDataNode dNode = (DialogueDataNode)dataNode; DialogueDataNode otherDNode = (DialogueDataNode)other.dataNode; DialogueDataGraph graph = (DialogueDataGraph)currentEditor.GetData(); List <DataGraphNode> connections = graph.GetNodeConnections(dNode); int connectionCount = connections.Count; if (otherDNode.type == DialogueDataNode.Type.StartDialogue) { return(false); } switch (dNode.type) { case DialogueDataNode.Type.EndDialogue: return(false); case DialogueDataNode.Type.StartDialogue: if (otherDNode.type == DialogueDataNode.Type.Answer || otherDNode.type == DialogueDataNode.Type.OnTrue || otherDNode.type == DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 0 : 1)) { return(false); } break; case DialogueDataNode.Type.Text: if (otherDNode.type == DialogueDataNode.Type.Answer || otherDNode.type == DialogueDataNode.Type.OnTrue || otherDNode.type == DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 0 : 1)) { return(false); } break; case DialogueDataNode.Type.Question: if (otherDNode.type != DialogueDataNode.Type.Answer || connectionCount > (isNewConnection ? 3 : 4)) { return(false); } break; case DialogueDataNode.Type.Answer: if (otherDNode.type == DialogueDataNode.Type.Answer || otherDNode.type == DialogueDataNode.Type.OnTrue || otherDNode.type == DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 0 : 1)) { return(false); } break; case DialogueDataNode.Type.Condition: if (otherDNode.type != DialogueDataNode.Type.OnTrue && otherDNode.type != DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 1 : 2)) { return(false); } if (isNewConnection) { if (connections.Count > 0) { DialogueDataNode left = (DialogueDataNode)connections[0]; if (left.type == otherDNode.type) { return(false); } } } else { if (connections.Count > 1) { DialogueDataNode left = (DialogueDataNode)connections[0]; DialogueDataNode right = (DialogueDataNode)connections[1]; if (left.type == right.type) { return(false); } } } break; case DialogueDataNode.Type.OnTrue: if (otherDNode.type == DialogueDataNode.Type.Answer || otherDNode.type == DialogueDataNode.Type.OnTrue || otherDNode.type == DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 0 : 1)) { return(false); } break; case DialogueDataNode.Type.OnFalse: if (otherDNode.type == DialogueDataNode.Type.Answer || otherDNode.type == DialogueDataNode.Type.OnTrue || otherDNode.type == DialogueDataNode.Type.OnFalse) { return(false); } if (connectionCount > (isNewConnection ? 0 : 1)) { return(false); } break; } return(true); }