Esempio n. 1
0
    def onRestore(self):
        """
		KBEngine method.
		entity的cell部分实体被恢复成功
		"""
        ComBehavior.onRestore(self)
        self.addTimer(1, 0, TIMER_TYPE_SPAWN)
Esempio n. 2
0
 def onTimer(self, tid, userArg):
     ComBehavior.onTimer(self, tid, userArg)
     if userArg == TIMER_TYPE_DESTROY:
         self.kill = True
         self.destroy()
         DEBUG_MSG("%s::destroy: %i" % (self.getClassName(), self.id))
         return
Esempio n. 3
0
    def onDestroy(self):
        """
		KBEngine method.
		entity销毁
		"""
        ComBehavior.onDestroy(self)

        # 销毁SceneAlloc
        if self.sceneAlloc != None:
            self.sceneAlloc.destroy()
            self.sceneAlloc = None

        # 如果帐号ENTITY存在 则也通知销毁它
        if self.accountEntity != None:
            _time = time.time() - self.accountEntity.relogin
            if _time > 1:
                self.accountEntity.destroy()
                self.accountEntity = None
            else:
                DEBUG_MSG("Role[%i].destroySelf: relogin =%i" %
                          (self.id, _time))

        # 解除引用
        if self.accountEntity != None:
            self.accountEntity.activeRole = None
            self.accountEntity = None
Esempio n. 4
0
	def onGetCell(self):
		"""
		KBEngine method.
		entity的cell部分实体被创建成功
		"""
		ComBehavior.onGetCell(self)

		self.cell.controllByClient(self.baseRole)
Esempio n. 5
0
	def __init__(self):
		KBEngine.Base.__init__(self)
		ComBehavior.__init__(self)
		self.createInNewSpace(None)

		self.roles = {}
		
		KBEngine.globalData["Space"] = self
Esempio n. 6
0
	def onDestroy(self):
		"""
		KBEngine method.
		"""
		ComBehavior.onDestroy(self)
		
		del KBEngine.globalData["space_%i" % self.spaceID]
		self.destroySpace()
Esempio n. 7
0
    def onTimer(self, tid, userArg):
        """
		KBEngine method.
		引擎回调timer触发
		"""
        ComBehavior.onTimer(self)
        if userArg == TIMER_TYPE_SPAWN:
            self.spawnTimer()
Esempio n. 8
0
    def onTimer(self, tid, userArg):
        """
		KBEngine method.
		引擎回调timer触发
		"""
        ComBehavior.onTimer(self, tid, userArg)

        if userArg == TIMER_TYPE_DESTROY:
            self.destroyCell()
Esempio n. 9
0
    def onEntitiesEnabled(self):
        """
		KBEngine method.
		该entity被正式激活为可使用, 此时entity已经建立了client对应实体, 可以在此创建它的
		cell部分。
		"""
        ComBehavior.onEntitiesEnabled(self)

        KBEngine.globalData["Space"].loginToSpace(self)
Esempio n. 10
0
	def __init__(self):
		KBEngine.Entity.__init__(self)
		ComBehavior.__init__(self)
		
		# 一个space代表的是一个抽象的空间,这里向这个抽象的空间添加了几何资源数据,如果数据是3D场景的
		# 该space中使用navigate寻路使用的是3D的API,如果是2D的几何数据navigate使用的是astar寻路
		#resPath = 'spaces/newgame_space_data'
		#KBEngine.addSpaceGeometryMapping(self.spaceID, None, resPath)		
		KBEngine.globalData["space_%i" % self.spaceID] = self.base
		KBEngine.globalData["SpaceID"] = self.spaceID
Esempio n. 11
0
    def onClientDeath(self):
        """
		KBEngine method.
		entity丢失了客户端实体
		"""
        ComBehavior.onClientDeath(self)

        # 防止正在请求创建cell的同时客户端断开了, 我们延时一段时间来执行销毁cell直到销毁base
        # 这段时间内客户端短连接登录则会激活entity
        self._destroyTimer = self.addTimer(1, 0, TIMER_TYPE_DESTROY)
Esempio n. 12
0
 def __init__(self):
     KBEngine.Entity.__init__(self)
     ComBehavior.__init__(self)
     self.addTimer(1, 0, SCDefine.TIMER_TYPE_SPAWN)
Esempio n. 13
0
 def __init__(self):
     KBEngine.Entity.__init__(self)
     ComBehavior.__init__(self)
     self.addTimer(3.2, 0, TIMER_TYPE_DESTROY)
Esempio n. 14
0
	def __init__(self):
		KBEngine.Entity.__init__(self)
		ComBehavior.__init__(self)
Esempio n. 15
0
 def __init__(self):
     KBEngine.Entity.__init__(self)
     ComBehavior.__init__(self)
     CombatProps.__init__(self)
     AniState.__init__(self)
Esempio n. 16
0
	def __init__(self):
		KBEngine.Proxy.__init__(self)
		ComBehavior.__init__(self)
		self.createCell(self.spaceCell)
Esempio n. 17
0
	def onGetCell(self):
		"""
		KBEngine method.
		entity的cell部分实体被创建成功
		"""
		ComBehavior.onGetCell(self)	
Esempio n. 18
0
 def __init__(self):
     KBEngine.Proxy.__init__(self)
     ComBehavior.__init__(self)
     self.sceneAlloc = None
     self.accountEntity = None
     self._destroyTimer = 0