129 lines
3.3 KiB
Lua
Raw Normal View History

2025-01-09 13:36:39 +08:00
---@class BP_PreViewFXActor_C:AActor
---@field DynamicTextRender UDynamicTextRenderComponent
---@field DefaultSceneRoot USceneComponent
2025-02-02 16:26:56 +08:00
---@field DefaultFX TMap:TEnumAsByte<EFXType>,UParticleSystem
2025-01-09 13:36:39 +08:00
---@field KillParticleOffsetTF FTransform
--Edit Below--
2025-02-02 16:26:56 +08:00
local BP_PreViewFXActor = {
FXTable = {};
FXIDList = {};
OverrideColor = {};
NowFXIndex = {};
}
2025-01-09 13:36:39 +08:00
2025-02-02 16:26:56 +08:00
2025-01-09 13:36:39 +08:00
function BP_PreViewFXActor:ReceiveBeginPlay()
BP_PreViewFXActor.SuperClass.ReceiveBeginPlay(self)
2025-02-02 16:26:56 +08:00
if UGCGameSystem.IsServer() then
else
--self.DefaultFX = {
-- [EFXType.Muzzle] = self.MuzzleParticle;
-- [EFXType.Kill] = self.KillParticle;
-- [EFXType.Bullet] = self.BulletParticle;
-- [EFXType.MuzzleTailed] = self.TailedMuzzle;
-- [EFXType.Hit] = self.HitParticle;
--}
self:InitFXTable()
end
end
--[[
FFXData
ID int32
FXType EFXType
Rarity int32
Name FString
Desc FString
Particle UParticleSystem
ColorValue float[]
BaseColor FLinearColor
]]
function BP_PreViewFXActor:InitFXTable()
for i, v in pairs(EFXType) do
self.FXIDList[v] = {}
self.NowFXIndex[v] = 0
end
local ReadFXTable = UGCSystemLibrary.GetDataTableFromPath(UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/A_Table/Table_FXData.Table_FXData'))
self.FXTable = table.DeepCopy(ReadFXTable)
for i, v in pairs(self.FXTable) do
UGCLogSystem.Log("[BP_PreViewFXActor_LoadFXTable] Key:%s", tostring(i))
table.insert(self.FXIDList[v.FXType], v.ID)
end
for i, v in pairs(self.FXIDList) do
table.sort(self.FXIDList[i])
end
end
--- 覆盖对应特效的颜色
---@param FXType EFXType
---@param NewColor FLinearColor 为nil则重置为默认颜色
function BP_PreViewFXActor:SetOverrideColor(FXType, NewColor)
---@field SetColorParameter:fun(ParameterName:FName,param:FLinearColor)
---@field SetVectorParameter:fun(ParameterName:FName,param:FVector)
self.OverrideColor[FXType] = NewColor
UGCEventSystem.SendEvent(EventEnum.OverrideFXColor, FXType)
end
function BP_PreViewFXActor:GetParticleColor(FXType)
return self.OverrideColor[FXType]
end
function BP_PreViewFXActor:GetParticleDefaultColor(FXType)
local FXIndex = self:GetNowFXIndex(FXType)
local FXID = self.FXIDList[FXType][FXIndex]
if FXID then
return self.FXTable[FXID].BaseColor
end
return nil
end
function BP_PreViewFXActor:GetNowFXIndex(FXType)
return self.NowFXIndex[FXType]
end
function BP_PreViewFXActor:GetNowFXFromFXType(FXType)
local FXIndex = self:GetNowFXIndex(FXType)
local FXID = self.FXIDList[FXType][FXIndex]
if FXID then
return self.FXTable[FXID].Particle
else
return self.DefaultFX[FXType]
end
end
function BP_PreViewFXActor:SetNextFX(FXType)
if #self.FXIDList[FXType] > 0 then
self.NowFXIndex[FXType] = (self.NowFXIndex[FXType] % #self.FXIDList[FXType]) + 1
UGCEventSystem.SendEvent(EventEnum.ChangeFX, FXType)
end
2025-01-09 13:36:39 +08:00
end
--[[
function BP_PreViewFXActor:ReceiveTick(DeltaTime)
BP_PreViewFXActor.SuperClass.ReceiveTick(self, DeltaTime)
end
--]]
--[[
function BP_PreViewFXActor:ReceiveEndPlay()
BP_PreViewFXActor.SuperClass.ReceiveEndPlay(self)
end
--]]
--[[
function BP_PreViewFXActor:GetReplicatedProperties()
return
end
--]]
--[[
function BP_PreViewFXActor:GetAvailableServerRPCs()
return
end
--]]
return BP_PreViewFXActor