hengyang_client/lua_probject/base_project/Game/View/Family/PlayEditView.lua

96 lines
3.6 KiB
Lua
Raw Normal View History

local PlayEditView = {}
local GroupGameSettingView = import("..NewGroup.MngView.GroupGameSettingView_jaingxi")
function PlayEditView.New()
setmetatable(PlayEditView, { __index = BaseWindow })
local inst = setmetatable({}, { __index = PlayEditView })
inst._animation = false
2025-07-04 02:06:24 +08:00
inst._full = 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
self.list_gamePlay.numItems = #playList + 1
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()
--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
obj:GetChild('Label_details'):GetChild('title').text = mode:LoadConfigToDetail(playList[index].config)
obj:GetChild('text_playName').text = playList[index].name
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
2025-07-04 02:06:24 +08:00
--self:UpdateFamilyRoom(fgCtr, self.groupId)
self:Refalsh(self.groupId)
end)
end)
end)
obj:GetChild("btn_edit").onClick:Set(function()
2025-07-04 02:06:24 +08:00
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()
--self:UpdateFamilyRoom(fgCtr, self.groupId)
self:Refalsh(self.groupId)
printlog("刷新玩法===>>>>")
group.update_play = true
end)
tem:Show()
end)
end
end
return PlayEditView