static int js_atomic_destroy(duk_context* ctx)
{
    if (!duk_is_object(ctx, 0))
        return 0;

    Object* obj = js_to_class_instance<Object>(ctx, 0, 0);

    if (!obj)
        return 0;

    if (obj->GetType() == Node::GetTypeStatic())
    {
        Node* node = (Node*) obj;
        js_atomic_destroy_node(node, ctx, true);
        return 0;
    }
    if (obj->GetType() == Scene::GetTypeStatic())
    {
        Scene* scene = (Scene*) obj;
        js_atomic_destroy_scene(scene, ctx);
        return 0;
    }
    else if (obj->GetType() == JSComponent::GetTypeStatic())
    {
        // FIXME: want to be able to destroy a single component
        assert(0);
        JSComponent* component = (JSComponent*) obj;
        component->UnsubscribeFromAllEvents();
        component->Remove();
        return 0;
    }

    return 0;
}
void JSUI::HandleObjectAdded(StringHash eventType, VariantMap& eventData)
{
    RefCounted* ref = static_cast<RefCounted*>(eventData[ObjectAdded::P_OBJECT].GetPtr());

    assert(ref->IsObject());

    Object* o = (Object*) ref;

    // for any UI type, we make sure it is kept alive
    if (uiTypes_.Contains(o->GetType()))
    {
        assert(o->JSGetHeapPtr());

        duk_push_global_stash(ctx_);
        duk_get_prop_string(ctx_, -1, "__jsui_widgetkeepalive");
        // can't use instance as key, as this coerces to [Object] for
        // string property, pointer will be string representation of
        // address, so, unique key
        duk_push_pointer(ctx_, o);
        duk_push_heapptr(ctx_, o->JSGetHeapPtr());
        duk_put_prop(ctx_, -3);
        duk_pop_2(ctx_);

    }

}
Example #3
0
File: AI.cpp Project: txal/XProject
void MonsterAI::SearchNearTarget(int64_t nNowMS)
{
	if (nNowMS < m_nNextSearchTime)
	{
		return;
	}
	m_nNextSearchTime = nNowMS + 2000;

	m_poTarget = NULL;
	int nMinDistance = 0;
	Point& oMyPos = m_poActor->GetPos();

	Actor* poMonster = NULL; //玩家要守护的东西
	Actor* poNearTar = NULL; //最近的目标

	Scene* poScene = m_poActor->GetScene();
	Scene::ObjMap& oObjMap = poScene->GetObjMap();
	Scene::ObjIter iter = oObjMap.begin();
	Scene::ObjIter iter_end = oObjMap.end();
	for (; iter != iter_end; ++iter)
	{
		Object* poObj = iter->second;
		if (poObj->GetType() != eOT_Role
			&& poObj->GetType() != eOT_Monster)
		{
			continue;
		}

		Actor* poActor = (Actor*)poObj;
		//if (m_poActor == poActor || poActor->IsDead() || poActor->GetScene() != poScene || !m_poActor->CheckCamp(poActor))
		//{
		//	continue;
		//}

		if (poActor->GetType() == eOT_Monster)
		{
			poMonster = poActor;
		}

		Point& oTarPos = poActor->GetPos();
		int nDistance = oMyPos.Distance(oTarPos);
		if (nMinDistance == 0 || nDistance < nMinDistance)
		{
			nMinDistance = nDistance;
			poNearTar = poActor;
		}
	}
	m_poTarget = poNearTar;

	//如果最近的目标在攻击距离外,则选择玩家保护的东西作为目标,否则就攻击最近的目标
	if (poNearTar != NULL)
	{
		int nAtkDist = m_poAction->GetAtkDist();
		int nTarDist = oMyPos.Distance(poNearTar->GetPos());
		if (nTarDist > nAtkDist && poMonster != NULL)
		{
			m_poTarget = poMonster;
		}
	}
}
/* method: "get_text_raw(s)\nGet the unevaluated Text from Text objects." */
static utf8_string Shape_get_text_raw(const Object& self){
  auto text = dynamic_cast<const ObjText*>(&self);
  if (!text){
    throw ValueError(space_sep(self.GetType(), "does not support text."));
  }
  return text->GetRawString();
}
Example #5
0
bool ObjectArray::IsNil (int i){
    if(i<0 || i >= array.size())
        throw EXCEPTION_ARRAY_OUT_OF_BOUNDS;
    Object * obj = array[i];
    if (obj == NULL)
        throw EXCEPTION_ARRAY_NULL_ENTRY;
    return obj->GetType() == TYPE_NIL;
}
/* method: "get_text_lines()->(s,...)\n
Returns the evaluated text from a Text-object split into lines. Takes
the bounding rectangle in consideration, so that the lines are split in
the same way as they appear in Faint." */
static text_lines_t Shape_get_text_lines(const Object& self){
  auto text = dynamic_cast<const ObjText*>(&self);
  if (!text){
    throw TypeError(space_sep(self.GetType(), "does not support text."));
  }

  NullExpressionContext ctx;
  return split_evaluated(ctx, *text);
}
Example #7
0
	DllExport
	void * urho_map_get_object(VariantMap &map, int hash, int* objHash)
	{
		StringHash h(hash);
		void* ptr = map[h].GetVoidPtr();
		Object * object = static_cast<Object *>(ptr);
		*objHash = object->GetType().Value(); //GetType is virtual
		return ptr;
	}
