UGCProjects/InfFire/Script/Blueprint/UGCPlayerController.lua

85 lines
2.3 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class UGCPlayerController_C:BP_UGCPlayerController_C
--Edit Below--
require('Script.Global.Global');
---@type UGCPlayerController_C
local UGCPlayerController = {};
function UGCPlayerController:ReceiveBeginPlay()
self.SuperClass.ReceiveBeginPlay(self);
GlobalInit.InitGlobalVar()
if IsClient then
WidgetManager:Init(self);
if not DefaultSettings.EnableAutoPickUp then UITool.HidePickUpPanel(); end
UGCEventSystem.SetTimer(self, function()
WidgetManager:ShowPanel(WidgetConfig.EUIType.Main, false);
end, 1);
end
-- 添加玩家死亡复活回调
self.OnCharacterDeadDelegate:Add(self.OnCharacterDeath, self)
end
--function UGCPlayerController:ReceiveTick(DeltaTime)
-- self.SuperClass.ReceiveTick(self, DeltaTime);
--end
--[[
function UGCPlayerController:ReceiveEndPlay()
self.SuperClass.ReceiveEndPlay(self);
end
--]]
--function UGCPlayerController:GetReplicatedProperties()
-- return;
--end
function UGCPlayerController:GetAvailableServerRPCs()
return "Test_Func"
end
--- 重置游戏
function UGCPlayerController:ResetGame()
local PlayerState = UGCGameSystem.GetPlayerStateByPlayerKey(self.PlayerKey)
PlayerState:ResetGame();
end
---@param Character UGCPlayerPawn_C
function UGCPlayerController:OnCharacterDeath(Character)
UGCLogSystem.Log("[UGCPlayerController:OnCharacterDeath] 执行")
end
--- 设置能否移动
function UGCPlayerController:SetCanMove(IsCan)
self:SetCinematicMode(not IsCan, false, false, true, false);
end
-------------------------------- MINI GAME --------------------------------
function UGCPlayerController:MiniFunc(InFuncName, ...)
GameState:MiniFunc(InFuncName, self.PlayerKey, ...);
end
function UGCPlayerController:Test_MiniFunc(InFuncName, ...)
GameState:MiniFunc("TestFunc", InFuncName, self.PlayerKey, ...);
end
-------------------------------- 测试 --------------------------------
function UGCPlayerController:Test_Func(InFuncName, ...)
UGCLogSystem.Log("[UGCPlayerController:Test_Func] 执行 %s", InFuncName)
self[InFuncName](self, ...)
end
function UGCPlayerController:Test_PlayerLeave()
MiniGameManager:OnPlayerLeave(self.PlayerKey);
end
UGCPlayerController.IsSelfShow = true;
function UGCPlayerController:HideSelf()
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey);
Pawn:HiddenMySelf(self.IsSelfShow);
self.IsSelfShow = not self.IsSelfShow;
end
return UGCPlayerController;