entity_spell_system/drag_and_drop/es_drag_and_drop.cpp

51 lines
1.7 KiB
C++
Raw Normal View History

2019-04-20 14:02:55 +02:00
#include "es_drag_and_drop.h"
2019-11-04 21:00:17 +01:00
const String ESDragAndDrop::BINDING_STRING_ES_DRAG_AND_DROP_TYPE = "None,Spell,Item,Inventory Item,Equipped Item";
Node *ESDragAndDrop::get_origin() const {
return _origin;
}
void ESDragAndDrop::set_origin(Node *origin) {
_origin = origin;
}
2019-04-20 14:02:55 +02:00
ESDragAndDrop::ESDragAndDropType ESDragAndDrop::get_type() {
return _type;
}
void ESDragAndDrop::set_type(ESDragAndDrop::ESDragAndDropType type) {
_type = type;
}
int ESDragAndDrop::get_item_id() {
return _item_id;
}
void ESDragAndDrop::set_item_id(int item_id) {
_item_id = item_id;
}
ESDragAndDrop::ESDragAndDrop() {
_item_id = 0;
_type = ES_DRAG_AND_DROP_TYPE_NONE;
_origin = NULL;
2019-04-20 14:02:55 +02:00
}
void ESDragAndDrop::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_origin"), &ESDragAndDrop::get_origin);
ClassDB::bind_method(D_METHOD("set_origin", "id"), &ESDragAndDrop::set_origin);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "origin", PROPERTY_HINT_RESOURCE_TYPE, "Node"), "set_origin", "get_origin");
2019-04-20 14:02:55 +02:00
ClassDB::bind_method(D_METHOD("get_type"), &ESDragAndDrop::get_type);
ClassDB::bind_method(D_METHOD("set_type", "type"), &ESDragAndDrop::set_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, BINDING_STRING_ES_DRAG_AND_DROP_TYPE), "set_type", "get_type");
ClassDB::bind_method(D_METHOD("get_item_id"), &ESDragAndDrop::get_item_id);
ClassDB::bind_method(D_METHOD("set_item_id", "id"), &ESDragAndDrop::set_item_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "item_id"), "set_item_id", "get_item_id");
BIND_ENUM_CONSTANT(ES_DRAG_AND_DROP_TYPE_NONE);
BIND_ENUM_CONSTANT(ES_DRAG_AND_DROP_TYPE_SPELL);
BIND_ENUM_CONSTANT(ES_DRAG_AND_DROP_TYPE_ITEM);
BIND_ENUM_CONSTANT(ES_DRAG_AND_DROP_TYPE_INVENTORY_ITEM);
2019-11-04 21:00:17 +01:00
BIND_ENUM_CONSTANT(ES_DRAG_AND_DROP_TYPE_EQUIPPED_ITEM);
2019-04-20 14:02:55 +02:00
}