void TemplateLoader::LoadType<Record::SActorTerm>(Ptr<IO::XmlReader> &xmlReader, Record::SActorTerm &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> vectors; value.Tokenize(Util::String(" "), vectors); switch (vectors.Size()) { case 2: ref.value = vectors[1]; case 1: ref.type = EEActorTermType::Value(vectors[0]); default: break; } }
void TemplateLoader::LoadType<Record::SBaseRange>(Ptr<IO::XmlReader> &xmlReader, Record::SBaseRange &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> vectors; value.Tokenize(Util::String(","), vectors); switch (vectors.Size()) { case 2: ref.range = vectors[1].AsInt(); case 1: ref.base = vectors[0].AsInt(); default: break; } }
void TemplateLoader::LoadType<Record::SFloatRangeMirror>(Ptr<IO::XmlReader> &xmlReader, Record::SFloatRangeMirror &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> vectors; value.Tokenize(Util::String(","), vectors); switch (vectors.Size()) { case 4: ref.positiveMin = AsFloat(vectors[3]); case 3: ref.positiveMax = AsFloat(vectors[2]); case 2: ref.negtiveMin = AsFloat(vectors[1]); case 1: ref.negtiveMax = AsFloat(vectors[0]); default: break; } }
void TemplateLoader::LoadType<Record::SColor>(Ptr<IO::XmlReader> &xmlReader, Record::SColor &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> colors; value.Tokenize(Util::String(","), colors); switch (colors.Size()) { case 4: ref.a = colors[3].AsInt(); case 3: ref.b = colors[2].AsInt(); case 2: ref.g = colors[1].AsInt(); case 1: ref.r = colors[0].AsInt(); default: break; } }
void TemplateLoader::LoadType<Record::STargetFilters>(Ptr<IO::XmlReader> &xmlReader, Record::STargetFilters &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> filterGroups; value.Tokenize(Util::String(";"), filterGroups); for (IndexT gpIdx = 0; gpIdx < filterGroups.Size(); ++gpIdx) { const Util::String& filters = filterGroups[gpIdx]; if (filters != "-" && filters.Length() > 0) { Record::ETargetFilterState state = (Record::ETargetFilterState)(gpIdx); Util::Array<Util::String> filtersToTarget; filters.Tokenize(Util::String(","), filtersToTarget); for (IndexT filterIdx = 0; filterIdx < filtersToTarget.Size(); ++filterIdx) { Record::ETargetFilter filter = Record::EETargetFilter::Value(filtersToTarget[filterIdx]); ref.Filters.Add(filter, state); } } } }
void TemplateLoader::LoadType<Record::SRotator>(Ptr<IO::XmlReader> &xmlReader, Record::SRotator &ref, const Util::StringAtom &attr, Component::TemplateContainer &container){ Util::String value = xmlReader->GetString(attr.Value()); Util::Array<Util::String> vectors; value.Tokenize(Util::String(","), vectors); switch (vectors.Size()) { case 3: ref.pitch = AsFloat(vectors[2]); ref.roll = AsFloat(vectors[1]); ref.yaw = AsFloat(vectors[0]); break; case 2: ref.roll = AsFloat(vectors[1]); ref.yaw = AsFloat(vectors[0]); break; case 1: float vf = AsFloat(vectors[0]); ref.roll = ref.yaw = ref.pitch = vf; break; } }