From 5e470d57ee68afe391efc611d0335e68452647f1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-7R8JEQQ\\k" <1076390229@qq.com> Date: Sat, 5 Jul 2025 21:36:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=AE=A4=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Game/Controller/GroupMgrController.lua | 9 +++ lua_probject/base_project/Game/Protocol.lua | 2 + .../Game/View/Family/FamilyBanDesk.lua | 3 +- .../Game/View/Family/FamilyChatRoom.lua | 64 ++++++++++++++---- .../Game/View/Family/FamilyEventView.lua | 12 ++++ .../Game/View/Family/FamilyMyFamily.lua | 2 +- .../Game/View/Family/FamilySelectNumber.lua | 3 +- .../base_project/Game/View/FamilyView.lua | 5 +- .../Family/MyFamily/com_myFamilyList.xml | 17 +++-- .../NumberList/Component/c_numberChild.xml | 36 ++++++---- .../Family/SelectNumber/com_SelectNumber.xml | 11 ++- .../ART/base/Family/ui/Family_fui.bytes | Bin 113103 -> 113666 bytes 12 files changed, 127 insertions(+), 37 deletions(-) diff --git a/lua_probject/base_project/Game/Controller/GroupMgrController.lua b/lua_probject/base_project/Game/Controller/GroupMgrController.lua index a7b8ff9d..e6ac1271 100644 --- a/lua_probject/base_project/Game/Controller/GroupMgrController.lua +++ b/lua_probject/base_project/Game/Controller/GroupMgrController.lua @@ -14,6 +14,7 @@ GroupMgrEvent = { NewMailTip = "NewMailTip", InviteResponse = "InviteResponse", IsOpenChatRoom = "IsOpenChatRoom", + ChatRoomData = "ChatRoomData", } GroupMgrController = { @@ -50,6 +51,7 @@ function GroupMgrController.new() self._eventmap[Protocol.FGMGR_EVT_NEW_MAIL] = self.OnEvtNewMailTip self._eventmap[Protocol.FGMGR_RESPONSE_INVITE] = self.FG_ResponseInvited self._eventmap[Protocol.FGMGR_EVT_ISOPEN_CHATROOM] = self.FG_Isopen_ChatRoom + self._eventmap[Protocol.FGMGR_EVT_DATA_CHATROOM] = self.FG_Data_ChatRoom -- self:connect(callback) return self end @@ -361,6 +363,13 @@ function M:FG_Isopen_ChatRoom(evt_data) DispatchEvent(self._dispatcher, GroupMgrEvent.IsOpenChatRoom, evt_data) end +function M:FG_Data_ChatRoom(evt_data) + print("收到是否开启聊天室推送") + pt(evt_data) + --json.decode(_totalScore) + DispatchEvent(self._dispatcher, GroupMgrEvent.ChatRoomData, evt_data) +end + function M:PopEvent() local _cacheEvent = self._cacheEvent if (_cacheEvent:Count() > 0) then diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index c17a8551..0e289007 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -389,6 +389,8 @@ Protocol = { FGMGR_EVT_ISOPEN_CHATROOM = "12011", -- 进入聊天室 FGMGR_EVT_ENTER_CHATROOM = "13004", + -- 聊天室协议 + FGMGR_EVT_DATA_CHATROOM = "13003", -- 设置是否允许观战 WEB_FG_SET_CANWATCH = "group/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 5bb2ca43..2f7f98b3 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua @@ -258,7 +258,8 @@ function BanDesk.New() setmetatable(BanDesk, { __index = BaseView }) local inst = setmetatable({}, { __index = BanDesk }) inst._close_destroy = true - inst._full = true + --inst._full = true + inst._scale = true inst._animation = false inst._full_offset = false inst._anim_pop = 0 diff --git a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua index 9aac9f9f..ffd5bcbc 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua @@ -2,30 +2,60 @@ require 'FairyGUI' --region LOCAL -local function PlayersItemRenderer(index, obj, self) - local loader_icon = obj:GetChild("") +local function SetBigWiller(totalScore) + local s = -999 + local winer = 0 + for _,player in pairs(totalScore) do + if player.score > s then + s = player.score + winer = _ + end + end + + totalScore[winer].winer = true +end + +local function list_players_Renderer(index, obj, totalScore, self) local tex_name = obj:GetChild("tex_name") + local loader_icon = obj:GetChild("loader_icon") local tex_id = obj:GetChild("tex_id") local tex_score = obj:GetChild("tex_score") - local cWiner = obj:GetController("cWiner") - tex_name.text = "wenb" - tex_id.text = "wenb" - tex_score.text = "wenb" + local player = totalScore[index + 1] + + tex_name.text = player.nick + tex_id.text = player.accId + tex_score.text = player.score + ImageLoad.Load(player.portrait, loader_icon) + + if player.winer then + obj:GetController("cWiner").selectedIndex = 1 + else + obj:GetController("cWiner").selectedIndex = 0 + end end local function ChatItemRenderer(index, obj, self) + + local data = self.ChatRoomData[index + 1] + local totalScore = json.decode(data.totalScore) + SetBigWiller(totalScore) + local list_players = obj:GetChild("list_players") local tex_time = obj:GetChild("tex_time") local tex_name = obj:GetChild("tex_name") - tex_time.text = "000" - tex_name.text = "000" + tex_time.text = os.date("游戏结算:%m月%d号 %X") --data.create_time + tex_name.text = data.game_info.name - list_players.itemRenderer = PlayersItemRenderer - list_players.numItems = 3 + list_players.itemRenderer = function(i, o) + list_players_Renderer(i, o, totalScore, self) + end + + list_players.numItems = #totalScore end +--[[ local function GetIsOpenChatRoom(groupId, self) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:GetIsOpenChatRoom(groupId, function(res) @@ -33,6 +63,7 @@ local function GetIsOpenChatRoom(groupId, self) pt(res) end) end +]] --endregion @@ -63,7 +94,9 @@ function FamilyChatRoom:Init(com, root) self.list_chat = self._view:GetChild("list_chat") self.btn_quit = self._view:GetChild("btn_quit") - self.list_chat.itemRenderer = ChatItemRenderer + self.list_chat.itemRenderer = function(index, obj) + ChatItemRenderer(index, obj, self) + end self.btn_quit.onClick:Set(function() self:Close() @@ -77,23 +110,30 @@ function FamilyChatRoom:Close() cChatRoom.selectedIndex = 0 end +function FamilyChatRoom:Refalsh() + self.list_chat.numItems = #self.ChatRoomData +end + function FamilyChatRoom:Show() local cChatRoom = self.root._view:GetController("cIsChatRoom") cChatRoom.selectedIndex = 1 + --[[ GetIsOpenChatRoom(self.root._group.id, self) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:GetChatRoom(self.root._group.id, function(res) self:GetChatCallBack(res) end) - self.list_chat.numItems = 4 + ]] end +--[[ function FamilyChatRoom:GetChatCallBack(res) print("收到聊天室协议") pt(res) pt(res.Data.records.totalScore) end +]] return FamilyChatRoom \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua index 6fc8cfca..eb4b6335 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua @@ -22,6 +22,7 @@ function FamilyEventView.new(root) 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._evtIsOpenChatRoom)) + mgr_ctr:AddEventListener(GroupMgrEvent.ChatRoomData, handler(self, self._evtChatRoomData)) return self end @@ -128,4 +129,15 @@ function M:_evtIsOpenChatRoom(...) pt(arg) end +function M:_evtChatRoomData(...) + local view = ViewManager.GetCurrenView() + if view.class ~= "FamilyMainView" then + return + end + local arg = { ... } --totalScore + view.com_FamilyChatRoom.ChatRoomData = arg + --view.com_FamilyChatRoom.list_chat.numItems = #arg + view.com_FamilyChatRoom:Refalsh() +end + return M diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua index f0332ca3..ff7d45e1 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua @@ -96,7 +96,7 @@ function FamilyMyFamily.New(groupId) setmetatable(FamilyMyFamily, { __index = BaseWindow }) local inst = setmetatable({}, { __index = FamilyMyFamily }) inst._close_destroy = true - inst._full = true + inst._scale = true inst._animation = false inst._full_offset = false inst._anim_pop = 0 diff --git a/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua b/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua index b4bf6d4c..e8f24921 100644 --- a/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua +++ b/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua @@ -3,7 +3,8 @@ local FamilySelectNumber = {} function FamilySelectNumber.New() setmetatable(FamilySelectNumber, { __index = BaseWindow}) local inst = setmetatable({}, { __index = FamilySelectNumber}) - inst._full = true + --inst._full = true + inst._scale = true inst._close_destroy = true inst._full_offset = false inst._anim_pop = 0 diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 8cab2b65..525a8283 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -41,7 +41,7 @@ function M:init(url) self._full_offset = false local view = self._view - -- FamilyChatRoom = FamilyChatRoom:Init(view:GetChild('com_chatRoom'), self) + self.com_FamilyChatRoom = FamilyChatRoom:Init(view:GetChild('com_chatRoom'), self) local fgCtr = ControllerManager.GetController(NewGroupController) @@ -111,7 +111,8 @@ function M:init(url) self.btn_chatRoom.onClick:Set(function() --local view = FamilyChatRoom.New() --view:Show() - FamilyChatRoom:Show() + --FamilyChatRoom:Show(self.ChatRoomData) + self.com_FamilyChatRoom:Show() end) end diff --git a/wb_new_ui/assets/Family/MyFamily/com_myFamilyList.xml b/wb_new_ui/assets/Family/MyFamily/com_myFamilyList.xml index 507ddb5a..b5c60be3 100644 --- a/wb_new_ui/assets/Family/MyFamily/com_myFamilyList.xml +++ b/wb_new_ui/assets/Family/MyFamily/com_myFamilyList.xml @@ -1,16 +1,23 @@ - + + + + + + + + - + - + - + @@ -23,6 +30,6 @@ - + \ No newline at end of file diff --git a/wb_new_ui/assets/Family/NumberList/Component/c_numberChild.xml b/wb_new_ui/assets/Family/NumberList/Component/c_numberChild.xml index 72d0723b..556728a8 100644 --- a/wb_new_ui/assets/Family/NumberList/Component/c_numberChild.xml +++ b/wb_new_ui/assets/Family/NumberList/Component/c_numberChild.xml @@ -6,41 +6,51 @@ + + + - - - + + + + + + - + - - - - - - - + - + + + + + + + - + + + + +