dezhou_client/lua_probject/base_project/Game/View/NewGroup/GroupQuickStartView.lua

41 lines
1.0 KiB
Lua

-- 快速上桌
local GroupQuickStartView = {}
local M = GroupQuickStartView
function GroupQuickStartView.new(blur_view,callback)
setmetatable(M, {__index = BaseWindow})
local self = setmetatable({}, {__index = M})
self.class = "GroupQuickStartView"
self._close_destroy = true
self._blur_view = blur_view
self._callback = callback
local url = "ui://NewGroup/Win_QuickStart"
self:init(url)
return self
end
function M:init(url)
BaseWindow.init(self,url)
end
function M:FillData(list, index)
self._index = index
local lst_game = self._view:GetChild("lst_game")
lst_game:RemoveChildrenToPool()
for i = 1, #list do
local tem = list[i]
local item = lst_game:AddItemFromPool()
item.title = tem.name
item.selected = index == i
end
local btn_confirm = self._view:GetChild("btn_confirm")
btn_confirm.onClick:Set(function()
if self._callback then
self._callback(lst_game.selectedIndex + 1)
end
self:Destroy()
end)
end
return M