104 lines
2.7 KiB
Lua
104 lines
2.7 KiB
Lua
|
---@class BP_PassagewayBlock_C:AActor
|
||
|
---@field Box UBoxComponent
|
||
|
---@field TipWidget UWidgetComponent
|
||
|
---@field DefaultSceneRoot USceneComponent
|
||
|
---@field Walls TArray<AStaticMeshActor*>
|
||
|
---@field Index int32
|
||
|
--Edit Below--
|
||
|
|
||
|
|
||
|
|
||
|
local BP_PassagewayBlock = {
|
||
|
ShowType = 1
|
||
|
};
|
||
|
|
||
|
function BP_PassagewayBlock:GetReplicatedProperties()
|
||
|
return
|
||
|
"ShowType"
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
function BP_PassagewayBlock:ReceiveBeginPlay()
|
||
|
self.SuperClass.ReceiveBeginPlay(self);
|
||
|
if UGCGameSystem.IsServer() then
|
||
|
self:SetShowType(CustomEnum.EPassagewayShowType.Hide)
|
||
|
-- 若非放置模式玩法则销毁Actor
|
||
|
if not PlacementModeConfig.IsPlaceMode() then
|
||
|
--self:K2_DestroyActor()
|
||
|
return
|
||
|
else
|
||
|
self.LoopCheckIsShowHandle = UGCEventSystem.SetTimerLoop(self, self.CheckClientIsShow, 2)
|
||
|
end
|
||
|
else
|
||
|
|
||
|
self:SetShowType(self.ShowType)
|
||
|
--UGCEventSystem.SetTimer(self, self.SetShowType, 2)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function BP_PassagewayBlock:CheckClientIsShow()
|
||
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "SetShowType", self.ShowType)
|
||
|
end
|
||
|
|
||
|
function BP_PassagewayBlock:OnRep_ShowType()
|
||
|
if self then
|
||
|
self:SetShowType(self.ShowType)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
function BP_PassagewayBlock:SetShowType(InShowType)
|
||
|
if InShowType then
|
||
|
self.ShowType = InShowType
|
||
|
end
|
||
|
UGCLogSystem.Log("[BP_PassagewayBlock_SetShowType] ShowType:%s", tostring(self.ShowType))
|
||
|
for i, WallActor in pairs(self.Walls) do
|
||
|
if UE.IsValid(WallActor) then
|
||
|
if InShowType == CustomEnum.EPassagewayShowType.Close then
|
||
|
WallActor.StaticMeshComponent:SetCollisionEnabled(ECollisionEnabled.QueryAndPhysics)
|
||
|
else
|
||
|
WallActor.StaticMeshComponent:SetCollisionEnabled(ECollisionEnabled.NoCollision)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
if UGCGameSystem.IsServer() then
|
||
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "SetShowType", self.ShowType)
|
||
|
else
|
||
|
self.TipWidget:GetUserWidgetObject():SetVis(InShowType == CustomEnum.EPassagewayShowType.Open, self.Index)
|
||
|
for i, WallActor in pairs(self.Walls) do
|
||
|
if UE.IsValid(WallActor) then
|
||
|
WallActor.StaticMeshComponent:SetVisibility(InShowType == CustomEnum.EPassagewayShowType.Close)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
--[[
|
||
|
function BP_PassagewayBlock:ReceiveTick(DeltaTime)
|
||
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
|
||
|
function BP_PassagewayBlock:ReceiveEndPlay()
|
||
|
if self.LoopCheckIsShowHandle then
|
||
|
UGCEventSystem.StopTimer(self.LoopCheckIsShowHandle)
|
||
|
self.LoopCheckIsShowHandle = nil
|
||
|
end
|
||
|
self.SuperClass.ReceiveEndPlay(self);
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
--[[
|
||
|
function BP_PassagewayBlock:GetAvailableServerRPCs()
|
||
|
return
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
return BP_PassagewayBlock;
|