-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhall_service.lua.bytes
More file actions
65 lines (54 loc) · 2.09 KB
/
hall_service.lua.bytes
File metadata and controls
65 lines (54 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--[[
大厅服务
--]]
local Service = require("services.service");
local HallService = class("HallService", Service);
function HallService:ctor()
HallService.super.ctor(self, "SERVICE_TYPE_HALL", "HallProto");
end
function HallService:onClear()
end
function HallService:handleResponse(msgType, msgId, msgData)
local msgName = self:enumName("ActionName", msgId, "XGameProto");
if msgName == "HALL_MATCH_ROOM_LIST" then
local resp = self:decode("MatchRoomListResp", msgData);
log.net("HALL_MATCH_ROOM_LIST resp:", log.dumpTable(resp));
if self:isSuccess(resp.iResultID) then
coli.eventManager.notify(coli.Events.E_Hall_SportRoomList, resp);
else
self:handleError(resp.iResultID);
end
end
end
function HallService:handleNotify(msgType, msgId, msgData)
end
-- 竞技赛事房间列表
function HallService:reqSportRoomList(datas)
log.net("Post MatchRoomListReq:", log.dumpTable(datas));
local msgId = self:enumVal("ActionName", "HALL_MATCH_ROOM_LIST", "XGameProto");
local msgType = coli.netService.MSGTYPE_REQUEST;
local req = self:encode("MatchRoomListReq", {
iPage = datas.page,
onlineGame = datas.online,
vecGameStatus = datas.stateList or nil,
bSelfRoom = datas.bOur or false,
iOffsetDay = datas.date or -1,
});
local msg = self:createUnencryptMsg(msgType, msgId, req);
local httpService = coli.serviceManager.httpService;
httpService.POST("/hall", msg);
httpService.addListenResp(msg.msgHead.nMsgID, function(respDatas)
self:respSportRoomList(respDatas);
end);
coli.utils.showNetLoading(nil, {delay = 0.5});
end
function HallService:respSportRoomList(respDatas)
local resp = self:decode("MatchRoomListResp", respDatas);
log.net("Post MatchRoomListResp:", log.dumpTable(resp));
if self:isSuccess(resp.iResultID) then
coli.eventManager.notify(coli.Events.E_Hall_SportRoomList, resp);
else
self:handleError(resp.iResultID);
end
end
return HallService;