diff --git a/lua_probject/base_project/Game/Controller/GameController.lua b/lua_probject/base_project/Game/Controller/GameController.lua index 243f6f4b..189417fe 100644 --- a/lua_probject/base_project/Game/Controller/GameController.lua +++ b/lua_probject/base_project/Game/Controller/GameController.lua @@ -17,14 +17,14 @@ GameEvent = { OnKicked = 'OnKicked', -- 更新玩家信息 OnUpdateInfo = 'OnUpdateInfo', - - --打开托管 - TupGuanOpen='TupGuanOpen', - --关闭托管 - TupGuanClose='TupGuanClose', - - --麻将修改牌大小 - MJModifySzie='MJModifySzie', + + --打开托管 + TupGuanOpen = 'TupGuanOpen', + --关闭托管 + TupGuanClose = 'TupGuanClose', + + --麻将修改牌大小 + MJModifySzie = 'MJModifySzie', } --- Base GameController @@ -40,7 +40,7 @@ GameController = { local M = GameController -setmetatable(M, {__index = IController}) +setmetatable(M, { __index = IController }) function M:init(name) self._name = name @@ -48,13 +48,13 @@ function M:init(name) self._cacheEvent = Queue.new(1000) self._eventmap = {} self._dispatcher = {} - self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT]=self.ResetConnect + self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT] = self.ResetConnect self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState self._eventmap[Protocol.GAME_EVT_PLAYER_EXIT] = self.OnEventPlayerLeave self._eventmap[Protocol.GAME_EVT_READY] = self.OnEventPlayerReady - self._eventmap[Protocol.GAME_EVT_READY_AND_XIPAI] = self.OnEventPlayerXiPaiReady + self._eventmap[Protocol.GAME_EVT_READY_AND_XIPAI] = self.OnEventPlayerXiPaiReady self._eventmap[Protocol.GAME_EVT_EXIT_ROOM_DISMISS] = self.OnEventExitRoomDismiss self._eventmap[Protocol.GAME_EVT_DISMISS_ROOM] = self.OnEventDismissRoom @@ -66,13 +66,11 @@ function M:init(name) self._eventmap[Protocol.GAME_EVT_KICKED] = self.OnEventKicked self._eventmap[Protocol.GAME_EVT_UPDATE_PLAYERINFO] = self.OnEvtUpdateInfo - - self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips - self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips - - --self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips - - + + self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips + self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips + + --self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips end function DispatchEvent(_dispatcher, evt_name, ...) @@ -86,11 +84,10 @@ function M:AddEventListener(evt_name, func) self._dispatcher[evt_name] = func end - function M:ResetConnect() --- print("断线重连================") - --ControllerManager.OnConnect(SocketCode.TimeoutDisconnect) - ViewManager.refreshGameView() + -- print("断线重连================") + --ControllerManager.OnConnect(SocketCode.TimeoutDisconnect) + ViewManager.refreshGameView() end ----------------------请求------------------------------------ @@ -105,7 +102,7 @@ function M:PlayerReady() end function M:PlayerXiPai() - local _client = ControllerManager.GameNetClinet + local _client = ControllerManager.GameNetClinet if not _client then return end @@ -163,9 +160,9 @@ function M:AskDismissRoom() if not _client then return end - _client:send(Protocol.GAME_ASK_DISMISS_ROOM,nil,function (res) + _client:send(Protocol.GAME_ASK_DISMISS_ROOM, nil, function(res) if res.ReturnCode == 84 then - ViewUtil.ErrorTip(res.ReturnCode,"解散失败") + ViewUtil.ErrorTip(res.ReturnCode, "解散失败") end end) end) @@ -283,14 +280,13 @@ function M:OnEventPlayerEnter(evt_data) -- p.total_hp = evt_data["total_hp"] or 0 if evt_data['hp_info'] then p.cur_hp = evt_data.hp_info.cur_hp - -- p.total_hp = evt_data.hp_info.total_hp + -- p.total_hp = evt_data.hp_info.total_hp end p.self_user = _user p.line_state = 1 DataManager.CurrenRoom:AddPlayer(p) printlog("PlayerEnter:") DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p) - end ) self:ReturnToRoom() @@ -330,47 +326,42 @@ function M:OnEventPlayerReady(evt_data) local pid = evt_data['aid'] local p = self._room:GetPlayerById(pid) p.ready = true - if evt_data.start~=nil then - if evt_data.start==1 then - p.isSendCardState=true - else - p.isSendCardState=false - end - - else - p.isSendCardState=false - end - + if evt_data.start ~= nil then + if evt_data.start == 1 then + p.isSendCardState = true + else + p.isSendCardState = false + end + else + p.isSendCardState = false + end + DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p) end ) end - function M:OnEventPlayerXiPaiReady(evt_data) self._cacheEvent:Enqueue( function() local pid = evt_data['aid'] local p = self._room:GetPlayerById(pid) p.ready = true - if evt_data.start~=nil then - if evt_data.start==1 then - p.isSendCardState=true - else - p.isSendCardState=false - end - - else - p.isSendCardState=false - end + if evt_data.start ~= nil then + if evt_data.start == 1 then + p.isSendCardState = true + else + p.isSendCardState = false + end + else + p.isSendCardState = false + end DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p) end ) end - - -- 聊天事件 function M:OnEventInteraction(evt_data) if self._room.ban_chat1 == false or self._room.ban_chat2 == false then @@ -382,24 +373,24 @@ function M:OnEventInteraction(evt_data) local parm = evt_data['parm'] DispatchEvent(self._dispatcher, GameEvent.Interaction, p, type1, parm) end - ) + ) end end -- GPS更新事件 -function M:OnEventUpdateGPS(evt_data) - self._cacheEvent:Enqueue( - function() - local seat = evt_data['seat'] - local pos = evt_data['pos'] - if seat == 0 or seat == 'skip' then - return - end - local p = self._room:GetPlayerBySeat(seat) - p.self_user.location = Location.new(pos) - end - ) -end +-- function M:OnEventUpdateGPS(evt_data) +-- self._cacheEvent:Enqueue( +-- function() +-- local seat = evt_data['seat'] +-- local pos = evt_data['pos'] +-- if seat == 0 or seat == 'skip' then +-- return +-- end +-- local p = self._room:GetPlayerBySeat(seat) +-- p.self_user.location = Location.new(pos) +-- end +-- ) +-- end -- 被踢出房间事件 @@ -567,7 +558,7 @@ function M:OnExit() end function M:__OnNetEvent(msg) - --print("Game消息ID===>>"..msg.Command) + --print("Game消息ID===>>"..msg.Command) local func = self._eventmap[msg.Command] if (func ~= nil) then func(self, msg.Data) @@ -591,42 +582,36 @@ function M:ReturnToRoom() end, self.tmpGroupID ) - end - function M:OnEvtOpenTupGTips(msg) - --print("显示托管倒计时=====================") - pt(msg) - local pid = msg['aid'] + --print("显示托管倒计时=====================") + pt(msg) + local pid = msg['aid'] local p = self._room:GetPlayerById(pid) - local t=msg['time'] - DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,true, t) + local t = msg['time'] + DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, true, t) end - function M:OnEvtCloseTupGTips(msg) - --print("关闭托管倒计时=================") - --pt(msg) - local pid = msg['aid'] + --print("关闭托管倒计时=================") + --pt(msg) + local pid = msg['aid'] local p = self._room:GetPlayerById(pid) - local t=msg['time'] - DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,false, t) + local t = msg['time'] + DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t) end - -function M:DispatchEventTuoGuan(p,isShow,t) - DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,isShow, t) +function M:DispatchEventTuoGuan(p, isShow, t) + DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t) end - - function M:OnEvtOpenGameHuTuoGtips(isAuto) - local _client = ControllerManager.GameNetClinet + local _client = ControllerManager.GameNetClinet if not _client then return end local data = {} data.autoCard = isAuto _client:send(Protocol.GAME_AUTO_CARD, data) -end \ No newline at end of file +end diff --git a/lua_probject/base_project/Game/View/NewGroup/GroupInfoView.lua b/lua_probject/base_project/Game/View/NewGroup/GroupInfoView.lua index 477035d4..f5ea9667 100644 --- a/lua_probject/base_project/Game/View/NewGroup/GroupInfoView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/GroupInfoView.lua @@ -285,7 +285,7 @@ local function __fillRoomItem(self, index, item, room) if room.default or isHidden == 1 then self:__startGame(room.id, room.pid, false, isHidden) else - self:__joinRoom(roomid,room) + self:__joinRoom(roomid, room) end else if self.roominfo.view and not self.roominfo.view.isDisposed then @@ -352,7 +352,7 @@ local function __fillRoomItem(self, index, item, room) if room.default or isHidden == 1 then self:__startGame(room.id, room.pid, false, isHidden) else - self:__joinRoom(roomid,room) + self:__joinRoom(roomid, room) end end ) @@ -1068,17 +1068,19 @@ function M:InitView(url) -- self._view:GetChild('player_diamond').text = self.curGroup.diamo local btn_refreshbg = self._view:GetChild("btn_refreshbg").onClick:Set(function() if self._view:GetController("bgchange").selectedIndex < 2 then - Utils.SaveLocalFile(DataManager.SelfUser.account_id .. "bgflag", self._view:GetController("bgchange").selectedIndex+1) + Utils.SaveLocalFile(DataManager.SelfUser.account_id .. "bgflag", + self._view:GetController("bgchange").selectedIndex + 1) printlog(self._view:GetController("bgchange").selectedIndex) - self._view:GetController("bgchange").selectedIndex = self._view:GetController("bgchange").selectedIndex+1 + self._view:GetController("bgchange").selectedIndex = self._view:GetController("bgchange").selectedIndex + 1 else Utils.SaveLocalFile(DataManager.SelfUser.account_id .. "bgflag", 0) self._view:GetController("bgchange").selectedIndex = 0 end end) - if Utils.LoadLocalFile(DataManager.SelfUser.account_id .. "bgflag") then - self._view:GetController("bgchange").selectedIndex = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. "bgflag") + if Utils.LoadLocalFile(DataManager.SelfUser.account_id .. "bgflag") then + self._view:GetController("bgchange").selectedIndex = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. + "bgflag") else self._view:GetController("bgchange").selectedIndex = 0 end @@ -1430,9 +1432,7 @@ function M:__onUpdate() end end -function M:__joinRoom(room_id,room) - - +function M:__joinRoom(room_id, room) if self.roominfo.view and not self.roominfo.view.isDisposed then self.roominfo.view:Dispose() end @@ -1440,7 +1440,7 @@ function M:__joinRoom(room_id,room) self.roominfo.view = riv self.roominfo.room = room - riv:GetChild('tex_room_id').text = room.id and '房间号:' .. room.id or '' + riv:GetChild('tex_room_id').text = room_id and '房间号:' .. room_id or '' local play = self.curGroup:getPlay(room.pid) local isHidden = 0 if play then @@ -1467,7 +1467,7 @@ function M:__joinRoom(room_id,room) riv:GetChild("wafashuoming").text = gameStr self:InitRoomInfoView() - + local roomCtr = ControllerManager.GetController(RoomController) local _gameCtrl = ControllerManager.GetController(GameController) local _currentCtrl = ControllerManager.GetCurrenController() @@ -1478,11 +1478,10 @@ function M:__joinRoom(room_id,room) if room.default or isHidden == 1 then self:__startGame(room.id, room.pid, false, isHidden) else - -- self:__joinRoom(room_id,room) + -- self:__joinRoom(room_id,room) printlog("join_room") - + if _gameCtrl == _currentCtrl then - if _gameCtrl.tmpRoomID ~= room_id then _gameCtrl:LevelRoom( function(res) @@ -1498,7 +1497,7 @@ function M:__joinRoom(room_id,room) end if response.ReturnCode == -2 then - self:__joinRoom(room_id,room) + self:__joinRoom(room_id, room) return elseif response.ReturnCode ~= 0 then ViewUtil.CloseModalWait('join_room') @@ -1517,13 +1516,10 @@ function M:__joinRoom(room_id,room) end ) return - end - - end - - roomCtr:PublicJoinRoom( + + roomCtr:PublicJoinRoom( Protocol.WEB_FG_JOIN_ROOM, room_id, false, @@ -1535,10 +1531,10 @@ function M:__joinRoom(room_id,room) RestartGame() return end - - + + if response.ReturnCode == -2 then - self:__joinRoom(room_id,room) + self:__joinRoom(room_id, room) return elseif response.ReturnCode ~= 0 then ViewUtil.CloseModalWait('join_room') @@ -1556,15 +1552,10 @@ function M:__joinRoom(room_id,room) end, self.curGroup.id ) - - - - - end end ) - + riv:GetChild('btn_close').onClick:Set( function() riv:Dispose() @@ -1628,8 +1619,8 @@ function M:__joinRoom(room_id,room) RestartGame() return end - - + + if response.ReturnCode == -2 then self:__joinRoom(room_id) return @@ -1829,7 +1820,7 @@ function M:_evtInvited(...) self._root_view, self.curGroup.id, function(roomid) - self:__joinRoom(roomid,self.roominfo.room) + self:__joinRoom(roomid, self.roominfo.room) end ) imv:FillData(data) @@ -2265,9 +2256,9 @@ function M:Show() BaseView.Show(self) local user = DataManager.SelfUser local roomid = user.room_id - + if user.group_id == self.curGroup.id and string.len(roomid) > 1 then - self:__joinRoom(roomid,self.roominfo.room) + self:__joinRoom(roomid, self.roominfo.room) user.group_id = 0 end end diff --git a/lua_probject/base_project/Game/View/NewGroup/GroupManagerStagView.lua b/lua_probject/base_project/Game/View/NewGroup/GroupManagerStagView.lua new file mode 100644 index 00000000..fdb156c0 --- /dev/null +++ b/lua_probject/base_project/Game/View/NewGroup/GroupManagerStagView.lua @@ -0,0 +1,131 @@ +local GroupManagerStagView = {} + +local M = GroupManagerStagView + +--保持管理窗口的lua独立,把统计的功能代码写在这 +function GroupManagerStagView.new(root) + setmetatable(M, { __index = root }) + local self = setmetatable({}, { __index = M }) + self.class = "GroupManagerStagView" + + self:Init() + self:InitInfo() + + return self +end + +function M:Init() + self._viewList_partner = self._view:GetChild('lst_partner') +end + +function M:InitInfo() + self._map_members = {} + + local obj = self._viewList_partner:AddItemFromPool() + self:PartnerRender( + { uid = DataManager.SelfUser.account_id, nick = DataManager.SelfUser.nick_name }, obj) + -- obj:GetController('show').selectedIndex = 1 + obj.data.selected = true + self._data_choosePlayer = { uid = DataManager.SelfUser.account_id, nick = DataManager.SelfUser.nick_name } + self:RecursionGetNumber1(0, DataManager.SelfUser.account_id, {}) + --将外面设置为最外圈页面 + self.ctr_index.selectedIndex = #self.page_config +end + +function M:SetRecursionGetNumber1Info(id, tempTable) + local me = self._map_members[id] + me.data.listInfo = tempTable + me.data.listNum = #tempTable + me.data.childNum = #tempTable + for i = 1, #tempTable do + local obj = me.data.list:AddItemFromPool() + self:PartnerRender(tempTable[i], obj) + end + self:SetListShow(tempTable, 1) + self:RecursionReSize(me) +end + +function M:PartnerRender(data, obj) + obj:GetChild('text_name').text = string.format("ID:%d", data.uid) + obj:GetChild('text_id').text = data.nick + obj.data = {} + obj.data.list = obj:GetChild('list') + obj.data.info = data + self._map_members[data.uid] = obj + obj:GetChild('area').onClick:Set(function() + if obj.data.info.parentId then + self:SetListShow(self._map_members[obj.data.info.parentId].data.listInfo, 0, data.uid) + end + if obj.data.selected then + self:SetListShow(obj.data.listInfo, 0, data.uid) + obj.data.selected = false + self:RecursionReSize(obj, -1, true) + self:SetListShow(obj.data.listInfo, 1) + else + obj.data.selected = true + self._data_choosePlayer = data + if obj.data.listNum then + self:RecursionReSize(obj) + else + self:RecursionGetNumber1(0, data.uid, {}) + end + end + -- obj:GetController('show').selectedIndex = 1 + if self.ctr_index.selectedIndex == #self.page_config then + self._view_map[#self.page_config + 1]:RefrenRecordData(data) + else + self.ctr_index.selectedIndex = #self.page_config + end + end) +end + +function M:RecursionReSize(obj, add, flag) + obj.data.list:ResizeToFit(flag and 0 or obj.data.childNum) + if obj.data.info.parentId and obj.data.info.parentId ~= 0 then + local father = self._map_members[obj.data.info.parentId] + father.data.childNum = father.data.childNum + obj.data.childNum * (add or 1) + self:RecursionReSize(father, add, false) + end +end + +function M:SetListShow(list, isShow, myID) + for i = 1, #list do + local obj = self._map_members[list[i].uid] + obj:GetController('show').selectedIndex = isShow + if isShow == 0 and obj.data.selected and list[i].uid ~= myID then + obj.data.selected = false + self:RecursionReSize(obj, -1, true) + end + end +end + +function M:RecursionGetNumber1(index, id, tempTable) + ViewUtil.ShowModalWait("正在获取成员中") + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_GroupSubMembers( + self.group_id, + index * 67, + 67, + id, + function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, '获取成员列表失败') + ViewUtil.CloseModalWait() + else + local numbers = res.Data.members + + if #numbers == 0 then + self:SetRecursionGetNumber1Info(id, tempTable) + ViewUtil.CloseModalWait() + else + for i = 1, #numbers do + table.insert(tempTable, numbers[i]) + end + self:RecursionGetNumber1(index + 1, id, tempTable) + end + end + end + ) +end + +return M diff --git a/lua_probject/base_project/Game/View/NewGroup/GroupManagerView.lua b/lua_probject/base_project/Game/View/NewGroup/GroupManagerView.lua index c84445b5..1ce35e41 100644 --- a/lua_probject/base_project/Game/View/NewGroup/GroupManagerView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/GroupManagerView.lua @@ -1,5 +1,7 @@ -- 牌友圈管理界面 local MngPageConfig = import(".MngView.MngPageConfig") +--做一个子类用来控制初始的统计界面 +local GroupManagerStagView = import(".GroupManagerStagView") local GroupManagerView = {} @@ -19,7 +21,7 @@ function GroupManagerView.new(blur_view, gid, btn_type, callback) self.group_id = gid self.partnerList = {} self.callback = callback - self:init("ui://NewGroup/Win_ManagerView", btn_type) + self:init(btn_type) return self end @@ -34,7 +36,13 @@ local function getPageConfig(id) end end -function M:init(url, btn_type) +function M:init(btn_type) + local url + if btn_type == 2 then + url = "ui://NewGroup/Win_ManagerView" + else + url = "ui://NewGroup/Win_ManagerView_old" + end BaseWindow.init(self, url) self.titleTxt = self._view:GetChild("n79") -- if btn_type == 2 then @@ -53,8 +61,27 @@ function M:init(url, btn_type) lev = 4 end + self.ctr_index = self._view:GetController("index") self.page_config = MngPageConfig.Config[btn_type][lev] + local gmsv + if btn_type == 2 then + --绑定统计代码 + self._child_statView = GroupManagerStagView.new(self) + -- 初始界面 --战况是用新界面 + local first_page_config = getPageConfig(19) + gmsv = first_page_config.view.new(self.group_id, self._root_view, self._child_statView._data_choosePlayer) + self._view_map = {} + self._view_map[#self.page_config + 1] = gmsv + gmsv.id = first_page_config.id + else + -- 初始界面 + local first_page_config = getPageConfig(self.page_config[1]) + gmsv = first_page_config.view.new(self.group_id, self._root_view) + self._view_map = {} + self._view_map[1] = gmsv + gmsv.id = first_page_config.id + end -- 初始化标题列表 for i = 1, #self.page_config do -- print("page_config:"..self.page_config[i]) @@ -67,7 +94,7 @@ function M:init(url, btn_type) local title = page.title item:GetChild("title").text = title item:GetChild("title2").text = title - if i == 1 then + if i == 1 and btn_type ~= 2 then item.selected = true end end @@ -94,12 +121,6 @@ function M:init(url, btn_type) -- end) -- 所有子界面加载点 local anchor = self._view:GetChild("anchor") - -- 初始界面 - local first_page_config = getPageConfig(self.page_config[1]) - local gmsv = first_page_config.view.new(self.group_id, self._root_view) - self._view_map = {} - self._view_map[1] = gmsv - gmsv.id = first_page_config.id anchor:AddChild(gmsv._view) --printlog("tttttttttttttttttttttt :" , gmsv._view.displayObject.gameObject.name," ",gmsv._view.parent.displayObject.gameObject.name) --gmsv._view:AddRelation(anchor, RelationType.Size) @@ -128,9 +149,7 @@ function M:init(url, btn_type) -- self._view:GetChild("n0"):GetController("v_menu").selectedIndex = 1 -- end - -- 切换界面 - self.ctr_index = self._view:GetController("index") self.ctr_index.onChanged:Set(function(pas) local anchor = self._view:GetChild("anchor") anchor:RemoveChildren() @@ -169,10 +188,10 @@ function M:init(url, btn_type) --self._view:AddRelation(anchor, RelationType.Size) -- 如果refresh为true,重新加载界面时执行初始化数据方法initData - if page_info.refresh then - self._view_map[index + 1]:initData() + if page_info then + self.titleTxt.text = page_info.title end - self.titleTxt.text = page_info.title + self._view_map[index + 1]:initData() end) end @@ -219,11 +238,14 @@ end -- quick_access_id 是快速访问标志,打开对应id的页面 function M:Show(quick_access_id) local index = self.ctr_index.selectedIndex - printlog("index+1index+1index+1index+1 ", index + 1) + printlog("index+1index+1index+1index+1 ", index + 1, self.page_config[index + 1]) if not quick_access_id then local page_info = getPageConfig(self.page_config[index + 1]) - if page_info.refresh then self._view_map[index + 1]:initData() end - self.titleTxt.text = page_info.title + -- if page_info.refresh then self._view_map[index + 1]:initData() end + if page_info then + self.titleTxt.text = page_info.title + end + self._view_map[index + 1]:initData() else -- 如果是 快速访问 for i, v in pairs(self.page_config) do diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngPartnerStatView.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngPartnerStatView.lua index 58bcf70c..b5301f1f 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngPartnerStatView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMngPartnerStatView.lua @@ -1,4 +1,4 @@ -local TimeSettingPanel = import(".TimeSettingPanel") +local TimeSettingPanel = import(".TimeSettingPanelTog") local GroupPartnerStatMember = import(".GroupPartnerStatMember") local GroupPartnerStatPlay = import(".GroupPartnerStatPlay") local GroupNumberInputView = import(".GroupNumberInputView") @@ -7,10 +7,11 @@ local GroupMngPartnerStatView = {} local M = GroupMngPartnerStatView -function GroupMngPartnerStatView.new(gid) +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 @@ -18,11 +19,13 @@ 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}) + 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 @@ -32,7 +35,7 @@ end -- 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) @@ -43,7 +46,6 @@ end function M:InitView() self._view = UIPackage.CreateObjectFromURL("ui://NewGroup/View_GroupPartnerStat") - local group = DataManager.groups:get(self.group_id) -- if group.lev ~= 3 then -- self._view:GetController("mng").selectedIndex = 1 -- end @@ -55,28 +57,34 @@ function M:InitView() -- end self.lst_record = self._view:GetChild("lst_record") - self.lst_record:SetVirtual() + self.lst_record:SetVirtual() self.lst_record.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, nil, true) + + 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}) + 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}) + 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 @@ -113,7 +121,7 @@ function M:InitView() local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_FindPartnerStat( self.group_id, - qid,0, 6, time_type,self.begin_time,self.end_time, + qid, 0, 6, time_type, self.begin_time, self.end_time, function(res) -- printlog("aaaaaaaaaaaaaaaa22222222222222222222222222222") -- pt(res) @@ -131,46 +139,191 @@ function M:InitView() for j = 1, #res.Data.members do local tem = item_result:AddItemFromPool() - self:FillRecordItem(res.Data.members[j],tem) + self:FillRecordItem(res.Data.members[j], tem) end end - end + end ) end ) - + local btn_back = self._view:GetChild('btn_back') btn_back.onClick:Set( function() 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 + 1) % 3 + + if type.selectedIndex == 1 then + table.sort(self.record_data, function(a, b) + return a.total_win > b.total_win + end) + elseif type.selectedIndex == 2 then + table.sort(self.record_data, function(a, b) + return a.total_win < b.total_win + end) + else + table.sort(self.record_data, function(a, b) + return a.total_round > b.total_round + end) + end + self.lst_record:RefreshVirtualList() + 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 + 1) % 3 + + if type.selectedIndex == 1 then + table.sort(self.record_data, function(a, b) + return a.total_round > b.total_round + end) + elseif type.selectedIndex == 2 then + table.sort(self.record_data, function(a, b) + return a.total_round < b.total_round + end) + else + table.sort(self.record_data, function(a, b) + return a.total_round > b.total_round + end) + end + self.lst_record:RefreshVirtualList() + 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 + 1) % 3 + + if type.selectedIndex == 1 then + table.sort(self.record_data, function(a, b) + return a.win_round > b.win_round + end) + elseif type.selectedIndex == 2 then + table.sort(self.record_data, function(a, b) + return a.win_round < b.win_round + end) + else + table.sort(self.record_data, function(a, b) + return a.total_round > b.total_round + end) + end + self.lst_record:RefreshVirtualList() + 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") + type.selectedIndex = (type.selectedIndex + 1) % 3 + + if type.selectedIndex == 1 then + table.sort(self.record_data, function(a, b) + return a.reward_hp > b.reward_hp + end) + elseif type.selectedIndex == 2 then + table.sort(self.record_data, function(a, b) + return a.reward_hp < b.reward_hp + end) + else + table.sort(self.record_data, function(a, b) + return a.total_round > b.total_round + end) + end + self.lst_record:RefreshVirtualList() + 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.record_data = {} + self.lst_record.numItems = 0 + self:RecursionGetRecoedData(0) + -- end +end - ViewUtil.ShowModalWait() - - local time_type = self._view:GetController("type").selectedIndex - if self.begin_time ~= nil and self.end_time ~= nil then - time_type = 0 - 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.record_data = {} + self.lst_record.numItems = 0 + self:RecursionGetRecoedData(0) +end +function M:RecursionGetRecoedData(index) + ViewUtil.ShowModalWait("正在获取数据中") local fgCtr = ControllerManager.GetController(NewGroupController) - fgCtr:FG_GetPartnerStat(self.group_id, index, 6, time_type,self.begin_time,self.end_time,function(res) - - ViewUtil.CloseModalWait() - - if res.ReturnCode == 0 then - - local members = res.Data.members - -- printlog("aaaaaaaaaaaaaacccccccccccccccccccccccccccccccc") - -- pt(members) - for i = 1, #members do - self.record_data[#self.record_data + 1] = members[i] + fgCtr:FG_GetPartnerStatMember(self.group_id, self._data_choosePlayyer.uid, + self._data_choosePlayyer.parentId or self._data_choosePlayyer.uid, + index * 67, 67, 0, self.begin_time, self.end_time, function(res) + if res.ReturnCode == 0 then + local members = res.Data.members + if members and #members > 0 then + for i = 1, #members do + self.record_data[#self.record_data + 1] = members[i] + end + self:RecursionGetRecoedData(index + 1) + else + ViewUtil.CloseModalWait() + self.lst_record.numItems = #self.record_data + end + else + ViewUtil.CloseModalWait() + ViewUtil.ErrorTip(res.ReturnCode) + return end - self.lst_record.numItems = #self.record_data + 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 + self.record_data[#self.record_data + 1] = ranks[i] + end + self:RecursionGetRankData(index + 1) + else + ViewUtil.CloseModalWait() + self.lst_record.numItems = #self.record_data + end + else + ViewUtil.CloseModalWait() + ViewUtil.ErrorTip(res.ReturnCode) + return end end) end @@ -187,23 +340,21 @@ local function __showRewardsValue(rtype, cur_value, max_value, mng) end function M:FillRecordItem(data, obj) + local group = DataManager.groups:get(self.group_id) - 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 - 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 - + 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 + ctr_show_total.selectedIndex = 1 + else + ctr_show_total.selectedIndex = 0 end - - obj:GetChild("tex_round_valid").text = d2ad(data.reward_hp+data.total_win)--d2ad(data.reward_hp) --data.valid_round / 100 + + obj:GetChild("tex_round_valid").text = d2ad(data.reward_hp + data.total_win) --d2ad(data.reward_hp) --data.valid_round / 100 obj:GetChild("tex_round_total").text = data.total_round obj:GetChild("tex_total").text = d2ad(data.total_win) obj:GetChild("tex_round_youxiao").text = data.valid_round / 100 @@ -216,65 +367,63 @@ function M:FillRecordItem(data, obj) 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 + 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.reward_hp)--d2ad(data.reward_hp+data.total_win) + btn_award.text = d2ad(data.reward_hp) --d2ad(data.reward_hp+data.total_win) 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() + 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() + 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) + -- btnMen.text = d2ad(data.autoscore) local menControl = obj:GetController("menkan") - - if group.lev==1 or (group.lev==3 and group.partnerLev>0) then + + 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 + 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) + 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,"设置失败") + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "设置失败") else ViewUtil.ShowBannerOnScreenCenter("设置成功") - btnMen.text = num - data.autoscore = ad2d(num) + btnMen.text = num + data.autoscore = ad2d(num) end end) end, 0) @@ -282,10 +431,18 @@ function M:FillRecordItem(data, obj) end) end -function M:OnRenderRecordItem(index, obj) - local data = self.record_data[index + 1] - self:FillRecordItem(data, obj) +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.total_win) + obj:GetChild('tex_round_total').text = data.total_round + obj:GetChild('tex_win').text = data.win_round or 0 + obj:GetChild('tex_reward').text = d2ad(data.reward_hp) end +function M:OnRenderRecordItem(index, obj) + local data = self.record_data[index + 1] + self:FillRecordItem2(data, obj) +end -return M \ No newline at end of file +return M diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/MngPageConfig.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/MngPageConfig.lua index b7e5b027..1aa7a49d 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/MngPageConfig.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/MngPageConfig.lua @@ -30,7 +30,7 @@ MngPageConfig.PageList = { { id = 5, title = "添加玩家", view = GroupMngAddMemberView, refresh = true, clear_image = false, anchorOffset = 300 }, { id = 6, title = "--del--", view = GroupMngMemberListView, refresh = false, clear_image = false, anchorOffset = 300 }, { id = 7, title = "积分记录", view = GroupMngFagListView, refresh = true, clear_image = false, anchorOffset = 300 }, - { id = 8, title = "开桌明细", view = GroupMngRoomStatView, refresh = true, clear_image = true, anchorOffset = 300 }, + { id = 8, title = "房间记录", view = GroupMngRoomStatView, refresh = true, clear_image = true, anchorOffset = 300 }, { id = 9, title = "战绩排行", view = GroupMngRankView, refresh = true, clear_image = false, anchorOffset = 300 }, { id = 10, title = "战队队长", view = GroupMngPartnerListView, refresh = true, clear_image = false, anchorOffset = 300 }, { id = 11, title = "--del--", view = GroupMngMemberListView, refresh = true, clear_image = true, anchorOffset = 300 }, @@ -64,16 +64,16 @@ MngPageConfig.Config = { { -- 盟主 --{19, 16, 7, 3, 8, 9, 13, 17}, - { 9, 14, 17, 16, 7 }, + { 17, 8, 16 }, -- 管理员 --{19, 16, 7, 3, 8, 9, 13, 17}, - { 9, 14, 17, 16, 7 }, + { 17, 8, 16 }, -- 合伙人 - { 14,17, 16, 7 }, + { 17, 8, 16 }, --{19,16,7, 8,17,22}, -- 普通玩家 --{9, 17}, - { 17, 9 }, + { 17 }, }, -- 成员按钮 { diff --git a/wb_new_ui/.objs/metas/m7iejg46/hsbhhjn.info b/wb_new_ui/.objs/metas/m7iejg46/hsbhhjn.info index 4171dcf4..f8e00ff4 100644 --- a/wb_new_ui/.objs/metas/m7iejg46/hsbhhjn.info +++ b/wb_new_ui/.objs/metas/m7iejg46/hsbhhjn.info @@ -5,6 +5,9 @@ }, "n79_ovii": { "hidden": true + }, + "n113_yvb2": { + "collapsed": true } }, "adaptiveTest": true, diff --git a/wb_new_ui/.objs/metas/m7iejg46/jgh8hwv.info b/wb_new_ui/.objs/metas/m7iejg46/jgh8hwv.info index bf3b2c37..2a3f691f 100644 --- a/wb_new_ui/.objs/metas/m7iejg46/jgh8hwv.info +++ b/wb_new_ui/.objs/metas/m7iejg46/jgh8hwv.info @@ -1,11 +1,29 @@ { "objectStatus": { - "n181_b8zx": { + "n213_yvb2": { "hidden": true }, - "n104_kwi0": { + "n189_dji9": { "hidden": true, "collapsed": true + }, + "n212_yvb2": { + "hidden": true + }, + "n83_kwi0": { + "collapsed": true + }, + "n184_b5ny": { + "hidden": true + }, + "n211_yvb2": { + "hidden": true + }, + "n214_yvb2": { + "hidden": true + }, + "n181_b8zx": { + "hidden": true } }, "adaptiveTest": true, diff --git a/wb_new_ui/.objs/metas/m7iejg46/l679hws.info b/wb_new_ui/.objs/metas/m7iejg46/l679hws.info index 8da9faae..c93662a6 100644 --- a/wb_new_ui/.objs/metas/m7iejg46/l679hws.info +++ b/wb_new_ui/.objs/metas/m7iejg46/l679hws.info @@ -3,6 +3,9 @@ "n86_kwi0": { "hidden": true }, + "n115_l679": { + "hidden": true + }, "n121_l679": { "collapsed": true }, diff --git a/wb_new_ui/.objs/metas/m7iejg46/t1hqhxw.info b/wb_new_ui/.objs/metas/m7iejg46/t1hqhxw.info index 9e26dfee..0a8f2d3a 100644 --- a/wb_new_ui/.objs/metas/m7iejg46/t1hqhxw.info +++ b/wb_new_ui/.objs/metas/m7iejg46/t1hqhxw.info @@ -1 +1,7 @@ -{} \ No newline at end of file +{ + "objectStatus": { + "n8_yvb2": { + "locked": true + } + } +} \ No newline at end of file diff --git a/wb_new_ui/.objs/metas/m7iejg46/t1hqhy5.info b/wb_new_ui/.objs/metas/m7iejg46/t1hqhy5.info new file mode 100644 index 00000000..3da5c3e9 --- /dev/null +++ b/wb_new_ui/.objs/metas/m7iejg46/t1hqhy5.info @@ -0,0 +1,7 @@ +{ + "objectStatus": { + "n5_yvb2": { + "hidden": true + } + } +} \ No newline at end of file diff --git a/wb_new_ui/.objs/metas/m7iejg46/yvb27ijw.info b/wb_new_ui/.objs/metas/m7iejg46/yvb27ijw.info new file mode 100644 index 00000000..126f0c5a --- /dev/null +++ b/wb_new_ui/.objs/metas/m7iejg46/yvb27ijw.info @@ -0,0 +1,26 @@ +{ + "objectStatus": { + "n54_j120": { + "hidden": true + }, + "n56_j120": { + "hidden": true + }, + "n68_xt5s": { + "hidden": true + }, + "n63_omkm": { + "hidden": true + }, + "n43_f6br": { + "hidden": true + }, + "n65_xt5s": { + "hidden": true + }, + "n36_oj7k": { + "hidden": true, + "collapsed": true + } + } +} \ No newline at end of file diff --git a/wb_new_ui/.objs/metas/m7iejg46/yvb27ik1.info b/wb_new_ui/.objs/metas/m7iejg46/yvb27ik1.info new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/wb_new_ui/.objs/metas/m7iejg46/yvb27ik1.info @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/wb_new_ui/assets/NewGroup/Win_ManagerView.xml b/wb_new_ui/assets/NewGroup/Win_ManagerView.xml index 824b4989..b22f66e6 100644 --- a/wb_new_ui/assets/NewGroup/Win_ManagerView.xml +++ b/wb_new_ui/assets/NewGroup/Win_ManagerView.xml @@ -1,21 +1,24 @@ - + + - + - + + + @@ -26,5 +29,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/NewGroup/Win_ManagerView_old.xml b/wb_new_ui/assets/NewGroup/Win_ManagerView_old.xml new file mode 100644 index 00000000..13f3eecd --- /dev/null +++ b/wb_new_ui/assets/NewGroup/Win_ManagerView_old.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/NewGroup/component/nav/Btn_menu_h.xml b/wb_new_ui/assets/NewGroup/component/nav/Btn_menu_h.xml index 0bf81f67..2a712418 100644 --- a/wb_new_ui/assets/NewGroup/component/nav/Btn_menu_h.xml +++ b/wb_new_ui/assets/NewGroup/component/nav/Btn_menu_h.xml @@ -1,19 +1,25 @@ - - + + + + + - - - + + - - - + + + + + - - - + + + + -