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

47 lines
1.3 KiB
Lua

---@class WB_FightPanel_C:UAEUserWidget
---@field Button_ShowGuide UButton
---@field HeadingInfo UWB_HeadingInfo_C
---@field W_TeamScore_Line UW_TeamScore_Line_C
---@field WB_DistanceDefenseLine UWB_DistanceDefenseLine_C
---@field WidgetSwitcher_IsAttack UWidgetSwitcher
--Edit Below--
---@type WB_FightPanel_C
local WB_FightPanel = { bInitDoOnce = false; };
function WB_FightPanel:Construct()
self:LuaInit();
end
function WB_FightPanel:LuaInit()
if self.bInitDoOnce then return end
self.bInitDoOnce = true
self.HeadingInfo:LuaInit()
WidgetLibrary.ButtonOnClickShowPanel(self.Button_ShowGuide, WidgetConfig.EUIType.Guide);
UGCEventSystem.AddListener(EventEnum.UpdateAttackers, self.UpdateLocalPlayerIsAttack, self)
self:UpdateLocalPlayerIsAttack()
-- 做一下校验操作
UGCEventSystem.SetTimerLoop(self, self.UpdateLocalPlayerIsAttack, 10)
end
function WB_FightPanel:OnShowPanel()
-- self.W_TeamScore_TargetScore:OnShowPanel()
end
function WB_FightPanel:OnClosePanel()
-- self.W_TeamScore_TargetScore:OnClosePanel()
end
function WB_FightPanel:UpdateLocalPlayerIsAttack()
if UGCGameSystem.GameState:PlayerIsAttacker(UGCSystemLibrary.GetLocalPlayerKey()) then
self.WidgetSwitcher_IsAttack:SetActiveWidgetIndex(0)
else
self.WidgetSwitcher_IsAttack:SetActiveWidgetIndex(1)
end
end
return WB_FightPanel;