public LinkConversationNodeTool(ConversationDataControl conversation, ConversationNodeDataControl father, int nodeType, int index) { this.father = father; ConversationNode childNode = null; if (nodeType == DIALOG_NODE) { childNode = new DialogueConversationNode(); } else if (nodeType == OPTION_NODE) { childNode = new OptionConversationNode(); } else { throw new Exception("Not valid node type!"); } var parentRect = this.father.getEditorRect(); childNode.setEditorX(parentRect.x + parentRect.width + 35); childNode.setEditorY(parentRect.y); child = this.father.conversation.getNodeDataControl(childNode); this.father = father; this.controller = Controller.Instance; this.index = index; }
public InsertNodeTool(ConversationDataControl content, ConversationNodeDataControl parent, int nodeType, int index) { this.content = content; this.isRootNode = parent == null; this.parent = isRootNode ? content.getRootNode() : parent; ConversationNode node = null; switch (nodeType) { case DIALOG_NODE: node = new DialogueConversationNode(); break; case OPTION_NODE: node = new OptionConversationNode(); break; } this.index = index; var parentRect = isRootNode ? new RectInt(0, 25, 0, 0) : parent.getEditorRect(); var childRect = isRootNode ? content.getRootNode().getEditorRect() : parent.getChilds()[index].getEditorRect(); var center = (parentRect.center + childRect.center) / 2f; node.setEditorX((int)(center.x - node.getEditorWidth() / 2f)); node.setEditorY((int)(center.y - node.getEditorHeight() / 2f)); this.newNode = ConversationNodeDataControlFactory.Instance.CreateDataControlFor(content, node); this.subTools = CreateTools(); }
public AddRemoveConversationNodeTool(int nodeType, ConversationNodeDataControl parent, int index) { this.parent = parent; ConversationNode child = null; if (nodeType == DIALOG_NODE) { child = new DialogueConversationNode(); } else if (nodeType == OPTION_NODE) { child = new OptionConversationNode(); } if (child != null) { var parentRect = parent.getEditorRect(); child.setEditorX(parentRect.x + parentRect.width + 35); child.setEditorY(parentRect.y); this.childDataControl = parent.conversation.getNodeDataControl(child); this.index = index; // Insert at last this.add = true; } }
protected override void lineAdded(int v, object data) { var child = data as ConversationNode; if (child == null) { child = new DialogueConversationNode(); var childPos = GetNewChildPosition(); child.setEditorX(childPos.x); child.setEditorY(childPos.y); } optionConversationNode.addChild(v, child); }
public DialogNodeEditor() { myNode = new DialogueConversationNode(); npc = new List <string>(); npc.Add("Player"); if (Controller.getInstance().getSelectedChapterDataControl() != null) { npc.AddRange(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCsIDs()); } conditionsTex = (Texture2D)Resources.Load("EAdventureData/img/icons/conditions-24x24", typeof(Texture2D)); noConditionsTex = (Texture2D)Resources.Load("EAdventureData/img/icons/no-conditions-24x24", typeof(Texture2D)); effectTex = (Texture2D)Resources.Load("EAdventureData/img/icons/effects/32x32/has-macro", typeof(Texture2D)); noEffectTex = (Texture2D)Resources.Load("EAdventureData/img/icons/effects/32x32/macro", typeof(Texture2D)); noBackgroundSkin = (GUISkin)Resources.Load("Editor/EditorNoBackgroundSkin", typeof(GUISkin)); noBackgroundSkin.button.margin = new RectOffset(1, 1, 1, 1); noBackgroundSkin.button.padding = new RectOffset(0, 0, 0, 0); }
/* * @Override * public Object clone() throws CloneNotSupportedException * { * * DialogueConversationNode dcn = (DialogueConversationNode) super.clone( ); * if( dialogue != null ) { * dcn.dialogue = new List<ConversationLine>(); * for (ConversationLine cl : dialogue) * dcn.dialogue.add((ConversationLine)cl.clone()); * } * dcn.effectConsumed = effectConsumed; * dcn.effects = ( effects != null ? (Effects) effects.clone( ) : null ); * //dcn.nextNode = (nextNode != null ? (ConversationNode) nextNode.clone() : null); * dcn.nextNode = null; * dcn.terminal = terminal; * dcn.keepShowing = keepShowing; * return dcn; * }*/ public override object Clone() { DialogueConversationNode dcn = (DialogueConversationNode)base.Clone(); if (dialogue != null) { dcn.dialogue = new List <ConversationLine>(); foreach (ConversationLine cl in dialogue) { dcn.dialogue.Add((ConversationLine)cl.Clone()); } } dcn.effectConsumed = effectConsumed; dcn.effects = (effects != null ? (Effects)effects.Clone() : null); //dcn.nextNode = (nextNode != null ? (ConversationNode) nextNode.clone() : null); dcn.nextNode = null; dcn.terminal = terminal; dcn.keepShowing = keepShowing; return(dcn); }
public ChangeTimeoutTool(OptionNodeDataControl optionNode, float newValue) { this.optionNode = optionNode; this.oldValue = optionNode.Timeout; this.newValue = newValue; this.isOnlyValueChange = oldValue > 0 && newValue > 0; if (oldValue > 0) { child = optionNode.getChilds().Last(); } else { var newChild = new DialogueConversationNode(); var childPos = optionNode.GetNewChildPosition(); newChild.setEditorX(childPos.x); newChild.setEditorY(childPos.y); child = optionNode.conversation.getNodeDataControl(newChild); } }
public ConversationNodeHolder(ConversationNode node) { this.node = node; if (node != null) { switch (node.getType()) { case ConversationNodeViewEnum.DIALOGUE: DialogueConversationNode dialog = (DialogueConversationNode)node; this.additional_effects = new EffectHolder(((DialogueConversationNode)node).getEffects()); this.child = 0; break; case ConversationNodeViewEnum.OPTION: this.additional_effects = new EffectHolder(((OptionConversationNode)node).getEffects()); this.child = -2; break; } } }
public DialogNodeDataControl(ConversationDataControl conversation, ConversationNode conversationNode) : base(conversation, conversationNode) { this.dialogConversationNode = conversationNode as DialogueConversationNode; }
/* * (non-Javadoc) * * @see conversationaleditor.xmlparser.ConversationParser#endElement(java.lang.string, java.lang.string, * java.lang.string) */ public override void endElement(string namespaceURI, string sName, string qName) { // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { // If the conversation ends, store it in the game data if (qName.Equals("tree-conversation")) { chapter.addConversation(new GraphConversation((TreeConversation)conversation)); } // If the tag is a line said by the player, add it to the current node else if (qName.Equals("speak-player")) { // Store the read string into the current node, and then delete the string. The trim is performed so we // don't // have to worry with indentations or leading/trailing spaces ConversationLine line = new ConversationLine(ConversationLine.PLAYER, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { line.setAudioPath(audioPath); } if (synthesizerVoice != null) { line.setSynthesizerVoice(synthesizerVoice); } currentNode.addLine(line); // If we were waiting an option, create a new DialogueNode if (state == STATE_WAITING_OPTION) { // Create a new DialogueNode, and link it to the current node (which will be a OptionNode) ConversationNode newDialogueNode = new DialogueConversationNode(); currentNode.addChild(newDialogueNode); // Add the current node (OptionNode) in the list of past option nodes, and change the current node pastOptionNodes.Add(currentNode); currentNode = newDialogueNode; // Go back to the normal state state = STATE_NORMAL; } } // If the tag is a line said by a non-player character, add it to the current node else if (qName.Equals("speak-char")) { // Store the read string into the current node, and then delete the string. The trim is performed so we // don't // have to worry with indentations or leading/trailing spaces ConversationLine line = new ConversationLine(characterName, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { line.setAudioPath(audioPath); } if (synthesizerVoice != null) { line.setSynthesizerVoice(synthesizerVoice); } currentNode.addLine(line); } // If an "option" tag ends, go back to keep working on the last OptionNode else if (qName.Equals("option")) { // Se the current node to the last OptionNode stored currentNode = pastOptionNodes[pastOptionNodes.Count - 1]; pastOptionNodes.RemoveAt(pastOptionNodes.Count - 1); } // Reset the current string currentstring = string.Empty; } // If an effect tag is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call effectSubParser.endElement(namespaceURI, sName, qName); // If the effect is being closed, insert the effect into the current node if (qName.Equals("effect")) { currentNode.setEffects(currentEffects); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see conversationaleditor.xmlparser.ConversationParser#endElement(java.lang.string, java.lang.string, * java.lang.string) */ public override void endElement(string namespaceURI, string sName, string qName) { // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { // If the conversation ends, store it in the game data if (qName.Equals("tree-conversation")) { chapter.addConversation(new GraphConversation((TreeConversation)conversation)); } // If the tag is a line said by the player, add it to the current node else if (qName.Equals("speak-player")) { // Store the read string into the current node, and then delete the string. The trim is performed so we // don't // have to worry with indentations or leading/trailing spaces ConversationLine line = new ConversationLine(ConversationLine.PLAYER, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { line.setAudioPath(audioPath); } if (synthesizerVoice != null) line.setSynthesizerVoice(synthesizerVoice); currentNode.addLine(line); // If we were waiting an option, create a new DialogueNode if (state == STATE_WAITING_OPTION) { // Create a new DialogueNode, and link it to the current node (which will be a OptionNode) ConversationNode newDialogueNode = new DialogueConversationNode(); currentNode.addChild(newDialogueNode); // Add the current node (OptionNode) in the list of past option nodes, and change the current node pastOptionNodes.Add(currentNode); currentNode = newDialogueNode; // Go back to the normal state state = STATE_NORMAL; } } // If the tag is a line said by a non-player character, add it to the current node else if (qName.Equals("speak-char")) { // Store the read string into the current node, and then delete the string. The trim is performed so we // don't // have to worry with indentations or leading/trailing spaces ConversationLine line = new ConversationLine(characterName, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { line.setAudioPath(audioPath); } if (synthesizerVoice != null) line.setSynthesizerVoice(synthesizerVoice); currentNode.addLine(line); } // If an "option" tag ends, go back to keep working on the last OptionNode else if (qName.Equals("option")) { // Se the current node to the last OptionNode stored currentNode = pastOptionNodes[pastOptionNodes.Count - 1]; pastOptionNodes.RemoveAt(pastOptionNodes.Count - 1); } // Reset the current string currentstring = string.Empty; } // If an effect tag is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call effectSubParser.endElement(namespaceURI, sName, qName); // If the effect is being closed, insert the effect into the current node if (qName.Equals("effect")) { currentNode.setEffects(currentEffects); subParsing = SUBPARSING_NONE; } } }