Example #8
0
double ObjectArray::GetDouble (int i){
    if(i<0 || i >= array.size())
        throw EXCEPTION_ARRAY_OUT_OF_BOUNDS;
    Object * obj = array[i];
    if (obj == NULL)
        throw EXCEPTION_ARRAY_NULL_ENTRY;
    if(obj->GetType() == TYPE_DOUBLE)
        return dynamic_cast<Native*>(obj)->GetDouble();
    throw EXCEPTION_WRONG_TYPE;
}
Example #9
0
std::string ObjectArray::GetString (int i){
    if(i<0 || i >= array.size())
        throw EXCEPTION_ARRAY_OUT_OF_BOUNDS;
    Object * obj = array[i];
    if (obj == NULL)
        throw EXCEPTION_ARRAY_NULL_ENTRY;
    if(obj->GetType() == TYPE_STRING)
        return dynamic_cast<Native*>(obj)->GetString();
    throw EXCEPTION_WRONG_TYPE;
}
Example #10
0
File: AI.cpp Project: txal/XProject
void RobotAI::SearchViewTarget(int64_t nNowMS)
{
	if (nNowMS < m_nNextSearchTime)
	{
		return;
	}
	m_nNextSearchTime = nNowMS + 2000;

	Point& oMyPos = m_poActor->GetPos();
	Scene* poScene = m_poActor->GetScene();
	MapConf* poMapConf = poScene->GetMapConf();

	m_poTarget = NULL;
	int nMaxHateVal = 0;

	Array<AOIOBJ*>& oObjList = poScene->GetAreaObserveds(m_poActor->GetAOIID(), 0);
	for (int i = 0; i < oObjList.Size(); ++i)
	{
		Object* poObj = oObjList[i]->poGameObj;
		int nObjType = poObj->GetType();
		if (nObjType != eOT_Role && nObjType != eOT_Robot)
		{
			continue;
		}

		Actor* poTarget = (Actor*)poObj;
		//if (m_poActor == poTarget || poTarget->IsDead() || poTarget->GetScene() != poScene || !m_poActor->CheckCamp(poTarget))
		//{
		//	continue;
		//}

		int nHateVal = 0;
		//HATE* poHate = m_poActor->GetHate(poTarget->GetID());
		//if (poHate != NULL)
		//{
		//	int nRelives = poTarget->GetRelives();
		//	if (nRelives != poHate->uRelives)
		//	{
		//		poHate->nValue = 0;
		//		poHate->uRelives = (uint8_t)nRelives;
		//	}
		//	nHateVal = poHate->nValue;
		//}
		//XLog(LEVEL_DEBUG, "%s Hate %s %d\n", m_poActor->GetName(), poTarget->GetName(), nHateVal);

		Point& oTarPos = poTarget->GetPos();
		if ((nMaxHateVal == 0 || nHateVal > nMaxHateVal) && BattleUtil::FloydCrossAble(poMapConf, oMyPos.x, oMyPos.y, oTarPos.x, oTarPos.y))
		{
			m_poTarget = poTarget;
			nMaxHateVal = nHateVal;
		}
	}
	//XLog(LEVEL_DEBUG, "%s Search hate target %s\n", m_poActor->GetName(), m_poTarget?m_poTarget->GetName():"null");
}
Example #11
0
static Deserializer* CastToDeserializer(duk_context* ctx, int index)
{
    Object* o = js_to_class_instance<Object>(ctx, index, 0);
    Deserializer* deserial = NULL;

    if (!o)
        return NULL;

    // type check! file supported for now
    if (o->GetType() == File::GetTypeStatic())
    {
        // cast it!
        deserial = (Deserializer*) ((File*)o);
    }

    return deserial;

}
void ViewOfCollection2::Build()
{
	ASSERT(0);
#if 0
	UI::TreeControl* pTree = new UI::TreeControl;

	pTree->AddColumn(new UI::TextString(WSTR("Name")));
	//pTree->m_treeHeader->AddColumn(new UI::TextString(L"Value"));

	UI::TreeItemChildren* children = new UI::TreeItemChildren(pTree);
	unsigned long count = m_pCollection->GetCount();
	for (int i = 0; i < count; i++)
	{
		Object* child = m_pCollection->GetItem(i);

		StringA* classname = child->GetType()->m_qname;
		/*
		{
			void* vtable = *(void**)child.m_p;
			rti* p3 = ((rti**)vtable)[-1];

			int count = p3->m_classHierarchyDescriptor->count;
			BaseClassDescriptor** table = p3->m_classHierarchyDescriptor->m_baseClassArray;

			Type_Info* ti = (Type_Info*)table[0]->typedesc;
			classname = ti->name() + strlen("class ");
		}
		*/

		UI::TreeItem* row = new UI::TreeItem(pTree);

		m_rows.Add(row);

		row->AppendColumnCell(new UI::TextString(classname->ToStringW()));

		children->AppendItem(row);
	}

	pTree->set_Children(children);

	set_VisualTree(pTree);
#endif
}
Example #13
0
String GetStringFromDictionary(Object dict, KeyType key)
{
    StringStream ss;
    switch (dict->GetType(key))
    {
        case VTYPE_BOOL:
            ss << (dict->GetBool(key) ? TEXT("true") : TEXT("false"));
            break;
        case VTYPE_INT:
            ss << dict->GetInt(key);
            break;
        case VTYPE_DOUBLE:
            ss << dict->GetDouble(key);
            break;
        case VTYPE_STRING:
            ss << String(dict->GetString(key));
            break;
        case VTYPE_LIST:
        {
            ss << TEXT("[");
            Array list = dict->GetList(key);
            size_t len = list->GetSize();
            for (size_t i = 0; i < len; ++i)
            {
                if (i > 0)
                    ss << TEXT(",");
                ss << TEXT("\"") << JSONEscape(list->GetString((int) i)) << TEXT("\"");
            }
            ss << TEXT("]");
        }
            break;
        case VTYPE_INVALID:
            ss << TEXT("invalid");
            break;
        case VTYPE_NULL:
            ss << TEXT("null");
            break;
        default:
            break;
    }
    
    return ss.str();
}
Example #14
0
File: AI.cpp Project: txal/XProject
void RobotAI::SearchNearTarget(int64_t nNowMS)
{ 
	if (nNowMS < m_nNextSearchTime)
	{
		return;
	}
	m_nNextSearchTime = nNowMS + 2000;

	m_poTarget = NULL;
	int nMinDistance = 0;
	Point& oMyPos = m_poActor->GetPos();

	Scene* poScene = m_poActor->GetScene();
	Array<AOIOBJ*>& oObjList = poScene->GetAreaObserveds(m_poActor->GetAOIID(), 0);
	for (int i = 0; i < oObjList.Size(); ++i)
	{
		Object* poObj = oObjList[i]->poGameObj;
		if (poObj->GetType() != eOT_Role
			&& poObj->GetType() != eOT_Robot)
		{
			continue;
		}

		Actor* poActor = (Actor*)poObj;
		//if (m_poActor == poActor || poActor->IsDead() || poActor->GetScene() != poScene || !m_poActor->CheckCamp(poActor))
		//{
		//	continue;
		//}

		Point& oTarPos = poActor->GetPos();
		int nDistance = oMyPos.Distance(oTarPos);
		if (nMinDistance == 0 || nDistance < nMinDistance)
		{
			nMinDistance = nDistance;
			m_poTarget = poActor;
		}
	}
}
static Deserializer* CastToDeserializer(duk_context* ctx, int index)
{
    Object* o = js_to_class_instance<Object>(ctx, index, 0);
    Deserializer* deserial = NULL;

    if (!o)
        return NULL;

    // Type check! Only File and BufferQueue are supported for now.
    StringHash type(o->GetType());
    if (type == File::GetTypeStatic())
    {
        // Cast it!
        deserial = (Deserializer*)((File*)o);
    }
    else if (type == BufferQueue::GetTypeStatic())
    {
        // Cast it!
        deserial = (Deserializer*)((BufferQueue*)o);
    }

    return deserial;

}
Example #16
0
void Tilemap::RenderObjectLayer(sf::RenderWindow& _window, priv::Layer& _layer)
{
	sf::Vector2i offset = camera->GetTileOffset(tile_dimensions.x, tile_dimensions.y);
	sf::IntRect bounds = camera->GetBounds(tile_dimensions.x, tile_dimensions.y);

	// Downcast the layer from Layer to ObjectLayer
	priv::ObjectLayer* object_layer = dynamic_cast<priv::ObjectLayer*>(&_layer);
	for (int i = 0; i < object_layer->GetNumObjects(); ++i)
	{
		Object* object = object_layer->GetObject(i);

		sf::Vector2i position = object->GetPosition();

		// The camera bounds is given to us in tiles, so we
		// need to convert it to pixels because the objects
		// in Tiled use pixels as their positional unit. This is
		// because they can exist between tiles.
		sf::IntRect bounds_px(bounds.left, bounds.top, bounds.width * tile_dimensions.x, bounds.height * tile_dimensions.y);

		if (bounds_px.contains(position))
		{
			string type = object->GetType();
			if (type == "tile")
			{
				int gid = object->GetGid();

				// The origin of the objects in Tiled is in the bottom left corner
				// for some odd reason, so we have to adjust for that here.
				const float pos_x = (const float)object->GetPosition().x - camera->GetPosition().x;
				const float pos_y = (const float)object->GetPosition().y - camera->GetPosition().y - tile_dimensions.y;

				tileset.RenderTile(_window, gid, pos_x, pos_y);
			}
		}
	}
}
Example #17
0
std::string Map::GetString (const std::string & key){
    Object * obj = GetObject(key);
    if(obj!=NULL && obj->GetType() == TYPE_STRING)
        return dynamic_cast<Native*>(obj)->GetString();
    throw EXCEPTION_WRONG_TYPE;
}
Example #18
0
double Map::GetDouble (const std::string & key){
    Object * obj = GetObject(key);
    if(obj!=NULL && obj->GetType() == TYPE_DOUBLE)
        return dynamic_cast<Native*>(obj)->GetFloat();
    throw EXCEPTION_WRONG_TYPE;
}
Example #19
0
int32_t Map::GetInteger (const std::string & key){
    Object * obj = GetObject(key);
    if(obj!=NULL && obj->GetType() == TYPE_INT)
        return dynamic_cast<Native*>(obj)->GetInt();
    throw EXCEPTION_WRONG_TYPE;
}
Example #20
0
uint8_t Map::GetByte (const std::string & key){
    Object * obj = GetObject(key);
    if(obj!=NULL && obj->GetType() == TYPE_BYTE)
        return dynamic_cast<Native*>(obj)->GetByte();
    throw EXCEPTION_WRONG_TYPE;
}
Example #21
0
bool Map::GetBoolean (const std::string & key){
    Object * obj = GetObject(key);
    if(obj!=NULL && obj->GetType() == TYPE_BOOLEAN)
        return dynamic_cast<Native*>(obj)->GetBoolean();
    throw EXCEPTION_WRONG_TYPE;
}
Example #22
0
bool Map::IsNil (const std::string & key){
    Object * obj = GetObject(key);
    return obj!=NULL && obj->GetType() == TYPE_NIL;
}
/* method: "get_type()->s\n
Returns the type of the object, as a string." */
static utf8_string Shape_get_type(const Object& self){
  return self.GetType();
}
Example #24
0
int main(int argc, char** argv)
{
    //constuct aoi instance
    TowerAoi::TowerAoi<Object>* aoi = new TowerAoi::TowerAoi<Object>(MAP_X, MAP_Y, TOWER_X, TOWER_Y);

    //register callback functions
    aoi->RegisterCallBackFunc(ObjectAdded, ObjectRemoved, ObjectMoved, WatcherMoved);

    srand(time(NULL));
    map<uint32, Object*> objs;
    for (uint32 i = 1; i <= OBJECT_NUM; i++) {
        //construct obj
        Object* obj = new Object(i, rand()%TYPE_NUM);
        objs[i] = obj;
        Location pos = GetRandLocaion();
        obj->SetPos(pos);
        //add as watcher
        if (i < WATCHER_NUM) {
            obj->m_isWatcher = true;
            aoi->AddWatcher(obj, pos, RANGE_TOWER);
            aoi->CheckConsistency();
        }
        //add as normal object
        aoi->AddObject(obj, pos);
        aoi->CheckConsistency();
    }

    //interactive test
    char command[1024] = {0};
    vector<string> strVec;
#define PROMPT {printf("invalid command.\n"); continue;}
    while (true) {
        strVec.clear();
        printf("**************************************\n");
        printf("* obj id 1~%d\n", objs.size());
        printf("* s objId --show object info: id, type, pos\n");
        printf("* m objId endx endy --move obj to pos(endx,endy)\n");
        printf("* c --check data consistency\n");
        printf("* a --add new object\n");
        printf("* d objId --remove object\n");
        printf("* p opNum --random operate aoi opNum times\n");
        printf("* Q --quit interactive mode\n");
        printf("**************************************\n");
        //scanf("%s", command);
        //gets(command);
        if (!fgets(command, 1024, stdin)) PROMPT;
        SplitString(strVec, command);
        if (strVec.size() < 1) PROMPT;
        if (strVec[0].compare("s") == 0) {
            if (strVec.size() < 2) PROMPT;
            uint32 objId = atoi(strVec[1].c_str());
            map<uint32, Object*>::iterator it = objs.find(objId);
            if (it == objs.end()) PROMPT;
            Object* obj = objs[objId];
            printf("obj: id(%d) type(%d) pos(%d,%d) isWatcher(%d)\n", obj->GetId(), obj->GetType(),
                   obj->m_pos.x, obj->m_pos.y, obj->m_isWatcher?1:0);
        } else if (strVec[0].compare("m") == 0) {
            if (strVec.size() < 4) PROMPT;
            uint32 objId = atoi(strVec[1].c_str());
            map<uint32, Object*>::iterator it = objs.find(objId);
            if (it == objs.end()) PROMPT;
            Object* obj = objs[objId];
            Location pos(0,0);
            pos.x = atoi(strVec[2].c_str());
            pos.y = atoi(strVec[3].c_str());
            if (aoi->UpdateObject(obj, obj->m_pos, pos)) {
                if (obj->m_isWatcher)
                    aoi->UpdateWatcher(obj, obj->m_pos, RANGE_TOWER, pos, RANGE_TOWER);
                obj->SetPos(pos);
            }
            /*aoi->CheckConsistency();*/
        } else if (strVec[0].compare("a") == 0) {
            AddRandomObject(objs, aoi);
            /*aoi->CheckConsistency();*/
        } else if (strVec[0].compare("d") == 0) {
            if (strVec.size() < 2) PROMPT;
            uint32 objId = atoi(strVec[1].c_str());
            map<uint32, Object*>::iterator it = objs.find(objId);
            if (it == objs.end()) PROMPT;
            Object* obj = objs[objId];
            aoi->RemoveObject(obj, obj->m_pos);
            if (obj->m_isWatcher)
                aoi->RemoveWatcher(obj, obj->m_pos, RANGE_TOWER);
            delete obj;
            objs.erase(it);
            /*aoi->CheckConsistency();*/
        } else if (strVec[0].compare("p") == 0) {
            if (strVec.size() < 2) PROMPT;
            uint32 opNum = atoi(strVec[1].c_str());
            for (uint32 num = 0; num < opNum; num++) {
                uint8 op = rand()%3;
                if (op == 0) { // add object
                    AddRandomObject(objs, aoi);
                } else if (op == 1) { //delete object
                    Object* obj = GetRandomObject(objs);
                    if (obj) {
                        aoi->RemoveObject(obj, obj->m_pos);
                        if (obj->m_isWatcher)
                            aoi->RemoveWatcher(obj, obj->m_pos, RANGE_TOWER);
                        objs.erase(obj->GetId());
                        delete obj;
                    }
                } else { //move object
                    Object* obj = GetRandomObject(objs);
                    if (obj) {
                        Location pos = GetRandLocaion();
                        if (aoi->UpdateObject(obj, obj->m_pos, pos)) {
                            if (obj->m_isWatcher)
                                aoi->UpdateWatcher(obj, obj->m_pos, RANGE_TOWER, pos, RANGE_TOWER);
                            obj->SetPos(pos);
                        }
                    }
                }
            }
            /*aoi->CheckConsistency();*/
        } else if (strVec[0].compare("c") == 0) {
            aoi->CheckConsistency();
            printf("data is all right\n");
        } else if (strVec[0].compare("Q") == 0) {
            break;
        }
    }

    //clear
    for (map<uint32, Object*>::iterator it = objs.begin(); it != objs.end(); it++) {
        delete it->second;
    }
    delete aoi;

    printf("press enter to continue...");
    getchar();
    return 0;
}
Example #25
0
static int js_atomic_destroy(duk_context* ctx)
{
    if (!duk_is_object(ctx, 0))
        return 0;

    Object* obj = js_to_class_instance<Object>(ctx, 0, 0);

    if (!obj)
        return 0;

    JSVM* vm = JSVM::GetJSVM(ctx);

    if (obj->GetType() == Node::GetTypeStatic())
    {

        Node* node = (Node*) obj;

        if (node->JSGetHeapPtr())
        {
            int top = duk_get_top(ctx);
            duk_push_global_stash(ctx);
            duk_get_prop_index(ctx, -1, JS_GLOBALSTASH_INDEX_NODE_REGISTRY);
            duk_push_pointer(ctx, node->JSGetHeapPtr());
            duk_del_prop(ctx, -2);
            duk_pop_2(ctx);
            assert(top = duk_get_top(ctx));
        }

        const Vector<SharedPtr<Component> >& components = node->GetComponents();

        for (unsigned i = 0; i < components.Size(); i++)
        {
             Component* component = components[i];

             if (component->GetType() == JSComponent::GetTypeStatic())
             {
                 JSComponent* jscomponent = (JSComponent*) component;
                 jscomponent->SetDestroyed();
             }

             component->UnsubscribeFromAllEvents();
        }

        node->RemoveAllComponents();
        node->UnsubscribeFromAllEvents();

        assert(node->Refs() >= 2);

        node->Remove();

        return 0;
    }
    else if (obj->GetType() == JSComponent::GetTypeStatic())
    {
        assert(0);
        JSComponent* component = (JSComponent*) obj;
        component->UnsubscribeFromAllEvents();
        component->Remove();
        return 0;
    }

    return 0;
}
void SceneView3D::HandleDragEnterWidget(StringHash eventType, VariantMap& eventData)
{
    using namespace DragEnterWidget;

    UIWidget* widget = static_cast<UIWidget*>(eventData[P_WIDGET].GetPtr());

    if (widget != this)
        return;

    UIDragObject* dragObject = static_cast<UIDragObject*>(eventData[P_DRAGOBJECT].GetPtr());

    Object* object = dragObject->GetObject();

    if (!object)
        return;

    if (object->GetType() == Asset::GetTypeStatic())
    {
        Asset* asset = (Asset*) object;
        AssetImporter* importer = asset->GetImporter();

        if (!importer)
            return;

        StringHash importerType = importer->GetType();

        if (importerType == PrefabImporter::GetTypeStatic())
        {
            dragNode_ = scene_->CreateChild(asset->GetName());
            PrefabComponent* pc = dragNode_->CreateComponent<PrefabComponent>();
            pc->SetPrefabGUID(asset->GetGUID());
        }
        else if (importerType == ModelImporter::GetTypeNameStatic())
        {
            dragNode_ = scene_->CreateChild();

            SharedPtr<File> file(new File(context_, asset->GetCachePath()));
            SharedPtr<XMLFile> xml(new XMLFile(context_));

            if (!xml->Load(*file))
                return;

            dragNode_->LoadXML(xml->GetRoot());
            dragNode_->SetName(asset->GetName());
        }
        else if (importerType == SpriterImporter::GetTypeNameStatic())
        {
            AnimationSet2D* animationSet = GetSubsystem<ResourceCache>()->GetResource<AnimationSet2D>(asset->GetPath());

            String animationName;

            if (animationSet && animationSet->GetNumAnimations())
            {
                animationName = animationSet->GetAnimation(0)->GetName();
            }

            dragNode_ = scene_->CreateChild(asset->GetName());

            AnimatedSprite2D* sprite = dragNode_->CreateComponent<AnimatedSprite2D>();

            if (!animationName.Length())
                sprite->SetAnimationSet(animationSet);
            else
                sprite->SetAnimation(animationSet, animationName);

        }
        else if (importerType == TextureImporter::GetTypeNameStatic())
        {
            dragNode_ = scene_->CreateChild(asset->GetName());

            Sprite2D* spriteGraphic = GetSubsystem<ResourceCache>()->GetResource<Sprite2D>(asset->GetPath());

            StaticSprite2D* sprite = dragNode_->CreateComponent<StaticSprite2D>();

            sprite->SetSprite(spriteGraphic);
        }


        if (dragNode_.NotNull())
        {
            Input* input = GetSubsystem<Input>();
            IntVector2 pos = input->GetMousePosition();
            UpdateDragNode(pos.x_, pos.y_);
        }



        //LOGINFOF("Dropped %s : %s on SceneView3D", asset->GetPath().CString(), asset->GetGUID().CString());
    }

}