Exemplo n.º 1
0
//-------------------------------------------------------------------------------------	
void ClientObject::onCreatedEntity(ENTITY_ID eid, std::string& entityType)
{
	INFO_MSG(boost::format("ClientObject::onCreatedEntity(%1%): rndUUID=%2% eid=%3% entityType=%4%!\n") % 
		name_ % eid % entityType);

	// 设置entity的cellMailbox
	EntityMailbox* mailbox = new EntityMailbox(EntityDef::findScriptModule(entityType.c_str()), 
		NULL, appID(), eid, MAILBOX_TYPE_CELL);

	createEntityCommon(entityType.c_str(), NULL, true, eid, true, NULL, mailbox);
}
Exemplo n.º 2
0
//-------------------------------------------------------------------------------------	
void ClientObject::onCreatedProxies(uint64 rndUUID, ENTITY_ID eid, std::string& entityType)
{
	entityID_ = eid;
	INFO_MSG(boost::format("ClientObject::onCreatedProxies(%1%): rndUUID=%2% eid=%3% entityType=%4%!\n") % 
		name_ % rndUUID % eid % entityType);

	// 设置entity的baseMailbox
	EntityMailbox* mailbox = new EntityMailbox(EntityDef::findScriptModule(entityType.c_str()), 
		NULL, appID(), eid, MAILBOX_TYPE_BASE);

	createEntityCommon(entityType.c_str(), NULL, true, eid, true, mailbox, NULL);
}
Exemplo n.º 3
0
//-------------------------------------------------------------------------------------	
void ClientObjectBase::onCreatedProxies(Mercury::Channel * pChannel, uint64 rndUUID, ENTITY_ID eid, std::string& entityType)
{
	if(entityID_ == 0)
	{
		EventData_LoginGatewaySuccess eventdata;
		eventHandler_.fire(&eventdata);
	}

	connectedGateway_ = true;
	entityID_ = eid;
	INFO_MSG(boost::format("ClientObject::onCreatedProxies(%1%): rndUUID=%2% eid=%3% entityType=%4%!\n") % 
		name_ % rndUUID % eid % entityType);

	// 设置entity的baseMailbox
	EntityMailbox* mailbox = new EntityMailbox(EntityDef::findScriptModule(entityType.c_str()), 
		NULL, appID(), eid, MAILBOX_TYPE_BASE);

	createEntityCommon(entityType.c_str(), NULL, true, eid, true, mailbox, NULL);
}
Exemplo n.º 4
0
//-------------------------------------------------------------------------------------	
void ClientObjectBase::onEntityEnterWorld(Mercury::Channel * pChannel, ENTITY_ID eid, ENTITY_SCRIPT_UID scriptType, SPACE_ID spaceID)
{
	client::Entity* entity = pEntities_->find(eid);
	if(entity == NULL)
	{	
		BUFFEREDMESSAGE::iterator iter = bufferedCreateEntityMessage_.find(eid);
		if(iter != bufferedCreateEntityMessage_.end())
		{
			ScriptDefModule* sm = EntityDef::findScriptModule(scriptType);
			KBE_ASSERT(sm);
			
			// 设置entity的cellMailbox
			EntityMailbox* mailbox = new EntityMailbox(EntityDef::findScriptModule(sm->getName()), 
				NULL, appID(), eid, MAILBOX_TYPE_CELL);

			createEntityCommon(sm->getName(), NULL, true, eid, true, NULL, mailbox);

			this->onUpdatePropertys(pChannel, *iter->second.get());
			bufferedCreateEntityMessage_.erase(iter);
		}
		else
		{
			ERROR_MSG(boost::format("ClientObjectBase::onEntityEnterWorld: not found entity(%1%).\n") % eid);
		}
		return;
	}

	DEBUG_MSG(boost::format("ClientObjectBase::onEntityEnterWorld: %1%.\n") % eid);

	EventData_EnterWorld eventdata;
	eventdata.spaceID = spaceID;
	eventdata.pEntity = entity->getAspect();

	eventHandler_.fire(&eventdata);

	entity->onEnterWorld();
}