Esempio n. 1
0
 def stopReactor(self):
     #Ctrl+c终止reactor
     from game.manager.PlayerManager import PlayerManager
     players = PlayerManager().players
     for key in players:
         _player = players[key]
         PlayerManager.updatePlayer(_player)
Esempio n. 2
0
    def startAllTasks(self):
        from game.manager.PlayerManager import PlayerManager
        GlobalManager.heartTask = task.LoopingCall(PlayerManager().heartCheck)
        GlobalManager.heartTask.start(60)

        from game.manager.PkSceneManager import PkSceneManager
        pkSearchTask = task.LoopingCall(PkSceneManager().searchPkPlayer)
        pkSearchTask.start(1)
Esempio n. 3
0
 def terminate(self):
     '''心跳包检测断开连接'''
     self.transport.loseConnection()
     PlayerManager().dropUserByConn(self)
Esempio n. 4
0
 def loadAllData(self):
     #加载所有的数据库数据
     from game.manager.PlayerManager import PlayerManager
     PlayerManager().loadAllPlayers()
Esempio n. 5
0
 def connectionLost(self, reason):
     '''连接断开处理'''
     PlayerManager().dropUserByConn(self)
Esempio n. 6
0
def chuPai_305_1(conn, data):
    proto = ChuPaiRequest()
    proto.ParseFromString(data)

    player = PlayerManager().getPlayerByConn(conn)
    PkSceneManager().chuPai(proto, player)
Esempio n. 7
0
def decidePlayer_304_1(conn, data):
    proto = DecideRequest()
    proto.ParseFromString(data)

    player = PlayerManager().getPlayerByConn(conn)
    PkSceneManager().decide(proto.decide, player)
Esempio n. 8
0
def readyPlayer_302_1(conn, data):
    proto = ReadyPkRequest()
    proto.ParseFromString(data)

    player = PlayerManager().getPlayerByConn(conn)
    PkSceneManager().setPlayerState(player)
Esempio n. 9
0
def searchPlayer_301_1(conn, data):
    player = PlayerManager().getPlayerByConn(conn)
    PkSceneManager().addPkPlayer(player)