diff --git a/lua_probject/base_project/Game/View/Common/ImageLoad.lua b/lua_probject/base_project/Game/View/Common/ImageLoad.lua index 28af59d8..913a65fd 100644 --- a/lua_probject/base_project/Game/View/Common/ImageLoad.lua +++ b/lua_probject/base_project/Game/View/Common/ImageLoad.lua @@ -4,21 +4,23 @@ local imgAssetMap = {} local imgQueue = Queue.new(2000) local function DownLoadImg(url) - local www = UnityEngine.WWW(url) - coroutine.www(www) - if string.utf8len(www.error) == 0 then - local obj = imgAssetMap[url] - if obj and not obj.load then - local texture = www.texture - www:Dispose() - if (texture ~= null) then - local ntexture = FairyGUI.NTexture(texture) - obj.ntexture = ntexture - obj.load = true - obj.co = nil + local www = UnityEngine.WWW(url) + coroutine.www(www) + if (www.error == nil or www.error == "") and www.bytesDownloaded > 0 then + local texture = www.texture + if texture ~= nil and texture.width > 2 and texture.height > 2 then + local obj = imgAssetMap[url] + if obj and not obj.load then + www:Dispose() + if (texture ~= null) then + local ntexture = FairyGUI.NTexture(texture) + obj.ntexture = ntexture + obj.load = true + obj.co = nil + end end end - end + end end local function SetTexture() @@ -32,6 +34,9 @@ local function SetTexture() tem.callback() end else + local _co = coroutine.start(DownLoadImg, tem.url) + -- local _co_load = coroutine.start(SetTexture,_iconObject,url,callback) + tem.co = _co imgQueue:Enqueue(tem) end end @@ -40,35 +45,35 @@ end UpdateBeat:Add(SetTexture) -- group 图片分组 -function ImageLoad.Load(url,_iconObject,group,callback) - if string.utf8len(url) == 0 then - return - end +function ImageLoad.Load(url, _iconObject, group, callback) + if string.utf8len(url) == 0 then + return + end if not group then group = "common" end - - local asset = imgAssetMap[url] - + + local asset = imgAssetMap[url] + if (asset ~= nil) then if asset.load then _iconObject.texture = asset.ntexture if callback then callback() end else - imgQueue:Enqueue({url = url,_iconObject = _iconObject,callback = callback}) + imgQueue:Enqueue({ url = url, _iconObject = _iconObject, callback = callback }) end return end - - local _co = coroutine.start(DownLoadImg,url) + + local _co = coroutine.start(DownLoadImg, url) -- local _co_load = coroutine.start(SetTexture,_iconObject,url,callback) - imgAssetMap[url] = {group = group,load=false,co = _co} - imgQueue:Enqueue({url = url,_iconObject = _iconObject,callback = callback}) -end + imgAssetMap[url] = { group = group, load = false, co = _co } + imgQueue:Enqueue({ url = url, _iconObject = _iconObject, callback = callback }) +end function ImageLoad.Clear(group) - for i,v in pairs(imgAssetMap) do + for i, v in pairs(imgAssetMap) do if v.group == group then if v.co then coroutine.stop(v.co) @@ -82,4 +87,4 @@ function ImageLoad.Clear(group) imgAssetMap[i] = nil end end -end \ No newline at end of file +end diff --git a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua index d51fc281..25821f8a 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua @@ -9,21 +9,32 @@ local data = { local FamilyRoomCard = {} local function charge(num, self) - local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_Recharge_Diamo(self.groupId, num, function(res) - print("收到充值房卡回调") - pt(res) - if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, "操作失败") - return + local _curren_msg = + MsgWindow.new( + self._root_view, + '确定要将房卡重置在改亲友圈?', + MsgWindow.MsgMode.OkAndCancel + ) + _curren_msg.onOk:Add( + function() + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_Recharge_Diamo(self.groupId, num, function(res) + print("收到充值房卡回调") + pt(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "操作失败") + return + end + local groupDiamo = res.Data.groupDiamo + local playerDiamo = res.Data.userDiamo + self.tex_curCard.text = "当前帐号房卡:" .. playerDiamo + self.tex_famliyCard.text = "亲友圈房卡:" .. groupDiamo + self.group.groupDiamo = groupDiamo + DataManager.SelfUser.diamo = playerDiamo + end) end - local groupDiamo = res.Data.groupDiamo - local playerDiamo = res.Data.userDiamo - self.tex_curCard.text = "当前帐号房卡:" .. playerDiamo - self.tex_famliyCard.text = "亲友圈房卡:" .. groupDiamo - self.group.groupDiamo = groupDiamo - DataManager.SelfUser.diamo = playerDiamo - end) + ) + _curren_msg:Show() end --#endregion diff --git a/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua b/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua new file mode 100644 index 00000000..4f71f015 --- /dev/null +++ b/lua_probject/base_project/Game/View/Lobby/DiamondRecord.lua @@ -0,0 +1,49 @@ +local DiamondRecord = {} + +local M = DiamondRecord + +--类型字段,1为进入游戏预扣,2为结束游戏返还 +local TypeTable = { "亲友圈开局游戏预扣", "因游戏结束返还您" } + +function M.New(data, callback) + setmetatable(M, { __index = BaseWindow }) + local self = setmetatable({}, { __index = M }) + self._full = true + self._full_offset = false + self.class = "com_FamilyMsgRecord" + BaseWindow.init(self, 'ui://Lobby/DiamondRecord') + self.data = data + self:Init() + self.closeCallback = callback + + return self +end + +function M:Init() + local list_msg = self._view:GetChild('list_msg') + list_msg.itemRenderer = function(index, obj) + self:msgRenderer(index, obj) + end + + --大厅的请求 +end + +function M:msgRenderer(index, obj) + local data = self.msgData + obj:GetChild('tex_time').text = os.date("%Y-%m-%d %H:%M:%S", math.floor(data[index + 1].m_time / 1000)) + obj:GetChild('tex_msg').text = string.format("%s%d房卡,剩余%d房卡", TypeTable[data[index + 1].diamo_type + 1], + data[index + 1].diamo_num, data[index + 1].diamo_cur) +end + +function M:Show(groupId) + getmetatable(M).__index.Show(self) +end + +function M:Close() + if self.closeCallback then + self.closeCallback() + end + getmetatable(M).__index.Close(self) +end + +return M diff --git a/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua b/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua new file mode 100644 index 00000000..b86269fe --- /dev/null +++ b/lua_probject/base_project/Game/View/Lobby/GamePlayDetail.lua @@ -0,0 +1,98 @@ +local GamePlayDetail = {} + +local M = GamePlayDetail + +--玩法详情 +local gamePlayDetail = { + --麻将 + { + { + icon0 = "lichuan0", + icon1 = "lichuan1", + detail = "lichuanDetail" + }, + { + icon0 = "jinxi0", + icon1 = "jinxi1", + detail = "金溪麻将" + }, + { + icon0 = "fuzhou0", + icon1 = "fuzhou1", + detail = "抚州麻将" + }, + { + icon0 = "nancheng0", + icon1 = "nancheng1", + detail = "南城麻将" + }, + }, + --扑克 + { + { + icon0 = "paodekuai0", + icon1 = "paodekuai1", + detail = "跑得快" + }, + }, + --字牌 + { + + }, +} + +function M.New(data, callback) + setmetatable(M, { __index = BaseWindow }) + local self = setmetatable({}, { __index = M }) + self._full = true + self._full_offset = false + self.class = "com_GamePlayDetail" + BaseWindow.init(self, 'ui://Lobby/GamePlay') + self.data = data + self:Init() + self.closeCallback = callback + + return self +end + +function M:Init() + local list_gamePlay = self._view:GetChild('list_gameName') + list_gamePlay.itemRenderer = function(index, obj) + obj:GetChild('icon0').url = string.format("ui://Lobby/%s", + gamePlayDetail[self._ctr_gameType.selectedIndex + 1][index + 1].icon0) + obj:GetChild('icon1').url = string.format("ui://Lobby/%s", + gamePlayDetail[self._ctr_gameType.selectedIndex + 1][index + 1].icon1) + end + list_gamePlay.onClickItem:Set(function(context) + self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s", + gamePlayDetail[self._ctr_gameType.selectedIndex + 1][context.sender.selectedIndex + 1].detail) + end) + + self._ctr_gameType = self._view:GetController('gameType') + self._ctr_gameType.onChanged:Set(function(context) + list_gamePlay.numItems = #gamePlayDetail[context.sender.selectedIndex + 1] + if list_gamePlay.numItems > 0 then + self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s", + gamePlayDetail[context.sender.selectedIndex + 1][1].detail) + list_gamePlay.selectedIndex = 0 + end + end) + + self._ctr_gameType.selectedIndex = 0 + list_gamePlay.numItems = #gamePlayDetail[1] + self._view:GetChild("gamePlayDetail").url = string.format("ui://Lobby/%s", gamePlayDetail[1][1].detail) + list_gamePlay.selectedIndex = 0 +end + +function M:Show() + getmetatable(M).__index.Show(self) +end + +function M:Close() + if self.closeCallback then + self.closeCallback() + end + getmetatable(M).__index.Close(self) +end + +return M diff --git a/lua_probject/base_project/Game/View/LobbyView.lua b/lua_probject/base_project/Game/View/LobbyView.lua index c81f57f2..ccec945a 100644 --- a/lua_probject/base_project/Game/View/LobbyView.lua +++ b/lua_probject/base_project/Game/View/LobbyView.lua @@ -8,6 +8,8 @@ local LobbyMessagesView = import(".Lobby.LobbyMessagesView") local LobbyRecordView = import(".Lobby.LobbyRecordView") local LobbyPlayerInfoView = import(".Lobby.LobbyPlayerInfoView") local CreatePlayView = import(".Family.CreatePlayView") +local DiamondRecord = import(".Lobby.DiamondRecord") +local GamePlayDetail = import(".Lobby.GamePlayDetail") local CreateRoomView = import(".Lobby.CreateRoomView") local RankView = import(".Lobby.RankView") @@ -70,9 +72,9 @@ function M:InitView(url) local btn_notice = self._view:GetChild("btn_notice") btn_notice.onClick:Set(function() - local noticeView = LobbyMessagesView.new(self._root_view) + local diamondRecord = DiamondRecord.New(self._root_view) -- noticeView:FillData(DataManager.SelfUser.notices.data) - noticeView:Show() + diamondRecord:Show() end) local btn_record = self._view:GetChild("btn_record") @@ -84,7 +86,8 @@ function M:InitView(url) local btn_gamePlay = self._view:GetChild("btn_gamePlay") btn_gamePlay.onClick:Add(function() - ViewUtil.ErrorTip(self._view, "该功能还会开放,敬请期待") + local gamePlayDetail = GamePlayDetail.New() + gamePlayDetail:Show() end) local btn_more = self._view:GetChild("btn_more") @@ -507,18 +510,18 @@ function M:GetPlayerInfoData() self:ShowPlayerInfo(data.raffle, data.diamo, data.newMail) if data.group_id ~= 0 then -- 重连,确保头像加载成功才能重连 - ViewUtil.ShowModalWait2(self._root_view) - coroutine.start(function() - local waitTimes = 0 - while not self._flag_loadImageSucces do - if waitTimes > 10 then - break - end - coroutine.wait(0.2) - end - ViewUtil.CloseModalWait() - self:ReconnectRoom(data.groupId) - end) + -- ViewUtil.ShowModalWait2(self._root_view) + -- coroutine.start(function() + -- local waitTimes = 0 + -- while not self._flag_loadImageSucces do + -- if waitTimes > 10 then + -- break + -- end + -- coroutine.wait(0.2) + -- end + -- ViewUtil.CloseModalWait() + self:ReconnectRoom(data.groupId) + -- end) end end end) diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index d642d55b..f01ab863 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -838,7 +838,7 @@ function M:OnHuCard(...) --先循环一遍把杠上开花放在最前面 for i = 1, #win_list do local HuMsg = win_list[i] - if HuMsg.type > 2 and HuMsg.type < 32 then + if HuMsg.type > 2 and HuMsg.type < 60 then if self.HuCardImg[HuMsg.type][1] == "tile_cs_gangshanghua" then local imgPath = "ui://Main_Majiang/tile_cs_gangshanghua" local imgObj = list_HuCardEffect:AddItemFromPool() @@ -856,7 +856,7 @@ function M:OnHuCard(...) local HuMsg = win_list[i] -- ↓↓↓先排列好特效图片 - if HuMsg.type > 2 and HuMsg.type < 32 then + if HuMsg.type > 2 and HuMsg.type < 60 then local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", ViewUtil.Sex_Chat[player.self_user.sex], "he" .. HuMsg.type) diff --git a/wb_new_ui/assets/Family/Main.xml b/wb_new_ui/assets/Family/Main.xml index 2feaad86..5f1ba572 100644 --- a/wb_new_ui/assets/Family/Main.xml +++ b/wb_new_ui/assets/Family/Main.xml @@ -10,7 +10,7 @@ - + @@ -123,7 +123,7 @@ - + diff --git a/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml b/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml index 1592bd4d..6e5b0a3c 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml @@ -1,18 +1,18 @@ - + - + - + diff --git a/wb_new_ui/assets/Lobby/2b25837b-0405-4fab-80d1-c15388ad67c8.png b/wb_new_ui/assets/Lobby/2b25837b-0405-4fab-80d1-c15388ad67c8.png new file mode 100644 index 00000000..f75c41b5 Binary files /dev/null and b/wb_new_ui/assets/Lobby/2b25837b-0405-4fab-80d1-c15388ad67c8.png differ diff --git a/wb_new_ui/assets/Lobby/DiamondRecord.xml b/wb_new_ui/assets/Lobby/DiamondRecord.xml new file mode 100644 index 00000000..947af77e --- /dev/null +++ b/wb_new_ui/assets/Lobby/DiamondRecord.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Lobby/GamePlay.xml b/wb_new_ui/assets/Lobby/GamePlay.xml new file mode 100644 index 00000000..c9401d02 --- /dev/null +++ b/wb_new_ui/assets/Lobby/GamePlay.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Lobby/GamePlay/component/child_gameName.xml b/wb_new_ui/assets/Lobby/GamePlay/component/child_gameName.xml new file mode 100644 index 00000000..b87f684b --- /dev/null +++ b/wb_new_ui/assets/Lobby/GamePlay/component/child_gameName.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + +