diff --git a/lua_probject/base_project/Game/Controller/GroupMgrController.lua b/lua_probject/base_project/Game/Controller/GroupMgrController.lua index 43209518..173c75cb 100644 --- a/lua_probject/base_project/Game/Controller/GroupMgrController.lua +++ b/lua_probject/base_project/Game/Controller/GroupMgrController.lua @@ -22,7 +22,8 @@ GroupMgrEvent = { OnFamilyReflash = "OnFamilyReflash", OnFamilyRoomReflash = "OnFamilyRoomReflash", OnFamilyMemberOut = "OnFamilyMemberOut", - OnRefNumberBan = "OnRefNumberBan" + OnRefNumberBan = "OnRefNumberBan", + OnRefShowStartRoom = "OnRefShowStartRoom" } GroupMgrController = { @@ -68,6 +69,8 @@ function GroupMgrController.new() self._eventmap[Protocol.WEB_FG_MEMBER_ONLINE] = self.OnMemberOnline self._eventmap[Protocol.WEB_FG_MEMBER_GAME_STATE] = self.OnMemberGameState self._eventmap[Protocol.FGMGR_EVT_Ref_NumberBan] = self.OnRefNumberBan + self._eventmap[Protocol.FGMGR_EVT_SHOWSTART] = self.OnRefShowStartRoom + -- self:connect(callback) return self end @@ -372,6 +375,16 @@ function M:FG_CLOSE_ISOPEN_CHATROOM(groupId, callback) end) end +-- 设置成员是否显示开始房间 +function M:FG_SetShowStartRoom(groupId, isOpen, callback) + local _data = {} + _data.groupId = groupId + _data.isOpen = isOpen + self._mgr_client:send(Protocol.FGMGR_SET_SHOWSTART, _data, function(res) + callback(res) + end) +end + -- 拉取聊天室数据 function M:FG_ENTER_CHATROOM(groupId, getData, callback) local _data = {} @@ -653,6 +666,12 @@ function M:OnRefNumberBan(evt_data) DispatchEvent(self._dispatcher, GroupMgrEvent.OnRefNumberBan, evt_data) end +function M:OnRefShowStartRoom(evt_data) + local group = DataManager.groups:get(self.groupId) + group.isOpenStartRoom = evt_data.isOpen + DispatchEvent(self._dispatcher, GroupMgrEvent.OnRefNumberBan, evt_data) +end + function M:PopEvent() local _cacheEvent = self._cacheEvent if (_cacheEvent:Count() > 0) then diff --git a/lua_probject/base_project/Game/Controller/NewGroupController.lua b/lua_probject/base_project/Game/Controller/NewGroupController.lua index 5417ee40..64a63868 100644 --- a/lua_probject/base_project/Game/Controller/NewGroupController.lua +++ b/lua_probject/base_project/Game/Controller/NewGroupController.lua @@ -43,6 +43,7 @@ function M:FG_GroupList(callback) group.show_num = tem.show_num group.isShow = tem.isShow group.isOpenChatRoom = tem.isOpenChatRoom + group.isOpenStartRoom = tem.isShowBeginRoom or 0 -- --是否显示开始房间 0显示 1隐藏 group.isWatch = tem.isWatch group.wechatId = tem.wechatId group.groupDiamo = tem.groupDiamo diff --git a/lua_probject/base_project/Game/Data/GroupData.lua b/lua_probject/base_project/Game/Data/GroupData.lua index 362e68a0..7a77d472 100644 --- a/lua_probject/base_project/Game/Data/GroupData.lua +++ b/lua_probject/base_project/Game/Data/GroupData.lua @@ -1,4 +1,4 @@ -local M = class("GroupData") +local M = class("GroupData") function M:ctor() self.id = 0 @@ -45,7 +45,6 @@ function M:ctor() self.hide_action = 0 --是否开启全民推广 self.promote = false - end -- 添加成员 @@ -53,8 +52,8 @@ function M:addMember(member) local _tem = self.memberMap[member.uid] if _tem then for k, v in pairs(member) do - _tem[k] = v - end + _tem[k] = v + end else self.memberMap[member.uid] = member self.members[#self.members + 1] = member @@ -67,10 +66,10 @@ function M:delMember(id) local _tem = self.memberMap[id] if _tem then self.memberMap[id] = nil - for i=1,#self.members do + for i = 1, #self.members do local member = self.members[i] if member.uid == id then - table.remove(self.members,i) + table.remove(self.members, i) break end end @@ -93,7 +92,7 @@ function M:addRoom(room) local pid = room.pid local play = self:getPlay(pid) if not play then return end - for i=1,#self.rooms do + for i = 1, #self.rooms do local tem = self.rooms[i] if room.id == tem.id then self.rooms[i] = room @@ -106,7 +105,7 @@ function M:addRoom(room) return end end - self.rooms[#self.rooms+1] = room + self.rooms[#self.rooms + 1] = room -- 把房间加入对应的玩法下的列表 play.rooms[#play.rooms + 1] = room end @@ -114,11 +113,11 @@ end -- 删除房间 function M:delRoom(id) local pid = 0 - for i=1,#self.rooms do + for i = 1, #self.rooms do local room = self.rooms[i] if room.id == id then pid = room.pid - table.remove(self.rooms,i) + table.remove(self.rooms, i) break end end @@ -138,16 +137,16 @@ end function M:addPlay(play) --printlog("添加玩法addPlay===>>>") --pt(play) - local maxRound=0 + local maxRound = 0 if play.maxRound then - maxRound=play.maxRound + maxRound = play.maxRound else local hpdata = json.decode(play.hpData) - maxRound=hpdata.maxRound + maxRound = hpdata.maxRound end - + local pnum = play.maxPlayers - local room = {maxPlayers = pnum, status = -1, default = true, pid = play.id,times=maxRound} + local room = { maxPlayers = pnum, status = -1, default = true, pid = play.id, times = maxRound } play.rooms = {} local index = self:getPlayIndex(play.id) @@ -162,59 +161,52 @@ function M:addPlay(play) --self.playList=self:SortPlay(self.playList) --pt(self.playList) --self.default_rooms=self:SortDefaultPlay(self.default_rooms) - end - function M:SortPlay(list) - local singlePlayList={} - local otherPlayList={} - - for i=1,#list do - local hpdata=json.decode(list[i].hpData) - if hpdata.maxRound and hpdata.maxRound==1 then - table.insert(singlePlayList,list[i]) + local singlePlayList = {} + local otherPlayList = {} + + for i = 1, #list do + local hpdata = json.decode(list[i].hpData) + if hpdata.maxRound and hpdata.maxRound == 1 then + table.insert(singlePlayList, list[i]) else - table.insert(otherPlayList,list[i]) + table.insert(otherPlayList, list[i]) end - end - - for i=1,#otherPlayList do - table.insert(singlePlayList,otherPlayList[i]) + + for i = 1, #otherPlayList do + table.insert(singlePlayList, otherPlayList[i]) end - + return singlePlayList - end - function M:SortDefaultPlay(list) - local singlePlayList={} - local otherPlayList={} - - for i=1,#list do - if list[i].times and list[i].times==1 then - table.insert(singlePlayList,list[i]) + local singlePlayList = {} + local otherPlayList = {} + + for i = 1, #list do + if list[i].times and list[i].times == 1 then + table.insert(singlePlayList, list[i]) else - table.insert(otherPlayList,list[i]) + table.insert(otherPlayList, list[i]) end - end - - for i=1,#otherPlayList do - table.insert(singlePlayList,otherPlayList[i]) + + for i = 1, #otherPlayList do + table.insert(singlePlayList, otherPlayList[i]) end - + return singlePlayList - end -- 删除玩法 function M:delPlay(pid) local index = self:getPlayIndex(pid) if index ~= -1 then - table.remove(self.playList,index) + table.remove(self.playList, index) table.remove(self.default_rooms, index) return true end @@ -254,7 +246,7 @@ function M:getPlayName(pid) end function M:getPlayIndex(pid) - for i=1,#self.playList do + for i = 1, #self.playList do local tem = self.playList[i] if tem.id == pid then return i @@ -266,7 +258,7 @@ end function M:clearPlay() self.playList = {} self.rooms = {} - self.default_rooms={} + self.default_rooms = {} for i = 1, #self.playList do self.playList[i].rooms = {} end @@ -280,4 +272,4 @@ function M:clear() self.default_rooms = {} end -return M \ No newline at end of file +return M diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index 9300afd9..1abfaa02 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -441,6 +441,10 @@ Protocol = { FGMGR_EVT_Push_Assistant = "push_assistant", -- 刷新成员列表 FGMGR_EVT_Ref_NumberBan = "13010", + --显示/隐藏一开始房间 + FGMGR_SET_SHOWSTART = "13012", + --显示/隐藏一开始房间接收事件 + FGMGR_EVT_SHOWSTART = "13013", --end::::::::::::::牌友圈协议:::::::::::::::::::: diff --git a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua index 44877983..ca6a9fa2 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyEventView.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyEventView.lua @@ -34,6 +34,7 @@ function M:AddListener() mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyReflash, handler(self, self._evtOnFamilyReflash)) mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyRoomReflash, handler(self, self._evtOnFamilyRoomReflash)) mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyMemberOut, handler(self, self._evtOnFamilyMemberOut)) + mgr_ctr:AddEventListener(GroupMgrEvent.OnRefShowStartRoom, handler(self, self._evtOnRefShowStartRoom)) print("家族添加监听") end @@ -58,6 +59,8 @@ function M:RemoveAll() mgr_ctr:RemoveEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState)) mgr_ctr:RemoveEventListener(GroupMgrEvent.OnFamilyRoomReflash, handler(self, self._evtOnFamilyRoomReflash)) mgr_ctr:RemoveEventListener(GroupMgrEvent.OnFamilyMemberOut, handler(self, self._evtOnFamilyMemberOut)) + mgr_ctr:RemoveEventListener(GroupMgrEvent.OnRefShowStartRoom, handler(self, self._evtOnRefShowStartRoom)) + print("家族去除监听") end @@ -390,4 +393,20 @@ function M:_evtOnFamilyMemberOut(...) win:Show() end +function M:_evtOnRefShowStartRoom(...) + local arg = { ... } + + -- local groupId = arg[1] + + -- local view = ViewManager.GetCurrenView() + -- if view.class ~= "FamilyMainView" then + -- return + -- end + + -- if view._group == nil or groupId ~= view._group.id then + -- return + -- end + self:UpdateFamilyRoom(nil, self._group.id) +end + return M diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index f5e2985f..dc8855e5 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -240,6 +240,18 @@ function M:init(url) end self.familyType.selectedIndex = 1 + + self._view:GetChild('btn_showALlStartRoom').onClick:Set(function() + local mgr_ctr = ControllerManager.GetController(GroupMgrController) + self:UpdateFamilyRoom(nil, self._group.id) + mgr_ctr:FG_SetShowStartRoom(self._group.id, 1 - self._group.isOpenStartRoom, function(res) + --因为没有回调,这边先把值设置好 + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode) + return + end + end) + end) end function M:Reflash() @@ -601,6 +613,11 @@ function M:UpdateFamilyRoom(fgCtr, id) table.insert(v.status == 0 and readyRoom or startRoom, v) end local all_num = #playList + #roomList + local show_num = all_num + if self._group.isOpenStartRoom == 1 then + self._view:GetChild('btn_showALlStartRoom'):GetController('isOpen').selectedIndex = self._group.isOpenStartRoom + show_num = #playList + #readyRoom + end list_room.itemRenderer = function(index, obj) if index < #readyRoom then local newIndex = index + 1 @@ -721,10 +738,11 @@ function M:UpdateFamilyRoom(fgCtr, id) pt(roomList) --list_room.numItems = all_num - if list_room.numItems == all_num then + + if list_room.numItems == show_num then list_room:RefreshVirtualList() else - list_room.numItems = all_num + list_room.numItems = show_num end --如果在编辑玩法页面则此处调用刷新 if self._view_PlayEditView then diff --git a/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua b/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua index 7ddd1a42..11eb5017 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbyPlayerInfoView.lua @@ -31,7 +31,8 @@ function M:init(url) view:GetChild('phone').text = user.phone view:GetChild('id').text = user.account_id view:GetChild('diamo').text = user.diamo - view:GetChild('sex').text = user.sex and "男" or "女" + view:GetChild('sex').text = user.sex == 1 and "男" or "女" + view:GetController('ctr_sex').selectedIndex = user.sex - 1 ImageLoad.Load(DataManager.SelfUser.head_url, view:GetChild("btn_PlayerHead")._iconObject) --change @@ -86,6 +87,23 @@ function M:init(url) type.selectedIndex = 0 end end) + + view:GetController('ctr_sex').onChanged:Set(function(context) + user.sex = context.sender.selectedIndex + 1 + ViewUtil.ShowModalWait2(self._root_view) + local loddyctr = ControllerManager.GetController(LoddyController) + local _data = {} + _data.sex = context.sender.selectedIndex + 1 + _data.type = 7 + + loddyctr:UpdateUserInfo(_data, function(res) + ViewUtil.CloseModalWait2() + if (res.ReturnCode == 0) then + else + ViewUtil.ErrorTip(res.ReturnCode, "切换性别失败") + end + end) + end) end return M diff --git a/wb_new_ui/assets/Family/Main.xml b/wb_new_ui/assets/Family/Main.xml index 5f1ba572..b1bd3e63 100644 --- a/wb_new_ui/assets/Family/Main.xml +++ b/wb_new_ui/assets/Family/Main.xml @@ -39,14 +39,14 @@ - + - + diff --git a/wb_new_ui/assets/Family/Main/Component/btn_showALlStartRoom.xml b/wb_new_ui/assets/Family/Main/Component/btn_showALlStartRoom.xml index fd140389..22382514 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_showALlStartRoom.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_showALlStartRoom.xml @@ -1,8 +1,18 @@ + - + + + + + + + + + +