2025-07-01 19:31:19 +08:00
|
|
|
local PlayEditView = {}
|
|
|
|
|
local GroupGameSettingView = import("..NewGroup.MngView.GroupGameSettingView_jaingxi")
|
|
|
|
|
|
2025-07-20 00:24:30 +08:00
|
|
|
local function UpdateFamilyRoom(self)
|
|
|
|
|
local view = ViewManager.GetCurrenView()
|
|
|
|
|
|
|
|
|
|
if view.class ~= "FamilyMainView" then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
view:UpdateFamilyRoom(self.groupId)
|
|
|
|
|
end
|
|
|
|
|
|
2025-07-01 19:31:19 +08:00
|
|
|
function PlayEditView.New()
|
|
|
|
|
setmetatable(PlayEditView, { __index = BaseWindow })
|
|
|
|
|
local inst = setmetatable({}, { __index = PlayEditView })
|
|
|
|
|
inst._animation = false
|
2025-07-07 21:03:06 +08:00
|
|
|
--inst._full = true
|
|
|
|
|
inst._scale = true
|
2025-07-01 19:31:19 +08:00
|
|
|
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
|
2025-07-04 19:36:00 +08:00
|
|
|
if self.list_gamePlay.numItems == #playList + 1 then
|
|
|
|
|
self.list_gamePlay:RefreshVirtualList()
|
|
|
|
|
else
|
|
|
|
|
self.list_gamePlay.numItems = #playList + 1
|
|
|
|
|
end
|
2025-07-01 19:31:19 +08:00
|
|
|
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()
|
2025-07-20 00:24:30 +08:00
|
|
|
UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId)
|
2025-07-01 19:31:19 +08:00
|
|
|
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
|
2025-07-20 00:24:30 +08:00
|
|
|
-- times倍数
|
|
|
|
|
local times = json.decode(playList[index].hpData).times
|
|
|
|
|
obj:GetChild('Label_details'):GetChild('title').text = times / 1000 .. "倍," .. mode:LoadConfigToDetail(playList[index].config)
|
2025-07-23 15:40:53 +08:00
|
|
|
obj:GetChild('text_playName').emojies = EmojiDitc.EmojiesDitc
|
|
|
|
|
obj:GetChild('text_playName').text = Utils.TextOmit(playList[index].name, 6)
|
2025-07-01 19:31:19 +08:00
|
|
|
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
|
|
|
|
2025-07-20 00:24:30 +08:00
|
|
|
UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId)
|
2025-07-01 19:31:19 +08:00
|
|
|
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()
|
2025-07-20 00:24:30 +08:00
|
|
|
UpdateFamilyRoom(self) --self:UpdateFamilyRoom(fgCtr, self.groupId)
|
2025-07-04 02:06:24 +08:00
|
|
|
self:Refalsh(self.groupId)
|
|
|
|
|
printlog("刷新玩法===>>>>")
|
|
|
|
|
group.update_play = true
|
|
|
|
|
end)
|
2025-07-01 19:31:19 +08:00
|
|
|
tem:Show()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return PlayEditView
|