UGCProjects/GZJ/Script/UI/WBP_SaveGame_Achievement_Item.lua

56 lines
2.2 KiB
Lua
Raw Permalink Normal View History

2025-01-08 22:46:12 +08:00
---@class WBP_SaveGame_Achievement_Item_C:UUserWidget
---@field Button_Achievement UButton
---@field Image_Achievement_Icon UImage
---@field Image_Achievement_SelectBG UImage
---@field TextBlock_Achievement_Num UTextBlock
--Edit Below--
local WBP_SaveGame_Achievement_Item = {
bInitDoOnce = false,
OwnerPanel = nil,
Info = {},
};
local BGPath = {
Gained = UGCGameSystem.GetUGCResourcesFullPath('Asset/UITexture/fileUI/Textures/ZD_UGC_file_23.ZD_UGC_file_23'),
NotGained = UGCGameSystem.GetUGCResourcesFullPath('Asset/UITexture/fileUI/Textures/ZD_UGC_file_22.ZD_UGC_file_22'),
}
function WBP_SaveGame_Achievement_Item:Construct()
self.Button_Achievement.OnClicked:Add(self.Button_Achievement_OnClicked, self)
self.Button_Achievement:SetTouchMethod(EButtonTouchMethod.PreciseTap)
end
function WBP_SaveGame_Achievement_Item:Destruct()
self.Button_Achievement.OnClicked:Remove(self.Button_Achievement_OnClicked, self)
end
function WBP_SaveGame_Achievement_Item:InitAchievementInfo(Info)
self.TextBlock_Achievement_Num:SetText(tostring(Info.Num))
self.Info = Info
if Info.HasGained then
UIManager.LoadTexture(self.Image_Achievement_SelectBG, BGPath.Gained)
self.Image_Achievement_Icon:SetColorAndOpacity({R=1,G=1,B=1,A=1})
self.TextBlock_Achievement_Num:SetColorAndOpacity({SpecifiedColor={R=1,G=1,B=1,A=1},ColorUseRule=0})
else
UIManager.LoadTexture(self.Image_Achievement_SelectBG, BGPath.NotGained)
self.Image_Achievement_Icon:SetColorAndOpacity({R=0.151042,G=0.151042,B=0.151042,A=1})
self.TextBlock_Achievement_Num:SetColorAndOpacity({SpecifiedColor={R=0.151042,G=0.151042,B=0.151042,A=1},ColorUseRule=0})
end
UIManager.LoadTexture(self.Image_Achievement_Icon, Info.Icon)
end
function WBP_SaveGame_Achievement_Item:Button_Achievement_OnClicked()
if self.OwnerPanel == nil then
return
end
self.OwnerPanel:OnCurAchievementChanged(self)
end
function WBP_SaveGame_Achievement_Item:SetAchievementIsSelected(bIsSelected)
self.Image_Achievement_SelectBG:SetVisibility(bIsSelected and ESlateVisibility.SelfHitTestInvisible or ESlateVisibility.Collapsed)
end
return WBP_SaveGame_Achievement_Item;