You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

699 lines
20 KiB

  1. require("luaScript.Protocol.ProtocolCommon")
  2. local Hall = class("Hall" , require("luaScript.Protocol.Protocol"))
  3. --[[
  4. 请求 0x0114 :
  5. 请求创建房间
  6. ┌───────────────┴────────────┒
  7. │ │
  8. 回复 0x0116 : 回复 0x0117
  9. 返回创建结果 已经在房间里面了
  10. 请求:0x0115 请求 0x0118
  11. 请求进入房间 请求回到房间
  12. ]]
  13. -- 命令集合
  14. local HallCmd = {
  15. --[[/**
  16. * 用户创建房间
  17. * <pre>
  18. * 请求: {@code CreateRoomRequest}
  19. * 返回:- 创建成功返回 0x0116
  20. * 返回:- 若此时用户已经在房间里面玩牌,则返回 0x0117
  21. * </pre>
  22. */--]]
  23. CreateRoomRequest = 0x0114,
  24. --[[/**
  25. * 申请加入私人房
  26. * <pre>
  27. * 请求: {@code JoinRoomRequest}
  28. * 返回:- 加入成功返回 0x0118
  29. * </pre>
  30. */--]]
  31. JoinRoomRequest = 0x0115,
  32. --[[/**
  33. * 创建房间返回结果
  34. * <pre>
  35. * 推送: {@code CreateRoomResponse}
  36. * </pre>
  37. */--]]
  38. CreateRoomResponse = 0x0116,
  39. --[[/**
  40. * 创建房间时用户已经在桌子上玩牌,此时客户端通过0x8001消息来重新进入游戏
  41. * <pre>
  42. * 推送: {@code CreateRoomResponseIn}
  43. * </pre>
  44. */--]]
  45. CreateRoomResponseIn = 0x0117,
  46. --[[/**
  47. * 申请加入私人房返回结果
  48. * <pre>
  49. * 推送: {@code CreateRoomResponse}
  50. * </pre>
  51. */--]]
  52. JoinRoomResponse = 0x0118,
  53. --[[/**
  54. * 房间列表请求
  55. * <pre>
  56. * 推送: {@code getRoomListRequest}
  57. * </pre>
  58. */--]]
  59. getRoomListRequest = 0x4001,
  60. --[[/**
  61. * 房间列表返回
  62. * <pre>
  63. * 推送: {@code getRoomListResponse}
  64. * </pre>
  65. */--]]
  66. getRoomListResponse = 0x4002,
  67. --[[/**
  68. * 快速加入
  69. * <pre>
  70. * 推送: {@code FastJoinRoomlyRequest}
  71. * </pre>
  72. */--]]
  73. FastJoinRoomlyRequest = 0x011a,
  74. --[[/**
  75. * 玩家已经在房间里面了,则发送此消息请求进入房间
  76. * <pre>
  77. * 推送: {@code EnterRoomRequest}
  78. * </pre>
  79. */--]]
  80. GAME_COMMAND_ENTER_ROOM = 0x8001,
  81. --[[/**
  82. * 客户端通过0x8001协议进入房间时, 优先通知客户端桌子游戏信息
  83. * <pre>
  84. * 推送: {@code EnterRoomResponse}
  85. * </pre>
  86. */--]]
  87. GAME_COMMAND_ENTER_ROOM_RESPONSE = 0x8017,
  88. --[[/**
  89. * 通过房间号查询游戏ID
  90. * <pre>
  91. * 请求: {@code QueryRoomRequest}
  92. * </pre>
  93. */--]]
  94. Query_Room_Request = 0x0201,
  95. --[[/**
  96. * 通过房间号查询游戏ID的结果
  97. * <pre>
  98. * 推送: {@code QueryRoomResponse}
  99. * </pre>
  100. */--]]
  101. Query_Room_Response = 0x0202,
  102. --[[/**
  103. * 服务器透传php推送消息协议
  104. * <pre>
  105. * 推送: {@code GetPhpMessageResponse}
  106. * </pre>
  107. */--]]
  108. GAME_COMMAND_PHP_MESSAGE = 0x0c0c,
  109. }
  110. -- /////////////////////////////////////////////////////////////////////////////////////// --
  111. QueryRoomRequest = defClass("QueryRoomRequest"
  112. -- 供查询的游戏列表
  113. , defVar("gameIdList", VT_String, "")
  114. -- 房间ID
  115. , defVar("roomId", VT_Int, 0)
  116. -- 扩展字段
  117. , defVar("extStr", VT_String, "")
  118. )
  119. QueryRoomResponse = defClass("QueryRoomResponse"
  120. -- 0; 找到对应的房间 1: 房间不存在
  121. , defVar("result", VT_Short, 0)
  122. -- 房间ID
  123. , defVar("roomId", VT_Int, 0)
  124. -- result为1时,此数据为0, 找到则为对应的游戏id
  125. , defVar("gameId", VT_Short, 0)
  126. -- 扩展字段
  127. , defVar("extStr", VT_String, "")
  128. )
  129. -- 创建房间请求
  130. CreateRoomRequest = defClass("CreateRoomRequest"
  131. -- 游戏id
  132. , defVar("gameId", VT_Short, 0)
  133. -- 底注
  134. , defVar("basechips", VT_Int, 0)
  135. -- 总局数
  136. , defVar("totalGameNum", VT_Short, 0)
  137. -- 需要的房卡信息
  138. , defVar("requireCards", VT_Int, 0)
  139. -- 进入游戏的方式 //0:游戏开始后不允许进人,1:游戏开始后可以进人
  140. , defVar("enterFlag", VT_Short, 0)
  141. -- json格式 ,不同游戏内容不一样
  142. , defVar("gameInfo", VT_String, "")
  143. -- 創建者的用户信息
  144. , defVar("userInfo", VT_String, "")
  145. )
  146. -- 进入房间成功,则读取房间数据
  147. CreateRoomEntitySuccess = defClass("CreateRoomEntitySuccess"
  148. -- 展示的房间id
  149. , defVar("iShowTid", VT_Int, 0)
  150. -- 服务id, 客户端无需关注
  151. , defVar("serverId", VT_Int, 0)
  152. -- gameId
  153. , defVar("gameId", VT_Int, 0)
  154. -- 游戏信息
  155. , defVar("gameInfo", VT_String, "")
  156. )
  157. -- 进入房间失败,数据为空
  158. CreateRoomEntityFailed = defClass("CreateRoomEntityFailed"
  159. )
  160. -- 创建房间结果
  161. CreateRoomEntity = defClass("CreateRoomEntity"
  162. -- 游戏id
  163. --1房卡数量不够,当result不为0时,则无下面3个参数
  164. , defVar("result", VT_Short, 0)
  165. -- 扩展自定义数据
  166. , localVar("custom", VT_Int)
  167. )
  168. CreateRoomEntityType =
  169. {
  170. [1] = { Data = CreateRoomEntitySuccess},
  171. [2] = { Data = CreateRoomEntityFailed},
  172. }
  173. CreateRoomDataFactories = {};
  174. for i , v in pairs(CreateRoomEntityType) do
  175. CreateRoomDataFactories[v.Data] = { conditionDataType = i, }
  176. end
  177. local newBindableArray = require("luaScript.Protocol.BindableArray");
  178. local function newCreateRoomResponse(defaultValue)
  179. return newBindableArray();
  180. end
  181. local function readCreateRoomResponse(stream)
  182. local obj = CreateRoomEntity:read(stream);
  183. print("xxxx readed:" , table.toString(obj));
  184. if obj.result == 0 then
  185. obj.custom = CreateRoomEntityType[1].Data:read(stream);
  186. else
  187. obj.custom = CreateRoomEntityType[2].Data:read(stream);
  188. end
  189. return obj;
  190. end
  191. local function writeCreateRoomResponse(value , stream)
  192. local cls = rawget(value.custom , "NetVar");
  193. --[[
  194. local conditionType = NotifyDataFactories[cls];
  195. if conditionType == nil then
  196. error("发往服务器时发现了不存在的conditionType:" .. tostring(conditionType));
  197. end
  198. --]]
  199. -- 写入数据
  200. CreateRoomEntity:write(stream , value);
  201. cls:write(stream , value.custom);
  202. end
  203. -- 创建房间结果
  204. CreateRoomResponseCreator = VT_Custom("CreateRoomResponseCreator" , newCreateRoomResponse , readCreateRoomResponse , writeCreateRoomResponse)
  205. CreateRoomResponse = defClass("CreateRoomResponse"
  206. , defVar("info", CreateRoomResponseCreator)
  207. )
  208. -- 创建房间时,玩家已经在房间里面
  209. CreateRoomResponseIn = defClass("CreateRoomResponseIn"
  210. -- 桌子信息
  211. , defVar("tid", VT_Int, 0)
  212. -- 游戏服务id
  213. , defVar("serverId", VT_Int, 0)
  214. -- 保留字段
  215. , defVar("res", VT_Int, 0)
  216. -- 服务等级
  217. , defVar("serverLevel", VT_Short, 0)
  218. -- 游戏id
  219. , defVar("gameId", VT_Short, 0)
  220. )
  221. -- 申请加入私人房
  222. JoinRoomRequest = defClass("JoinRoomRequest"
  223. -- 游戏id
  224. , defVar("gameId", VT_Short, 0)
  225. -- 展示的房间id
  226. , defVar("inputTid", VT_Int, 0)
  227. -- 用户信息
  228. , defVar("userInfo", VT_String, 0)
  229. )
  230. -- 0x8001 : 玩家已经在房间里面了,则直接发送真实房间号,申请进入房间
  231. EnterRoomRequest = defClass("EnterRoomRequest"
  232. -- 房间真实id
  233. , defVar("tid", VT_Int, 0)
  234. -- nUserId
  235. , defVar("nUserId", VT_Int, 0)
  236. -- 用户信息
  237. , defVar("userInfo", VT_String, "")
  238. )
  239. -- 0x8017
  240. EnterRoomResponse = defClass("EnterRoomResponse"
  241. -- 总局数
  242. , defVar("totalGameNum", VT_Short, 0)
  243. -- 房间号
  244. , defVar("ShowTableId", VT_Int, 0)
  245. -- 游戏id
  246. , defVar("gameId", VT_Int, 0)
  247. -- 游戏信息,json格式,同创建房间
  248. , defVar("strGameInfo", VT_String, "")
  249. -- 茶馆id,大于0说明用户在茶馆中
  250. , defVar("nClubId", VT_Int, 0)
  251. )
  252. --------------------
  253. FastJoinRoomlyRequest = defClass("FastJoinRoomlyRequest"
  254. -- 游戏id列表, 用逗号隔开,如“1,2,3” 则表示此合集包含游戏1,2,3
  255. , defVar("gameIdList", VT_String, "")
  256. -- 房间号
  257. , defVar("roomId", VT_Int, 0)
  258. -- 用户信息
  259. , defVar("userInfo", VT_String, "")
  260. )
  261. getRoomListRequest = defClass("getRoomListRequest"
  262. -- 游戏类型
  263. , defVar("gameId", VT_Short, 0)
  264. -- 游戏id
  265. , defVar("uid", VT_Int, 0)
  266. )
  267. roomList = defClass("roomList"
  268. -- 桌子的ID
  269. , defVar("nShowTableId", VT_Int, 0)
  270. -- 总局数
  271. , defVar("nTotalGameNum", VT_Short, 0)
  272. -- 当前人数
  273. , defVar("nUserCount", VT_Short, 0)
  274. -- 最大人数
  275. , defVar("nMaxUserCount", VT_Short, 0)
  276. -- 游戏信息 json格 式,同创建房间json
  277. , defVar("strGameInfo", VT_String, "")
  278. )
  279. getRoomListResponse = defClass("getRoomListResponse"
  280. -- 桌子的ID
  281. , defVar("roomList", VT_Vector(roomList), {})
  282. )
  283. -- //////////////////////////////////// 以上是消息结构的定义 //////////////////////////////////// --
  284. -- //////////////////////////////////// 以下是服务器消息的处理 //////////////////////////////////// --
  285. -- 请求创建房间
  286. function Hall:requestCreateRoom(request)
  287. -- 为了收到服务器返回的结果时能正确接收房间消息
  288. -- 这里应该先加载房间协议
  289. local gameInfo = {}
  290. local gameType = nil
  291. if request.gameInfo then
  292. gameInfo = json.decode(request.gameInfo)
  293. gameType = gameInfo.gamerule or 0
  294. end
  295. app:changeGameProtocol(request.gameId or 0,gameType);
  296. logD("Hall:requestCreateRoom() request = ", table.tostring(request))
  297. app.waitDialogManager:showWaitNetworkDialog();
  298. self:sendResponse{cmd = HallCmd.CreateRoomRequest , sender = request};
  299. end
  300. -- 创建房间结果 - 创建房间的结果,成功或者失败
  301. function Hall:onCreateRoomResponse(status, response)
  302. print("Hall:onCreateRoomResponse(), ", table.tostring(response))
  303. app.waitDialogManager:closeWaitNetworkDialog();
  304. local errCode =
  305. {
  306. [0] = "创建房间成功",
  307. [1] = PLN.CURRENCY_NOT_ENOUGH,
  308. [2] = "达到最高开房限制",
  309. [3] = "桌子数不够了",--需要服务器加桌子
  310. }
  311. -- 不成功则弹出提示
  312. if response.info.result and response.info.result ~= 0 then
  313. showTooltip(errCode[response.info.result] or tostring(response.info.result));
  314. return;
  315. end
  316. if cc.Application:getInstance():getTargetPlatform() == 0 then
  317. cc.UserDefault:getInstance():setIntegerForKey("LastRoomID",response.info.custom.iShowTid)
  318. cc.UserDefault:getInstance():flush()
  319. end
  320. -- 如果加入失败,服务器会通过 0x8005 下发房间数据
  321. -- 如果加入成功,服务器会通过 0x8007 或 0x8009 下发房间数据
  322. -- 请到对应的 ProtocolRoom 里面去处理
  323. end
  324. -- 创建房间结果 - 玩家已经在房间里面了
  325. function Hall:onCreateRoomResponseIn(status, response)
  326. print("Hall:onCreateRoomResponseIn(), ", table.tostring(response))
  327. app.waitDialogManager:closeWaitNetworkDialog();
  328. -- 服务器告知玩家已经在房间里面了
  329. -- 则直接申请回到房间
  330. --这里应该加入协议切换类型,在金币场多次点后,第二次判断在房间里面,收到此消息,于是从金币场切回了房卡的协议去了
  331. --[[ [2019-07-04 16:04:15][LUA] Hall:onCreateRoomResponseIn(), {
  332. ["gameId"] = 2,
  333. ["res"] = 1,
  334. ["serverId"] = 3,
  335. ["serverLevel"] = 20,
  336. ["tid"] = 198656,
  337. }--]]
  338. local protocolType = PROTOCOL_TYPE.COMMON
  339. if response.serverLevel and response.serverLevel > 1 then
  340. protocolType = PROTOCOL_TYPE.COIN
  341. end
  342. self:requestEnterRoom(response.gameId,response.tid,protocolType);
  343. end
  344. -- 申请加入房间
  345. function Hall:requestJoinRoom(gameId, tableId)
  346. print("Hall:requestJoinRoom(), ", gameId, tableId )
  347. local request = JoinRoomRequest:new();
  348. request.gameId = gameId;
  349. request.inputTid = tableId;
  350. request.userInfo = app.user.userInfo;
  351. local function doRequest()
  352. app:changeGameProtocol(gameId, 1);
  353. print("Hall:requestJoinRoom(), ", table.tostring(request))
  354. app.waitDialogManager:showWaitNetworkDialog();
  355. self:sendResponse{cmd = HallCmd.JoinRoomRequest , sender = request};
  356. end
  357. -- 检查一下这个子游戏是否需要更新
  358. if app.subGameManager then
  359. local isInstall = app.subGameManager:isInstaller(gameId)
  360. local isNeedUpdate = app.subGameManager:isNeedUpdate(gameId)
  361. if not isInstall or isNeedUpdate then
  362. downloadSubGame(gameId, doRequest)
  363. return;
  364. end
  365. end
  366. doRequest()
  367. end
  368. -- 加入房间结果
  369. function Hall:onJoinRoomResponse(status, response)
  370. print("Hall:onJoinRoomResponse(), ", table.tostring(response))
  371. app.waitDialogManager:closeWaitNetworkDialog();
  372. local errCode = response.info.result
  373. if errCode ~= 0 then
  374. local errString = ENTER_ROOM_RET_STR[errCode] or "房间不存在"
  375. showTooltip(errString);
  376. return;
  377. end
  378. --[[
  379. -- 展示的房间id
  380. , defVar("iShowTid", VT_Int, 0)
  381. -- 服务id, 客户端无需关注
  382. , defVar("serverId", VT_Int, 0)
  383. -- gameId
  384. , defVar("gameId", VT_Int, 0)
  385. -- 游戏信息
  386. , defVar("gameInfo", VT_String, "")
  387. ]]
  388. local gameId = response.info.custom.gameId
  389. local gameInfo = json.decode(response.info.custom.gameInfo)
  390. local gameType = gameInfo.gamerule
  391. -- 为了收到服务器返回的结果时能正确接收房间消息
  392. -- 这里应该先加载房间协议
  393. app:changeGameProtocol(gameId,gameType);
  394. -- 如果加入失败,服务器会通过 0x8005 下发房间数据
  395. -- 如果加入成功,服务器会通过 0x8007 或 0x8009 下发房间数据
  396. -- 请到对应的 ProtocolRoom 里面去处理
  397. end
  398. -- 快速加入房间
  399. function Hall:requestFastJoinRoom(roomId)
  400. print("Hall:requestFastJoinRoom()", roomId)
  401. local listIds = app.subGameManager:getGameListInstalled()
  402. local request = FastJoinRoomlyRequest:new();
  403. request.gameIdList = listIds
  404. request.roomId = roomId;
  405. request.userInfo = app.user.userInfo;
  406. print("Hall:requestFastJoinRoom() ", table.tostring(request))
  407. app.waitDialogManager:showWaitNetworkDialog();
  408. self:sendResponse{cmd = HallCmd.FastJoinRoomlyRequest , sender = request};
  409. end
  410. -- 0x8001 : 请求回到房间,玩家已经在房间了,使用此接口
  411. function Hall:requestEnterRoom(gameId, tableId, protocolType)
  412. print("Hall:requestEnterRoom()", tableId)
  413. local request = EnterRoomRequest:new();
  414. request.tid = tableId
  415. request.nUserId = app.user.loginInfo.uid;
  416. request.userInfo = app.user.userInfo;
  417. app:changeGameProtocol(gameId, 1, protocolType);
  418. print("Hall:requestEnterRoom() ", table.tostring(request))
  419. -- app.waitDialogManager:showWaitNetworkDialog();
  420. self:sendResponse{cmd = HallCmd.GAME_COMMAND_ENTER_ROOM , sender = request};
  421. end
  422. -- 0x8017 : 对 0x8001 的回复
  423. function Hall:onEnterRoomResponse(status, response)
  424. print("Hall:onEnterRoomResponse", table.tostring(response))
  425. app.waitDialogManager:closeWaitNetworkDialog();
  426. if not response then
  427. return;
  428. end
  429. local gameid = response.gameId
  430. local gameRule = nil
  431. local gameInfo = json.decode(response.strGameInfo)
  432. if response.ShowTableId then
  433. setGameRoomId(response.ShowTableId)
  434. end
  435. if gameInfo then
  436. gameRule = gameInfo.gamerule or 0
  437. --桌子下标
  438. app.club_php.tableIdx = gameInfo.tableIdx
  439. end
  440. local clubID = response.nClubId;
  441. if clubID > 0 then
  442. --茶馆id>0,说明玩家从茶馆中开房
  443. app.club_php.clubID = clubID;
  444. else
  445. app.club_php.clubID = 0;
  446. end
  447. -- 为了收到服务器返回的结果时能正确接收房间消息
  448. -- 这里应该先加载房间协议
  449. app:changeGameProtocol(gameid, gameRule);
  450. end
  451. -- 请求获取房间列表
  452. function Hall:requestGetRoomList(gameId)
  453. local request = getRoomListRequest:new()
  454. request.gameId = gameId
  455. request.uid = app.user.loginInfo.uid
  456. self:sendResponse{cmd = HallCmd.getRoomListRequest , sender = request};
  457. end
  458. -- 获取房间结果
  459. function Hall:onGetRoomListResponse(status, response)
  460. print("Hall:onGetRoomListResponse(), ", table.tostring(response))
  461. self:dispatchEvent({name = "onGetRoomListResponse", response = response});
  462. end
  463. -- 通过房间号查询游戏ID
  464. -- 查询完成后返回 gameid, roomid
  465. function Hall:queryRoomId(roomId, callback)
  466. if not self.queryCallbackList then
  467. self.queryCallbackList = {}
  468. end
  469. if not self.queryIndex then
  470. self.queryIndex = 0
  471. end
  472. self.queryIndex = self.queryIndex + 1
  473. local extStr = tostring(self.queryIndex)
  474. self.queryCallbackList[extStr] = callback
  475. local gameIds = {}
  476. for k,v in pairs(app.serverConfigs.subGameList) do
  477. table.insert(gameIds,v.gameId or 0)
  478. end
  479. local ids = nil;
  480. for id,v in pairs(gameIds) do
  481. if v > 0 then
  482. if not ids then
  483. ids = tostring(v)
  484. else
  485. ids = tostring(ids) .. "," .. tostring(v)
  486. end
  487. end
  488. end
  489. local request = QueryRoomRequest:new()
  490. request.gameIdList = ids
  491. request.roomId = roomId
  492. request.extStr = extStr
  493. logD("Hall:queryRoomId() ", table.tostring(request))
  494. self:sendResponse{cmd = HallCmd.Query_Room_Request , sender = request};
  495. end
  496. -- 查询房间结果
  497. function Hall:onQueryRoomResponse(status, response)
  498. print("Hall:onQueryRoomResponse(), ", table.tostring(response))
  499. local result = response.result
  500. local gameId = response.gameId
  501. local roomId = response.roomId
  502. local extStr = response.extStr;
  503. local queryCallback = self.queryCallbackList[extStr]
  504. if queryCallback then
  505. queryCallback(gameId, roomId)
  506. end
  507. end
  508. --服务器透传php推送消息协议
  509. function Hall:onGetPhpMessageResponse(status, response)
  510. logD("Hall:onGetPhpMessageResponse(), response = ", table.tostring(response))
  511. --[[
  512. -- 如果5分钟之内没有再次收到推送消息,则上传日志
  513. if self.timerHandler then
  514. cc.Director:getInstance():getScheduler():unscheduleScriptEntry(self.timerHandler);
  515. self.timerHandler = nil
  516. end
  517. self.unschedule = cc.Director:getInstance():getScheduler():scheduleScriptFunc(function()
  518. uploadLogs("PHPMESSAGE")
  519. end, 5 * 60, false)
  520. --]]
  521. -- 以下是正常逻辑
  522. if not response then
  523. logD("Hall:onGetPhpMessageResponse", "response is nil");
  524. return ;
  525. end
  526. local message = json.decode(response.stringValue);
  527. if message == nil then
  528. return
  529. end
  530. logD("Hall:onGetPhpMessageResponse(), message = ", table.tostring(message))
  531. if tonumber(message.type) == 10 then
  532. -- 充值钻石
  533. local attr = message.attr
  534. logD("Hall:onGetPhpMessageResponse(), attr = ", table.tostring(attr))
  535. app.user.loginInfo.curCardNum = tonumber(attr.curr_card)
  536. app.user.loginInfo.historyCardNum = tonumber(attr.total_card)
  537. elseif tonumber(message.type) == 12 then
  538. -- 充值欢乐豆
  539. local attr = message.attr
  540. app.user.loginInfo.curBeanNum = tonumber(attr.curr_beans)
  541. self:dispatchEvent({name = GAME_EVENT.RECHARGE_RESULT})
  542. elseif tonumber(message.type) == 13 then
  543. -- 充值礼券
  544. local attr = message.attr
  545. app.user.loginInfo.curLiquanNum = tonumber(attr.curr_coupons)
  546. self:dispatchEvent({name = "couponsAdd", attr = attr})
  547. elseif tonumber(message.type) == 14 then
  548. -- 客户端实时上传日志
  549. if message.attr and message.attr.date then
  550. if logFileManager then
  551. logFileManager:uploadFilesByDay(message.attr.date)
  552. end
  553. end
  554. else
  555. -- 这里处理不了的,就发送事件出去,让能处理的人处理
  556. app:dispatchEvent({name = "onPhpMessage",msg = message});
  557. end
  558. end
  559. -- //////////////////////////////////// 以上是服务器消息的处理 //////////////////////////////////// --
  560. function Hall:ctor(net)
  561. Hall.super.ctor(self , net);
  562. -- 玩家已经在房间里面了,则发送此消息,请求进入房间
  563. self:defMsgFunc{name = "enterRoomRequest", cmd = HallCmd.GAME_COMMAND_ENTER_ROOM, sender = EnterRoomRequest};
  564. -- 推送创建房间结果(正常进入)如果进房成功,服务器会快速分配桌子给玩家,分配成功返回进入桌子成功消息 RoomCmd.GAME_COMMAND_LOGIN_GAME_SUCCESS
  565. self:defPushMsg{cmd = HallCmd.CreateRoomResponse , reader = CreateRoomResponse, func = handler(self , self.onCreateRoomResponse)};
  566. -- 推送创建房间结果(玩家已经在房间里面)
  567. self:defPushMsg{cmd = HallCmd.CreateRoomResponseIn , reader = CreateRoomResponseIn, func = handler(self , self.onCreateRoomResponseIn)};
  568. -- 推送加入房间结果,同快速加入结果
  569. self:defPushMsg{cmd = HallCmd.JoinRoomResponse , reader = CreateRoomResponse, func = handler(self , self.onJoinRoomResponse)};
  570. -- 发8001返回此消息,为游戏房间信息
  571. self:defPushMsg{cmd = HallCmd.GAME_COMMAND_ENTER_ROOM_RESPONSE , reader = EnterRoomResponse, func = handler(self , self.onEnterRoomResponse)};
  572. -- 房间列表结果
  573. self:defPushMsg{cmd = HallCmd.getRoomListResponse , reader = getRoomListResponse, func = handler(self , self.onGetRoomListResponse)};
  574. self:defPushMsg{cmd = HallCmd.Query_Room_Response , reader = QueryRoomResponse, func = handler(self , self.onQueryRoomResponse)};
  575. self:defPushMsg{cmd = HallCmd.GAME_COMMAND_PHP_MESSAGE, reader = StringPacket, func = handler(self, self.onGetPhpMessageResponse)}
  576. end
  577. return Hall;