PGRData/Script/matrix/xui/xuishop/XUiShopWaferSelect.lua
2024-09-01 22:49:41 +02:00

88 lines
No EOL
3.5 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--[[
v1.29 商店优化
优化当前分解商店-意识商店的筛选功能
1去掉当前【位置】筛选按钮以及下拉选择位置的下拉条
2将原【位置】按钮替换成【切换套装】按钮。
3进入分解-意识商店时,默认选中套装为排序第一意识套装(康德丽娜)
4点击【切换套装】按钮弹出二级界面显示所有可选择的意识套装图标、名称、属性简介。
5选中某一意识套装后点击【确认】按钮后关闭二级界面商店刷新为对应意识显示顺序按照意识位置从一到六依次显示。
65星和4星意识商店中有材料道具【切换套装】按钮变成【筛选】按钮同时在筛选界面新增分类【其他类】。
7选中【其他类】商店刷新对应的除意识外的道具。
8【2】—【5】步骤的操作逻辑参考【战斗——资源——作战补给——资源商店——切换套装】的操作逻辑可直接复用需要特殊处理不属于意识类的道具
--]]
local XUiShopWaferSelect = XLuaUiManager.Register(XLuaUi, "UiShopWaferSelect")
function XUiShopWaferSelect:OnAwake()
self:InitComponent()
self:InitDynamicTable()
end
function XUiShopWaferSelect:OnStart(SelectData, dataProvider, selectCallBack)
self.DataProvider = dataProvider
self.SelectCallBack = selectCallBack
self.CurData = SelectData
self:UpdateGridList()
end
function XUiShopWaferSelect:InitComponent()
self.BtnConfirm.CallBack = function() self:OnBtnConfirmClick() end
self.BtnClose.CallBack = function() self:OnBtnCloseClick() end
self.BtnCancel.CallBack = function() self:OnBtnCloseClick() end
self.BtnTanchuangClose.CallBack = function() self:OnBtnCloseClick() end
self.GridSuitSimple.gameObject:SetActiveEx(false)
end
function XUiShopWaferSelect:InitDynamicTable()
self.DynamicTable = XDynamicTableNormal.New(self.PanelSelectList.gameObject)
self.DynamicTable:SetDelegate(self)
self.DynamicTable:SetProxy(require("XUi/XUiShop/XUiShopWaferSelectGrid"))
end
function XUiShopWaferSelect:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_INIT then
grid:Init(self)
elseif event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
local data = self.DataProvider[index]
self:UpdateGrid(grid, data)
elseif event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_TOUCHED then
local data = self.DataProvider[index]
self:OnGridClick(data)
end
end
function XUiShopWaferSelect:OnGridClick(data)
self.CurData = data
for k, v in ipairs(self.DataProvider) do
local grid = self.DynamicTable:GetGridByIndex(k)
if grid then
self:UpdateGrid(grid, v)
end
end
end
function XUiShopWaferSelect:UpdateGrid(grid, data)
if data then
local isSelected = self.CurData == data
grid:Refresh(data, isSelected)
end
end
function XUiShopWaferSelect:UpdateGridList()
self.ImgEmpty.gameObject:SetActiveEx(not self.DataProvider or #self.DataProvider == 0)
self.DynamicTable:SetDataSource(self.DataProvider)
self.DynamicTable:ReloadDataASync()
end
function XUiShopWaferSelect:OnBtnConfirmClick()
if self.SelectCallBack then
self.SelectCallBack(self.CurData)
end
self:Close()
end
function XUiShopWaferSelect:OnBtnCloseClick()
self:Close()
end
return XUiShopWaferSelect