diff --git a/lua_probject/base_project/Game/Controller/LoddyController.lua b/lua_probject/base_project/Game/Controller/LoddyController.lua index 3bc4c717..35c5432f 100644 --- a/lua_probject/base_project/Game/Controller/LoddyController.lua +++ b/lua_probject/base_project/Game/Controller/LoddyController.lua @@ -349,7 +349,7 @@ function M:RequestRecordList(callback, roomid) self.recordList[#self.recordList + 1] = record_list end end - callback(res.ReturnCode) + callback(res) else callback(res.ReturnCode) end diff --git a/lua_probject/base_project/Game/Controller/LoginController.lua b/lua_probject/base_project/Game/Controller/LoginController.lua index 7afcd049..e22d6862 100644 --- a/lua_probject/base_project/Game/Controller/LoginController.lua +++ b/lua_probject/base_project/Game/Controller/LoginController.lua @@ -14,7 +14,7 @@ end local _LocalConfigAllGame = { -- 10, 33, - 90, + -- 90, 66, 86, 87, 88, 89 } diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua index 2bf17fc9..aa1f8948 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua @@ -53,8 +53,8 @@ function FamilyNumberRecord.New(root) btn_chooseTimeBegin.text = os.date('%Y-%m-%d', os.time()) btn_chooseTimeEnd.text = os.date('%Y-%m-%d', os.time()) - text_score_majiang.text = MJScore - text_score_poker.text = PKScore + text_score_majiang.text = 0 - MJScore + text_score_poker.text = 0 - PKScore self._viewText_titleRecord.text = string.format("%s 成员记录", self._text_groupTitle) self._view:GetChild('text_residueDiamond').text = self._group.diamo self._view:GetChild('text_timeRecord').text = os.date('%Y-%m-%d %H:%M', os.time()) @@ -139,7 +139,7 @@ function FamilyNumberRecord.New(root) ViewUtil.ShowOneChooose("修改限制分失败" .. res.ReturnCode) else MJScore = tonumber(text) - text_score_majiang.text = MJScore + text_score_majiang.text = 0 - MJScore end end) end) @@ -153,7 +153,7 @@ function FamilyNumberRecord.New(root) ViewUtil.ShowOneChooose("修改限制分失败" .. res.ReturnCode) else PKScore = tonumber(text) - text_score_poker.text = PKScore + text_score_poker.text = 0 - PKScore end end) end) @@ -197,8 +197,8 @@ function FamilyNumberRecord.New(root) else MJScore = tonumber(res.Data.mj_score) PKScore = tonumber(res.Data.pk_score) - text_score_majiang.text = MJScore - text_score_poker.text = PKScore + text_score_majiang.text = 0 - MJScore + text_score_poker.text = 0 - PKScore end end) return self @@ -324,7 +324,7 @@ function M:NumverRankRenderer(groupId) ImageLoad.Load(info.portrait, obj:GetChild('btn_head')._iconObject) obj:GetChild('text_ID').text = info.uid obj:GetChild('text_nick').text = info.nick - obj:GetChild('text_score').text = info.score + obj:GetChild('text_score').text = tonumber(info.score) / 1000 obj:GetChild('btn_lookRecord').onClick:Set(function() self.ctr_numberRecord.selectedIndex = 1 self:OnClickNumberRank(groupId, info.uid, info.round) @@ -343,15 +343,25 @@ function M:OnClickSortType(groupId, pid, sortType) local numberRecordList = self._viewList_numverRecord fgCtr:FG_GetMemberRank(groupId, 0, 0, 10, self.familyChooseTimeView:GetBeginTime(), self.familyChooseTimeView:GetEndTime(), sortType, function(res) - pt(res) - if res.ReturnCode ~= 0 then - ViewUtil.ShowOneChooose("获取排行榜失败" .. res.ReturnCode) - else - self.rank = res.Data.ranks - self.showRank = self.rank - numberRecordList.numItems = #self.showRank - end - end) + pt(res) + if res.ReturnCode ~= 0 then + ViewUtil.ShowOneChooose("获取排行榜失败" .. res.ReturnCode) + else + self.rank = res.Data.ranks + self.showRank = self.rank + local round = 0 + local win = 0 + local cost = 0 + for i = 1, #self.rank do + round = round + self.rank[i].round + win = win + self.rank[i].win + end + round = math.floor(round / 2) + self._view:GetChild('text_allRound').text = round + self._view:GetChild('text_winNum').text = win + numberRecordList.numItems = #self.showRank + end + end) end function M:OnClickNumberRank(groupId, uid, round) diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index eac2a9a2..f87baa4c 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -55,6 +55,7 @@ end function M:InitCloseClick() self.btn_close.onClick:Set(function() + print("lingmengfamily", self.lastType, self.familyType.selectedIndex) if not self.lastType or self.familyType.selectedIndex == 1 then ControllerManager.ChangeController(LoddyController) ViewManager.ChangeView(ViewManager.View_Lobby) @@ -110,6 +111,28 @@ function M:ShowShop() self._child_familyLobbyShopView:Show() end +function M:MoreBtn() + local ctr_more = self._view:GetController('moreBtn') + self._view:GetChild('bg_moreBtnBack').onClick:Set(function() + ctr_more.selectedIndex = 0 + end) + ctr_more.selectedIndex = 1 + self:ChangeMore() +end + +function M:BanFamily() + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_UpdateGroupInfo(self._group.id, name, self._group.name, not self._group.ban, self._group.dissolve_opt, + self._group.kick_opt, self._group.apply, self._group.ban_chat1, self._group.ban_chat2, self._group.option, 0, + function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "一键打样失败") + else + self._view:GetController('familyBan').selectedIndex = self._group.ban and 1 or 0 + end + end) +end + function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type) local list_familyNumber = self._view:GetChild('list_familyNumber') list_familyNumber:SetVirtual() @@ -165,6 +188,7 @@ function M:UpdateFamilyRoom(fgCtr, id) local roomList = self._group.rooms print("lingmengroomList") pt(roomList) + pt(playList) local roomCtr = ControllerManager.GetController(RoomController) list_room.itemRenderer = function(index, obj) if index < #roomList then @@ -177,6 +201,14 @@ function M:UpdateFamilyRoom(fgCtr, id) playGameInfoTable[roomList[newIndex].pid].name, roomList[newIndex].id) obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1 + obj:GetController('num').selectedIndex = roomList[newIndex].maxPlayers - 2 + local plist = roomList[newIndex].plist + local insertName = "" + for i = 1, #plist do + ImageLoad.Load(plist[i].portrait, obj:GetChild(string.format("player%d", i))._iconObject) + insertName = string.format("%s、%s", plist[i].nick, insertName) + end + obj:GetChild('Label_joinPlayers').text = insertName obj:GetChild('btn_joinGame').onClick:Set(function() roomCtr:PublicJoinRoom( Protocol.WEB_FG_JOIN_ROOM, @@ -211,6 +243,7 @@ function M:UpdateFamilyRoom(fgCtr, id) obj:GetChild('game_type').text = string.format("(%s)%s", playList[newIndex].game_name, playList[newIndex] .name) obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0 + obj:GetController('num').selectedIndex = playList[newIndex].maxPlayers - 2 obj:GetChild('btn_joinGame').onClick:Set(function() roomCtr:PublicJoinRoom( Protocol.WEB_FG_MATCH_ROOM, @@ -278,6 +311,7 @@ function M:ConnetFamily(index, groups, isCreate) list_family:SetVirtual() self._group = DataManager.groups:get(groups[index].id) self._view:GetChild('text_familyId').text = self._group.id + self._view:GetController('familyBan').selectedIndex = self._group.ban and 1 or 0 -- print("===================================self._group") pt(self._group) self._roomNum = self._group.room_num @@ -346,13 +380,13 @@ function M:OnUpdate() -- -- print("====================================UpdateFamilyRoom", fgCtr, self._group.id) self:UpdateFamilyRoom(fgCtr, self._group.id) end - if not self.lastType or self.lastType - heatTime > 30 then + if not self.lastTime or self.lastTime - heatTime > 30 then fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res) self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, 1) pt(res) end) - self.lastType = heatTime + self.lastTime = heatTime end end @@ -394,7 +428,7 @@ local IDENTITY_LIST = { }, { name = "高级选项", - Fct = M.CreateFamily + Fct = M.MoreBtn }, { name = "亲友圈排行榜", @@ -436,7 +470,7 @@ local IDENTITY_LIST = { }, { name = "高级选项", - Fct = M.CreateFamily + Fct = M.MoreBtn }, { name = "亲友圈排行榜", @@ -465,6 +499,25 @@ local IDENTITY_LIST = { }, } +local MORE_LIST = { + { + name = "一键打样", + Fct = M.BanFamily + }, + { + name = "消息记录", + Fct = M.ShareWx + }, + { + name = "禁止同桌", + Fct = M.ShareWx + }, + { + name = "关闭聊天室", + Fct = M.ShareWx + }, +} + function M:ChangeOther(i) local otherList = IDENTITY_LIST[i].otherList local list_other = self._view:GetChild('list_other') @@ -472,9 +525,23 @@ function M:ChangeOther(i) list_other:SetVirtual() list_other.itemRenderer = function(index, obj) obj:GetChild('title').text = otherList[index + 1].name - obj.onClick:Add(handler(self, otherList[index + 1].Fct)) + obj.onClick:Set(handler(self, otherList[index + 1].Fct)) end list_other.numItems = #otherList end +function M:ChangeMore() + local moreList = MORE_LIST + local list_other = self._view:GetChild('list_more') + list_other:SetVirtual() + list_other.itemRenderer = function(index, obj) + obj:GetChild('title').text = moreList[index + 1].name + obj.onClick:Set(handler(self, moreList[index + 1].Fct)) + obj.onClick:Add(function() + self._view:GetController('moreBtn').selectedIndex = 0 + end) + end + list_other.numItems = #moreList +end + return M diff --git a/lua_probject/base_project/Game/View/Lobby/LobbyRecordView.lua b/lua_probject/base_project/Game/View/Lobby/LobbyRecordView.lua index 2933c1cd..ae5d8b1d 100644 --- a/lua_probject/base_project/Game/View/Lobby/LobbyRecordView.lua +++ b/lua_probject/base_project/Game/View/Lobby/LobbyRecordView.lua @@ -5,12 +5,13 @@ local LobbyRecordView = {} local M = LobbyRecordView setmetatable(M, { __index = BaseWindow }) -function LobbyRecordView.new(Fct_UpdateDiamo) +function LobbyRecordView.new() local self = setmetatable({}, { __index = M }) self.class = 'LobbyRecordView' self._close_destroy = true self:init('ui://Lobby/Record') - self.UpdateDiamo = Fct_UpdateDiamo + self._viewlist_numberRecordDetail = self._view:GetChild('list_numberRecordDetail') + return self end @@ -19,14 +20,90 @@ function M:init(url) local view = self._view + self.records = { totalScore = 0, childNum = 0, winNum = 0 } local loddyCtr1 = ControllerManager.GetController(LoddyController) loddyCtr1:RequestRecordList(function(res) - if res ~= 0 then + if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "获取战绩失败") else - pt(loddyCtr1.recordList) + -- pt(loddyCtr1.recordList) + local records = res.Data.military_list + for i = 1, #records do + local info = records[i] + local tempTableChild = self.records + info.totalScore = json.decode(info.totalScore) + local totalScore = 0 + print("lingmengtotalScore", #info.totalScore, DataManager.SelfUser.account_id) + for i = 1, #info.totalScore do + pt(info.totalScore) + if info.totalScore[i].accId == DataManager.SelfUser.account_id then + totalScore = info.totalScore[i].score + end + end + if info.round ~= "1" or totalScore ~= 0 then + table.insert(tempTableChild, info) + print(tempTableChild.totalScore) + tempTableChild.totalScore = tempTableChild.totalScore + totalScore + tempTableChild.childNum = tempTableChild.childNum + 1 + tempTableChild.winNum = tempTableChild.winNum + (totalScore > 0 and 1 or 0) + end + end end + self._viewlist_numberRecordDetail.numItems = self.records.childNum end) end +function M:NumberRecordDetailRender() + local list_numberRecordDetail = self._viewlist_numberRecordDetail + list_numberRecordDetail:SetVirtual() + list_numberRecordDetail.itemRenderer = function(index, obj) + local info = self.records + obj:GetChild('text_gameName').text = info.game_info.name + obj:GetChild('text_time').text = os.date('%Y-%m-%d\n%H:%M', info.create_time) + obj:GetChild('text_roomID').text = info.room_id + obj:GetChild('text_userDiamond').text = 0 + obj:GetChild('btn_lookRecord').onClick:Set(function() + print("lingmeng查看") + end) + obj:GetController('seleted').onChanged:Set(function(context) + pt(getmetatable(context.sender)) + if context.sender.selectedIndex == 1 then + if not self.military[info.military_id] then + self.military.size = self.military.size + 1 + self.military[info.military_id] = self.military.size + table.insert(self.military.list, info.military_id) + end + else + if self.military[info.military_id] then + self.military.size = self.military.size - 1 + table.remove(self.military.list, self.military[info.military_id]) + self.military[info.military_id] = nil + end + end + end) + if self._flag_allChoose and self._flag_allChoose > 0 then + obj:GetController('seleted').selectedIndex = 1 + self._flag_allChoose = self._flag_allChoose - 1 + end + if self._flag_allChooseReverse and self._flag_allChooseReverse > 0 then + obj:GetController('seleted').selectedIndex = 1 - obj:GetController('seleted').selectedIndex + self._flag_allChooseReverse = self._flag_allChooseReverse - 1 + end + local resultDetailList = obj:GetChild('list') + resultDetailList:SetVirtual() + resultDetailList.itemRenderer = function(index, obj) + local resultInfo = info.totalScore[index + 1] + ImageLoad.Load(resultInfo.portrait, obj:GetChild('btn_head')._iconObject) + obj:GetChild('text_name').text = resultInfo.nick + obj:GetChild('text_score').text = resultInfo.score + obj:GetController('colour').selectedIndex = resultInfo.score >= 0 and 1 or 0 + end + resultDetailList.numItems = #info.totalScore + end +end + +function M:ResetRecords() + self.records = { totalScore = 0, childNum = 0, winNum = 0 } +end + return M diff --git a/wb_new_ui/assets/Family/Main.xml b/wb_new_ui/assets/Family/Main.xml index a17c2892..bb969945 100644 --- a/wb_new_ui/assets/Family/Main.xml +++ b/wb_new_ui/assets/Family/Main.xml @@ -7,6 +7,8 @@ + + @@ -16,44 +18,44 @@ - - + + - - + + - + - + - - + + - + - + - + - - - + + + - + - - + + @@ -68,7 +70,7 @@ - + @@ -78,7 +80,7 @@ - + @@ -86,17 +88,24 @@ - + - + - + + + + + + + + @@ -331,6 +340,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Family/Main/Component/Label_joinPlayers.xml b/wb_new_ui/assets/Family/Main/Component/Label_joinPlayers.xml index da9fcf63..df0bcc28 100644 --- a/wb_new_ui/assets/Family/Main/Component/Label_joinPlayers.xml +++ b/wb_new_ui/assets/Family/Main/Component/Label_joinPlayers.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/wb_new_ui/assets/Family/Main/Component/btn_head.xml b/wb_new_ui/assets/Family/Main/Component/btn_head.xml index 1ab8710f..82787ae6 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_head.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_head.xml @@ -2,7 +2,7 @@ - + diff --git a/wb_new_ui/assets/Family/Main/Component/c_familyMember.xml b/wb_new_ui/assets/Family/Main/Component/c_familyMember.xml index 3d6e7fa3..157d6a7c 100644 --- a/wb_new_ui/assets/Family/Main/Component/c_familyMember.xml +++ b/wb_new_ui/assets/Family/Main/Component/c_familyMember.xml @@ -1,10 +1,10 @@ - + - + diff --git a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml index 6b091100..62545f6e 100644 --- a/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml +++ b/wb_new_ui/assets/Family/Main/Component/c_roomChild.xml @@ -1,6 +1,7 @@ + @@ -14,13 +15,34 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Lobby/Main/Component/btn_head.xml b/wb_new_ui/assets/Lobby/Main/Component/btn_head.xml new file mode 100644 index 00000000..1ab8710f --- /dev/null +++ b/wb_new_ui/assets/Lobby/Main/Component/btn_head.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + +