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

66 lines
2.6 KiB
Lua

---@class WB_HuntingMarkEnemy_C:UUserWidget
---@field CanvasPanel_Child UCanvasPanel
---@field Image_1 UImage
--Edit Below--
local WB_HuntingMarkEnemy = { bInitDoOnce = false; };
--[==[ Construct
function WB_HuntingMarkEnemy:Construct()
end
-- Construct ]==]
function WB_HuntingMarkEnemy:Tick(MyGeometry, InDeltaTime)
--UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick]")
local IsTrace = false
if self.TracePlayerKey then
--UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick]22222222222222222222222222222222222222222222222222222222")
if UGCGameSystem.GameState and UGCGameSystem.GameState:IsHuntTime() then
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.TracePlayerKey)
--UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick] 1")
if Pawn and not UGCPawnSystem.HasPawnState(Pawn, EPawnState.Dead) then
--UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick] 2")
local PlayerPos
if UE.IsValid(Pawn.Mesh) then
PlayerPos = Pawn.Mesh:GetSocketLocation("spine_03")
UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick] PlayerPos:%s", VectorHelper.ToString(PlayerPos))
else
PlayerPos = Pawn:K2_GetActorLocation()
PlayerPos.Z = PlayerPos.Z + 30
UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick] PlayerPos22:%s", VectorHelper.ToString(PlayerPos))
end
local Succeed, Pos2D = WidgetLayoutLibrary.ProjectWorldLocationToWidgetPosition(UGCSystemLibrary.GetLocalPlayerController(), PlayerPos)
if Succeed then
--UGCLogSystem.Log("[WB_HuntingMarkEnemy_Tick] 3 Pos2D:%s", VectorHelper.ToString2D(Pos2D))
IsTrace = true
local CanvasSlot = WidgetLayoutLibrary.SlotAsCanvasSlot(self.CanvasPanel_Child)
CanvasSlot:SetPosition(Pos2D)
end
end
end
end
self:SetTraceUIVis(IsTrace)
end
-- function WB_HuntingMarkEnemy:Destruct()
-- end
function WB_HuntingMarkEnemy:SetTracePlayerKey(InPlayerKey)
UGCLogSystem.Log("[WB_HuntingMarkEnemy_SetTracePlayerKey] InPlayerKey:%s", tostring(InPlayerKey))
self.TracePlayerKey = InPlayerKey
end
function WB_HuntingMarkEnemy:SetTraceUIVis(InIsVis)
if self.IsVis ~= InIsVis then
self.IsVis = InIsVis
if self.IsVis then
self.CanvasPanel_Child:SetVisibility(ESlateVisibility.HitTestInvisible);
else
self.CanvasPanel_Child:SetVisibility(ESlateVisibility.Collapsed);
end
end
end
return WB_HuntingMarkEnemy;