bool ConditionScript::LoadFromXml(TiXmlElement *node) { TiXmlElement *sc_node = node->FirstChildElement(); if (!sc_node) return false; for (;sc_node;sc_node = sc_node->NextSiblingElement()) { if (sc_node->ValueStr() == "calaos:script") { string type = ""; if (sc_node->Attribute("type")) type = sc_node->Attribute("type"); if (type == "lua") { TiXmlText *tnode = dynamic_cast<TiXmlText *>(sc_node->FirstChild()); if (tnode) script = tnode->ValueStr(); } } else if (sc_node->ValueStr() == "calaos:input" && sc_node->Attribute("id")) { string id = sc_node->Attribute("id"); IOBase *in = ListeRoom::Instance().get_io(id); if (in) in_event[in] = in; } } return true; }
bool ActionScript::LoadFromXml(TiXmlElement *pnode) { TiXmlElement *sc_node = pnode->FirstChildElement("calaos:script"); if (!sc_node) return false; std::string type = ""; if (sc_node->Attribute("type")) type = sc_node->Attribute("type"); if (type == "lua") { TiXmlText *tnode = dynamic_cast<TiXmlText *>(sc_node->FirstChild()); if (tnode) script = tnode->ValueStr(); } return true; }
bool ActionMail::LoadFromXml(TiXmlElement *pnode) { TiXmlElement *mail_node = pnode->FirstChildElement("calaos:mail"); if (!mail_node) return false; if (mail_node->Attribute("sender")) mail_sender = mail_node->Attribute("sender"); if (mail_node->Attribute("recipients")) mail_recipients = mail_node->Attribute("recipients"); if (mail_node->Attribute("subject")) mail_subject = mail_node->Attribute("subject"); if (mail_node->Attribute("attachment")) mail_attachment = mail_node->Attribute("attachment"); //remove spaces replace_str(mail_recipients, " ", ""); TiXmlText *tnode = dynamic_cast<TiXmlText *>(mail_node->FirstChild()); if (tnode) mail_message = tnode->ValueStr(); return true; }
bool EntityRecipe::SpecIterator::Visit(const TiXmlText& textNode) { // We should be the only child of our parent if (textNode.Parent()->FirstChild() != textNode.Parent()->LastChild()) { return false; } std::string text = textNode.ValueStr(); // If text looks like placeholder, try to look up it in bindings and associate if found if (!text.empty() && text.at(0) == '$') { BindingsStore::iterator bindings = mRecipe->mBindings.find(text.substr(1)); if (bindings != mRecipe->mBindings.end()) { bindings->second->associateXmlElement(const_cast<TiXmlNode&> (*textNode.Parent())); S_LOG_VERBOSE("Associated " << bindings->first << " with " << text); } else { S_LOG_WARNING("Binding for " << text << " not found."); } } return true; }