diff --git a/.gitignore b/.gitignore index 52efc250..a73c5c8e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,9 @@ wb_unity_pro/Assets/* !wb_unity_pro/Assets/ART/ !lua_probject/** +<<<<<<< HEAD !wb_unity_pro/Assets/ART/** -!.gitignore \ No newline at end of file +!.gitignore +======= +!wb_unity_pro/Assets/ART/** +>>>>>>> 9cc8415a0cfae87c6dc49e927ee054dfac98e95a diff --git a/lua_probject/base_project/Game/Controller/NewGroupController.lua b/lua_probject/base_project/Game/Controller/NewGroupController.lua index 4cb9d4a5..b7b2b99a 100644 --- a/lua_probject/base_project/Game/Controller/NewGroupController.lua +++ b/lua_probject/base_project/Game/Controller/NewGroupController.lua @@ -42,6 +42,8 @@ function M:FG_GroupList(callback) group.option = tem.option group.show_num = tem.show_num group.isShow = tem.isShow + group.isOpenChatRoom = tem.isOpenChatRoom + group.isWatch = tem.isWatch l_groups:add(group) end end @@ -1267,12 +1269,11 @@ end -- 设置添加&禁止同桌 2025.6.21 -- 添加同桌时 tableId = -1 table = {} ----@param id 亲友圈id +---@param id 亲友圈id ---@param tableId 同桌id ---@param table 同桌玩家 ---@param tableName 同桌备注&名字 function M:FG_SetBanTable1(id, tableId, players, name, callback) - local _data = {} _data.id = id _data.tableId = tableId @@ -1299,7 +1300,6 @@ end -- 获取禁止同桌 2025.6.21 ---@param group_id 亲友圈id function M:FG_GetBanTable1(group_id, callback) - local _data = {} _data.id = group_id @@ -1582,7 +1582,7 @@ function M:FG_SetGroupShow(isShow, groupId, callback) end) end ---聊天室 +--聊天室数据 ---@groupId 亲友圈id function M:GetChatRoom(groupId, callback) local _client = ControllerManager.GroupClient @@ -1592,3 +1592,27 @@ function M:GetChatRoom(groupId, callback) callback(res) end) end + +--禁止&允许成员查看聊天室 +function M:SetIsOpenChatRoom(groupId, value, callback) + print("能否查看聊天室 groupId = ", groupId) + local _client = ControllerManager.GroupClient + local _data = {} + _data.id = groupId + _data.isOpenChatRoom = value + _client:send(Protocol.WEB_FG_SET_ISOPEN_CHATROOM, _data, function(res) + callback(res) + end) +end + +-- 设置是否允许观战 +function M:SetCanWatch(groupId, value, callback) + print("设置是否能观战 groupId = ", groupId) + local _client = ControllerManager.GroupClient + local _data = {} + _data.id = groupId + _data.isWatch = value + _client:send(Protocol.WEB_FG_SET_CANWATCH, _data, function(res) + callback(res) + end) +end diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index 96beb6d7..ab0d4d09 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -273,7 +273,12 @@ Protocol = { WEB_FG_SET_Family_Heartbeat = "group/set_group_heartbeat", -- 亲友圈聊天室 - WEB_FG_GETCHATROOM = 'group/get_chat_rooms', + WEB_FG_GETCHATROOM = "group/get_chat_rooms", + -- 设置是否允许成员查看聊天室 + WEB_FG_SET_ISOPEN_CHATROOM = "group/set_open_chatroom", + -- 设置是否允许观战 + WEB_FG_SET_CANWATCH = "group/set_group_guest", + -------------- group-log--------------------- -- 获取奖励日志 WEB_FG_GET_REWARDS_LOG = "group/log/get_reward_log", diff --git a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua index 4d3f3649..74fa21ae 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua @@ -20,63 +20,125 @@ end local function GetIconFromGroupData(playerId, group) local player = group.memberMap[playerId] - if player then + if player then return player.portrait end - print("玩家不在group中,无法找到头像 玩家id=",playerId) + print("玩家不在group中,无法找到头像 玩家id=", playerId) return "" end -local function AllUid(deskList) +local function RemoveItem(table, condition) + for _, item in pairs(table) do + if condition(item) then + table[_] = nil + end + end + --修复下标 + local re = {} + for _, item in pairs(table) do + re[#re + 1] = item + end + + return re +end + +local function GetPlayerFromGroupData(playerId, group) + local player = group.memberMap[playerId] + if player then + return player + end + + print("玩家不在group中, 玩家id=", playerId) + return nil +end + +local function AllUid(deskList) local re = {} pt(deskList) - 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) + if self.sending then + ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") + return + end + -- 点击弹出选择成员界面 local view = FamilySelectNumber.New() view:Show(self.root._group.id, function(number) 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() self:ReflashDesk() end) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function(res) + self.sending = false + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("设置失败") + return + end + data.deskList[#data.deskList + 1] = { uid = number.uid } + self:ReflashDesk() + end) end) end local function DelPalyer(data, uid, self) + --print("删除玩家", uid) + + 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 - + local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function() self:ReflashDesk() end) end + + local function DelDesk(data, self) + 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() self:Reflash() end) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, {}, data.deskName, function() + self.sending = false + 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() + fgCtr:FG_SetBanTable1(self.root._group.id, deskData.deskId, AllUid(deskData.deskList), name, function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("删除失败") + return + end + deskData.deskName = name self:ReflashDesk() self:CloseRemaskWindow() end) @@ -85,30 +147,86 @@ 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 return re end +local function list_BanedPlayersRenderer(index, obj, data, self, fatherIndex) + local loader_icon = obj:GetChild("loader_icon") + local tex_name = obj:GetChild("tex_name") + + local uid = data.deskList[index + 1].uid + local player = GetPlayerFromGroupData(uid, self.root._group) + obj:GetController("cStyle").selectedIndex = 0 + tex_name.text = player.nick + local img = player.portrait + ImageLoad.Load(img, loader_icon) + + local btn_delPlayer = obj:GetChild("btn_delPlayer") + btn_delPlayer.onClick:Set(function() + -- 删除玩家按钮 + self.changedIndex = fatherIndex + DelPalyer(data, player.uid, self) + end) +end + +local function list_banItemRenderer(index, obj, self) + local data = self.BanData[index + 1] + --print("刷新关系") + --pt(data) + local tex_name = obj:GetChild("tex_name") + local list_BanedPlayers = obj:GetChild("list_BanedPlayers") + local btn_del = obj:GetChild("btn_del") + local btn_edit = obj:GetChild("btn_edit") + + tex_name.text = data.deskName + obj:GetController("cStyle").selectedIndex = 0 + + btn_edit.onClick:Set(function() + -- 修改备注 + self.changedIndex = index + self.selectBanItem = data + self:OpenRemaskWindow() + end) + + btn_del.onClick:Set(function() + -- 删除整个桌子 + DelDesk(data, self) + end) + + list_BanedPlayers.itemRenderer = function(i, o) + list_BanedPlayersRenderer(i, o, data, self, index) + end + list_BanedPlayers.numItems = #data.deskList + + local add_play = list_BanedPlayers:AddItemFromPool() + add_play:GetController("cStyle").selectedIndex = 1 + add_play:GetChild("btn_addPlayer").onClick:Set(function() + -- 添加玩家按钮 + self.changedIndex = index + AddPlayer(data, self) + end) +end + --endregion function BanDesk:TryShow(r) - local view = BanDesk.New() self.root = r @@ -127,8 +245,8 @@ function BanDesk:Close() end function BanDesk.New() - setmetatable(BanDesk, {__index = BaseView}) - local inst = setmetatable({}, {__index = BanDesk}) + setmetatable(BanDesk, { __index = BaseView }) + local inst = setmetatable({}, { __index = BanDesk }) inst._close_destroy = true inst._full = true inst._animation = false @@ -141,6 +259,7 @@ function BanDesk.New() end function BanDesk:Init() + self.sending = false self.btn_close = self._view:GetChild("btn_close") self.list_banItem = self._view:GetChild("list_banItem") @@ -170,73 +289,51 @@ function BanDesk:Init() end) self.list_banItem.itemRenderer = function(index, obj) - - local data = self.BanData[index +1] - - local tex_name = obj:GetChild("tex_name") - local list_BanedPlayers = obj:GetChild("list_BanedPlayers") - local btn_del = obj:GetChild("btn_del") - local btn_edit = obj:GetChild("btn_edit") - - tex_name.text = data.deskName - obj:GetController("cStyle").selectedIndex = 0 - - btn_edit.onClick:Set(function() - -- 修改备注 - self.changedIndex = index - self.selectBanItem = data - self:OpenRemaskWindow() - end) - - btn_del.onClick:Set(function() - -- 删除整个桌子 - DelDesk(data, self) - end) - - list_BanedPlayers.itemRenderer = function(playerIndex, playerObj) - - local loader_icon = playerObj:GetChild("loader_icon") - local tex_name = playerObj:GetChild("tex_name") - - local player = data.deskList[playerIndex + 1] - playerObj:GetController("cStyle").selectedIndex = 0 - tex_name.text = player.nick - local img = GetIconFromGroupData(player.uid, self.root._group) - ImageLoad.Load(img, loader_icon) - - local btn_delPlayer = playerObj:GetChild("btn_delPlayer") - btn_delPlayer.onClick:Set(function() - -- 删除玩家按钮 - self.changedIndex = index - DelPalyer(data, player.uid, self) - end) - end - - list_BanedPlayers.numItems = #data.deskList - - local add_play = list_BanedPlayers:AddItemFromPool() - add_play:GetController("cStyle").selectedIndex = 1 - add_play:GetChild("btn_addPlayer").onClick:Set(function() - -- 添加玩家按钮 - self.changedIndex = index - AddPlayer(data, self) - end) + list_banItemRenderer(index, obj, self) end + + + -- list_BanedPlayers.itemRenderer = function(playerIndex, playerObj) + + -- local loader_icon = playerObj:GetChild("loader_icon") + -- local tex_name = playerObj:GetChild("tex_name") + + -- local player = data.deskList[playerIndex + 1] + -- playerObj:GetController("cStyle").selectedIndex = 0 + -- tex_name.text = player.nick + -- local img = GetIconFromGroupData(player.uid, self.root._group) + -- ImageLoad.Load(img, loader_icon) + + -- local btn_delPlayer = playerObj:GetChild("btn_delPlayer") + -- btn_delPlayer.onClick:Set(function() + -- -- 删除玩家按钮 + -- self.changedIndex = index + -- DelPalyer(data, player.uid, self) + -- end) + -- end + + -- list_BanedPlayers.numItems = #data.deskList + + -- local add_play = list_BanedPlayers:AddItemFromPool() + -- add_play:GetController("cStyle").selectedIndex = 1 + -- add_play:GetChild("btn_addPlayer").onClick:Set(function() + -- -- 添加玩家按钮 + -- self.changedIndex = index + -- AddPlayer(data, self) + -- end) + -- 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) - print("BanDesk:GetBanTableCallback") - self.BanData = Sort(res.Data.ban_list) self.list_banItem.numItems = #self.BanData @@ -245,32 +342,25 @@ 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 + ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") + return + end + + self.sending = true local fgCtr = ControllerManager.GetController(NewGroupController) local groupId = self.root._group.id local banList = {} fgCtr:FG_SetBanTable1(groupId, -1, banList, "新建关系", function() + self.sending = false self:Reflash() end) end) end function BanDesk:ReflashDesk() - -- 只刷新一个元素,暂时怎么处理,有时间优化 - local data = self.BanData[self.changedIndex +1] local obj = self.list_banItem:GetChildAt(self.changedIndex) - local tex_name = obj:GetChild("tex_name") - local list_BanedPlayers = obj:GetChild("list_BanedPlayers") - tex_name.text = data.deskName - obj:GetController("cStyle").selectedIndex = 0 - list_BanedPlayers.numItems = #data.deskList - - local add_play = list_BanedPlayers:AddItemFromPool() - add_play:GetController("cStyle").selectedIndex = 1 - add_play:GetChild("btn_addPlayer").onClick:Set(function() - -- 添加玩家按钮 - self.changedIndex = self.changedIndex - AddPlayer(data, self) - end) + list_banItemRenderer(self.changedIndex, obj, self) end -- 打开备注界面 @@ -282,5 +372,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/FamilyChatRoom.lua b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua index 476a9e4e..8cfa1f1c 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua @@ -1,5 +1,41 @@ require 'FairyGUI' +--region LOCAL + +local function PlayersItemRenderer(index, obj, self) + local loader_icon = obj:GetChild("") + local tex_name = obj:GetChild("tex_name") + 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" +end + +local function ChatItemRenderer(index, obj, self) + 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" + + list_players.itemRenderer = PlayersItemRenderer + list_players.numItems = 3 +end + +local function GetIsOpenChatRoom(groupId, self) + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:GetIsOpenChatRoom(groupId, function(res) + print("收到是否打开聊天室协议") + pt(res) + end) +end + +--endregion + local FamilyChatRoom = {} --[[ @@ -20,13 +56,15 @@ function FamilyChatRoom:Init(com, root) --self._full_offset = false --self._animation = false --BaseWindow.init(self, "ui://Family/com_chatRoom") - + self.rendererData = {} self.root = root self._view = com self.list_chat = self._view:GetChild("list_chat") self.btn_quit = self._view:GetChild("btn_quit") + self.list_chat.itemRenderer = ChatItemRenderer + self.btn_quit.onClick:Set(function() self:Close() end) @@ -43,15 +81,19 @@ 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 +return FamilyChatRoom diff --git a/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua b/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua index d73888b3..4897edc7 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua @@ -36,8 +36,8 @@ function FamilyJoinAndCreate:init(root) fgCtr:FG_GroupList(function(res) fgCtr:FG_CreateGroup(self.input_name.text, 1, 2, function(res) if res.ReturnCode == 0 then - --self.familyType.selectedIndex = 1 - self:ConnetFamily(1, DataManager.groups.groupList, true) + root.familyType.selectedIndex = 1 + root:ConnetFamily(1, DataManager.groups.groupList, true) else ViewUtil.ErrorTip(res.ReturnCode, '创建大联盟失败!') end diff --git a/lua_probject/base_project/Game/View/Family/FamilyMsgRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyMsgRecord.lua new file mode 100644 index 00000000..a910d543 --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyMsgRecord.lua @@ -0,0 +1,41 @@ +local FamilyMsgRecord = {} + +function FamilyMsgRecord.New(callback) + setmetatable(FamilyMsgRecord, { __index = BaseWindow }) + local inst = setmetatable({}, { __index = FamilyMsgRecord }) + inst._close_destroy = true + inst._full = true + inst._animation = false + inst._full_offset = false + inst._anim_pop = 0 + BaseWindow.init(inst, 'ui://Family/com_FamilyMsgRecord') + inst:Init() + inst._root_view:GetChild("win_mode").visible = false + + inst.closeCallback = callback + + return inst +end + +function FamilyMsgRecord:Show() + BaseWindow.Show(self) +end + +function FamilyMsgRecord:Init() + self.btn_quit = self._view:GetChild("btn_quit") + + self.btn_quit.onClick:Set(function() + self:Close() + end) +end + +function FamilyMsgRecord:Close() + + if self.closeCallback then + self.closeCallback() + end + + BaseWindow.Close(self) +end + +return FamilyMsgRecord \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua index 222bd5ac..714d9460 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua @@ -1,4 +1,5 @@ local FamilyRoomCardRecord = import(".FamilyRoomCardRecord") +local RoomCardRecord = import(".RoomCardRecord") --region LOCAL @@ -15,6 +16,34 @@ local function ShowMainView() root.familyType.selectedIndex = rootLastIndex or 1 end +local function ChangeNotice(self) + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_UpdateGroupInfo( + self.family.id, + self.family.name, + self.input_notice.text, + not self.family.ban, + self.family.dissolve_opt, + self.family.kick_opt, + self.family.apply, + self.family.ban_chat1, + self.family.ban_chat2, + self.family.option, + 0, + function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "更改公告失败,请稍后再试") + else + ViewUtil.ErrorTip(res.ReturnCode, "修改成功!") + self.family.notice = self.input_notice.text + self:Refalsh() + self.cWindow.selectedIndex = 0 + end + end + ) +end + + --endregion function FamilyMyFamily:TryShow(groupId, r) @@ -25,7 +54,6 @@ function FamilyMyFamily:TryShow(groupId, r) end function FamilyMyFamily:Show() - self:Refalsh() HideMainView() @@ -38,7 +66,6 @@ function FamilyMyFamily:Close() end function FamilyMyFamily:Refalsh() - self.family = DataManager.groups.groupMap[self.groupId] self.tex_fName.text = self.family.name @@ -48,12 +75,10 @@ function FamilyMyFamily:Refalsh() self.tex_nocice.text = self.family.notice ImageLoad.Load(self.family.o_portrait, self.loader_icon) - self.cStyle.selectedIndex = self.family.lev -1 + self.cStyle.selectedIndex = self.family.lev - 1 -- index = 0 是显示隐藏按钮 self.showNumber = self.family.isShow - print("self.family.isShow",self.family.isShow) - pt(self.family) if self.showNumber == 0 then self.cDisplayNumber.selectedIndex = 1 self.tex_fNumber.text = "*" @@ -85,6 +110,7 @@ function FamilyMyFamily:Init() self.tex_cradNum = self._view:GetChild("tex_cradNum") self.tex_nocice = self._view:GetChild("tex_nocice") self.tex_playerName = self._view:GetChild("tex_playerName") + self.tex_changeTitle = self._view:GetChild("tex_changeTitle") self.btn_quitFamily = self._view:GetChild("btn_quitFamily") self.btn_playSet = self._view:GetChild("btn_playSet") @@ -122,7 +148,9 @@ function FamilyMyFamily:Init() end) self.btn_czRecord.onClick:Set(function() - local view = FamilyRoomCardRecord.New() + --local view = FamilyRoomCardRecord.New() + --view:Show() + local view = RoomCardRecord.New() view:Show() end) @@ -138,9 +166,14 @@ function FamilyMyFamily:Init() self.btn_quitFamily.onClick:Set(function() local fgCtr = ControllerManager.GetController(NewGroupController) - print("发送了退出协议 familyid = ",self.family.id) + print("发送了退出协议 familyid = ", self.family.id) fgCtr:FG_ExitGroup(self.family.id, function(res) - pt(res) + if res.ReturnCode ~= 0 then + return + end + self:Close() + ControllerManager.ChangeController(NewGroupController) + ViewManager.ChangeView(ViewManager.View_Family) end) end) @@ -156,36 +189,10 @@ function FamilyMyFamily:Init() self.cWindow.selectedIndex = 1 end) - self.btn_confirmNotice.onClick:Set(function() - local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_UpdateGroupInfo( - self.family.id, - self.family.name, - self.input_notice.text, - not self.family.ban, - self.family.dissolve_opt, - self.family.kick_opt, - self.family.apply, - self.family.ban_chat1, - self.family.ban_chat2, - self.family.option, - 0, - function(res) - if res.ReturnCode ~= 0 then - ViewUtil.ErrorTip(res.ReturnCode, "更改公告失败,请稍后再试") - else - ViewUtil.ErrorTip(res.ReturnCode, "修改成功!") - self.family.notice = self.input_notice.text - self:Refalsh() - self.cWindow.selectedIndex = 0 - end - end - ) - end) + self.btn_confirmNotice.onClick:Set(ChangeNotice) self.btn_hideNumber.onClick:Set(function() - - if self.isShowContenting == true then + if self.isShowContenting == true then ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") return end @@ -193,12 +200,12 @@ function FamilyMyFamily:Init() print("点击了") local fgCtr = ControllerManager.GetController(NewGroupController) - self.isShowContenting = true - fgCtr:FG_SetGroupShow(0, self.family.id, function (res) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(0, self.family.id, function(res) print("收到协议M:FG_SetGroupShow") pt(res) self.isShowContenting = false - if res.ReturnCode ~= 0 then + if res.ReturnCode ~= 0 then ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") return end @@ -209,7 +216,7 @@ function FamilyMyFamily:Init() end) self.btn_showNumber.onClick:Set(function() - if self.isShowContenting == true then + if self.isShowContenting == true then ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") return end @@ -217,12 +224,60 @@ function FamilyMyFamily:Init() print("点击了") local fgCtr = ControllerManager.GetController(NewGroupController) - self.isShowContenting = true - fgCtr:FG_SetGroupShow(1, self.family.id, function (res) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(1, self.family.id, function(res) print("收到协议M:FG_SetGroupShow") pt(res) self.isShowContenting = false - if res.ReturnCode ~= 0 then + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") + return + end + self.family.isShow = 1 + self:Refalsh() + ViewUtil.ShowBannerOnScreenCenter("设置成功") + end) + end) + + self.btn_hideNumber.onClick:Set(function() + if self.isShowContenting == true then + ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") + return + end + + print("点击了") + + local fgCtr = ControllerManager.GetController(NewGroupController) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(0, self.family.id, function(res) + print("收到协议M:FG_SetGroupShow") + pt(res) + self.isShowContenting = false + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") + return + end + self.family.isShow = 0 + self:Refalsh() + ViewUtil.ShowBannerOnScreenCenter("设置成功") + end) + end) + + self.btn_showNumber.onClick:Set(function() + if self.isShowContenting == true then + ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") + return + end + + print("点击了") + + local fgCtr = ControllerManager.GetController(NewGroupController) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(1, self.family.id, function(res) + print("收到协议M:FG_SetGroupShow") + pt(res) + self.isShowContenting = false + if res.ReturnCode ~= 0 then ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") return end @@ -235,4 +290,4 @@ function FamilyMyFamily:Init() return self end -return FamilyMyFamily \ No newline at end of file +return FamilyMyFamily diff --git a/lua_probject/base_project/Game/View/Family/RoomCardRecord.lua b/lua_probject/base_project/Game/View/Family/RoomCardRecord.lua new file mode 100644 index 00000000..8930525c --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/RoomCardRecord.lua @@ -0,0 +1,25 @@ +local RoomCardRecord = {} + +function RoomCardRecord.New() + setmetatable(RoomCardRecord, { __index = BaseWindow }) + local inst = setmetatable({}, { __index = RoomCardRecord }) + inst._close_destroy = true + inst._full = true + inst._animation = false + inst._full_offset = false + inst._anim_pop = 0 + BaseWindow.init(inst, 'ui://Family/com_familyRoomCardRecord') + inst:Init() + inst._root_view:GetChild("win_mode").visible = false + return inst +end + +function RoomCardRecord:Show() + BaseWindow.Show(self) +end + +function RoomCardRecord:Init() + self.list_record = self._view:GetChild("list_record") +end + +return RoomCardRecord \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index e6e474c8..bcb65d7e 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -16,6 +16,7 @@ local FamilyMyFamily = import(".Family.FamilyMyFamily") local FamilyRoomCard = import(".Family.FamilyRoomCard") local FamilyMyfamilyList = import(".Family.FamilyMyfamilyList") local FamilyChatRoom = import(".Family.FamilyChatRoom") +local FamilyMsgRecord = import(".Family.FamilyMsgRecord") --- FamilyView = {} @@ -126,6 +127,57 @@ function M:ShareWx() familyInviteFamilyView:Show() end +function M:MsgView() + self.lastType = self.familyType.selectedIndex + self.familyType.selectedIndex = 0 + local view = FamilyMsgRecord.New(function() + self.familyType.selectedIndex = self.lastType + end) + view:Show() +end + +function M:SetIsOpenChatRoom() + local value = 1 + if self._group.isOpenChatRoom == 1 then + value = 0 + elseif self._group.isOpenChatRoom == 0 then + value = 1 + end + + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:SetIsOpenChatRoom(self._group.id, value, function(res) + print("设置开启聊天室协议") + pt(res) + + if res.ReturnCode ~= 0 then + return + end + self._group.isOpenChatRoom = value + self:RefalshMoreBtn() + end) +end + +function M:SetCanWatch() + local value = 1 + if self._group.isWatch == 1 then + value = 0 + elseif self._group.isWatch == 0 then + value = 1 + end + + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:SetCanWatch(self._group.id, value, function(res) + print("设置是否观战") + pt(res) + + if res.ReturnCode ~= 0 then + return + end + self._group.isWatch = value + self:RefalshMoreBtn() + end) +end + function M:FamilyRecord() if not self._ViewChild_Record or not self._ViewChild_Record.ShouRanks then self._ViewChild_Record = FamilyRecord.New(self, self._group.id) @@ -198,6 +250,7 @@ function M:MoreBtn() end) ctr_more.selectedIndex = 1 self:ChangeMore() + self:RefalshMoreBtn() end function M:BanFamily() @@ -288,7 +341,10 @@ function M:UpdateFamilyRoom(fgCtr, id) roomList[newIndex].id) obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1 obj:GetController('num').selectedIndex = roomList[newIndex].maxPlayers - 2 - obj:GetController('type').selectedIndex = 1 + if self._group.isWatch == 1 then + -- 允许观战 + obj:GetController('type').selectedIndex = 1 + end local plist = roomList[newIndex].plist local insertName = "" for i = 1, #plist do @@ -644,7 +700,7 @@ local MORE_LIST = { }, { name = "消息记录", - Fct = M.ShareWx + Fct = M.MsgView }, { name = "禁止同桌", @@ -652,7 +708,11 @@ local MORE_LIST = { }, { name = "关闭聊天室", - Fct = M.ShareWx + Fct = M.SetIsOpenChatRoom + }, + { + name = "关闭旁观", + Fct = M.SetCanWatch }, } @@ -682,4 +742,26 @@ function M:ChangeMore() list_other.numItems = #moreList end +function M:RefalshMoreBtn() + -- 有空优化吧 + + local tex = "" + if self._group.isOpenChatRoom == 1 then + tex = "关闭聊天室" + elseif self._group.isOpenChatRoom == 0 then + tex = "打开聊天室" + end + MORE_LIST[4].name = tex + + local tex = "" + if self._group.isWatch == 1 then + tex = "关闭观战" + elseif self._group.isWatch == 0 then + tex = "打开观战" + end + MORE_LIST[5].name = tex + + self:ChangeMore() +end + return M diff --git a/lua_probject/base_project/Main.lua b/lua_probject/base_project/Main.lua index d454d07b..a3a0990f 100644 --- a/lua_probject/base_project/Main.lua +++ b/lua_probject/base_project/Main.lua @@ -42,6 +42,7 @@ function Main() typeof(UnityEngine.AudioClip))) FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S" 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("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) diff --git a/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml b/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml index 1f52f4d4..622df041 100644 --- a/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml +++ b/wb_new_ui/assets/Family/ChatRoom/Component/item_record.xml @@ -5,7 +5,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 9cc8415a0cfae87c6dc49e927ee054dfac98e95a diff --git a/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 266.png b/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 266.png new file mode 100644 index 00000000..99bed9f7 Binary files /dev/null and b/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 266.png differ diff --git a/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 291.png b/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 291.png new file mode 100644 index 00000000..c1bf2439 Binary files /dev/null and b/wb_new_ui/assets/Family/ChatRoom/Image/Rectangle 291.png differ diff --git a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml index c7121cc6..9fab46a5 100644 --- a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml +++ b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml @@ -10,7 +10,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 9cc8415a0cfae87c6dc49e927ee054dfac98e95a diff --git a/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time.xml b/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time.xml new file mode 100644 index 00000000..4387f77c --- /dev/null +++ b/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time_item.xml b/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time_item.xml new file mode 100644 index 00000000..4c09c556 --- /dev/null +++ b/wb_new_ui/assets/Family/FamilyRoomCardRecord/Component/box_time_item.xml @@ -0,0 +1,10 @@ + + + + + + + + +