Esempio n. 1
0
    def onRecv(self, fileno):
        if self._socket.fileno() == fileno:
            sock, addr = self._socket.accept()
            self._clients[sock.fileno()] = (sock, addr)
            KBEngine.registerReadFileDescriptor(sock.fileno(), self.onRecv)
            KBEDebug.DEBUG_MSG("Poller::onRecv: new channel[%s/%i]" %
                               (addr, sock.fileno()))
        else:
            sock, addr = self._clients.get(fileno, None)
            if sock is None:
                return

            data = sock.recv(2048)

            if len(data) == 0:
                KBEDebug.DEBUG_MSG("Poller::onRecv: %s/%i disconnect!" %
                                   (addr, sock.fileno()))
                KBEngine.deregisterReadFileDescriptor(sock.fileno())
                sock.close()
                del self._clients[fileno]
                return

            KBEDebug.DEBUG_MSG("Poller::onRecv: %s/%i get data, size=%i" %
                               (addr, sock.fileno(), len(data)))
            self.processData(sock, data)
Esempio n. 2
0
    def onClientDeath(self):
        """
		KBEngine method.
		客户端对应实体已经销毁
		"""
        KBEDebug.DEBUG_MSG("Account[%i].onClientDeath:" % self.id)
        self.destroy()
Esempio n. 3
0
def onInit(isReload):
	"""
	KBEngine method.
	当引擎启动后初始化完所有的脚本后这个接口被调用
	@param isReload: 是否是被重写加载脚本后触发的
	@type isReload: bool
	"""
	KBEDebug.DEBUG_MSG('onInit::isReload:%s' % isReload)
Esempio n. 4
0
def onLoseChargeCB(ordersID, dbid, success, datas):
    """
	KBEngine method.
	有一个不明订单被处理, 可能是超时导致记录被billing
	清除, 而又收到第三方充值的处理回调
	"""
    KBEDebug.DEBUG_MSG('onLoseChargeCB: ordersID=%s, dbid=%i, success=%i, datas=%s' % \
          (ordersID, dbid, success, datas))
Esempio n. 5
0
def load_whitelists():
    try:
        import KBEngine
        import KBEDebug
        p = './scripts/data/whitelists.txt'
        if KBEngine.hasRes(p):
            fs = KBEngine.open(p, 'r')
            lines = fs.readlines()
            for line in lines:
                if line.strip() != '':
                    whitelists.append(int(line.strip()))
        KBEDebug.DEBUG_MSG("whitelists: {}".format(whitelists))
    except:
        pass
Esempio n. 6
0
def onBaseAppData(key, value):
    """
	KBEngine method.
	baseAppData有改变
	"""
    KBEDebug.DEBUG_MSG('onBaseAppData: %s' % key)
Esempio n. 7
0
def onGlobalDataDel(key):
    """
	KBEngine method.
	globalData有删除
	"""
    KBEDebug.DEBUG_MSG('onDelGlobalData: %s' % key)
Esempio n. 8
0
def onGlobalData(key, value):
    """
	KBEngine method.
	globalData有改变
	"""
    KBEDebug.DEBUG_MSG('onGlobalData: %s' % key)
Esempio n. 9
0
def onBaseAppDataDel(key):
    """
	KBEngine method.
	baseAppData有删除
	"""
    KBEDebug.DEBUG_MSG('onBaseAppDataDel: %s' % key)
Esempio n. 10
0
def onInit(isReload):
    """
	KBEngine method.
	当引擎启动后初始化完所有的脚本后这个接口被调用
	"""
    KBEDebug.DEBUG_MSG('onInit::isReload:%s' % isReload)
Esempio n. 11
0
def onCellAppDataDel(key):
    """
	KBEngine method.
	cellAppData删除 
	"""
    KBEDebug.DEBUG_MSG('onCellAppDataDel: %s' % key)
Esempio n. 12
0
def onCellAppData(key, value):
    """
	KBEngine method.
	cellAppData改变 
	"""
    KBEDebug.DEBUG_MSG('onCellAppData: %s' % key)
Esempio n. 13
0
 def printCustomClass(self):
     KBEDebug.DEBUG_MSG("Account[%i].printCustomClass: %s" %
                        (self.id, CustomClass.Get().printf()))
Esempio n. 14
0
 def __init__(self, spellCaster):
     KBEDebug.DEBUG_MSG("Skill:__init__")
     self.spellCaster = spellCaster
Esempio n. 15
0
 def conjure(self, spellCaster):
     KBEDebug.DEBUG_MSG("Skill:conjure")
Esempio n. 16
0
 def __init__(self):
     KBEDebug.DEBUG_MSG("Lobby:__init__")
     KBEngine.Base.__init__(self)