public object DOMParse(XmlElement element, params object[] parameters) { XmlElement tmpXmlElement; var completable = new Completable(); completable.setId(element.GetAttribute("id")); completable.setRepeatable(element.GetAttribute("repeatable") == "true"); switch (element.GetAttribute("type")) { case "combat": completable.setType(Completable.TYPE_COMBAT); break; case "completable": completable.setType(Completable.TYPE_COMPLETABLE); break; case "game": completable.setType(Completable.TYPE_GAME); break; case "level": completable.setType(Completable.TYPE_LEVEL); break; case "quest": completable.setType(Completable.TYPE_QUEST); break; case "race": completable.setType(Completable.TYPE_RACE); break; case "session": completable.setType(Completable.TYPE_SESSION); break; case "stage": completable.setType(Completable.TYPE_STAGE); break; case "storynode": completable.setType(Completable.TYPE_STORYNODE); break; default: completable.setType(Completable.TYPE_COMPLETABLE); break; } tmpXmlElement = (XmlElement)element.SelectSingleNode("start-milestone"); if (tmpXmlElement != null) { completable.setStart(parseMilestone(tmpXmlElement, parameters)); } tmpXmlElement = (XmlElement)element.SelectSingleNode("end-milestone"); if (tmpXmlElement != null) { completable.setEnd(parseMilestone(tmpXmlElement, parameters)); } tmpXmlElement = (XmlElement)element.SelectSingleNode("progress"); if (tmpXmlElement != null) { completable.setProgress(parseProgress(tmpXmlElement, parameters)); } tmpXmlElement = (XmlElement)element.SelectSingleNode("score"); if (tmpXmlElement != null) { completable.setScore(parseScore(tmpXmlElement, parameters)); } return(completable); }
/** * get all the completables * @param id * the id of the completable to find * @return a completable that matches the id */ public Completable getCompletable(string id) { Completable selectedCompletable = null; foreach (Completable completable in getCompletabes()) { if (completable.getId().Equals(id)) { selectedCompletable = completable; } } return(selectedCompletable); }
/** * adds a completable * @param completable * the completable to add into the list of completables */ public void addCompletable(Completable completable) { getCompletabes().Add(completable); }
//################################################# //################################################# //################################################# public object Clone() { Completable nc = new Completable(); return(nc); }