/**
         * 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);
        }
Ejemplo n.º 2
0
    /**
     * Sets a new name in the given line of the node.
     *
     * @param nodeView
     *            Node in which the line is placed
     * @param lineIndex
     *            Index of the line to modify
     * @param name
     *            New name for the line
     */
    public void setNodeLineName(ConversationNodeView nodeView, int lineIndex, string name)
    {
        // Take the complete node
        ConversationNode node = (ConversationNode)nodeView;

        controller.addTool(new ChangeNameTool(node.getLine(lineIndex), name));
    }
 public AddConversationNodeTool(ConversationNodeView nodeView, int nodeType,
                                Dictionary <ConversationNodeView, List <ConditionsController> > allConditions)
 {
     this.parent        = (ConversationNode)nodeView;
     this.nodeType      = nodeType;
     this.allConditions = allConditions;
 }
Ejemplo n.º 4
0
    /**
     * Sets a new text in the given line of the node.
     *
     * @param nodeView
     *            Node in which the line is placed
     * @param lineIndex
     *            Index of the line to modify
     * @param text
     *            New text for the line
     */
    public void setNodeLineText(ConversationNodeView nodeView, int lineIndex, string text)
    {
        // Take the complete node
        ConversationNode node = (ConversationNode)nodeView;

        controller.addTool(new ChangeStringValueTool(node.getLine(lineIndex), text, "getText", "setText"));
    }
Ejemplo n.º 5
0
    /**
     * Change the randomly in the selected node.
     *
     * @param selectedNode
     *            The node in which will be the actions
     *
     */
    public void setRandomlyOptions(ConversationNodeView selectedNode)
    {
        ConversationNode node = (ConversationNode)selectedNode;

        //Change the randomly of showing of options
        controller.addTool(new ChangeBooleanValueTool(node, !((OptionConversationNode)node).isRandom(), "isRandom", "setRandom"));
    }
 public LinkConversationNodeTool(ConversationDataControl _dataControl, ConversationNodeView _fatherView,
                                 ConversationNodeView _childView)
 {
     this.fatherView  = _fatherView;
     this.childView   = _childView;
     this.dataControl = _dataControl;
     this.controller  = Controller.getInstance();
 }
Ejemplo n.º 7
0
    /**
     * Shows the GUI to edit the effects of the node.
     *
     * @param nodeView
     *            Node whose effects we want to modify
     */
    public void editNodeEffects(ConversationNodeView nodeView)
    {
        // Take the complete node
        ConversationNode node = (ConversationNode)nodeView;

        // Show a edit effects dialog with a new effects controller
        //TODO: implement
        //new EffectsDialog(new EffectsController(node.getEffects()));
    }
Ejemplo n.º 8
0
 public DeleteConversationNodeTool(int mode, ConversationNodeView _nodeView, Conversation conversation, Dictionary <ConversationNodeView, List <ConditionsController> > allConditions)
 {
     this.mode             = mode;
     this.showConfirmation = (mode == MODE_TREE);
     this.controller       = Controller.getInstance();
     this.nodeView         = _nodeView;
     this.conversation     = conversation;
     this.rootNode         = conversation.getRootNode();
     this.allConditions    = allConditions;
 }
Ejemplo n.º 9
0
    public void setEditorY(ConversationNodeView selectedNode, int y)
    {
        ConversationNode node = (ConversationNode)selectedNode;

        if (y != node.getEditorY())
        {
            node.setEditorY(y);
            Controller.getInstance().dataModified();
        }
    }
