From 8b5c8c34890b271437202297a0f3e9969a10ef92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Mon, 23 Jun 2025 01:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E4=B8=BB=E6=90=9C=E7=B4=A2=E6=88=BF?= =?UTF-8?q?=E9=97=B4id=E5=92=8C=E4=BA=BA=E7=89=A9id=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=82=B9=E5=BC=80=E8=A7=82=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/Controller/LoginController.lua | 115 +++++++++--------- .../NewGroup/MngView/GroupMngRoomStatView.lua | 47 ++++++- 2 files changed, 98 insertions(+), 64 deletions(-) diff --git a/lua_probject/base_project/Game/Controller/LoginController.lua b/lua_probject/base_project/Game/Controller/LoginController.lua index 7fe58b03..201fdf2f 100644 --- a/lua_probject/base_project/Game/Controller/LoginController.lua +++ b/lua_probject/base_project/Game/Controller/LoginController.lua @@ -1,4 +1,3 @@ - LoginController = {} @@ -6,100 +5,98 @@ local M = {} --- Create a new LoginController function LoginController.new() - setmetatable(M, {__index = IController}) - local self = setmetatable({}, {__index = M}) - self.baseType = LoginController - self.class = "Login" - return self + setmetatable(M, { __index = IController }) + local self = setmetatable({}, { __index = M }) + self.baseType = LoginController + self.class = "Login" + return self end -local _LocalConfigAllGame={ -10,13,14,15,16,17,22,33,65,66,67,77,88, +local _LocalConfigAllGame = { + 10, 13, 14, 15, 16, 17, 22, 33, 65, 66, 67, 77, 88, -101,102,103,104,105,106,107,108, - -301,201,202,203 + 101, 102, 103, 104, 105, 106, 107, + 108, + 301, 201, 202, 203 } -local FilterGame=function(games) - local tempGames={} - for k,v in pairs(games) do - if IsHasDictionary(v.game_id,_LocalConfigAllGame) then - table.insert(tempGames,v) - end - end - return tempGames +local FilterGame = function(games) + local tempGames = {} + for k, v in pairs(games) do + if IsHasDictionary(v.game_id, _LocalConfigAllGame) then + table.insert(tempGames, v) + end + end + return tempGames end -local function __Login(cmd,_data,callBack) +local function __Login(cmd, _data, callBack) local _client = ControllerManager.WebClient - _client:send(cmd, _data, function(res) + _client:send(cmd, _data, function(res) printlog("1111111111111111222222222222222222222222") --pt(cmd) - --pt(res) + --pt(res) if (res.ReturnCode == 0) then - local data = res.Data - local account = data["account"] - local user = DataManager.SelfUser - user.acc = account.acc + local data = res.Data + local account = data["account"] + local user = DataManager.SelfUser + user.acc = account.acc user.account_id = account["id"] - user.diamo = account["diamo"] - user.nick_name = account["nick"] - user.sex = account["sex"] - user.head_url = account["portrait"] - user.room_id = account["roomid"] - user.group_id = account["groupId"] - user.type = account["type"] - user.agent = account["mng"] - - user.real_info = account.real_info - user.phone = account.phone - user.address = account.address - user.games =FilterGame(data.games) - if Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then + user.diamo = account["diamo"] + user.nick_name = account["nick"] + user.sex = account["sex"] + user.head_url = account["portrait"] + user.room_id = account["roomid"] + user.group_id = account["groupId"] + user.type = account["type"] + user.agent = account["mng"] + + user.real_info = account.real_info + user.phone = account.phone + user.address = account.address + user.games = FilterGame(data.games) + if Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then --GameApplication.Instance.printLog = true else --GameApplication.Instance.printLog = user.type == 2 end - - _client:setSession(data["session_id"]..","..data["token"]) + + _client:setSession(data["session_id"] .. "," .. data["token"]) print("11111111111111111111111111111111") pt(data) ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web) - ControllerManager.GroupClient:setSession((data["session_id"]..","..data["token"])) - + ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"])) end - if (callBack ~= nil) then + if (callBack ~= nil) then callBack(res) end end) end --手机登录 -function M:PhoneLogin(phone,code,callback) +function M:PhoneLogin(phone, code, callback) local _data = {} _data["phone"] = phone _data["code"] = code - __Login(Protocol.WEB_PHONE_LOGIN, _data,callback) + __Login(Protocol.WEB_PHONE_LOGIN, _data, callback) end --手机密码登录 -function M:PhonePasswordLogin(phone,password,callback) +function M:PhonePasswordLogin(phone, password, callback) local _data = {} _data["phone"] = phone _data["password"] = password - __Login(Protocol.WEB_PHONE_PASSWORD_LOGIN, _data,callback) + __Login(Protocol.WEB_PHONE_PASSWORD_LOGIN, _data, callback) end -function M:IdPasswordLogin(uid,password,callback) +function M:IdPasswordLogin(uid, password, callback) local _data = {} _data["id"] = tonumber(uid) _data["password"] = password - __Login(Protocol.WEB_ID_PASSWORD_LOGIN, _data,callback) + __Login(Protocol.WEB_ID_PASSWORD_LOGIN, _data, callback) end - function M:Login(callback) local user = DataManager.SelfUser local _data = {} @@ -107,23 +104,21 @@ function M:Login(callback) _data["nick"] = user.nick_name _data["sex"] = user.sex _data["portrait"] = user.head_url - __Login(Protocol.WEB_USER_LOGIN, _data,callback) + __Login(Protocol.WEB_USER_LOGIN, _data, callback) end -function M:QuickLogin(session_id,callback) +function M:QuickLogin(session_id, callback) local _data = {} local _client = ControllerManager.WebClient _client:setSession(session_id) - -- ControllerManager.GroupClient:setSession(session_id) - __Login(Protocol.WEB_QUICK_LOGIN, _data,callback) + -- ControllerManager.GroupClient:setSession(session_id) + __Login(Protocol.WEB_QUICK_LOGIN, _data, callback) end - - function M.OnEnter(self) - --print("login controller enter") + --print("login controller enter") end function M.OnExit(self) - --print("login controller exit") + --print("login controller exit") end diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngRoomStatView.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngRoomStatView.lua index 079dc937..7f533189 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngRoomStatView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngRoomStatView.lua @@ -81,6 +81,7 @@ end function M:GetRecordData(index, qid) qid = qid or 0 ViewUtil.ShowModalWait() + local group = DataManager.groups:get(self.group_id) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetGroupRecord(self.group_id, GetPlatform(), qid, index, 6, function(res) printlog("ccccccccccccccccccccccccccccccccccccc") @@ -103,8 +104,15 @@ function M:GetRecordData(index, qid) ctr_search.selectedIndex = 0 end else - for i = 1, #records do - self.player_record_data[#self.player_record_data + 1] = records[i] + if group.lev == 1 then + for i = 1, #records do + self.player_record_data[#self.player_record_data + 1] = self:deepcopy(records[i]) + self.player_record_data[#self.player_record_data + 1] = self:deepcopy(records[i]) + end + else + for i = 1, #records do + self.player_record_data[#self.player_record_data + 1] = records[i] + end end self.lst_player_record.numItems = #self.player_record_data ctr_search.selectedIndex = 2 @@ -196,17 +204,20 @@ end function M:OnRenderRecordItem1(index, obj) local data = self.tempRec[index + 1] + data.seat = 2 - (index + 1) % 2 self:FillRecordItem(data, obj) end function M:OnRenderPlayerRecordItem(index, obj) local data = self.player_record_data[index + 1] + data.seat = 2 - (index + 1) % 2 self:FillRecordItem(data, obj) end function M:GetRecordByRoomid() local qid = self._view:GetChild("tex_id").text ViewUtil.ShowModalWait() + local group = DataManager.groups:get(self.group_id) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetRecordByRoomid(self.group_id, qid, GetPlatform(), function(res) if self._is_destroy then @@ -220,8 +231,16 @@ function M:GetRecordByRoomid() ViewUtil.ErrorTip(nil, "没有找到回放") return end - self.tempRec = res.Data.rec - self.lst_record_find.numItems = #res.Data.rec + if group.lev == 1 then + self.tempRec = {} + for i = 1, #res.Data.rec do + table.insert(self.tempRec, self:deepcopy(res.Data.rec[i])) + table.insert(self.tempRec, self:deepcopy(res.Data.rec[i])) + end + else + self.tempRec = res.Data.rec + end + self.lst_record_find.numItems = #self.tempRec self._view:GetController("search").selectedIndex = 1 end @@ -353,6 +372,7 @@ function M:OnShowRecordInfo(rdata, ids) if group.lev == 1 then DataManager.CurrenRoom.self_player = DataManager.CurrenRoom:GetPlayerBySeat(rdata.seat) end + printlog("lingmeng seat", DataManager.CurrenRoom.self_player.seat) -- if DataManager.SelfUser.playback[playback_id] ~= nil then -- DataManager.SelfUser.playback[playback_id][i] = data -- else @@ -393,4 +413,23 @@ function M:GenaratePlayBack(id, game_id, ...) return tem end +-- lua table 深拷贝 +function M:deepcopy(object) + local lookup_table = {} + local function _copy(object) + if type(object) ~= 'table' then + return object + elseif lookup_table[object] then + return lookup_table[object] + end + local new_table = {} + lookup_table[object] = new_table + for index, value in pairs(object) do + new_table[_copy(index)] = _copy(value) + end + return setmetatable(new_table, getmetatable(object)) + end + return _copy(object) +end + return M