local PlayEditView = {} local GroupGameSettingView = import("..NewGroup.MngView.GroupGameSettingView_jaingxi") local function UpdateFamilyRoom(self) local view = ViewManager.GetCurrenView() if view.class ~= "FamilyMainView" then return end view:UpdateFamilyRoom(nil, self.groupId) end function PlayEditView.New() setmetatable(PlayEditView, { __index = BaseWindow }) local inst = setmetatable({}, { __index = PlayEditView }) inst._animation = false --inst._full = true inst._scale = true inst._full_offset = false inst._anim_pop = 0 BaseWindow.init(inst, "ui://Family/com_playEdit") inst:Init() return inst end function PlayEditView:Show(groupId) self:Refalsh(groupId) BaseWindow.Show(self) end function PlayEditView:Refalsh(groupId) self.groupId = groupId self.group = DataManager.groups:get(self.groupId) local playList = self.group.playList if self.list_gamePlay.numItems == #playList + 1 then self.list_gamePlay:RefreshVirtualList() else self.list_gamePlay.numItems = #playList + 1 end end function PlayEditView:Init() self.btn_quit = self._view:GetChild("btn_close") self.list_gamePlay = self._view:GetChild('list_gamePlay') self.btn_quit.onClick:Set(function() self:Close() end) self.list_gamePlay:SetVirtual() self.list_gamePlay.itemRenderer = function(index, obj) local playList = self.group.playList if index == 0 then obj:GetController('type').selectedIndex = 0 obj:GetChild('num').text = string.format("%d/7", #playList) obj:GetChild('btn_addPlay').onClick:Set(function() local tem = GroupGameSettingView.new(self.blur_view, self.groupId, 0, nil, function(play) local group = DataManager.groups:get(self.groupId) group:addPlay(play) -- self:FillView() UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) self:Refalsh(self.groupId) printlog("刷新玩法===>>>>") group.update_play = true end) tem:Show() end) return end obj:GetChild('text_title').text = playList[index].game_name local mode = ExtendManager.GetExtendConfig(playList[index].gameId):GetGameInfo() local pId = playList[index].id -- times倍数 local times = json.decode(playList[index].hpData).times obj:GetChild('Label_details'):GetChild('title').text = times / 1000 .. "倍," .. mode:LoadConfigToDetail(playList[index].config) obj:GetChild('text_playName').emojies = EmojiDitc.EmojiesDitc obj:GetChild('text_playName').text = Utils.TextOmit(playList[index].name, 6, "...") obj:GetController('type').selectedIndex = 1 obj:GetChild('btn_del').onClick:Set(function() ViewUtil.ShowTwoChooose("是否要删除该玩法", function() local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_DelPlay(self.groupId, playList[index].id, function(res) if res.ReturnCode ~= 0 then local msg = Table_Error_code_Map[res.ReturnCode] or {} msg = msg.note or "操作失败" ViewUtil.ShowBannerOnScreenCenter(msg) return end UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) self:Refalsh(self.groupId) end) end) end) obj:GetChild("btn_edit").onClick:Set(function() local tem = GroupGameSettingView.new(self.blur_view, self.groupId, pId, playList[index], function(play) local group = DataManager.groups:get(self.groupId) group:addPlay(play) -- self:FillView() UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId) self:Refalsh(self.groupId) printlog("刷新玩法===>>>>") group.update_play = true end) tem:Show() end) end end return PlayEditView