Ejemplo n.º 10
0
    /**
     * Sets a new audio path in the given line of the node.
     *
     * @param nodeView
     *            Node in which the line is placed
     * @param lineIndex
     *            Index of the line to modify
     * @param audioPath
     *            New audio path for the line
     */
    public void setNodeLineAudioPath(ConversationNodeView nodeView, int lineIndex, string audioPath)
    {
        // Take the complete node
        ConversationNode node = (ConversationNode)nodeView;

        // Set the new text for the line if the value has changed
        if (!node.hasAudioPath(lineIndex) || !node.getAudioPath(lineIndex).Equals(audioPath))
        {
            controller.addTool(new ChangeStringValueTool(node.getLine(lineIndex), audioPath, "getAudioPath", "setAudioPath"));
        }
    }
Ejemplo n.º 11
0
 public bool editLineAudioPath(ConversationNodeView selectedNode, int selectedRow)
 {
     //try
     //{
     return(controller.addTool(new SelectLineAudioPathTool(((ConversationNode)selectedNode).getLine(selectedRow))));
     //}
     //catch (CloneNotSupportedException e)
     //{
     //    ReportDialog.GenerateErrorReport(new Exception("Could not clone resources"), false, TC.get("Error.Title"));
     //    return false;
     //}
 }
Ejemplo n.º 12
0
    /**
     * 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;
    }
        public override bool canAddChild(ConversationNodeView nodeView, int nodeType)
        {
            bool canAddChild = false;

            // A dialogue node only accepts nodes if it is terminal
            if (nodeView.getType() == ConversationNodeViewEnum.DIALOGUE && nodeView.isTerminal())
            {
                canAddChild = true;
            }

            // An option node only accepts dialogue nodes
            if (nodeView.getType() == ConversationNodeViewEnum.OPTION && nodeType == (int)ConversationNodeViewEnum.DIALOGUE)
            {
                canAddChild = true;
            }

            return(canAddChild);
        }
        public override int[] getAddableNodes(ConversationNodeView nodeView)
        {
            int[] addableNodes = null;

            // Dialogue nodes can add both dialogue and option nodes
            if (nodeView.getType() == ConversationNodeViewEnum.DIALOGUE)
            {
                addableNodes = new int[] { (int)ConversationNodeViewEnum.DIALOGUE, (int)ConversationNodeViewEnum.OPTION }
            }
            ;

            // Option nodes can only add dialogue nodes
            else if (nodeView.getType() == ConversationNodeViewEnum.OPTION)
            {
                addableNodes = new int[] { (int)ConversationNodeViewEnum.DIALOGUE }
            }
            ;

            return(addableNodes);
        }
Ejemplo n.º 15
0
    /**
     * 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);
    }
        public override bool canDeleteLink(ConversationNodeView nodeView)
        {
            bool canLinkNode = false;

            // The node must not be the root
            if (nodeView != graphConversation.getRootNode())
            {
                // A dialogue node only can link it it is terminal
                if (nodeView.getType() == ConversationNodeViewEnum.DIALOGUE && nodeView.isTerminal())
                {
                    canLinkNode = true;
                }

                // An option node can always link to another node
                if (nodeView.getType() == ConversationNodeViewEnum.OPTION)
                {
                    canLinkNode = true;
                }
            }

            return(!canLinkNode && this.getAllNodesViews().Count > 1);
        }
        public override bool canLinkNodeTo(ConversationNodeView fatherView, ConversationNodeView childView)
        {
            bool canLinkNodeTo = false;

            // Check first if the nodes are different
            if (fatherView != childView)
            {
                // If the father is a dialogue node, it can link to another if it is terminal
                // Check also that the father is not a child of the child node, to prevent cycles
                if (fatherView.getType() == ConversationNodeViewEnum.DIALOGUE && fatherView.isTerminal() && !isDirectFather(childView, fatherView))
                {
                    canLinkNodeTo = true;
                }

                // If the father is an option node, it can only link to a dialogue node
                if (fatherView.getType() == ConversationNodeViewEnum.OPTION && childView.getType() == ConversationNodeViewEnum.DIALOGUE)
                {
                    canLinkNodeTo = true;
                }
            }

            return(canLinkNodeTo);
        }
Ejemplo n.º 18
0
 public DeleteNodeLinkTool(ConversationNodeView nodeView) : this((ConversationNode)nodeView)
 {
 }
Ejemplo n.º 19
0
 /**
  * Returns if it is possible to move the given node
  *
  * @param nodeView
  *            Node to be moved
  * @return True if the node initially can be moved, false otherwise
  */
 public abstract bool canMoveNode(ConversationNodeView nodeView);
