//------------------------------------------------------------------------------------- void Base::onDestroy(bool callScript) { if(callScript) { SCOPED_PROFILE(SCRIPTCALL_PROFILE); SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onDestroy")); } if(this->hasDB()) { onCellWriteToDBCompleted(0, -1); } eraseEntityLog(); }
//------------------------------------------------------------------------------------- void Base::onDestroy(bool callScript) { setDirty(); if(callScript) { SCOPED_PROFILE(SCRIPTCALL_PROFILE); SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onDestroy")); } if(this->hasDB()) { onCellWriteToDBCompleted(0, -1, -1); } eraseEntityLog(); // 按照当前的设计来说,有clientMailbox_必定是proxy // 至于为何跑到base里来和python本身是C语言实现有关 if(clientMailbox_) static_cast<Proxy*>(this)->kick(); }
//------------------------------------------------------------------------------------- void Base::writeToDB() { if(isArchiveing_) return; isArchiveing_ = true; if(isDestroyed()) { return; } if(this->getCellMailbox() == NULL) { onCellWriteToDBCompleted(); } else { Mercury::Bundle bundle; bundle.newMessage(CellappInterface::reqWriteToDBFromBaseapp); bundle << this->getID(); this->getCellMailbox()->postMail(bundle); } }