/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#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 it is a player tag, store the player in the game data if (qName.Equals("player")) { chapter.setPlayer(player); } // If it is a documentation tag, hold the documentation in the player else if (qName.Equals("documentation")) { player.setDocumentation(currentstring.ToString().Trim()); } // If it is a resources tag, add the resources to the player else if (qName.Equals("resources")) { player.addResources(currentResources); } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed, add the condition to the resources, and switch the state if (qName.Equals("condition")) { currentResources.setConditions(currentConditions); subParsing = SUBPARSING_NONE; } } // If it is a description tag, create the new description (with its id) else if (subParsing == SUBPARSING_DESCRIPTION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("description")) { this.descriptions.Add(description); subParsing = SUBPARSING_NONE; } } }
public override void endElement(string namespaceURI, string sName, string qName) { if (qName.Equals("documentation") && subParsing == GLOBAL_STATE) { currentGlobalState.setDocumentation(currentString.ToString().Trim()); } else if (qName.Equals("documentation") && subParsing == MACRO) { currentMacro.setDocumentation(currentString.ToString().Trim()); } currentString = string.Empty; // If an element is being subparsed if (subParsing != NONE) { // Spread the end element call subParser.endElement(namespaceURI, sName, qName); // Debug.Log(subParsing + " " + sName + " " + qName); // If the element is not being subparsed anymore, return to normal state if (qName.Equals("scene") && subParsing == SCENE || (qName.Equals("slidescene") || qName.Equals("videoscene")) && subParsing == CUTSCENE || qName.Equals("book") && subParsing == BOOK || qName.Equals("object") && subParsing == OBJECT || qName.Equals("player") && subParsing == PLAYER || qName.Equals("character") && subParsing == CHARACTER || qName.Equals("tree-conversation") && subParsing == CONVERSATION || qName.Equals("graph-conversation") && subParsing == CONVERSATION || qName.Equals("timer") && subParsing == TIMER || qName.Equals("global-state") && subParsing == GLOBAL_STATE || qName.Equals("macro") && subParsing == MACRO || qName.Equals("atrezzoobject") && subParsing == ATREZZO || qName.Equals("assessment") && subParsing == ASSESSMENT || qName.Equals("adaptation") && subParsing == ADAPTATION) { subParsing = NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#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 it is an object tag, store the object in the game data if (qName.Equals("barrier")) { scene.addBarrier(barrier); } // If it is a documentation tag, hold the documentation in the current element else if (qName.Equals("documentation")) { if (reading == READING_NONE) { barrier.setDocumentation(currentstring.ToString().Trim()); } } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { if (reading == READING_NONE) { this.barrier.setConditions(currentConditions); } // Switch state subParsing = SUBPARSING_NONE; } } }
public override void endElement(string namespaceURI, string sName, string qName) { // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { // If it is a name tag, store the name in the active area if (qName.Equals("name")) { description.setName(currentstring.ToString().Trim()); } // If it is a brief tag, store the brief description in the active area else if (qName.Equals("brief")) { description.setDescription(currentstring.ToString().Trim()); } // If it is a detailed tag, store the detailed description in the active area else if (qName.Equals("detailed")) { description.setDetailedDescription(currentstring.ToString().Trim()); } // Reset the current string currentstring = string.Empty; }// end if subparsing none // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { this.description.setConditions(currentConditions); // Switch state subParsing = SUBPARSING_NONE; } } }
public override void endElement(string namespaceURI, string sName, string qName) { if (qName.Equals("documentation")) { if (reading == READING_NONE) { animation.setDocumentation(currentstring.ToString().Trim()); } } else if (qName.Equals("resources")) { animation.addResources(currentResources); } if (reading != READING_NONE) { subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("transition") || qName.Equals("frame")) { reading = READING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#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 it is a timer tag, add it to the game data if (qName.Equals("timer")) { chapter.addTimer(timer); } // If it is a documentation tag, hold the documentation in the slidescene else if (qName.Equals("documentation")) { timer.setDocumentation(currentstring.ToString().Trim()); } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("init-condition")) { timer.setInitCond(currentConditions); // Switch the state subParsing = SUBPARSING_NONE; } // If the condition tag is being closed if (qName.Equals("end-condition")) { timer.setEndCond(currentConditions); // Switch the state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, store the effect in the next scene and switch the state if (qName.Equals("effect")) { timer.setEffects(currentEffects); subParsing = SUBPARSING_NONE; } // If the effect tag is being closed, add the post-effects to the current next scene and switch the state if (qName.Equals("post-effect")) { timer.setPostEffects(currentEffects); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#endElement(java.lang.string, java.lang.string, * java.lang.string) */ public override void endElement(string namespaceURI, string sName, string qName) { // Debug.Log("END: " + sName + " " + qName ); // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { newEffect = null; // If it is a speak-player if (qName.Equals("speak-player")) { // Add the effect and clear the current string newEffect = new SpeakPlayerEffect(currentstring.ToString().Trim()); ((SpeakPlayerEffect)newEffect).setAudioPath(audioPath); } // If it is a speak-char else if (qName.Equals("speak-char")) { // Add the effect and clear the current string newEffect = new SpeakCharEffect(currentCharIdTarget, currentstring.ToString().Trim()); ((SpeakCharEffect)newEffect).setAudioPath(audioPath); }// If it is a show-text else if (qName.Equals("show-text")) { // Add the new ShowTextEffect newEffect = new ShowTextEffect(currentstring.ToString().Trim(), x, y, frontColor, borderColor); ((ShowTextEffect)newEffect).setAudioPath(audioPath); } // Not reading Random effect: Add the new Effect if not null if (!readingRandomEffect && newEffect != null) { effects.add(newEffect); // Store current effect currentEffect = newEffect; } // Reading random effect if (readingRandomEffect) { // When we have just created the effect, add it if (newEffect != null && newEffect == randomEffect) { effects.add(newEffect); } // Otherwise, determine if it is positive or negative effect else if (newEffect != null && !positiveBlockRead) { randomEffect.setPositiveEffect(newEffect); positiveBlockRead = true; } // Negative effect else if (newEffect != null && positiveBlockRead) { randomEffect.setNegativeEffect(newEffect); positiveBlockRead = false; readingRandomEffect = false; newEffect = randomEffect; randomEffect = null; } // Store current effect currentEffect = newEffect; } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { //Debug.Log(currentEffect); //Debug.Log(currentConditions); // Store the conditions in the effect currentEffect.setConditions(currentConditions); // Switch state 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 tag ending is the conversation, create the graph conversation, with the first node of the list if (qName.Equals("graph-conversation")) { setNodeLinks(); chapter.addConversation(new GraphConversation(conversationName, graphNodes[0])); } // If a node is closed else if (qName.Equals("dialogue-node") || qName.Equals("option-node")) { // Add the current node to the node list, and the set of children references into the node links graphNodes.Add(currentNode); nodeLinks.Add(currentLinks); } // 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 = new ConversationLine(ConversationLine.PLAYER, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { conversationLine.setAudioPath(audioPath); } if (synthesizerVoice != null) { conversationLine.setSynthesizerVoice(synthesizerVoice); } conversationLine.setKeepShowing(keepShowingLine); currentNode.addLine(conversationLine); } // 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 = new ConversationLine(characterName, currentstring.Trim()); if (audioPath != null && !this.audioPath.Equals("")) { conversationLine.setAudioPath(audioPath); } if (synthesizerVoice != null) { conversationLine.setSynthesizerVoice(synthesizerVoice); } conversationLine.setKeepShowing(keepShowingLine); currentNode.addLine(conversationLine); } // Reset the current string currentstring = string.Empty; } // If we are subparsing an effect else if (subParsing == SUBPARSING_EFFECT || subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect is being closed, insert the effect into the current node if (qName.Equals("effect") && subParsing == SUBPARSING_EFFECT) { currentNode.setEffects(currentEffects); subParsing = SUBPARSING_NONE; } // If the effect is being closed, insert the effect into the current node else if (qName.Equals("condition") && subParsing == SUBPARSING_CONDITION) { conversationLine.setConditions(currentConditions); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#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 it is an object tag, store the object in the game data if (qName.Equals("active-area")) { scene.addActiveArea(activeArea); } // If it is a documentation tag, hold the documentation in the current element else if (qName.Equals("documentation")) { activeArea.setDocumentation(currentstring.ToString().Trim()); } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { if (reading == READING_NONE) { this.activeArea.setConditions(currentConditions); } // Switch state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, switch the state if (qName.Equals("effect")) { subParsing = SUBPARSING_NONE; } } else if (subParsing == SUBPARSING_ACTIONS) { subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("actions")) { subParsing = SUBPARSING_NONE; } } // If it is a description tag, create the new description (with its id) else if (subParsing == SUBPARSING_DESCRIPTION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("description")) { this.descriptions.Add(description); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#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 it is a resources tag, add it to the object if (qName.Equals("resources")) { if (reading == READING_RESOURCES) { currentCustomAction.addResources(currentResources); reading = READING_NONE; } } // If it is a documentation tag, hold the documentation in the current element else if (qName.Equals("documentation")) { currentDocumentation = currentstring.ToString().Trim(); } // If it is a examine tag, store the new action in the object else if (qName.Equals("examine")) { Action examineAction = new Action(Action.EXAMINE, currentConditions, currentEffects, currentNotEffects); examineAction.setDocumentation(currentDocumentation); examineAction.setKeepDistance(currentKeepDistance); examineAction.setNeedsGoTo(currentNeedsGoTo); examineAction.setActivatedNotEffects(activateNotEffects); examineAction.setActivatedClickEffects(activateClickEffects); element.addAction(examineAction); reading = READING_NONE; } // If it is a grab tag, store the new action in the object else if (qName.Equals("grab")) { Action grabAction = new Action(Action.GRAB, currentConditions, currentEffects, currentNotEffects); grabAction.setDocumentation(currentDocumentation); grabAction.setKeepDistance(currentKeepDistance); grabAction.setNeedsGoTo(currentNeedsGoTo); grabAction.setActivatedNotEffects(activateNotEffects); grabAction.setActivatedClickEffects(activateClickEffects); element.addAction(grabAction); reading = READING_NONE; } // If it is an use tag, store the new action in the object else if (qName.Equals("use")) { Action useAction = new Action(Action.USE, currentConditions, currentEffects, currentNotEffects); useAction.setDocumentation(currentDocumentation); useAction.setNeedsGoTo(currentNeedsGoTo); useAction.setKeepDistance(currentKeepDistance); useAction.setActivatedNotEffects(activateNotEffects); useAction.setActivatedClickEffects(activateClickEffects); element.addAction(useAction); reading = READING_NONE; } // If it is an use tag, store the new action in the object else if (qName.Equals("talk-to")) { Action talkToAction = new Action(Action.TALK_TO, currentConditions, currentEffects, currentNotEffects); talkToAction.setDocumentation(currentDocumentation); talkToAction.setNeedsGoTo(currentNeedsGoTo); talkToAction.setKeepDistance(currentKeepDistance); talkToAction.setActivatedNotEffects(activateNotEffects); talkToAction.setActivatedClickEffects(activateClickEffects); element.addAction(talkToAction); reading = READING_NONE; } // If it is an use-with tag, store the new action in the object else if (qName.Equals("use-with")) { Action useWithAction = new Action(Action.USE_WITH, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); useWithAction.setDocumentation(currentDocumentation); useWithAction.setKeepDistance(currentKeepDistance); useWithAction.setNeedsGoTo(currentNeedsGoTo); useWithAction.setActivatedNotEffects(activateNotEffects); useWithAction.setActivatedClickEffects(activateClickEffects); element.addAction(useWithAction); reading = READING_NONE; } // If it is an use-with tag, store the new action in the object else if (qName.Equals("drag-to")) { Action useWithAction = new Action(Action.DRAG_TO, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); useWithAction.setDocumentation(currentDocumentation); useWithAction.setKeepDistance(currentKeepDistance); useWithAction.setNeedsGoTo(currentNeedsGoTo); useWithAction.setActivatedNotEffects(activateNotEffects); useWithAction.setActivatedClickEffects(activateClickEffects); element.addAction(useWithAction); reading = READING_NONE; } // If it is a give-to tag, store the new action in the object else if (qName.Equals("give-to")) { Action giveToAction = new Action(Action.GIVE_TO, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); giveToAction.setDocumentation(currentDocumentation); giveToAction.setKeepDistance(currentKeepDistance); giveToAction.setNeedsGoTo(currentNeedsGoTo); giveToAction.setActivatedNotEffects(activateNotEffects); giveToAction.setActivatedClickEffects(activateClickEffects); element.addAction(giveToAction); reading = READING_NONE; } // If it is a custom tag, store the new custom action in the object else if (qName.Equals("custom")) { currentCustomAction.setName(currentName); currentCustomAction.setConditions(currentConditions); currentCustomAction.setEffects(currentEffects); currentCustomAction.setNotEffects(currentNotEffects); currentCustomAction.setDocumentation(currentDocumentation); currentCustomAction.setKeepDistance(currentKeepDistance); currentCustomAction.setNeedsGoTo(currentNeedsGoTo); currentCustomAction.setActivatedNotEffects(activateNotEffects); currentCustomAction.setClickEffects(currentClickEffects); currentCustomAction.setActivatedClickEffects(activateClickEffects); // customAction.addResources(currentResources); element.addAction(currentCustomAction); currentCustomAction = null; reading = READING_NONE; } // If it is a custom-interact tag, store the new custom interact action in the object else if (qName.Equals("custom-interact")) { currentCustomAction.setConditions(currentConditions); currentCustomAction.setEffects(currentEffects); currentCustomAction.setNotEffects(currentNotEffects); currentCustomAction.setName(currentName); currentCustomAction.setTargetId(currentIdTarget); currentCustomAction.setDocumentation(currentDocumentation); currentCustomAction.setKeepDistance(currentKeepDistance); currentCustomAction.setNeedsGoTo(currentNeedsGoTo); currentCustomAction.setActivatedNotEffects(activateNotEffects); currentCustomAction.setClickEffects(currentClickEffects); currentCustomAction.setActivatedClickEffects(activateClickEffects); // customAction.addResources(currentResources); element.addAction(currentCustomAction); currentCustomAction = null; reading = READING_NONE; } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { // Store the conditions in the resources if (reading == READING_RESOURCES) { currentResources.setConditions(currentConditions); } // Switch state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, switch the state if (qName.Equals("effect")) { subParsing = SUBPARSING_NONE; } // If the not-effect tag is being closed, switch the state else if (qName.Equals("not-effect")) { subParsing = SUBPARSING_NONE; } // If the not-effect tag is being closed, switch the state else if (qName.Equals("click-effect")) { subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#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 it is an object tag, store the object in the game data if (qName.Equals("atrezzoobject")) { chapter.addAtrezzo(atrezzo); } // If it is a resources tag, add it to the object else if (qName.Equals("resources")) { atrezzo.addResources(currentResources); reading = READING_NONE; } // If it is a documentation tag, hold the documentation in the current element else if (qName.Equals("documentation")) { if (reading == READING_NONE) { atrezzo.setDocumentation(currentstring.ToString().Trim()); } } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { // Store the conditions in the resources if (reading == READING_RESOURCES) { currentResources.setConditions(currentConditions); } // Switch state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, switch the state if (qName.Equals("effect")) { subParsing = SUBPARSING_NONE; } } // If it is a description tag, create the new description (with its id) else if (subParsing == SUBPARSING_DESCRIPTION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("description")) { this.descriptions.Add(description); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#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 it is a slidescene tag, add it to the game data if (qName.Equals("slidescene") || qName.Equals("videoscene")) { chapter.addCutscene(cutscene); } // If it is a resources tag, add it to the slidescene else if (qName.Equals("resources")) { cutscene.addResources(currentResources); reading = READING_NONE; } // If it is a name tag, add the name to the slidescene else if (qName.Equals("name")) { cutscene.setName(currentstring.ToString().Trim()); } // If it is a documentation tag, hold the documentation in the slidescene else if (qName.Equals("documentation")) { cutscene.setDocumentation(currentstring.ToString().Trim()); } // If it is a next-scene tag, add the next scene to the slidescene else if (qName.Equals("next-scene")) { cutscene.addNextScene(currentNextScene); reading = READING_NONE; } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { // If we are parsing a resources tag, add the conditions to the current resources if (reading == READING_RESOURCES) { currentResources.setConditions(currentConditions); } // If we are parsing a next-scene tag, add the conditions to the current next scene if (reading == READING_NEXT_SCENE) { currentNextScene.setConditions(currentConditions); } // Switch the state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, store the effect in the next scene and switch the state if (qName.Equals("effect")) { if (currentNextScene != null) { currentNextScene.setEffects(currentEffects); } else { Effects effects = cutscene.getEffects(); foreach (AbstractEffect effect in currentEffects.getEffects()) { effects.add(effect); } } subParsing = SUBPARSING_NONE; } // If the effect tag is being closed, add the post-effects to the current next scene and switch the state if (qName.Equals("post-effect")) { if (currentNextScene != null) { currentNextScene.setPostEffects(currentEffects); } else { Effects effects = cutscene.getEffects(); foreach (AbstractEffect effect in currentEffects.getEffects()) { effects.add(effect); } } //currentNextScene.setPostEffects( currentEffects ); subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#endElement(java.lang.string, java.lang.string, * java.lang.string) */ public override void endElement(string namespaceURI, string sName, string qName) { Debug.Log("END: " + sName + " " + qName + " sub:" + subParsing + ", reading: " + reading); // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { // If it is a scene tag, store the scene in the game data if (qName.Equals("scene")) { if (scene != null) { TrajectoryFixer.fixTrajectory(scene); } chapter.addScene(scene); } // If it is a resources tag, add the resources to the scene else if (qName.Equals("resources")) { scene.addResources(currentResources); reading = READING_NONE; } // If it is a name tag, store the name in the scene else if (qName.Equals("name")) { scene.setName(currentstring.ToString().Trim()); } // If it is a documentation tag, hold the documentation in the current element else if (qName.Equals("documentation")) { if (reading == READING_NONE) { scene.setDocumentation(currentstring.ToString().Trim()); } else if (reading == READING_EXIT) { currentExit.setDocumentation(currentstring.ToString().Trim()); } else if (reading == READING_ELEMENT_REFERENCE) { currentElementReference.setDocumentation(currentstring.ToString().Trim()); } } // If it is an exit tag, store the exit in the scene else if (qName.Equals("exit")) { if (currentExit.getNextScenes().Count > 0) { foreach (NextScene nextScene in currentExit.getNextScenes()) { Exit exit = (Exit)currentExit; exit.setNextScenes(new List <NextScene>()); exit.setDestinyX(nextScene.getPositionX()); exit.setDestinyY(nextScene.getPositionY()); exit.setEffects(nextScene.getEffects()); exit.setPostEffects(nextScene.getPostEffects()); if (exit.getDefaultExitLook() == null) { exit.setDefaultExitLook(nextScene.getExitLook()); } else { if (nextScene.getExitLook() != null) { if (nextScene.getExitLook().getExitText() != null && !nextScene.getExitLook().getExitText().Equals("")) { exit.getDefaultExitLook().setExitText(nextScene.getExitLook().getExitText()); } if (nextScene.getExitLook().getCursorPath() != null && !nextScene.getExitLook().getCursorPath().Equals("")) { exit.getDefaultExitLook().setCursorPath(nextScene.getExitLook().getCursorPath()); } } } exit.setHasNotEffects(false); exit.setConditions(nextScene.getConditions()); exit.setNextSceneId(nextScene.getTargetId()); scene.addExit(exit); } } else { scene.addExit(currentExit); } //scene.addExit( currentExit ); reading = READING_NONE; } // If it is an exit look tag, store the look in the exit else if (qName.Equals("exit-look")) { Debug.Log("559" + currentExitLook.getExitText()); if (reading == READING_NEXT_SCENE) { currentNextScene.setExitLook(currentExitLook); } else if (reading == READING_EXIT) { currentExit.setDefaultExitLook(currentExitLook); } } // If it is a next-scene tag, store the next scene in the current exit else if (qName.Equals("next-scene")) { currentExit.addNextScene(currentNextScene); reading = READING_NONE; } else if (qName.Equals("point")) { currentExit.addPoint(currentPoint); } // If it is a object-ref tag, store the reference in the scene else if (qName.Equals("object-ref")) { Debug.Log("SceneReference End"); scene.addItemReference(currentElementReference); reading = READING_NONE; } // If it is a character-ref tag, store the reference in the scene else if (qName.Equals("character-ref")) { Debug.Log("CharRef End"); scene.addCharacterReference(currentElementReference); reading = READING_NONE; } // If it is a atrezzo-ref tag, store the reference in the scene else if (qName.Equals("atrezzo-ref")) { scene.addAtrezzoReference(currentElementReference); reading = READING_NONE; } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { // If we are parsing resources, add the condition to the current resources if (reading == READING_RESOURCES) { currentResources.setConditions(currentConditions); } // If we are parsing a next-scene, add the condition to the current next scene if (reading == READING_NEXT_SCENE) { currentNextScene.setConditions(currentConditions); } // If we are parsing an element reference, add the condition to the current element reference if (reading == READING_ELEMENT_REFERENCE) { currentElementReference.setConditions(currentConditions); } if (reading == READING_EXIT) { currentExit.setConditions(currentConditions); } // Switch the state subParsing = SUBPARSING_NONE; } } // If an effect is being subparsed else if (subParsing == SUBPARSING_EFFECT) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the effect tag is being closed, add the effects to the current next scene and switch the state if (qName.Equals("effect")) { if (reading == READING_NEXT_SCENE) { currentNextScene.setEffects(currentEffects); } if (reading == READING_EXIT) { currentExit.setEffects(currentEffects); } subParsing = SUBPARSING_NONE; } // If the effect tag is being closed, add the post-effects to the current next scene and switch the state if (qName.Equals("post-effect")) { if (reading == READING_NEXT_SCENE) { currentNextScene.setPostEffects(currentEffects); } if (reading == READING_EXIT) { currentExit.setPostEffects(currentEffects); } subParsing = SUBPARSING_NONE; } if (qName.Equals("not-effect")) { currentExit.setNotEffects(currentEffects); subParsing = SUBPARSING_NONE; } } // If an active area is being subparsed else if (subParsing == SUBPARSING_ACTIVE_AREA) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("active-area")) { subParsing = SUBPARSING_NONE; } } // If a barrier is being subparsed else if (subParsing == SUBPARSING_BARRIER) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("barrier")) { subParsing = SUBPARSING_NONE; } } else if (subParsing == SUBPARSING_TRAJECTORY) { subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("trajectory")) { subParsing = SUBPARSING_NONE; // next line is moved to TrayectorySubParser //scene.getTrajectory().deleteUnconnectedNodes(); } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#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 it is a character tag, store the character in the game data if (qName.Equals("character")) { chapter.addCharacter(npc); } // If it is a documentation tag, hold the documentation in the character else if (qName.Equals("documentation")) { if (reading == READING_NONE) { npc.setDocumentation(currentstring.ToString().Trim()); } else if (reading == READING_CONVERSATION_REFERENCE) { conversationReference.setDocumentation(currentstring.ToString().Trim()); } } // If it is a resources tag, add the resources in the character else if (qName.Equals("resources")) { npc.addResources(currentResources); reading = READING_NONE; } // If it is a conversation reference tag, add the reference to the character else if (qName.Equals("conversation-ref")) { //npc.addConversationReference( conversationReference ); Action action = new Action(Action.TALK_TO); action.setConditions(conversationReference.getConditions()); action.setDocumentation(conversationReference.getDocumentation()); TriggerConversationEffect effect = new TriggerConversationEffect(conversationReference.getTargetId()); action.getEffects().add(effect); npc.addAction(action); reading = READING_NONE; } // Reset the current string currentstring = ""; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the end element call subParser.endElement(namespaceURI, sName, qName); // If the condition is being closed if (qName.Equals("condition")) { // Add the condition to the resources if (reading == READING_RESOURCES) { currentResources.setConditions(currentConditions); } // Add the condition to the conversation reference if (reading == READING_CONVERSATION_REFERENCE) { conversationReference.setConditions(currentConditions); } // Stop subparsing subParsing = SUBPARSING_NONE; } } else if (subParsing == SUBPARSING_ACTIONS) { subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("actions")) { subParsing = SUBPARSING_NONE; } } // If it is a description tag, create the new description (with its id) else if (subParsing == SUBPARSING_DESCRIPTION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); if (qName.Equals("description")) { this.descriptions.Add(description); 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; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#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 it is a book tag, add the book to the game data if (qName.Equals("book")) { chapter.addBook(book); } // If it is a resources tag, add the resources to the book else if (qName.Equals("resources")) { book.addResources(currentResources); } // If it is a documentation tag, hold the documentation in the book else if (qName.Equals("documentation")) { book.setDocumentation(currentstring.ToString().Trim()); } // If it is a text tag, add the text to the book else if (qName.Equals("text")) { // Add the new text paragraph if (currentstring != null && currentstring.ToString().Trim().Replace("\t", "").Replace("\n", "").Length > 0) { book.addParagraph(new BookParagraph(BookParagraph.TEXT, currentstring.ToString().Trim().Replace("\t", ""))); } } // If it is a title tag, add the text to the book else if (qName.Equals("title")) { // Add the new title paragraph if (currentstring != null) { book.addParagraph(new BookParagraph(BookParagraph.TITLE, currentstring.ToString().Trim().Replace("\t", ""))); } } else if (qName.Equals("bullet")) { // Add the new bullet paragraph if (currentstring != null) { book.addParagraph(new BookParagraph(BookParagraph.BULLET, currentstring.ToString().Trim().Replace("\t", ""))); } } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the end element call conditionSubParser.endElement(namespaceURI, sName, qName); // If the condition is being closed, add the conditions to the resources if (qName.Equals("condition")) { currentResources.setConditions(currentConditions); subParsing = SUBPARSING_NONE; } } }