38 lines
1.1 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
local PawnTool = {};
---@type table<PlayerKey, bool>
PawnTool.IsPlayersShow = {};
--- 客户端执行 隐藏玩家
---@param InPlayerKey PlayerKey
function PawnTool.HidePawn(InPlayerKey, IsHide)
if IsClient then
if IsHide == nil then IsHide = true; end
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(InPlayerKey);
if UE.IsValidPawn(Pawn) then
Pawn:HiddenMySelf(IsHide);
PawnTool.IsPlayersShow[InPlayerKey] = not IsHide;
end
end
end
--- 客户端执行,显示玩家
function PawnTool.ShowPawn(InPlayerKey, IsShow)
if IsClient then
if IsShow == nil then IsShow = true; end
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(InPlayerKey)
if UE.IsValidPawn(Pawn) then
Pawn:HiddenMySelf(not IsShow);
PawnTool.IsPlayersShow[InPlayerKey] = IsShow;
end
end
end
--- 打开 Pawn 的描边
function PawnTool.OpenPawnOutline(InPlayerKey, IsShow)
if IsClient then
if IsShow == nil then IsShow = true; end
STExtraBlueprintFunctionLibrary.EnablePlayerAvatarOutline(self, IsShow);
UGCGameSystem.GameState:RegisterPostProcessMgr(self);
end
end