UGCProjects/GZJ/Script/UI/Guide/WBP_GuideTips_0.lua

83 lines
2.3 KiB
Lua
Raw Normal View History

2025-01-08 22:46:12 +08:00
---@class WBP_GuideTips_0_C:UAEUserWidget
---@field Button_Close UButton
---@field Button_L UButton
---@field Button_R UButton
---@field CanvasPanel_IPX UCanvasPanel
---@field Image_Paging_00 UImage
---@field Image_Paging_01 UImage
---@field Image_Paging_02 UImage
---@field Image_Paging_03 UImage
---@field WidgetSwitcher_Tips UWidgetSwitcher
--Edit Below--
local WBP_GuideTips_0 = {
bInitDoOnce = false;
CurIndex = 0,
};
local ColorList = {
{R = 0.287441, G = 0.287441, B = 0.287441, A = 1.0},
{R = 1, G = 0.508881, B = 0.138432, A = 1.0},
}
function WBP_GuideTips_0:Construct()
self.Button_R.OnClicked:Add(WBP_GuideTips_0.OnButtonRClicked, self)
self.Button_L.OnClicked:Add(WBP_GuideTips_0.OnButtonLClicked, self)
self.Button_Close.OnClicked:Add(WBP_GuideTips_0.OnButtonCloseClicked, self)
self.PagingImgs = {
self.Image_Paging_00,
self.Image_Paging_01,
self.Image_Paging_02,
self.Image_Paging_03,
}
self.CurIndex = 0
self:OnCurIndexChanged(self.CurIndex)
end
function WBP_GuideTips_0:Destruct()
self.Button_R.OnClicked:Remove(WBP_GuideTips_0.OnButtonRClicked, self)
self.Button_L.OnClicked:Remove(WBP_GuideTips_0.OnButtonLClicked, self)
self.Button_Close.OnClicked:Remove(WBP_GuideTips_0.OnButtonCloseClicked, self)
end
function WBP_GuideTips_0:OnShowPanel()
if NewPlayerGuideManager then
NewPlayerGuideManager:RemoveGuide(1)
end
end
function WBP_GuideTips_0:OnButtonRClicked()
self.CurIndex = math.clamp(self.CurIndex + 1, 0, 3)
self:OnCurIndexChanged(self.CurIndex)
end
function WBP_GuideTips_0:OnButtonLClicked()
self.CurIndex = math.clamp(self.CurIndex - 1, 0, 3)
self:OnCurIndexChanged(self.CurIndex)
end
function WBP_GuideTips_0:OnCurIndexChanged(CurIndex)
self.WidgetSwitcher_Tips:SetActiveWidgetIndex(CurIndex)
self:SetPagingImg(CurIndex)
end
function WBP_GuideTips_0:SetPagingImg(Index)
for i, PagingImg in pairs(self.PagingImgs) do
if i == (Index + 1) then
PagingImg:SetColorAndOpacity(ColorList[2])
else
PagingImg:SetColorAndOpacity(ColorList[1])
end
end
end
function WBP_GuideTips_0:OnButtonCloseClicked()
--close UI
if UIManager:IsVisiblePanel(EUIType.GeneralGuide) then
UIManager:ClosePanel(EUIType.GeneralGuide)
end
end
return WBP_GuideTips_0;