diff --git a/lua_probject/base_project/Game/Controller/GroupMgrController.lua b/lua_probject/base_project/Game/Controller/GroupMgrController.lua index d4c992c5..c6726d63 100644 --- a/lua_probject/base_project/Game/Controller/GroupMgrController.lua +++ b/lua_probject/base_project/Game/Controller/GroupMgrController.lua @@ -111,6 +111,8 @@ function M:connect(host, groupId, callback) _mgr_client:connect() _mgr_client.onconnect:Add(function(code) self.code = code + printlog("lingmeng _mgr_client.onconnect", code) + DataManager._flag_zangxian = false if (code == SocketCode.Connect) then print("GroupMgrController已连接", code) local _data = {} @@ -183,7 +185,29 @@ function M:connect(host, groupId, callback) self:disconnect() _mgr_client:destroy() if callback then - callback({ ReturnCode = 101 }) + if code == SocketCode.DisconnectByServer then + if DataManager._flag_logout then + local _curren_msg = + MsgWindow.new( + nil, + '您的账号在另一个地点登录, 请确定您的账号是否泄密', + MsgWindow.MsgMode.OnlyOk + ) + _curren_msg.onOk:Add( + function() + PlayerPrefs.DeleteKey('session_id') + PlayerPrefs.Save() + RestartGame() + end + ) + _curren_msg:Show() + return + end + DataManager._flag_zangxian = true + callback({ ReturnCode = 1001 }) + else + callback({ ReturnCode = 1001 }) + end end end end) diff --git a/lua_probject/base_project/Game/Controller/LoginController.lua b/lua_probject/base_project/Game/Controller/LoginController.lua index 02fed4df..2e19dfa2 100644 --- a/lua_probject/base_project/Game/Controller/LoginController.lua +++ b/lua_probject/base_project/Game/Controller/LoginController.lua @@ -56,6 +56,7 @@ local function __Login(cmd, _data, callBack) user.address = account.address user.games = FilterGame(data.games) user.havaPsw = data.havaPassword + user.currenIp = data.ip if Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then --GameApplication.Instance.printLog = true else @@ -67,6 +68,38 @@ local function __Login(cmd, _data, callBack) pt(data) ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web) ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"])) + ControllerManager.GroupClient.holdCallback = function(response) + print("lingmeng log roupClient.holdCallback", response.ReturnCode, + response.ReturnCode == Table_Error_code.ERR_LOGOUT) + if response.ReturnCode == Table_Error_code.ERR_LOGOUT then + if not DataManager._flag_logout then + -- local tip = "您的登录凭证已过期,请重新登录" + -- if DataManager._flag_zangxian then + -- tip = "您的账号在另一个地点登录, 请确定您的账号是否泄密" + -- end + ViewUtil.CloseModalWait2() + local _curren_msg = + MsgWindow.new( + nil, + "您的账号在另一个地点登录, 请确定您的账号是否泄密", + MsgWindow.MsgMode.OnlyOk + ) + _curren_msg.onOk:Add( + function() + PlayerPrefs.DeleteKey('session_id') + PlayerPrefs.Save() + RestartGame() + end + ) + _curren_msg:Show() + end + DataManager._flag_logout = true + else + DataManager._flag_logout = false + end + print("lingmeng log roupClient.holdCallback2", DataManager._flag_logout or false) + return DataManager._flag_logout or false + end end if (callBack ~= nil) then diff --git a/lua_probject/base_project/Game/Controller/RoomController.lua b/lua_probject/base_project/Game/Controller/RoomController.lua index 49bd7420..86614651 100644 --- a/lua_probject/base_project/Game/Controller/RoomController.lua +++ b/lua_probject/base_project/Game/Controller/RoomController.lua @@ -26,7 +26,11 @@ local function __ConntectGameServer(cmd, room, host, _data, callback) print("lingmeng clent code2", cmd, response.ReturnCode) if (response.ReturnCode == 0) then _game_client.onconnect:Clear() - _game_client.onconnect:Add(ControllerManager.OnConnect) + if cmd == Protocol.GAME_WITNESS_ROOM then + _game_client.onconnect:Add(ControllerManager.OnConnectWitness) + else + _game_client.onconnect:Add(ControllerManager.OnConnect) + end callback(response) return end @@ -340,8 +344,20 @@ function M:JoinRoom(room_id, callback) self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM, room_id, false, callback, group_id, group_layer) end +function M:WitnessRoom(room_id, callback) + self:PublicWitnessRoom(Protocol.WEB_FG_Witness_ROOM, room_id, DataManager.CurrenRoom.group_id, callback, + DataManager.CurrenRoom.game_id, + DataManager.CurrenRoom.play_id) +end + function M:ResetJionRoom(callback) local _game = ControllerManager.GetController(GameController) local o_room = DataManager.CurrenRoom self:JoinRoom(o_room.room_id, callback) end + +function M:ResetWitnessRoom(callback) + local _game = ControllerManager.GetController(GameController) + local o_room = DataManager.CurrenRoom + self:WitnessRoom(o_room.room_id, callback) +end diff --git a/lua_probject/base_project/Game/ControllerManager.lua b/lua_probject/base_project/Game/ControllerManager.lua index 927d396f..54e01aca 100644 --- a/lua_probject/base_project/Game/ControllerManager.lua +++ b/lua_probject/base_project/Game/ControllerManager.lua @@ -78,9 +78,6 @@ function ControllerManager.SetGameNetClient(client) ControllerManager.GameNetClinet:destroy() end ControllerManager.GameNetClinet = client - -- if (client ) then - -- client.onconnect:Add(ControllerManager.OnConnect) - -- end end function ControllerManager.OnConnect(code) @@ -99,6 +96,20 @@ function ControllerManager.OnConnect(code) end end +function ControllerManager.OnConnectWitness(code) + print("lingmeng code OnConnectWitness", code) + if (code ~= SocketCode.Connect) then + ControllerManager.SetGameNetClient(nil) + if code ~= SocketCode.DisconnectByServer then + ControllerManager.OnGameWitnessConnect(SocketCode.TimeoutDisconnect) + else + ControllerManager.OnGameWitnessConnect(SocketCode.DisconnectByServer) + end + else + ControllerManager.OnGameWitnessConnect(SocketCode.Connect) + end +end + function ControllerManager.ResetJionRoom() ControllerManager.reset_join_room = ControllerManager.reset_join_room + 1 if ControllerManager.reset_join_room > 3 then @@ -118,3 +129,23 @@ function ControllerManager.ResetJionRoom() ControllerManager.OnGameConnect(SocketCode.Connect) end) end + +function ControllerManager.ResetWitnessRoom() + ControllerManager.reset_witness_room = ControllerManager.reset_witness_room + 1 + if ControllerManager.reset_witness_room > 999 then + ControllerManager.OnGameWitnessConnect(SocketCode.NetworkException) + return + end + ControllerManager.ChangeController(RoomController) + local roomCtr = ControllerManager.GetController(RoomController) + roomCtr:ResetWitnessRoom(function(res) + if res.ReturnCode == 11 or res.ReturnCode == 81 or res.ReturnCode == 1005 then + ControllerManager.OnGameWitnessConnect(SocketCode.Disconnect) + return + elseif res.ReturnCode ~= 0 then + ControllerManager.ResetWitnessRoom() + return + end + ControllerManager.OnGameWitnessConnect(SocketCode.Connect) + end) +end diff --git a/lua_probject/base_project/Game/View/Family/FamilAllRank.lua b/lua_probject/base_project/Game/View/Family/FamilAllRank.lua index 127a7c62..f68591a1 100644 --- a/lua_probject/base_project/Game/View/Family/FamilAllRank.lua +++ b/lua_probject/base_project/Game/View/Family/FamilAllRank.lua @@ -4,6 +4,7 @@ local M = FamilAllRank function FamilAllRank.New(root, groupId) local self = setmetatable({}, { __index = M }) + self._close_destroy = true self._father = root self.group_id = groupId self:init() @@ -12,8 +13,8 @@ end function M:init() local root = self._father - self._lastTpe = root.familyType.selectedIndex - root.familyType.selectedIndex = 0 + -- self._lastTpe = root.familyType.selectedIndex + -- root.familyType.selectedIndex = 0 local comp_rank = UIPackage.CreateObjectFromURL("ui://Family/Comp_Rank") root._view:AddChild(comp_rank) --[[ @@ -26,8 +27,8 @@ function M:init() comp_rank:SetScale(scaleX, scaleY) self._view = comp_rank - local viewBox_leftTime = comp_rank:GetChild('left_time') - local viewBox_rightTime = comp_rank:GetChild('right_time') + self._viewBox_leftTime = comp_rank:GetChild('left_time') + self._viewBox_rightTime = comp_rank:GetChild('right_time') local viewBtn_search = comp_rank:GetChild('btn_search') local viewBtn_close = comp_rank:GetChild('btn_close') @@ -42,18 +43,18 @@ function M:init() end) local serverDayValues, serverDayItems = self:InitTime() - viewBox_leftTime.items = serverDayItems - viewBox_leftTime.values = serverDayValues - viewBox_rightTime.items = serverDayItems - viewBox_rightTime.values = serverDayValues + self._viewBox_leftTime.items = serverDayItems + self._viewBox_leftTime.values = serverDayValues + self._viewBox_rightTime.items = serverDayItems + self._viewBox_rightTime.values = serverDayValues self.leftTimes = tonumber(serverDayValues[1]) self.rightTimes = tonumber(serverDayValues[1]) - viewBox_leftTime.onChanged:Set(function() - self.leftTimes = tonumber(viewBox_leftTime.value) + self._viewBox_leftTime.onChanged:Set(function() + self.leftTimes = tonumber(self._viewBox_leftTime.value) end) - viewBox_rightTime.onChanged:Set(function() - self.rightTimes = tonumber(viewBox_rightTime.value) + self._viewBox_rightTime.onChanged:Set(function() + self.rightTimes = tonumber(self._viewBox_rightTime.value) end) self._viewList_round:SetVirtual() @@ -94,16 +95,15 @@ end function M:ShouRanks(root, groupId) self._father = root self.group_id = groupId - self._lastTpe = self._father.familyType.selectedIndex + self._lastTpe = 1 self._father.familyType.selectedIndex = 0 self._view.visible = true - self:SearchRank() end function M:RoundListRenderer(index, obj) local rankTable = self.roundRanks obj:GetChild('text_rank').text = index + 1 - obj:GetChild('text_id').text = rankTable[index + 1].rankTable + obj:GetChild('text_id').text = rankTable[index + 1].uid obj:GetChild('text_name').text = rankTable[index + 1].nick obj:GetChild('text_other').text = rankTable[index + 1].round ImageLoad.Load(rankTable[index + 1].portrait, obj:GetChild('btn_head')._iconObject) @@ -112,7 +112,7 @@ end function M:WinListRenderer(index, obj) local rankTable = self.winRanks obj:GetChild('text_rank').text = index + 1 - obj:GetChild('text_id').text = rankTable[index + 1].rankTable + obj:GetChild('text_id').text = rankTable[index + 1].uid obj:GetChild('text_name').text = rankTable[index + 1].nick obj:GetChild('text_other').text = rankTable[index + 1].win ImageLoad.Load(rankTable[index + 1].portrait, obj:GetChild('btn_head')._iconObject) diff --git a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua index 624782da..366b0e54 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua @@ -69,31 +69,38 @@ function M:initBtn() end function M:FillList(numbers) + local copy_numbers = {} + for k, v in pairs(numbers) do + copy_numbers[k] = v + end + table.sort(copy_numbers, function(a, b) + return a.lev < b.lev + end) pt("lingmeng", numbers) local fgCtr = ControllerManager.GetController(NewGroupController) self._viewList_allNumbers:SetVirtual() self._viewList_allNumbers.itemRenderer = function(index, obj) local i = index + 1 - obj:GetController('lev').selectedIndex = numbers[i].lev - 1 - obj:GetController('ban').selectedIndex = numbers[i].ban + obj:GetController('lev').selectedIndex = copy_numbers[i].lev - 1 + obj:GetController('ban').selectedIndex = copy_numbers[i].ban obj:GetChild('name').emojies = EmojiDitc.EmojiesDitc - obj:GetChild('name').text = numbers[i].nick - obj:GetChild('id').text = string.format("ID:%s", numbers[i].uid) + obj:GetChild('name').text = copy_numbers[i].nick + obj:GetChild('id').text = string.format("ID:%s", copy_numbers[i].uid) obj:GetChild("remark").emojies = EmojiDitc.EmojiesDitc - if numbers[i].tag == "" then + if copy_numbers[i].tag == "" then obj:GetChild("remark").text = "备注:无" else - obj:GetChild("remark").text = "备注:" .. numbers[i].tag + obj:GetChild("remark").text = "备注:" .. copy_numbers[i].tag end - ImageLoad.Load(numbers[i].portrait, obj:GetChild('btn_head')._iconObject) + ImageLoad.Load(copy_numbers[i].portrait, obj:GetChild('btn_head')._iconObject) obj.onClick:Set(function() print("lingmengtextBtn_detail") ViewUtil.ShowModalWait2() - fgCtr:FG_FindMember(self._group.id, numbers[i].uid, function(res) + fgCtr:FG_FindMember(self._group.id, copy_numbers[i].uid, function(res) ViewUtil.CloseModalWait2() local familyNumberDetail = FamilyNumberDetail.new(self._group.id, self._group.lev, res) familyNumberDetail:SetTickCallback(handler(self, self.TickNumberCallback)) @@ -103,10 +110,10 @@ function M:FillList(numbers) end) end - if self._viewList_allNumbers.numItems == #numbers then + if self._viewList_allNumbers.numItems == #copy_numbers then self._viewList_allNumbers:RefreshVirtualList() else - self._viewList_allNumbers.numItems = #numbers + self._viewList_allNumbers.numItems = #copy_numbers end end diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua index 7770f624..26ca4f0e 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua @@ -168,7 +168,7 @@ function FamilyMyFamily:Refalsh() self.tex_fNumber.text = self.family.member_num self.tex_cradNum.text = self.family.diamo self.tex_nocice.text = self.family.notice - self.tex_wxId.text = Utils.TextOmit(self.family.wechatId, 6, "...") + self.tex_wxId.text = self.family.wechatId ImageLoad.Load(self.family.o_portrait, self.loader_icon) self.cStyle.selectedIndex = self.family.lev - 1 diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua b/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua index 4b1efe53..9332cd25 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua @@ -1,4 +1,6 @@ local FamilyMyFamily = import(".FamilyMyFamily") +local FamilAllRank = import(".FamilAllRank") + --#region LOCAL @@ -132,7 +134,9 @@ function FamilyMyfamilyList:Init() end) btn_rank.onClick:Set(function() - + self:Close() + self._ViewChild_AllRank = FamilAllRank.New(self.FamilyView, group.id) + self._ViewChild_AllRank:ShouRanks(self.FamilyView, group.id) end) end diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index c51b072a..8ca874bc 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -469,10 +469,10 @@ function M:ShowShop() end function M:ShowAllRank() - if not self._ViewChild_AllRank or not self._ViewChild_AllRank.ShouRanks then - self._ViewChild_AllRank = FamilAllRank.New(self, self._group.id) - return - end + -- if not self._ViewChild_AllRank or not self._ViewChild_AllRank.ShouRanks then + self._ViewChild_AllRank = FamilAllRank.New(self, self._group.id) + -- return + -- end self._ViewChild_AllRank:ShouRanks(self, self._group.id) end @@ -579,23 +579,29 @@ function M:EnterGroup(fgCtr, id) fgCtr:FG_EnterGroup(id, function(res) ViewUtil:CloseModalWait2() if res.ReturnCode ~= 0 then - if res.ReturnCode == 101 then - -- ViewUtil:ShowModalWait2(0.01) - -- self:EnterGroup(fgCtr, id) - local _curren_msg = - MsgWindow.new( - self._root_view, - '您的账号在另一个地点登录, 请确定您的账号是否泄密', - MsgWindow.MsgMode.OnlyOk - ) - PlayerPrefs.DeleteKey('session_id') - PlayerPrefs.Save() - _curren_msg.onOk:Add( - function() - RestartGame() - end - ) - _curren_msg:Show() + if res.ReturnCode == 101 or res.ReturnCode == 1001 then + -- -- self._coroutine_zangxian = coroutine.start(function() + -- -- coroutine.wait(0.2) + -- local _curren_msg = + -- MsgWindow.new( + -- self._root_view, + -- '您的账号在另一个地点登录, 请确定您的账号是否泄密', + -- MsgWindow.MsgMode.OnlyOk + -- ) + -- PlayerPrefs.DeleteKey('session_id') + -- PlayerPrefs.Save() + -- _curren_msg.onOk:Add( + -- function() + -- RestartGame() + -- end + -- ) + -- _curren_msg:Show() + -- -- end) + -- return + -- elseif res.ReturnCode == 1001 then + -- coroutine.stop(self._coroutine_zangxian) + ViewUtil:ShowModalWait2(0.01) + self:EnterGroup(fgCtr, id) return end ViewUtil.ErrorTip(res.ReturnCode, "获取房间列表列表失败") diff --git a/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua b/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua index 2790868d..bc6f5b3f 100644 --- a/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua +++ b/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua @@ -2,7 +2,7 @@ local DiamondRecord = {} local M = DiamondRecord ---类型字段,1为进入游戏预扣,2为结束游戏返还 +--类型字段,1为进入游戏预扣,2为结束游戏返还,3为 local TypeTable = { "亲友圈开局游戏预扣", "因游戏结束返还您", "您为亲友圈充值" } function M.New(data, callback) @@ -51,8 +51,14 @@ function M:msgRenderer(index, obj) elseif type == 1 and data.group_name and #data.group_name > 0 then obj:GetChild('tex_msg').text = string.format("您解散了【%s(%s)】亲友圈,返还您%d房卡,剩余%d房卡", data.group_name, data.group_id, data.diamo_num, data.diamo_cur) + elseif type == 3 then + obj:GetChild('tex_msg').text = string.format("助理为【%s(%s)】用户充值%d房卡,剩余%d房卡", data.user_nick, data.uid, + data.diamo_num, data.diamo_cur) + elseif type == 4 then + obj:GetChild('tex_msg').text = string.format("助理为【%s(%s)】用户扣除%d房卡,剩余%d房卡", data.user_nick, data.uid, + data.diamo_num, data.diamo_cur) else - obj:GetChild('tex_msg').text = string.format("%s%d房卡,剩余%d房卡", TypeTable[data.diamo_type + 1], + obj:GetChild('tex_msg').text = string.format("%s%d房卡,剩余%d房卡", TypeTable[data.diamo_type + 1] or "你获得", data.diamo_num, data.diamo_cur) end end diff --git a/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua b/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua index 2b8925a9..15c1b9cb 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua @@ -20,6 +20,7 @@ end function M:init(url) BaseWindow.init(self, url) + ViewUtil.ShowModalWait2() local view = self._view local input_name = view:GetChild('input_name'); @@ -48,11 +49,21 @@ function M:init(url) local btn_send = view:GetChild('btn_send') btn_send.onClick:Set(function() + local name = input_name.text + local id = input_idInfo.text + if string.utf8len(name) < 2 or string.utf8len(name) > 6 then + ViewUtil.ErrorTip(-1, "您输入的名字过长或过短") + return + end + if #name < 17 or #name > 18 then + ViewUtil.ErrorTip(-1, "您输入的身份证不合法") + return + end local _data = {} _data.type = 1 _data.real_info = {} - _data.real_info.name = input_name.text - _data.real_info.ID = input_idInfo.text + _data.real_info.name = name + _data.real_info.ID = id local loddyctr = ControllerManager.GetController(LoddyController) loddyctr:UpdateUserInfo(_data, function(res) if res.ReturnCode ~= 0 then @@ -63,6 +74,21 @@ function M:init(url) end end) end) + + local loddyCtr1 = ControllerManager.GetController(LoddyController) + loddyCtr1:GetUserInfo(function(res) + ViewUtil.CloseModalWait2() + if res.ReturnCode == 0 then + if res.Data.real_info and res.Data.real_info then + input_name.text = res.Data.real_info.name or "" + input_idInfo.text = res.Data.real_info.ID or "" + btn_send.visible = false + end + self:Show() + else + ViewUtil.ErrorTip(res.ReturnCode, "获取认证信息失败") + end + end) end return M diff --git a/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua b/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua index 2b185868..f14a04ca 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua @@ -30,17 +30,17 @@ function M:init(url) view:GetChild('diamo').text = user.diamo view:GetChild('sex').text = user.sex == 1 and "男" or "女" view:GetController('ctr_sex').selectedIndex = user.sex - 1 - view:GetChild('ip').text = DataManager.SelfUser.currenIp + view:GetChild('ip').text = DataManager.SelfUser.currenIp or "正在获取IP中..." ImageLoad.Load(DataManager.SelfUser.head_url, view:GetChild("btn_PlayerHead")._iconObject) - if DataManager.SelfUser.currenIp then - self._loadAll = self._loadAll + 1 - else - GameApplication.Instance:GetPublicIP(function(ip) - DataManager.SelfUser.currenIp = ip - view:GetChild('ip').text = DataManager.SelfUser.currenIp - self:CheckAllload() - end) - end + -- if DataManager.SelfUser.currenIp then + -- self._loadAll = self._loadAll + 1 + -- else + -- GameApplication.Instance:GetPublicIP(function(ip) + -- DataManager.SelfUser.currenIp = ip + -- view:GetChild('ip').text = DataManager.SelfUser.currenIp or "正在获取IP中..." + -- self:CheckAllload() + -- end) + -- end --change view:GetChild('choose_id').text = user.account_id @@ -134,7 +134,7 @@ end function M:CheckAllload() self._loadAll = self._loadAll + 1 - if self._loadAll >= 2 then + if self._loadAll >= 1 then self:Show() end end diff --git a/lua_probject/base_project/Game/View/LobbyView.lua b/lua_probject/base_project/Game/View/LobbyView.lua index 6c2854ae..d609dd66 100644 --- a/lua_probject/base_project/Game/View/LobbyView.lua +++ b/lua_probject/base_project/Game/View/LobbyView.lua @@ -59,17 +59,16 @@ function M:InitView(url) local btn_shop = self._view:GetChild("btn_shop") btn_shop.onClick:Add(handler(self, function() - local shopView = LobbyShopView.new(function() - ViewUtil.ErrorTip(-1, "该功能还会开放,敬请期待") - -- self:ShowPlayerInfo(1, DataManager.SelfUser.diamo, 1) - end) - shopView:Show() + -- local shopView = LobbyShopView.new(function() + ViewUtil.ErrorTip(-1, "该功能还会开放,敬请期待") + -- self:ShowPlayerInfo(1, DataManager.SelfUser.diamo, 1) + -- end) + -- shopView:Show() end)) local btn_authenticate = self._view:GetChild("btn_authenticate") btn_authenticate.onClick:Add(handler(self, function() local authenticateView = LobbyAuthenticateView.new() - authenticateView:Show() -- ViewUtil.ErrorTip(-1, "该功能还会开放,敬请期待") end)) @@ -182,9 +181,9 @@ function M:InitView(url) printlog("load Callback") self._flag_loadImageSucces = true end) - GameApplication.Instance:GetPublicIP(function(ip) - DataManager.SelfUser.currenIp = ip - end) + -- GameApplication.Instance:GetPublicIP(function(ip) + -- DataManager.SelfUser.currenIp = ip + -- end) btn_head.onClick:Set(function() -- local headView = HeadView.new(DataManager.SelfUser, nil, function() -- view:GetChild("tex_name").text = DataManager.SelfUser.nick_name diff --git a/lua_probject/base_project/Game/View/LoginView.lua b/lua_probject/base_project/Game/View/LoginView.lua index b6d34d18..08f0194f 100644 --- a/lua_probject/base_project/Game/View/LoginView.lua +++ b/lua_probject/base_project/Game/View/LoginView.lua @@ -266,7 +266,19 @@ function M:QuickLogin() ViewUtil.ShowModalWait2(self._root_view, "正在登录游戏...") local loginCtr = ControllerManager.GetController(LoginController) loginCtr:QuickLogin(session_id, function(response) - __login_response(self, response) + if (response.ReturnCode == Table_Error_code.ERR_SERVER or response.ReturnCode == Table_Error_code.ERR_LOGOUT) then + local _curren_msg = + MsgWindow.new( + self._root_view, + '您的账号在另一个地点登录, 请确定您的账号是否泄密', + MsgWindow.MsgMode.OnlyOk + ) + PlayerPrefs.DeleteKey('session_id') + PlayerPrefs.Save() + _curren_msg:Show() + else + __login_response(self, response) + end end) end end diff --git a/lua_probject/base_project/Game/View/WitnessView.lua b/lua_probject/base_project/Game/View/WitnessView.lua index bee0599a..26abe86b 100644 --- a/lua_probject/base_project/Game/View/WitnessView.lua +++ b/lua_probject/base_project/Game/View/WitnessView.lua @@ -373,7 +373,7 @@ function M:OnUpdate() else print("witness error") print(result) - error(result) + -- error(result) end end end @@ -436,6 +436,12 @@ function M:OnUpdate() end end +function M:OnApplicationActive() + ViewUtil.ShowModalWait2() + ControllerManager.reset_witness_room = 0 + ControllerManager.ResetWitnessRoom() +end + function M:onLeftTimeOver() end diff --git a/lua_probject/base_project/Game/ViewManager.lua b/lua_probject/base_project/Game/ViewManager.lua index 03b181e1..57788485 100644 --- a/lua_probject/base_project/Game/ViewManager.lua +++ b/lua_probject/base_project/Game/ViewManager.lua @@ -94,17 +94,59 @@ local function __OnGameConnectAction(state) ViewUtil.CloseModalWait2() end +local function __OnGameWitnessConnectAction(state) + --print("state:"..state) + NetResetConnectWindow.CloseNetReset() + if state == SocketCode.Connect then + ViewManager.ChangeView(ViewManager.View_Witness, DataManager.CurrenRoom.game_id) + return + -- elseif state == SocketCode.DisconnectByServer then + -- NetResetConnectWindow.ShowNetReset() + -- ControllerManager.reset_witness_room = 0 + -- ControllerManager.ResetWitnessRoom() + -- elseif state == SocketCode.ExceptionOnConnect or state == SocketCode.NetworkException then + -- -- __NetTip("请检查您的网络环境!") + -- NetResetConnectWindow.ShowNetReset() + -- ControllerManager.reset_witness_room = 0 + -- ControllerManager.ResetWitnessRoom() + elseif state == SocketCode.Disconnect then + ControllerManager.ChangeController(LoddyController) + ViewManager.ChangeView(ViewManager.View_Lobby) + else + -- ViewUtil.ShowModalWait2() + -- ControllerManager.reset_witness_room = 0 + -- ControllerManager.ResetWitnessRoom() + -- NetResetConnectWindow.ShowNetReset() + end + ViewUtil.CloseModalWait2() +end + function ViewManager.Init() _viewClassMap[ViewManager.View_Login] = LoginView _viewClassMap[ViewManager.View_Lobby] = LobbyView _viewClassMap[ViewManager.View_Family] = FamilyView ControllerManager.OnGameConnect = __OnGameConnectAction + ControllerManager.OnGameWitnessConnect = __OnGameWitnessConnectAction ControllerManager.WebClient.holdCallback = function(response) if response.ReturnCode == Table_Error_code.ERR_LOGOUT then - PlayerPrefs.DeleteKey("session_id") - PlayerPrefs.Save() + ViewUtil.CloseModalWait2() + local _curren_msg = + MsgWindow.new( + nil, + "您的登录凭证已过期,请重新登录", + MsgWindow.MsgMode.OnlyOk + ) + _curren_msg.onOk:Add( + function() + PlayerPrefs.DeleteKey('session_id') + PlayerPrefs.Save() + RestartGame() + end + ) + _curren_msg:Show() + return true end if response.ReturnCode == -1 or response.ReturnCode == Table_Error_code.ERR_LOGOUT then ViewUtil.CloseModalWait2() diff --git a/lua_probject/base_project/Main.lua b/lua_probject/base_project/Main.lua index d18a302d..6d2f6cd9 100644 --- a/lua_probject/base_project/Main.lua +++ b/lua_probject/base_project/Main.lua @@ -42,17 +42,17 @@ oldGameVersion = 2 --1 原始 2 老游戏新加功能 function Main() -- EmmyluaDebug - if true then - local suc = pcall(function() - local path = Application.streamingAssetsPath .. "/../../.." - package.cpath = package.cpath .. ";" .. path .. "/?.dll" - local dbg = require("emmy_core") - dbg.tcpConnect('localhost', 9966) - end) - if suc then - print("=============================调试连接成功!===========================") - end - end + -- if true then + -- local suc = pcall(function() + -- local path = Application.streamingAssetsPath .. "/../../.." + -- package.cpath = package.cpath .. ";" .. path .. "/?.dll" + -- local dbg = require("emmy_core") + -- dbg.tcpConnect('localhost', 9966) + -- end) + -- if suc then + -- print("=============================调试连接成功!===========================") + -- end + -- end pcall(function() EmojiLuaHelper.Init() @@ -62,7 +62,7 @@ function Main() Application.targetFrameRate = 60 FairyGUI.UIConfig.buttonSound = FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3", typeof(UnityEngine.AudioClip))) - FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S" + FairyGUI.UIConfig.defaultFont = "兰亭黑简" FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null) FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正胖娃_GBK", "base/static/fonts/方正胖娃_GBK.ttf"), null) FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正粗圆_GBK", "base/static/fonts/方正粗圆_GBK.ttf"), null) @@ -98,9 +98,9 @@ function Main() --_game_info["login_url"]="http://8.134.59.224:8101/" --pt(_game_info) debug_print = false --GetGameInfo("debug_print") - -- if Application.platform == RuntimePlatform.WindowsEditor then - debug_print = true - -- end + if Application.platform == RuntimePlatform.WindowsEditor then + debug_print = true + end local NetManager = taurus.client.NetManager NetManager.debug_print = debug_print -- 网络延时8秒 diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua index 8655f32a..74a8bc0c 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua @@ -200,6 +200,7 @@ function M:EventInit() local index = self:GetPos(win_seat) local info = self._player_card_info[index] local player = self._room:GetPlayerBySeat(win_seat) + MJMainView.ShowHand(self, scoreData) info:ShowHuCard(win_card, index == 1) -- self.cHuCardEffect.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua index b3a49728..513559ae 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua @@ -200,6 +200,7 @@ function M:EventInit() local index = self:GetPos(win_seat) local info = self._player_card_info[index] local player = self._room:GetPlayerBySeat(win_seat) + MJMainView.ShowHand(self, scoreData) info:ShowHuCard(win_card, index == 1) -- self.cHuCardEffect.selectedIndex = 1 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index aa735eee..fb12ca2a 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -201,6 +201,7 @@ function M:EventInit() local index = self:GetPos(win_seat) local info = self._player_card_info[index] local player = self._room:GetPlayerBySeat(win_seat) + MJMainView.ShowHand(self, scoreData) info:ShowHuCard(win_card, index == 1) @@ -302,11 +303,11 @@ function M:EventInit() self:UpdateCardBox(0) self._ctr_cardbox.selectedIndex = 0 local arg = { ... } - MJMainView.ShowHand(self, arg) local result = arg[1] local liuju = result.liuju local data = result.info_list local niao = result.niao + -- MJMainView.ShowHand(self, data) -- if liuju then -- local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu") -- self._view:AddChild(le) diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua index 90926fe3..747c4418 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua @@ -200,6 +200,7 @@ function M:EventInit() local index = self:GetPos(win_seat) local info = self._player_card_info[index] local player = self._room:GetPlayerBySeat(win_seat) + MJMainView.ShowHand(self, scoreData) info:ShowHuCard(win_card, index == 1) -- self.cHuCardEffect.selectedIndex = 1 diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 449c074c..62f4f821 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -707,11 +707,12 @@ function M:OnResult1(...) self:UpdateCardBox(0) self._ctr_cardbox.selectedIndex = 0 local arg = { ... } - -- self:ShowHand(arg) local result = arg[1] local liuju = result.liuju local data = result.info_list local niao = result.niao + self:ShowHand(data) + -- self:RemoveCursor() self._clearingView = self.EXClearingViewClass.new(self) if self._niao_View then diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 7d2a0166..7e0cbe18 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -240,7 +240,7 @@ function M:UpdateHandCardWitness(getcard, isSelf) end function M:FillWitnessCard(btn_card) - btn_card:GetChild("icon").url = 'ui://Main_Majiang/b201_0' + btn_card:GetChild("icon").url = 'ui://Main_Majiang/back_201' end -- 获取麻将图片资源位置,可以在扩展中复写 diff --git a/wb_new_ui/assets/Common/GlobalModalWaiting_jiangxi.xml b/wb_new_ui/assets/Common/GlobalModalWaiting_jiangxi.xml index 34116f56..f946585a 100644 --- a/wb_new_ui/assets/Common/GlobalModalWaiting_jiangxi.xml +++ b/wb_new_ui/assets/Common/GlobalModalWaiting_jiangxi.xml @@ -6,6 +6,11 @@ + + + + +