UGCProjects/GZJ/Script/UI/WBP_TechnologyPanel.lua
2025-01-08 22:46:12 +08:00

46 lines
1.3 KiB
Lua

---@class WBP_TechnologyPanel_C:UUserWidget
---@field Image_Alert UImage
---@field Panel_BG UWBP_WidgetHeader_C
---@field TextBlock_KillPoint UTextBlock
---@field UniformGridPanel_Technology UUniformGridPanel
--Edit Below--
local WBP_TechnologyPanel = { bInitDoOnce = false; };
-- Construct
function WBP_TechnologyPanel:Construct()
self.Panel_BG.UIType = EUIType.Tech
self.Panel_BG:Construct()
EventSystem:AddListener(EventType.PlayerKillPointChanged, self.ChangeKillPoint, self)
local TargetPlayerState = GameDataManager.GetLocalPlayerState()
self:ChangeKillPoint(TargetPlayerState.KillPoint.Current)
-- 先隐藏
self:SetAlert(false)
end
function WBP_TechnologyPanel:OnShowPanel()
NewPlayerGuideManager:RemoveGuide(10)
end
function WBP_TechnologyPanel:Destruct()
EventSystem:RemoveListener(EventType.PlayerKillPointChanged, self.ChangeKillPoint, self)
end
function WBP_TechnologyPanel:SetAlert(IsShow)
if IsShow then
self.Image_Alert:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
-- 关闭警告
EventSystem.SetTimer(self, function()
self:SetAlert(false)
end, 2.5)
else
self.Image_Alert:SetVisibility(ESlateVisibility.Collapsed)
end
end
function WBP_TechnologyPanel:ChangeKillPoint(NewKillPoint)
self.TextBlock_KillPoint:SetText(string.format('%d', NewKillPoint))
end
return WBP_TechnologyPanel;