2025-01-04 23:00:19 +08:00

53 lines
1.6 KiB
Lua

---@class WB_AchievementTasks_C:UUserWidget
---@field VerticalBox_Tasks UVerticalBox
--Edit Below--
local WB_AchievementTasks = { bInitDoOnce = false; };
--[==[ Construct
function WB_AchievementTasks:Construct()
end
-- Construct ]==]
-- function WB_AchievementTasks:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_AchievementTasks:Destruct()
-- end
function WB_AchievementTasks:Init()
if self.bInitDoOnce then
return;
end
self.bInitDoOnce = true
UGCEventSystem.AddListener(ArchiveDataConfig.GetParamNotifyEvent(ArchiveDataConfig.EArchiveType.MapStar), self.UpdateStar, self)
end
function WB_AchievementTasks:SetMapType(InMapType)
self:Init()
self.MapType = InMapType
local MapInfo = MiniGameConfig.MiniGameInfo[InMapType]
if MapInfo then
for i = 1, self.VerticalBox_Tasks:GetChildrenCount() do
local Item = self.VerticalBox_Tasks:GetChildAt(i - 1)
if MapInfo.Task and MapInfo.Task[i] then
Item:SetText(MapInfo.Task[i].Desc)
end
end
end
self:UpdateStar()
end
function WB_AchievementTasks:UpdateStar()
UGCLogSystem.Log("[WB_AchievementTasks_UpdateStar] MapType:%s", tostring(self.MapType))
local Count = UGCGameSystem.GameState:GetPlayerStarFromMapType(UGCSystemLibrary.GetLocalPlayerKey(), self.MapType)
for i = 1, self.VerticalBox_Tasks:GetChildrenCount() do
local Item = self.VerticalBox_Tasks:GetChildAt(i - 1)
Item:SetIsIlluminate(Count >= i)
UGCLogSystem.Log("[WB_AchievementTasks_UpdateStar]Count:%s", tostring(Count))
end
end
return WB_AchievementTasks;