群主搜索房间id和人物id无法点开观战
parent
11e7962f7f
commit
8b5c8c3489
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
LoginController = {}
|
||||
|
||||
|
||||
|
|
@ -6,32 +5,32 @@ local M = {}
|
|||
|
||||
--- Create a new LoginController
|
||||
function LoginController.new()
|
||||
setmetatable(M, {__index = IController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
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)
|
||||
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)
|
||||
printlog("1111111111111111222222222222222222222222")
|
||||
|
|
@ -55,19 +54,18 @@ local function __Login(cmd,_data,callBack)
|
|||
user.real_info = account.real_info
|
||||
user.phone = account.phone
|
||||
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
|
||||
--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
|
||||
|
|
@ -77,29 +75,28 @@ local function __Login(cmd,_data,callBack)
|
|||
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,19 +104,17 @@ 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)
|
||||
__Login(Protocol.WEB_QUICK_LOGIN, _data, callback)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M.OnEnter(self)
|
||||
--print("login controller enter")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -102,10 +103,17 @@ function M:GetRecordData(index, qid)
|
|||
if ctr_search.selectedIndex ~= 0 then
|
||||
ctr_search.selectedIndex = 0
|
||||
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
|
||||
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
|
||||
end
|
||||
|
|
@ -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
|
||||
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.lst_record_find.numItems = #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
|
||||
|
|
|
|||
Loading…
Reference in New Issue