void EC_DynamicComponent::DeserializeFromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { u8 num_attributes = source.Read<u8>(); std::vector<DeserializeData> deserializedAttributes; for (uint i = 0; i < num_attributes; ++i) { std::string name = source.ReadString(); std::string type = source.ReadString(); std::string value = source.ReadString(); DeserializeData attributeData(name, type, value); deserializedAttributes.push_back(attributeData); } DeserializeCommon(deserializedAttributes, change); }
template<> void TUNDRACORE_API Attribute<AssetReferenceList>::FromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { AssetReferenceList value; u8 numValues = source.Read<u8>(); for(u32 i = 0; i < numValues; ++i) value.Append(AssetReference(source.ReadString().c_str())); Set(value, change); }
template<> void TUNDRACORE_API Attribute<QVariantList>::FromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { QVariantList value; u8 numValues = source.Read<u8>(); for(u32 i = 0; i < numValues; ++i) { std::string str = source.ReadString(); value.append(QVariant(QString(str.c_str()))); } Set(value, change); }
template<> void TUNDRACORE_API Attribute<QVariant>::FromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { std::string str = source.ReadString(); QVariant value(QString(str.c_str())); Set(value, change); }
template<> void TUNDRACORE_API Attribute<EntityReference>::FromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { EntityReference value; value.ref = source.ReadString().c_str(); Set(value, change); }