2019-09-11 15:06:30 +02:00
|
|
|
#include "entity_data_container.h"
|
|
|
|
|
2019-10-08 13:37:08 +02:00
|
|
|
Dictionary EntityDataContainer::to_dict() {
|
|
|
|
return call("_to_dict");
|
|
|
|
}
|
|
|
|
void EntityDataContainer::from_dict(const Dictionary &dict) {
|
|
|
|
call("_from_dict", dict);
|
|
|
|
}
|
|
|
|
|
|
|
|
Dictionary EntityDataContainer::_to_dict() {
|
|
|
|
Dictionary dict;
|
|
|
|
|
|
|
|
dict["class_name"] = get_class_static();
|
|
|
|
|
|
|
|
return dict;
|
|
|
|
}
|
|
|
|
void EntityDataContainer::_from_dict(const Dictionary &dict) {
|
|
|
|
ERR_FAIL_COND(dict.empty());
|
|
|
|
}
|
2019-09-11 15:06:30 +02:00
|
|
|
|
|
|
|
EntityDataContainer::EntityDataContainer() {
|
|
|
|
}
|
|
|
|
EntityDataContainer::~EntityDataContainer() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void EntityDataContainer::_bind_methods() {
|
2019-10-08 13:37:08 +02:00
|
|
|
//Serialization
|
|
|
|
BIND_VMETHOD(MethodInfo("_from_dict", PropertyInfo(Variant::DICTIONARY, "dict")));
|
|
|
|
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::DICTIONARY, "dict"), "_to_dict"));
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("from_dict", "dict"), &EntityDataContainer::from_dict);
|
|
|
|
ClassDB::bind_method(D_METHOD("to_dict"), &EntityDataContainer::to_dict);
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("_from_dict", "dict"), &EntityDataContainer::_from_dict);
|
|
|
|
ClassDB::bind_method(D_METHOD("_to_dict"), &EntityDataContainer::_to_dict);
|
2019-09-11 15:06:30 +02:00
|
|
|
}
|