Skip to content

Commit c91395c

Browse files
committed
up
1 parent 696fa44 commit c91395c

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

demo/res/scripts/client/Avatar.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ def set_own_val(self, oldValue):
8888
class PlayerAvatar(Avatar, EventHandler):
8989
def __init__(self): # 这里引擎不会自动调用
9090
EventHandler.__init__(self)
91-
self.registerEvents()
92-
93-
def registerEvents(self):
94-
"""
95-
注册事件监听
96-
"""
97-
kbesystem.eventMgr.registerEventHandler("TargetMgr.onTargetChanged", self.onTargetChanged)
9891

9992
def onTargetChanged(self, _preTargetID, _currTargetID):
10093
"""

kbe/src/lib/client_lib/entity.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,28 @@ Entity::~Entity()
8080
{
8181
enterword_ = false;
8282
ENTITY_DECONSTRUCTION(Entity);
83+
S_RELEASE(cellMailbox_);
84+
S_RELEASE(baseMailbox_);
85+
8386
script::PyGC::decTracing("Entity");
87+
88+
if(pClientApp_->pEntities())
89+
pClientApp_->pEntities()->pGetbages()->erase(id());
90+
91+
Py_DECREF(pClientApp_);
8492
}
8593

94+
//-------------------------------------------------------------------------------------
95+
void Entity::pClientApp(ClientObjectBase* p)
96+
{
97+
if(p)
98+
Py_INCREF(p);
99+
else
100+
Py_DECREF(pClientApp_);
101+
102+
pClientApp_ = p;
103+
}
104+
86105
//-------------------------------------------------------------------------------------
87106
PyObject* Entity::pyGetBaseMailbox()
88107
{

kbe/src/lib/client_lib/entity.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Entity : public script::ScriptObject
111111
pClientApp section
112112
*/
113113
DECLARE_PY_GET_MOTHOD(pyGetClientApp);
114-
INLINE void pClientApp(ClientObjectBase* p);
114+
void pClientApp(ClientObjectBase* p);
115115
INLINE ClientObjectBase* pClientApp()const;
116116

117117
const EntityAspect* getAspect()const{ return &aspect_; }

0 commit comments

Comments
 (0)