From 573edc0de68a7fd103134be57afd244e44b34cff Mon Sep 17 00:00:00 2001 From: "DESKTOP-7R8JEQQ\\k" <1076390229@qq.com> Date: Wed, 2 Jul 2025 20:13:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/Controller/GroupMgrController.lua | 8 +- lua_probject/base_project/Game/Protocol.lua | 6 +- .../Game/View/Family/FamilyBanDesk.lua | 87 +++++++++--------- .../Game/View/Family/FamilyEventView.lua | 4 +- .../Game/View/Family/FamilyRoomCard.lua | 5 + lua_probject/base_project/Main.lua | 2 +- .../InviteFamily/Component/btn_close.xml | 4 +- wb_new_ui/assets/Family/Main.xml | 19 +++- .../Family/SelectNumber/com_SelectNumber.xml | 11 ++- wb_new_ui/assets/Family/com_roomCard.xml | 1 + .../ART/base/Family/ui/Family_atlas0.png | Bin 3463956 -> 3424738 bytes .../ART/base/Family/ui/Family_atlas0_1.png | Bin 1832725 -> 1791560 bytes .../ART/base/Family/ui/Family_atlas0_2.png | Bin 369722 -> 606228 bytes .../ART/base/Family/ui/Family_atlas0_3.png | Bin 445408 -> 614207 bytes .../ART/base/Family/ui/Family_atlas0_4.png | Bin 614207 -> 208185 bytes .../ART/base/Family/ui/Family_fui.bytes | Bin 106788 -> 107196 bytes .../ui/Main_Majiang_atlas0_4.png.meta | 2 +- .../ui/Main_Majiang_atlas0_5.png.meta | 2 +- .../ui/Main_Majiang_atlas_yry6yx.png.meta | 2 +- .../ui/main_majiang_atlas0.png.meta | 2 +- .../ui/main_majiang_atlas0_1.png.meta | 2 +- .../ui/main_majiang_atlas0_2.png.meta | 2 +- .../ui/main_majiang_atlas0_3.png.meta | 2 +- .../ui/main_majiang_fui.bytes.meta | 2 +- .../static/fonts/方正粗圆_GBK.ttf.meta | 2 +- 25 files changed, 98 insertions(+), 67 deletions(-) diff --git a/lua_probject/base_project/Game/Controller/GroupMgrController.lua b/lua_probject/base_project/Game/Controller/GroupMgrController.lua index 565810e4..21f71f22 100644 --- a/lua_probject/base_project/Game/Controller/GroupMgrController.lua +++ b/lua_probject/base_project/Game/Controller/GroupMgrController.lua @@ -49,7 +49,7 @@ function GroupMgrController.new() self._eventmap[Protocol.FGMGR_EVT_UPDATE_GROUP] = self.OnEvtUpdateGroup self._eventmap[Protocol.FGMGR_EVT_NEW_MAIL] = self.OnEvtNewMailTip self._eventmap[Protocol.FGMGR_RESPONSE_INVITE] = self.FG_ResponseInvited - self._eventmap[Protocol.WEB_FG_ISOPEN_CHATROOM] = self.FG_Isopen_ChatRoom + self._eventmap[Protocol.FGMGR_EVT_ISOPEN_CHATROOM] = self.FG_Isopen_ChatRoom -- self:connect(callback) return self end @@ -297,7 +297,7 @@ function M:FG_OPEN_ISOPEN_CHATROOM(groupId, callback) local _data = {} _data.groupId = groupId _data.uid = DataManager.SelfUser.account_id - self._mgr_client:send(Protocol.WEB_FG_OPEN_ISOPEN_CHATROOM, _data, function(res) + self._mgr_client:send(Protocol.FGMGR_EVT_OPEN_ISOPEN_CHATROOM, _data, function(res) callback(res) end) end @@ -307,7 +307,7 @@ function M:FG_CLOSE_ISOPEN_CHATROOM(groupId, callback) local _data = {} _data.groupId = groupId _data.uid = DataManager.SelfUser.account_id - self._mgr_client:send(Protocol.WEB_FG_CLOSE_ISOPEN_CHATROOM, _data, function(res) + self._mgr_client:send(Protocol.FGMGR_EVT_CLOSE_ISOPEN_CHATROOM, _data, function(res) callback(res) end) end @@ -395,7 +395,7 @@ function M:OnExit() end function M:__OnNetEvent(msg) - ---- print("消息ID===>>"..msg.Command) + print("消息ID===>>"..msg.Command) local func = self._eventmap[msg.Command] if (func ~= nil) then func(self, msg.Data) end end diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index ea0a9fde..79cdeada 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -382,12 +382,12 @@ Protocol = { -- 未读邮件提示事件 FGMGR_EVT_NEW_MAIL = "update_mail_tip", -- 设置允许成员查看聊天室 - WEB_FG_OPEN_ISOPEN_CHATROOM = "13001", + FGMGR_EVT_OPEN_ISOPEN_CHATROOM = "13001", -- 设置不允许成员查看聊天室 - WEB_FG_CLOSE_ISOPEN_CHATROOM = "13002", + FGMGR_EVT_CLOSE_ISOPEN_CHATROOM = "13002", -- 监听聊天室是否开启 - WEB_FG_ISOPEN_CHATROOM = "12011", + FGMGR_EVT_ISOPEN_CHATROOM = "12011", -- 设置是否允许观战 WEB_FG_SET_CANWATCH = "set_group_guest", diff --git a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua index 3b71771b..5bb2ca43 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua @@ -15,15 +15,15 @@ local function ShowMainView(self) end local function RemoveItem(table, condition) - for _,item in pairs(table) do - if condition(item) then + for _, item in pairs(table) do + if condition(item) then table[_] = nil end end --修复下标 local re = {} - for _,item in pairs(table) do + for _, item in pairs(table) do re[#re + 1] = item end @@ -32,26 +32,33 @@ end local function GetPlayerFromGroupData(playerId, group) local player = group.memberMap[playerId] - if player then + if player then return player end - print("玩家不在group中, 玩家id=",playerId) + print("玩家不在group中, 玩家id=", playerId) return nil end local function AllUid(deskList) - local re = {} - for _, player in pairs(deskList) do + for _, player in pairs(deskList) do re[#re + 1] = player.uid end return re end -local function AddPlayer(data, self) +local function Exists(id, deskList) + for _, player in pairs(deskList) do + if id == player.uid then + return true + end + end + return false +end - if self.sending then +local function AddPlayer(data, self) + if self.sending then ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") return end @@ -59,17 +66,23 @@ local function AddPlayer(data, self) -- 点击弹出选择成员界面 local view = FamilySelectNumber.New() view:Show(self.root._group.id, function(number) + + if Exists(number.uid, data.deskList) then + ViewUtil.ShowBannerOnScreenCenter("设置失败,成员已经在关系中") + return + end + local players = AllUid(data.deskList) players[#players + 1] = number.uid self.sending = true local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function(res) self.sending = false - if res.ReturnCode ~= 0 then + if res.ReturnCode ~= 0 then ViewUtil.ShowBannerOnScreenCenter("设置失败") return end - data.deskList[#data.deskList + 1] = {uid = number.uid} + data.deskList[#data.deskList + 1] = { uid = number.uid } self:ReflashDesk() end) end) @@ -78,61 +91,60 @@ end local function DelPalyer(data, uid, self) --print("删除玩家", uid) - if self.sending then + if self.sending then ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") return end local players = AllUid(data.deskList) - for _, id in pairs(players) do - if id == uid then + for _, id in pairs(players) do + if id == uid then players[_] = nil end end -- 修复下标的连续性,不然json.encode会吧空下标也解析出来 local fix = {} - for _, id in pairs(players) do + for _, id in pairs(players) do fix[#fix + 1] = id end players = fix - + self.sending = true local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function(res) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function(res) self.sending = false - if res.ReturnCode ~= 0 then + if res.ReturnCode ~= 0 then ViewUtil.ShowBannerOnScreenCenter("删除失败") return end data.deskList = RemoveItem(data.deskList, function(item) - if item.uid == uid then + if item.uid == uid then return true end end) - self:ReflashDesk() + self:ReflashDesk() end) end local function DelDesk(data, self) - - if self.sending then + if self.sending then ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") return end self.sending = true local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, {}, data.deskName, function() + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, {}, data.deskName, function() self.sending = false - self:Reflash() + self:Reflash() end) end local function ChangeName(deskData, name, self) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_SetBanTable1(self.root._group.id, deskData.deskId, AllUid(deskData.deskList), name, function(res) - if res.ReturnCode ~= 0 then + if res.ReturnCode ~= 0 then ViewUtil.ShowBannerOnScreenCenter("删除失败") return end @@ -145,19 +157,19 @@ end local function Sort(BanData) -- 把空的桌子放到下面 local emtpy = {} - for index, desk in pairs(BanData) do - if desk.deskList == nil or #desk.deskList == 0 then + for index, desk in pairs(BanData) do + if desk.deskList == nil or #desk.deskList == 0 then emtpy[#emtpy + 1] = desk BanData[index] = nil end end local re = {} - for _, desk in pairs(BanData) do + for _, desk in pairs(BanData) do re[#re + 1] = desk end - for _, desk in pairs(emtpy) do + for _, desk in pairs(emtpy) do re[#re + 1] = desk end @@ -184,7 +196,7 @@ local function list_BanedPlayersRenderer(index, obj, data, self, fatherIndex) end local function list_banItemRenderer(index, obj, self) - local data = self.BanData[index +1] + local data = self.BanData[index + 1] --print("刷新关系") --pt(data) local tex_name = obj:GetChild("tex_name") @@ -196,7 +208,7 @@ local function list_banItemRenderer(index, obj, self) obj:GetController("cStyle").selectedIndex = 0 btn_edit.onClick:Set(function() - -- 修改备注 + -- 修改备注 self.changedIndex = index self.selectBanItem = data self:OpenRemaskWindow() @@ -225,7 +237,6 @@ end function BanDesk:TryShow(r) - local view = BanDesk.New() self.root = r @@ -258,7 +269,6 @@ function BanDesk.New() end function BanDesk:Init() - self.sending = false self.btn_close = self._view:GetChild("btn_close") @@ -291,21 +301,18 @@ function BanDesk:Init() self.list_banItem.itemRenderer = function(index, obj) list_banItemRenderer(index, obj, self) end - end function BanDesk:Reflash() - local fgCtr = ControllerManager.GetController(NewGroupController) local groupId = self.root._group.id - fgCtr:FG_GetBanTable1(groupId,function(res) + fgCtr:FG_GetBanTable1(groupId, function(res) self:GetBanTableCallback(res) end) end function BanDesk:GetBanTableCallback(res) - self.BanData = Sort(res.Data.ban_list) self.list_banItem.numItems = #self.BanData @@ -314,8 +321,7 @@ function BanDesk:GetBanTableCallback(res) local btn_addBanItem = addBanItem:GetChild("btn_addBanItem") addBanItem:GetController("cStyle").selectedIndex = 1 btn_addBanItem.onClick:Set(function() - - if self.sending then + if self.sending then ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") return end @@ -345,5 +351,4 @@ function BanDesk:CloseRemaskWindow() self.cSetName.selectedIndex = 0 end - -return BanDesk \ No newline at end of file +return BanDesk diff --git a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua index 6c1127b4..6fc8cfca 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua @@ -21,7 +21,7 @@ function FamilyEventView.new(root) mgr_ctr:AddEventListener(GroupMgrEvent.UpdateGroup, handler(self, self._evtUpdateGroup)) mgr_ctr:AddEventListener(GroupMgrEvent.NewMailTip, handler(self, self._evtNewMailTip)) mgr_ctr:AddEventListener(GroupMgrEvent.InviteResponse, handler(self, self._evtInviteResponse)) - mgr_ctr:AddEventListener(GroupMgrEvent.IsOpenChatRoom, handler(self, self._evtInviteResponse)) + mgr_ctr:AddEventListener(GroupMgrEvent.IsOpenChatRoom, handler(self, self._evtIsOpenChatRoom)) return self end @@ -123,7 +123,7 @@ end function M:_evtIsOpenChatRoom(...) local arg = { ... } - + print("_evtIsOpenChatRoom") pt(arg) end diff --git a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua index e879380e..8f580cec 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRoomCard.lua @@ -25,10 +25,15 @@ function FamilyRoomCard.New() BaseWindow.init(Instance, "ui://Family/com_roomCard") Instance._close_destroy = true + Instance.btn_close = Instance._view:GetChild("btn_close") Instance.list_bayCrad = Instance._view:GetChild("list_bayCrad") Instance.tex_curCard = Instance._view:GetChild('tex_curCard') Instance.tex_famliyCard = Instance._view:GetChild("tex_famliyCard") + Instance.btn_close.onClick:Set(function() + Instance:Close() + end) + Instance.list_bayCrad.itemRenderer = function(index, obj) local _idx = index +1 local num = data[_idx].num diff --git a/lua_probject/base_project/Main.lua b/lua_probject/base_project/Main.lua index 25f511ba..e8db3b89 100644 --- a/lua_probject/base_project/Main.lua +++ b/lua_probject/base_project/Main.lua @@ -59,7 +59,7 @@ function Main() 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) - --FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null) + FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null) --FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null) _game_info = json.decode(GameApplication.Instance.GameInfo) --_game_info["login_url"]="http://8.134.59.224:8101/" diff --git a/wb_new_ui/assets/Family/InviteFamily/Component/btn_close.xml b/wb_new_ui/assets/Family/InviteFamily/Component/btn_close.xml index a2e12b92..ed4f922a 100644 --- a/wb_new_ui/assets/Family/InviteFamily/Component/btn_close.xml +++ b/wb_new_ui/assets/Family/InviteFamily/Component/btn_close.xml @@ -2,7 +2,9 @@ - + + +