//------------------------------------------------------------------------------------- void Proxy::initClientCellPropertys() { if(getClientMailbox() == NULL) return; Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(ClientInterface::onUpdatePropertys); (*pBundle) << this->getID(); ENTITY_PROPERTY_UID spaceuid = ENTITY_BASE_PROPERTY_UTYPE_SPACEID; Mercury::FixedMessages::MSGInfo* msgInfo = Mercury::FixedMessages::getSingleton().isFixed("Property::spaceID"); if(msgInfo != NULL) { spaceuid = msgInfo->msgid; } (*pBundle) << spaceuid << this->getSpaceID(); MemoryStream* s = MemoryStream::ObjPool().createObject(); addPositionAndDirectionToStream(*s); (*pBundle).append(s); MemoryStream::ObjPool().reclaimObject(s); // celldata获取客户端感兴趣的数据初始化客户端 如:ALL_CLIENTS s = MemoryStream::ObjPool().createObject(); addCellDataToStream(ED_FLAG_ALL_CLIENTS|ED_FLAG_CELL_PUBLIC_AND_OWN|ED_FLAG_OWN_CLIENT, s); (*pBundle).append(*s); MemoryStream::ObjPool().reclaimObject(s); //getClientMailbox()->postMail((*pBundle)); //Mercury::Bundle::ObjPool().reclaimObject(pBundle); sendToClient(ClientInterface::onUpdatePropertys, pBundle); }
//------------------------------------------------------------------------------------- void Entity::backupCellData() { AUTO_SCOPED_PROFILE("backup"); if(baseMailbox_ != NULL) { // 将当前的cell部分数据打包 一起发送给base部分备份 Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(BaseappInterface::onBackupEntityCellData); (*pBundle) << id_; MemoryStream* s = MemoryStream::ObjPool().createObject(); addPositionAndDirectionToStream(*s); (*pBundle).append(s); MemoryStream::ObjPool().reclaimObject(s); s = MemoryStream::ObjPool().createObject(); addCellDataToStream(ENTITY_CELL_DATA_FLAGS, s); (*pBundle).append(s); MemoryStream::ObjPool().reclaimObject(s); baseMailbox_->postMail((*pBundle)); Mercury::Bundle::ObjPool().reclaimObject(pBundle); } else { WARNING_MSG(boost::format("Entity::backupCellData(): %1% %2% has no base!\n") % this->getScriptName() % this->getID()); } }
//------------------------------------------------------------------------------------- void Proxy::initClientCellPropertys() { if(clientMailbox() == NULL) return; Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(ClientInterface::onUpdatePropertys); (*pBundle) << this->id(); ENTITY_PROPERTY_UID spaceuid = ENTITY_BASE_PROPERTY_UTYPE_SPACEID; Mercury::FixedMessages::MSGInfo* msgInfo = Mercury::FixedMessages::getSingleton().isFixed("Property::spaceID"); if(msgInfo != NULL) { spaceuid = msgInfo->msgid; } if(scriptModule()->usePropertyDescrAlias()) { uint8 aliasID = ENTITY_BASE_PROPERTY_ALIASID_SPACEID; (*pBundle) << aliasID << this->spaceID(); } else { (*pBundle) << spaceuid << this->spaceID(); } MemoryStream* s = MemoryStream::ObjPool().createObject(); // celldata获取客户端感兴趣的数据初始化客户端 如:ALL_CLIENTS addCellDataToStream(ED_FLAG_ALL_CLIENTS|ED_FLAG_CELL_PUBLIC_AND_OWN|ED_FLAG_OWN_CLIENT, s, true); (*pBundle).append(*s); MemoryStream::ObjPool().reclaimObject(s); //clientMailbox()->postMail((*pBundle)); //Mercury::Bundle::ObjPool().reclaimObject(pBundle); sendToClient(ClientInterface::onUpdatePropertys, pBundle); }