群主搜索房间id和人物id无法点开观战

master
罗家炜 2025-06-23 01:19:44 +08:00
parent 11e7962f7f
commit 8b5c8c3489
2 changed files with 98 additions and 64 deletions

View File

@ -1,4 +1,3 @@
LoginController = {} LoginController = {}
@ -6,32 +5,32 @@ local M = {}
--- Create a new LoginController --- Create a new LoginController
function LoginController.new() function LoginController.new()
setmetatable(M, {__index = IController}) setmetatable(M, { __index = IController })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.baseType = LoginController self.baseType = LoginController
self.class = "Login" self.class = "Login"
return self return self
end end
local _LocalConfigAllGame={ local _LocalConfigAllGame = {
10,13,14,15,16,17,22,33,65,66,67,77,88, 10, 13, 14, 15, 16, 17, 22, 33, 65, 66, 67, 77, 88,
101,102,103,104,105,106,107,108, 101, 102, 103, 104, 105, 106, 107,
108,
301,201,202,203 301, 201, 202, 203
} }
local FilterGame=function(games) local FilterGame = function(games)
local tempGames={} local tempGames = {}
for k,v in pairs(games) do for k, v in pairs(games) do
if IsHasDictionary(v.game_id,_LocalConfigAllGame) then if IsHasDictionary(v.game_id, _LocalConfigAllGame) then
table.insert(tempGames,v) table.insert(tempGames, v)
end end
end end
return tempGames return tempGames
end end
local function __Login(cmd,_data,callBack) local function __Login(cmd, _data, callBack)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:send(cmd, _data, function(res) _client:send(cmd, _data, function(res)
printlog("1111111111111111222222222222222222222222") printlog("1111111111111111222222222222222222222222")
@ -55,19 +54,18 @@ local function __Login(cmd,_data,callBack)
user.real_info = account.real_info user.real_info = account.real_info
user.phone = account.phone user.phone = account.phone
user.address = account.address user.address = account.address
user.games =FilterGame(data.games) user.games = FilterGame(data.games)
if Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then if Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then
--GameApplication.Instance.printLog = true --GameApplication.Instance.printLog = true
else else
--GameApplication.Instance.printLog = user.type == 2 --GameApplication.Instance.printLog = user.type == 2
end end
_client:setSession(data["session_id"]..","..data["token"]) _client:setSession(data["session_id"] .. "," .. data["token"])
print("11111111111111111111111111111111") print("11111111111111111111111111111111")
pt(data) pt(data)
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web) 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 end
if (callBack ~= nil) then if (callBack ~= nil) then
@ -77,29 +75,28 @@ local function __Login(cmd,_data,callBack)
end end
--手机登录 --手机登录
function M:PhoneLogin(phone,code,callback) function M:PhoneLogin(phone, code, callback)
local _data = {} local _data = {}
_data["phone"] = phone _data["phone"] = phone
_data["code"] = code _data["code"] = code
__Login(Protocol.WEB_PHONE_LOGIN, _data,callback) __Login(Protocol.WEB_PHONE_LOGIN, _data, callback)
end end
--手机密码登录 --手机密码登录
function M:PhonePasswordLogin(phone,password,callback) function M:PhonePasswordLogin(phone, password, callback)
local _data = {} local _data = {}
_data["phone"] = phone _data["phone"] = phone
_data["password"] = password _data["password"] = password
__Login(Protocol.WEB_PHONE_PASSWORD_LOGIN, _data,callback) __Login(Protocol.WEB_PHONE_PASSWORD_LOGIN, _data, callback)
end end
function M:IdPasswordLogin(uid,password,callback) function M:IdPasswordLogin(uid, password, callback)
local _data = {} local _data = {}
_data["id"] = tonumber(uid) _data["id"] = tonumber(uid)
_data["password"] = password _data["password"] = password
__Login(Protocol.WEB_ID_PASSWORD_LOGIN, _data,callback) __Login(Protocol.WEB_ID_PASSWORD_LOGIN, _data, callback)
end end
function M:Login(callback) function M:Login(callback)
local user = DataManager.SelfUser local user = DataManager.SelfUser
local _data = {} local _data = {}
@ -107,19 +104,17 @@ function M:Login(callback)
_data["nick"] = user.nick_name _data["nick"] = user.nick_name
_data["sex"] = user.sex _data["sex"] = user.sex
_data["portrait"] = user.head_url _data["portrait"] = user.head_url
__Login(Protocol.WEB_USER_LOGIN, _data,callback) __Login(Protocol.WEB_USER_LOGIN, _data, callback)
end end
function M:QuickLogin(session_id,callback) function M:QuickLogin(session_id, callback)
local _data = {} local _data = {}
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:setSession(session_id) _client:setSession(session_id)
-- ControllerManager.GroupClient:setSession(session_id) -- ControllerManager.GroupClient:setSession(session_id)
__Login(Protocol.WEB_QUICK_LOGIN, _data,callback) __Login(Protocol.WEB_QUICK_LOGIN, _data, callback)
end end
function M.OnEnter(self) function M.OnEnter(self)
--print("login controller enter") --print("login controller enter")
end end

View File

@ -81,6 +81,7 @@ end
function M:GetRecordData(index, qid) function M:GetRecordData(index, qid)
qid = qid or 0 qid = qid or 0
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local group = DataManager.groups:get(self.group_id)
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetGroupRecord(self.group_id, GetPlatform(), qid, index, 6, function(res) fgCtr:FG_GetGroupRecord(self.group_id, GetPlatform(), qid, index, 6, function(res)
printlog("ccccccccccccccccccccccccccccccccccccc") printlog("ccccccccccccccccccccccccccccccccccccc")
@ -102,10 +103,17 @@ function M:GetRecordData(index, qid)
if ctr_search.selectedIndex ~= 0 then if ctr_search.selectedIndex ~= 0 then
ctr_search.selectedIndex = 0 ctr_search.selectedIndex = 0
end end
else
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 else
for i = 1, #records do for i = 1, #records do
self.player_record_data[#self.player_record_data + 1] = records[i] self.player_record_data[#self.player_record_data + 1] = records[i]
end end
end
self.lst_player_record.numItems = #self.player_record_data self.lst_player_record.numItems = #self.player_record_data
ctr_search.selectedIndex = 2 ctr_search.selectedIndex = 2
end end
@ -196,17 +204,20 @@ end
function M:OnRenderRecordItem1(index, obj) function M:OnRenderRecordItem1(index, obj)
local data = self.tempRec[index + 1] local data = self.tempRec[index + 1]
data.seat = 2 - (index + 1) % 2
self:FillRecordItem(data, obj) self:FillRecordItem(data, obj)
end end
function M:OnRenderPlayerRecordItem(index, obj) function M:OnRenderPlayerRecordItem(index, obj)
local data = self.player_record_data[index + 1] local data = self.player_record_data[index + 1]
data.seat = 2 - (index + 1) % 2
self:FillRecordItem(data, obj) self:FillRecordItem(data, obj)
end end
function M:GetRecordByRoomid() function M:GetRecordByRoomid()
local qid = self._view:GetChild("tex_id").text local qid = self._view:GetChild("tex_id").text
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local group = DataManager.groups:get(self.group_id)
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetRecordByRoomid(self.group_id, qid, GetPlatform(), function(res) fgCtr:FG_GetRecordByRoomid(self.group_id, qid, GetPlatform(), function(res)
if self._is_destroy then if self._is_destroy then
@ -220,8 +231,16 @@ function M:GetRecordByRoomid()
ViewUtil.ErrorTip(nil, "没有找到回放") ViewUtil.ErrorTip(nil, "没有找到回放")
return return
end end
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 self.tempRec = res.Data.rec
self.lst_record_find.numItems = #res.Data.rec end
self.lst_record_find.numItems = #self.tempRec
self._view:GetController("search").selectedIndex = 1 self._view:GetController("search").selectedIndex = 1
end end
@ -353,6 +372,7 @@ function M:OnShowRecordInfo(rdata, ids)
if group.lev == 1 then if group.lev == 1 then
DataManager.CurrenRoom.self_player = DataManager.CurrenRoom:GetPlayerBySeat(rdata.seat) DataManager.CurrenRoom.self_player = DataManager.CurrenRoom:GetPlayerBySeat(rdata.seat)
end end
printlog("lingmeng seat", DataManager.CurrenRoom.self_player.seat)
-- if DataManager.SelfUser.playback[playback_id] ~= nil then -- if DataManager.SelfUser.playback[playback_id] ~= nil then
-- DataManager.SelfUser.playback[playback_id][i] = data -- DataManager.SelfUser.playback[playback_id][i] = data
-- else -- else
@ -393,4 +413,23 @@ function M:GenaratePlayBack(id, game_id, ...)
return tem return tem
end 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 return M