70 lines
2.2 KiB
Lua
70 lines
2.2 KiB
Lua
---@class WB_SceneItemGuide_C:UUserWidget
|
|
---@field Button_close UButton
|
|
---@field Button_left UButton
|
|
---@field Button_right UButton
|
|
---@field CanvasPanel_IPX UCanvasPanel
|
|
---@field CheckBox_select UCheckBox
|
|
---@field HorizontalBox_Paging UHorizontalBox
|
|
---@field WidgetSwitcher_page UWidgetSwitcher
|
|
--Edit Below--
|
|
---@type WB_SceneItemGuide_C
|
|
local WB_SceneItemGuide = {
|
|
bInitDoOnce = false;
|
|
SelectColor = {R = 1., G = 0.51, B = 0.14, A = 1.};
|
|
NotSelectColor = {R = 1., G = 1., B = 1., A = 1.};
|
|
};
|
|
|
|
function WB_SceneItemGuide:Construct()
|
|
WidgetLibrary.BindButtonClicked(self.Button_close, self.CloseGuide, self)
|
|
WidgetLibrary.BindButtonClicked(self.Button_left, self.LastGuide, self)
|
|
WidgetLibrary.BindButtonClicked(self.Button_right, self.NextGuide, self)
|
|
|
|
end
|
|
|
|
function WB_SceneItemGuide:OnShowPanel(...)
|
|
self.WidgetSwitcher_page:SetActiveWidgetIndex(0);
|
|
end
|
|
|
|
function WB_SceneItemGuide:GetNowIndex()
|
|
return self.WidgetSwitcher_page:GetActiveWidgetIndex()
|
|
end
|
|
function WB_SceneItemGuide:UpdateIndex(NewIndex)
|
|
if NewIndex >= self.WidgetSwitcher_page:GetChildrenCount() then
|
|
NewIndex = 0
|
|
elseif NewIndex < 0 then
|
|
NewIndex = self.WidgetSwitcher_page:GetChildrenCount() - 1
|
|
end
|
|
self.WidgetSwitcher_page:SetActiveWidgetIndex(NewIndex)
|
|
for i = 1, self.WidgetSwitcher_page:GetChildrenCount(), 1 do
|
|
local TempImage = self.HorizontalBox_Paging:GetChildAt(i - 1);
|
|
if TempImage ~= nil then
|
|
if (i - 1) == NewIndex then
|
|
TempImage:SetColorAndOpacity(self.SelectColor)
|
|
else
|
|
TempImage:SetColorAndOpacity(self.NotSelectColor)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
function WB_SceneItemGuide:NextGuide()
|
|
self:UpdateIndex(self:GetNowIndex() + 1)
|
|
SoundSystem.PlaySound(SoundSystem.ESound.Btn)
|
|
end
|
|
function WB_SceneItemGuide:LastGuide()
|
|
self:UpdateIndex(self:GetNowIndex() - 1)
|
|
SoundSystem.PlaySound(SoundSystem.ESound.Btn)
|
|
end
|
|
function WB_SceneItemGuide:CloseGuide()
|
|
WidgetManager:ClosePanel(WidgetConfig.EUIType.SceneItemGuide);
|
|
end
|
|
|
|
-- function WB_SceneItemGuide:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_SceneItemGuide:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_SceneItemGuide; |