local TimeSettingPanel = import(".TimeSettingPanelTog") local GroupPartnerStatMember = import(".GroupPartnerStatMember") local GroupPartnerStatPlay = import(".GroupPartnerStatPlay") local GroupNumberInputView = import(".GroupNumberInputView") -- 开桌统计 local GroupMngPartnerStatView = {} local M = GroupMngPartnerStatView function GroupMngPartnerStatView.new(gid, rootView, player) local self = M self.class = "GroupMngPartnerStatView" self.group_id = gid self._data_choosePlayyer = player self:InitView() return self end function M:initData() self.lst_record.numItems = 0 self.record_data = {} self.ctr_search = self._view:GetController('search') local now_time = os.date("*t", now) local today = os.time({ year = now_time.year, month = now_time.month, day = now_time.day, hour = 0, min = 0, sec = 0 }) self.begin_time = today self.end_time = today + 86400 -- print("lingmeng initData") self:GetRecordData(0) --self:ShowPeopleNum() end -- function M:ShowPeopleNum() -- local fgCtr = ControllerManager.GetController(NewGroupController) -- fgCtr:FG_GetMembersCount(self.group_id,function(res) -- ViewUtil.CloseModalWait() -- if res.ReturnCode == 0 then -- self._view:GetChild('tex_memb_num').text = res.Data.member_num -- self._view:GetChild('tex_total_hp').text = d2ad(res.Data.hp_num1+res.Data.otherHp) -- end -- end) -- end function M:InitView() self._view = UIPackage.CreateObjectFromURL("ui://NewGroup/View_GroupPartnerStat") -- if group.lev ~= 3 then -- self._view:GetController("mng").selectedIndex = 1 -- end local lst_mgr_index = self._view:GetChild("lst_mgr_index") -- lst_mgr_index.visible = false -- if group.lev == 1 then -- lst_mgr_index.visible = true -- end self.lst_record = self._view:GetChild("lst_record") self.lst_record:SetVirtual() self.lst_record.itemRenderer = function(index, obj) self:OnRenderRecordItem(index, obj) end self.lst_record.scrollPane.onPullUpRelease:Set(function() self._data_index = self._data_index + 1 self:GetRecoedData(self._data_index * 33, self._data_selectedSortType) end) self.lst_record_find = self._view:GetChild("lst_member_find") self.lst_record_find:SetVirtual() self.lst_record_find.itemRenderer = function(index, obj) self:OnRenderRecordItem(index, obj) end -- self.lst_record.scrollPane.onPullUpRelease:Set(function() -- self:GetRecordData(self.lst_record.numItems) -- end) self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"), -308, 0, function() self.begin_time, self.end_time = self.time_panel:GetDate() self.record_data = {} self.record_data.numItems = 0 self:GetRecordData(0) end, true) local ctr_page = self._view:GetController("type") ctr_page.onChanged:Set(function() self.record_data = {} self.lst_record.numItems = 0 if ctr_page.selectedIndex == 0 then local now_time = os.date("*t", now) local today = os.time({ year = now_time.year, month = now_time.month, day = now_time.day, hour = 0, min = 0, sec = 0 }) self.begin_time = today self.end_time = today + 86400 else local now_time = os.date("*t", now) local today = os.time({ year = now_time.year, month = now_time.month, day = now_time.day, hour = 0, min = 0, sec = 0 }) self.begin_time = today - 86400 * ctr_page.selectedIndex self.end_time = today - 86400 * (ctr_page.selectedIndex - 1) end self:GetRecordData(0) end) -- self._view:GetChild("btn_search").onClick:Set(function() -- self.record_data = {} -- self.lst_record.numItems = 0 -- self.begin_time, self.end_time = self.time_panel:GetDate() -- self:GetRecordData(0) -- end) -- 搜索玩家 local ctr_search = self._view:GetController('search') self._view:GetChild('btn_search').onClick:Set( function() -- printlog("aaaaaaaaaa1111111111111111111111111111111111111111111111") ViewUtil.ShowModalWait(nil) local text = self._view:GetChild('tex_id').text local qid, qnick if text == "" then ViewUtil.CloseModalWait() ViewUtil.ErrorTip(nil, '输入不能为空') return end self._view:GetChild('tex_id').text = "" qid = tonumber(text) or 0 local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetMemberStat(self.group_id, qid, DataManager.SelfUser.account_id, 0, 6, 3, self.begin_time, self.end_time, 1, function(res) if res.ReturnCode == 0 then local members = res.Data.members self.record_data_find = {} for i = 1, #members do if members[i].round > 0 then members[i].pump = 0 - members[i].pump self.record_data_find[#self.record_data_find + 1] = members[i] end end ctr_search.selectedIndex = 1 ViewUtil.CloseModalWait() -- print("lingmeng record_data_find", #self.record_data_find) self.lst_record_find.numItems = #self.record_data_find else ViewUtil.CloseModalWait() ViewUtil.ErrorTip(res.ReturnCode) return end end) end ) local btn_back = self._view:GetChild('btn_back') btn_back.onClick:Set( function() ctr_search.selectedIndex = 0 table.sort(self.record_data, function(a, b) return a.round > b.round end) self.lst_record.numItems = #self.record_data end ) self.btn_totalWin = self._view:GetChild('btn_totalWin') self.btn_totalWin.onClick:Set( function() -- self.btn_totalRound:GetController("type").selectedIndex = 0 -- self.btn_total:GetController("type").selectedIndex = 0 -- self.btn_reward:GetController("type").selectedIndex = 0 -- local type = self.btn_totalWin:GetController("type") -- type.selectedIndex = type.selectedIndex == 0 and 1 or 3 - type.selectedIndex local type = self.btn_totalWin:GetController("type") if type.selectedIndex == 0 then self._data_selectedSortType = 1 else self._data_selectedSortType = 3 - self._data_selectedSortType end -- if type.selectedIndex == 1 then -- table.sort(self.record_data, function(a, b) -- return a.score > b.score -- end) -- elseif type.selectedIndex == 2 then -- table.sort(self.record_data, function(a, b) -- return a.score < b.score -- end) -- end -- self.lst_record:RefreshVirtualList() self:GetRecoedData(0, self._data_selectedSortType) end ) self.btn_totalRound = self._view:GetChild('btn_totalRound') self.btn_totalRound.onClick:Set( function() -- self.btn_totalWin:GetController("type").selectedIndex = 0 -- self.btn_total:GetController("type").selectedIndex = 0 -- self.btn_reward:GetController("type").selectedIndex = 0 -- local type = self.btn_totalRound:GetController("type") -- type.selectedIndex = type.selectedIndex == 0 and 1 or 3 - type.selectedIndex local type = self.btn_totalRound:GetController("type") if type.selectedIndex == 0 then self._data_selectedSortType = 3 else self._data_selectedSortType = 7 - self._data_selectedSortType end -- if type.selectedIndex == 1 then -- table.sort(self.record_data, function(a, b) -- return a.round > b.round -- end) -- elseif type.selectedIndex == 2 then -- table.sort(self.record_data, function(a, b) -- return a.round < b.round -- end) -- end -- self.lst_record:RefreshVirtualList() self:GetRecoedData(0, self._data_selectedSortType) end ) self.btn_total = self._view:GetChild('btn_total') self.btn_total.onClick:Set( function() -- self.btn_totalWin:GetController("type").selectedIndex = 0 -- self.btn_totalRound:GetController("type").selectedIndex = 0 -- self.btn_reward:GetController("type").selectedIndex = 0 -- local type = self.btn_total:GetController("type") -- type.selectedIndex = type.selectedIndex == 0 and 1 or 3 - type.selectedIndex local type = self.btn_total:GetController("type") if type.selectedIndex == 0 then self._data_selectedSortType = 5 else self._data_selectedSortType = 11 - self._data_selectedSortType end -- if type.selectedIndex == 1 then -- table.sort(self.record_data, function(a, b) -- return a.win > b.win -- end) -- elseif type.selectedIndex == 2 then -- table.sort(self.record_data, function(a, b) -- return a.win < b.win -- end) -- end -- self.lst_record:RefreshVirtualList() self:GetRecoedData(0, self._data_selectedSortType) end ) self.btn_reward = self._view:GetChild('btn_reward') self.btn_reward.onClick:Set( function() -- self.btn_totalWin:GetController("type").selectedIndex = 0 -- self.btn_totalRound:GetController("type").selectedIndex = 0 -- self.btn_total:GetController("type").selectedIndex = 0 local type = self.btn_reward:GetController("type") if type.selectedIndex == 0 then self._data_selectedSortType = 7 else self._data_selectedSortType = 15 - self._data_selectedSortType end -- if type.selectedIndex == 1 then -- table.sort(self.record_data, function(a, b) -- return a.pump > b.pump -- end) -- elseif type.selectedIndex == 2 then -- table.sort(self.record_data, function(a, b) -- return a.pump < b.pump -- end) -- end -- self.lst_record:RefreshVirtualList() self:GetRecoedData(0, self._data_selectedSortType) end ) end function M:GetRecordData(index) local group = DataManager.groups:get(self.group_id) -- pt("lingmeng GetRecordData", self.group_id, self._data_choosePlayyer, group.lev) -- if group.lev == 1 and self._data_choosePlayyer.uid == DataManager.SelfUser.account_id then -- self:RecursionGetRankData(0) -- else self:GetRecoedData(0, 5) -- end end function M:RefrenRecordData(data) self._data_choosePlayyer = data local group = DataManager.groups:get(self.group_id) -- pt("lingmeng GetRecordData2", self.group_id, self._data_choosePlayyer, group.lev) self:GetRecoedData(0, 5) end function M:RecursionGetRecoedData(index) ViewUtil.ShowModalWait("正在获取数据中") local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetMemberStat(self.group_id, 0, self._data_choosePlayyer.uid, index * 67, 67, 3, self.begin_time, self.end_time, 5, function(res) if res.ReturnCode == 0 then local members = res.Data.members if members and #members > 0 then for i = 1, #members do if members[i].round > 0 then members[i].pump = 0 - members[i].pump self.record_data[#self.record_data + 1] = members[i] end end self:RecursionGetRecoedData(index + 1) else ViewUtil.CloseModalWait() self.btn_totalRound:GetController("type").selectedIndex = 1 self.btn_totalWin:GetController("type").selectedIndex = 0 self.btn_total:GetController("type").selectedIndex = 0 self.btn_reward:GetController("type").selectedIndex = 0 -- table.sort(self.record_data, function(a, b) -- return a.round > b.round -- end) self.lst_record.numItems = #self.record_data end else ViewUtil.CloseModalWait() ViewUtil.ErrorTip(res.ReturnCode) return end end) end function M:GetRecoedData(index, type) if index == 0 then self._data_index = 0 self.record_data = {} self.lst_record.numItems = 0 end ViewUtil.ShowModalWait("正在获取数据中") local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetMemberStat(self.group_id, 0, self._data_choosePlayyer.uid, index, 33, 3, self.begin_time, self.end_time, type, function(res) if res.ReturnCode == 0 then local members = res.Data.members ViewUtil.CloseModalWait() if members and #members > 0 then for i = 1, #members do if members[i].round > 0 then members[i].pump = 0 - members[i].pump self.record_data[#self.record_data + 1] = members[i] end end self.btn_totalRound:GetController("type").selectedIndex = 0 self.btn_totalWin:GetController("type").selectedIndex = 0 self.btn_total:GetController("type").selectedIndex = 0 self.btn_reward:GetController("type").selectedIndex = 0 self._data_selectedSortType = 0 if type / 2 <= 1 then if type <= 0 then ViewUtil.ErrorTip(nil, "排序种类出错") return end self.btn_totalWin:GetController("type").selectedIndex = 2 - type % 2 elseif type / 2 <= 2 then self.btn_totalRound:GetController("type").selectedIndex = 2 - type % 2 elseif type / 2 <= 3 then self.btn_total:GetController("type").selectedIndex = 2 - type % 2 elseif type / 2 <= 4 then self.btn_reward:GetController("type").selectedIndex = 2 - type % 2 else ViewUtil.ErrorTip(nil, "排序种类出错") return end self._data_selectedSortType = type self.lst_record.numItems = #self.record_data else self._data_index = self._data_index - 1 end else ViewUtil.CloseModalWait() ViewUtil.ErrorTip(res.ReturnCode) return end end) end function M:RecursionGetRankData(index) ViewUtil.ShowModalWait() local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetMemberRank(self.group_id, 0, index * 67, 67, self.begin_time, self.end_time, 0, function(res) if res.ReturnCode == 0 then local ranks = res.Data.ranks if ranks and #ranks > 0 then for i = 1, #ranks do -- ranks[i].pump = 0 - ranks[i].pump self.record_data[#self.record_data + 1] = ranks[i] end self:RecursionGetRankData(index + 1) else ViewUtil.CloseModalWait() table.sort(self.record_data, function(a, b) return a.round > b.round end) self.lst_record.numItems = #self.record_data end else ViewUtil.CloseModalWait() ViewUtil.ErrorTip(res.ReturnCode) return end end) end -- 显示奖励 local function __showRewardsValue(rtype, cur_value, max_value, mng) local str = "" if not mng then str = string.format("%s%%/%s%%", cur_value, max_value) else str = string.format("%s%%", cur_value) end return str end function M:FillRecordItem(data, obj) local group = DataManager.groups:get(self.group_id) obj:GetChild("tex_name").text = ViewUtil.stringEllipsis(data.nick) .. "(" .. data.total .. ")" obj:GetChild("tex_id").text = "ID:" .. data.uid local tex_total_score = obj:GetChild("tex_total_score") local ctr_show_total = obj:GetController("show_total") if data._total_hp then tex_total_score.text = data._total_hp ctr_show_total.selectedIndex = 1 else ctr_show_total.selectedIndex = 0 end obj:GetChild("tex_round_valid").text = d2ad(data.pump + data.score) --d2ad(data.pump) --data.valid_round / 100 obj:GetChild("tex_round_total").text = data.round obj:GetChild("tex_total").text = d2ad(data.score) obj:GetChild("tex_round_youxiao").text = data.valid_round / 100 local btn_check_members = obj:GetChild("btn_check_members") btn_check_members.onClick:Set(function() ViewUtil.ShowModalWait(self._root_view) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_GetTotalHp(self.group_id, data.uid, function(res) ViewUtil.CloseModalWait() if res.ReturnCode == 0 then local hp = d2ad(res.Data.hp) tex_total_score.text = hp data._total_hp = hp data.total = res.Data.total_member - 1 obj:GetChild("tex_name").text = data.nick .. "(" .. data.total .. ")" ctr_show_total.selectedIndex = 1 end end) end) local btn_award = obj:GetChild("btn_award") btn_award.text = d2ad(data.pump) --d2ad(data.pump+data.score) btn_award.onClick:Set(function() local time_type = self._view:GetController("type").selectedIndex local gniv = GroupPartnerStatPlay.new(self.group_id, data.uid, data.partnerLev, DataManager.SelfUser.account_id, time_type, self.begin_time, self.end_time) gniv:Show() end) local btn_detail = obj:GetChild("btn_detail") btn_detail.onClick:Set(function() local time_type = self._view:GetController("type").selectedIndex --printlog("ccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwww ",self.begin_time," ",self.end_time) local gniv = GroupPartnerStatMember.new(self.group_id, data.uid, 0, self.begin_time, self.end_time) gniv:Show() end) local btnMen = obj:GetChild("btnMen") -- btnMen.text = d2ad(data.autoscore) local menControl = obj:GetController("menkan") if group.lev == 1 or (group.lev == 3 and group.partnerLev > 0) then if (DataManager.SelfUser.account_id ~= data.uid) then menControl.selectedIndex = 1 btnMen.text = d2ad(data.autoscore) btnMen.touchable = true else btnMen.text = d2ad(data.autoscore) menControl.selectedIndex = 1 btnMen.touchable = false end else menControl.selectedIndex = 0 end btnMen.onClick:Set(function() local gfiv = GroupNumberInputView.new(self._root_view, function(num) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_SetPartnerThreshold(self.group_id, data.uid, num, function(res) ViewUtil.CloseModalWait() if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "设置失败") else ViewUtil.ShowBannerOnScreenCenter("设置成功") btnMen.text = num data.autoscore = ad2d(num) end end) end, 0) gfiv:Show() end) end function M:FillRecordItem2(data, obj) obj:GetChild('tex_name').text = data.nick obj:GetChild('tex_id').text = data.uid obj:GetChild('tex_total').text = d2ad(data.score) obj:GetChild('tex_round_total').text = data.round obj:GetChild('tex_win').text = data.win or 0 obj:GetChild('tex_reward').text = d2ad(data.pump) end function M:OnRenderRecordItem(index, obj) local dataList = self.record_data if self._view:GetController('search').selectedIndex == 1 then dataList = self.record_data_find end -- print("lingmeng dataList", #dataList) local data = dataList[index + 1] self:FillRecordItem2(data, obj) end return M