//------------------------------------------------------------------------------------- void Entity::onTeleportSuccess(PyObject* nearbyEntity, SPACE_ID lastSpaceID) { SCOPED_PROFILE(SCRIPTCALL_PROFILE); SCRIPT_OBJECT_CALL_ARGS1(this, const_cast<char*>("onTeleportSuccess"), const_cast<char*>("O"), nearbyEntity); }
void EntityApp<E>::onBroadcastGlobalDataChange(Mercury::Channel* pChannel, KBEngine::MemoryStream& s) { std::string key, value; bool isDelete; s >> isDelete; s.readBlob(key); if(!isDelete) { s.readBlob(value); } PyObject * pyKey = script::Pickler::unpickle(key); if(pyKey == NULL) { ERROR_MSG("EntityApp::onBroadcastCellAppDataChange: no has key!\n"); return; } Py_INCREF(pyKey); if(isDelete) { if(pGlobalData_->del(pyKey)) { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS1(getEntryScript().get(), const_cast<char*>("onGlobalDataDel"), const_cast<char*>("O"), pyKey); } } else { PyObject * pyValue = script::Pickler::unpickle(value); if(pyValue == NULL) { ERROR_MSG("EntityApp::onBroadcastCellAppDataChange: no has value!\n"); Py_DECREF(pyKey); return; } Py_INCREF(pyValue); if(pGlobalData_->write(pyKey, pyValue)) { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS2(getEntryScript().get(), const_cast<char*>("onGlobalData"), const_cast<char*>("OO"), pyKey, pyValue); } Py_DECREF(pyValue); } Py_DECREF(pyKey); }
//------------------------------------------------------------------------------------- void Entity::onMove(PyObject* userData) { SCOPED_PROFILE(ONMOVE_PROFILE); SCRIPT_OBJECT_CALL_ARGS1(this, const_cast<char*>("onMove"), const_cast<char*>("O"), userData); }