Ejemplo n.º 20
0
 /**
  * Returns if it is possible to delete the given node
  *
  * @param nodeView
  *            Node to be deleted
  * @return True if the node can be deleted, false otherwise
  */
 public abstract bool canDeleteNode(ConversationNodeView nodeView);
Ejemplo n.º 21
0
 /**
  * Returns if it is possible to link a given node with another one
  *
  * @param fatherView
  *            Node to act as the father
  * @param childView
  *            Node to act as the child
  * @return True if node2 can be attached to node1, false otherwise
  */
 public abstract bool canLinkNodeTo(ConversationNodeView fatherView, ConversationNodeView childView);
Ejemplo n.º 22
0
 /**
  * Returns if it is possible to link the given node
  *
  * @param nodeView
  *            Node to be linked
  * @return True if the node initially can be linked to another one, false
  *         otherwise
  */
 public abstract bool canLinkNode(ConversationNodeView nodeView);
Ejemplo n.º 23
0
 public SearchableNode(ConversationNodeView cnv)
 {
     this.cnv = cnv;
 }
Ejemplo n.º 24
0
 public AddNodeLineTool(ConversationNodeView nodeView, int lineIndex, string name, List <ConditionsController> node) : this((ConversationNode)nodeView, lineIndex, name, node)
 {
 }
Ejemplo n.º 25
0
 /**
  * Returns if it is possible to add a child to the given node
  *
  * @param nodeView
  *            Node which we want to know if a child is addable
  * @param nodeType
  *            The type of node that we want to add
  * @return True if a child can be added (get NodeTypes with
  *         getAddeableNodes( ConversationalNode )), false otherwise
  */
 public abstract bool canAddChild(ConversationNodeView nodeView, int nodeType);
Ejemplo n.º 26
0
 public DeleteNodeLineTool(ConversationNodeView nodeView, int lineIndex, List <ConditionsController> node) : this((ConversationNode)nodeView, lineIndex, node)
 {
 }
Ejemplo n.º 27
0
    /**
     * Check if in selectedNode is active the pre-hearing option
     *
     * @param selectedNode
     *            The node in which will it ask
     * @return
     */
    public bool isPreListeningActivate(ConversationNodeView selectedNode)
    {
        ConversationNode node = (ConversationNode)selectedNode;

        return(((OptionConversationNode)node).isPreListening());
    }
Ejemplo n.º 28
0
 public MoveNodeLineTool(ConversationNodeView nodeView, int lineIndex, int mode) : this((ConversationNode)nodeView, lineIndex, mode)
 {
 }
Ejemplo n.º 29
0
    /**
     * Check if in selectedNode is active the show user response option, for dialogue node
     *
     * @param selectedNode
     *            The node in which will it ask
     * @return
     */
    public bool isKeepShowingDialogueActivate(ConversationNodeView selectedNode)
    {
        ConversationNode node = (ConversationNode)selectedNode;

        return(((DialogueConversationNode)node).isKeepShowing());
    }
 public DeleteNodeOptionTool(ConversationNodeView parent, int optionIndex) : base(parent)
 {
     this.confirmText  = TC.get("Conversation.ConfirmationDeleteOption");
     this.confirmTitle = TC.get("Conversation.OperationDeleteOption");
     this.linkIndex    = optionIndex;
 }
Ejemplo n.º 31
0
    public int getEditorY(ConversationNodeView selectedNode)
    {
        ConversationNode node = (ConversationNode)selectedNode;

        return(node.getEditorY());
    }