def doRobotShutDown(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doRobotShutDown, roomId, msgDict, 1) return 1 # do sync code # msg = MsgPack(msgDict) return 1
def doRobotCallUp(self, roomId, tableId, ucount, uids, params, isSync): if not isSync: ftcore.runOnce(self.doRobotCallUp, roomId, tableId, ucount, uids, params, 1) return 1 # do sync code return 1
def doRoomLeave(self, ctrlRoomId, tableId, userId, reason, needSendRes, isSync): if not isSync: ftcore.runOnce(self.doRoomLeave, ctrlRoomId, tableId, userId, reason, needSendRes, 1) return 1 # do sync code return 1
def doQuickStart(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doQuickStart, roomId, msgDict, 1) return 1 # do sync code msg = MsgPack(msgDict) tyglobal.rooms()[roomId].doQuickStart(msg) return 1
def doSitDown(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doSitDown, roomId, msgDict, 1) return 1 msg = MsgPack(msgDict) tableId = msg.getParamInt('tableId', 0) userId = msg.getParamInt('userId', 0) seatId = msg.getParamInt('seatId', 0) clientId = msg.getParamStr('clientId', '') room = tyglobal.rooms()[roomId] table = room.maptable[tableId] table.doSit(msg, userId, seatId, clientId) return 1
def init(): """ 启动模拟环境. """ ftglobal.gameId = 9993 # 初始化环境基础变量 server_id, mn_port, conf_ip, conf_port, conf_dbid, namespace = "HU9999000001", 8400, "172.16.4.15", 8003, 3, \ "hall5" ftcore.runOnce(_initSafe, server_id, mn_port, conf_ip, int(conf_port), int(conf_dbid), namespace, None) #延迟运行测试用例 ftcore.runOnceDelay(5, testcase0) ftcore.mainloop()
def rankSendReward(self, userId2Data, gameId, mail, eventId, intEventParam): """ 排行榜发奖 """ if not userId2Data: return 0 def _longwork(): for userId, data in userId2Data.iteritems(): self._rankSendReward(int(userId), gameId, data, mail, eventId, intEventParam) ftcore.runOnce(_longwork) return 1
def doTableManageClearPlayers(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doTableManageClearPlayers, roomId, msgDict, 1) return 1 msg = MsgPack(msgDict) pass
def doTableManageGameStart(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doTableManageGameStart, roomId, msgDict, 1) return 1 msg = MsgPack(msgDict) pass
def doTableCallObserve(self, roomId, msgDict, isSync): if not isSync: ftcore.runOnce(self.doTableCallObserve, roomId, msgDict, 1) return 1 msg = MsgPack(msgDict) pass
def doUserChangeDone(self, roomId, tableId, userId, clientId, isSync): if not isSync: ftcore.runOnce(self.doUserChangeDone, roomId, tableId, userId, clientId, 1) return 1 pass
def testRun(): ftlog.info('===main===') mock() ftcore.runOnce(main) ftcore.mainloop()