/** * Returns if the given father has a direct line of dialogue nodes to get to * the child node. * * @param fatherView * Father node * @param childView * Child node * @return True if the father is related to child following only dialogue * nodes, false otherwise */ private bool isDirectFather(ConversationNodeView fatherView, ConversationNodeView childView) { bool isDirectFatherL = false; // Check if both nodes are dialogue nodes if (fatherView.getType() == ConversationNodeViewEnum.DIALOGUE && childView.getType() == ConversationNodeViewEnum.DIALOGUE) { // Check if the father is not a terminal node if (!fatherView.isTerminal()) { // If the only child of the father equals the child, there is a direct line if (fatherView.getChildView(0) == childView) { isDirectFatherL = true; } // If not, keep searching with the only child of the father else { isDirectFatherL = isDirectFather(fatherView.getChildView(0), childView); } } } return(isDirectFatherL); }
/** * Checks if there is a "go-back" tag in the given node. This is, if the * node is a DialogueNode, and is linked to the OptionNode from which came * from * * @param node * Node (must be a DialogueNode) to check * @return True if the node has a "go-back" tag, false otherwise */ public static bool thereIsGoBackTag(ConversationNodeView node) { bool goBackTag = false; // Perform the check only if the node is a DialogueNode and it has a child if (node.getType() == ConversationNodeViewEnum.DIALOGUE && node.getChildCount() > 0) { ConversationNodeView possibleFather = node.getChildView(0); // For each child of the possible father node, check if it match with the possible child for (int i = 0; i < possibleFather.getChildCount(); i++) if (possibleFather.getChildView(i) == node) goBackTag = true; } return goBackTag; }
/** * Checks if there is a "go-back" tag in the given node. This is, if the * node is a DialogueNode, and is linked to the OptionNode from which came * from * * @param node * Node (must be a DialogueNode) to check * @return True if the node has a "go-back" tag, false otherwise */ public static bool thereIsGoBackTag(ConversationNodeView node) { bool goBackTag = false; // Perform the check only if the node is a DialogueNode and it has a child if (node.getType() == ConversationNodeViewEnum.DIALOGUE && node.getChildCount() > 0) { ConversationNodeView possibleFather = node.getChildView(0); // For each child of the possible father node, check if it match with the possible child for (int i = 0; i < possibleFather.getChildCount(); i++) { if (possibleFather.getChildView(i) == node) { goBackTag = true; } } } return(goBackTag); }