特效
This commit is contained in:
parent
848b21b727
commit
0cb62cb96b
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
FX_Preview/Asset/FX/BulletFX/Bullet1/P_Bullet_1_P.uasset
Normal file
BIN
FX_Preview/Asset/FX/BulletFX/Bullet1/P_Bullet_1_P.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
FX_Preview/Asset/FX/KillFX/ElectricBall/P_Kill_Boom_P.uasset
Normal file
BIN
FX_Preview/Asset/FX/KillFX/ElectricBall/P_Kill_Boom_P.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
FX_Preview/Asset/FX/TailedMuzzle/Type2/P_TailedMuzzle_2_P.uasset
Normal file
BIN
FX_Preview/Asset/FX/TailedMuzzle/Type2/P_TailedMuzzle_2_P.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
FX_Preview/Asset/FX/TailedMuzzle/Type7/P_TailedMuzzle_7_P.uasset
Normal file
BIN
FX_Preview/Asset/FX/TailedMuzzle/Type7/P_TailedMuzzle_7_P.uasset
Normal file
Binary file not shown.
BIN
FX_Preview/Asset/FX/Z_ReferenceAssets/P_Turret_JGT_B_01.uasset
Normal file
BIN
FX_Preview/Asset/FX/Z_ReferenceAssets/P_Turret_JGT_B_01.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -56,17 +56,6 @@ function BP_PreViewFXActor:InitFXTable()
|
|||||||
end
|
end
|
||||||
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)
|
function BP_PreViewFXActor:GetParticleColor(FXType)
|
||||||
return self.OverrideColor[FXType]
|
return self.OverrideColor[FXType]
|
||||||
end
|
end
|
||||||
@ -80,6 +69,27 @@ function BP_PreViewFXActor:GetParticleDefaultColor(FXType)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BP_PreViewFXActor:GetColorValue(FXType)
|
||||||
|
local FXIndex = self:GetNowFXIndex(FXType)
|
||||||
|
local FXID = self.FXIDList[FXType][FXIndex]
|
||||||
|
if FXID then
|
||||||
|
return self.FXTable[FXID].ColorValue
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
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, self.OverrideColor[FXType])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function BP_PreViewFXActor:GetNowFXIndex(FXType)
|
function BP_PreViewFXActor:GetNowFXIndex(FXType)
|
||||||
return self.NowFXIndex[FXType]
|
return self.NowFXIndex[FXType]
|
||||||
end
|
end
|
||||||
@ -102,6 +112,22 @@ function BP_PreViewFXActor:SetNextFX(FXType)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BP_PreViewFXActor:SetParticleCompColor(ParticleComp, FXType)
|
||||||
|
if UE.IsValid(ParticleComp) then
|
||||||
|
local ColorValue = self:GetColorValue(FXType)
|
||||||
|
local Color = self:GetParticleColor(FXType)
|
||||||
|
if Color == nil then
|
||||||
|
Color = self:GetParticleDefaultColor(FXType)
|
||||||
|
end
|
||||||
|
for i, v in pairs(ColorValue) do
|
||||||
|
local TempColor = table.DeepCopy(UE.ToTable(Color))
|
||||||
|
local ColorVector = KismetMathLibrary.Conv_LinearColorToVector(TempColor)
|
||||||
|
ColorVector = VectorHelper.MulNumber(ColorVector, v)
|
||||||
|
ParticleComp:SetVectorParameter("Color" .. i, ColorVector)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
function BP_PreViewFXActor:ReceiveTick(DeltaTime)
|
function BP_PreViewFXActor:ReceiveTick(DeltaTime)
|
||||||
BP_PreViewFXActor.SuperClass.ReceiveTick(self, DeltaTime)
|
BP_PreViewFXActor.SuperClass.ReceiveTick(self, DeltaTime)
|
||||||
|
@ -35,7 +35,10 @@ function UGCGameState:SpawnParticleAtPos(Pos)
|
|||||||
Z = Pos.Z + TempPreViewActor.KillParticleOffsetTF.Translation.Z,
|
Z = Pos.Z + TempPreViewActor.KillParticleOffsetTF.Translation.Z,
|
||||||
}
|
}
|
||||||
local FXScale = {X = TempPreViewActor.KillParticleOffsetTF.Scale3D.X, Y = TempPreViewActor.KillParticleOffsetTF.Scale3D.Y, Z = TempPreViewActor.KillParticleOffsetTF.Scale3D.Z}
|
local FXScale = {X = TempPreViewActor.KillParticleOffsetTF.Scale3D.X, Y = TempPreViewActor.KillParticleOffsetTF.Scale3D.Y, Z = TempPreViewActor.KillParticleOffsetTF.Scale3D.Z}
|
||||||
GameplayStatics.SpawnEmitterAtLocation(self, KillParticle, Pos, {Roll = 0, Pitch = 0, Yaw = 0}, FXScale, true)
|
local KillParticleComp = GameplayStatics.SpawnEmitterAtLocation(self, KillParticle, Pos, {Roll = 0, Pitch = 0, Yaw = 0}, FXScale, true)
|
||||||
|
|
||||||
|
-- 设置颜色
|
||||||
|
TempPreViewActor:SetParticleCompColor(KillParticleComp, EFXType.Kill)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
40
FX_Preview/Script/Blueprint/UGCPlayerController.lua
Normal file
40
FX_Preview/Script/Blueprint/UGCPlayerController.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---@class UGCPlayerController_C:BP_UGCPlayerController_C
|
||||||
|
--Edit Below--
|
||||||
|
local UGCPlayerController = {}
|
||||||
|
|
||||||
|
|
||||||
|
function UGCPlayerController:ReceiveBeginPlay()
|
||||||
|
UGCPlayerController.SuperClass.ReceiveBeginPlay(self)
|
||||||
|
if UGCGameSystem.IsServer() then
|
||||||
|
else
|
||||||
|
local PreviewFxWidget = UserWidget.NewWidgetObjectBP(self, UE.LoadClass(UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/PreviewFX/WB_FX_Main.WB_FX_Main_C')));
|
||||||
|
PreviewFxWidget:AddToViewport(20000)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
function UGCPlayerController:ReceiveTick(DeltaTime)
|
||||||
|
UGCPlayerController.SuperClass.ReceiveTick(self, DeltaTime)
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
--[[
|
||||||
|
function UGCPlayerController:ReceiveEndPlay()
|
||||||
|
UGCPlayerController.SuperClass.ReceiveEndPlay(self)
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
--[[
|
||||||
|
function UGCPlayerController:GetReplicatedProperties()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
--[[
|
||||||
|
function UGCPlayerController:GetAvailableServerRPCs()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
return UGCPlayerController
|
@ -31,10 +31,15 @@ function UGCPlayerPawn:ReceiveBeginPlay()
|
|||||||
if not UGCGameSystem.IsServer() and self.CheckFXHandle == nil then
|
if not UGCGameSystem.IsServer() and self.CheckFXHandle == nil then
|
||||||
-- 这里防止未设置成功做的校验
|
-- 这里防止未设置成功做的校验
|
||||||
self.CheckFXHandle = UGCEventSystem.SetTimerLoop(self, self.UpdateFX, 2)
|
self.CheckFXHandle = UGCEventSystem.SetTimerLoop(self, self.UpdateFX, 2)
|
||||||
|
-- 绑定粒子颜色改变的函数
|
||||||
|
UGCEventSystem.AddListener(EventEnum.OverrideFXColor, self.OverrideFXColor, self)
|
||||||
|
-- 绑定粒子改变
|
||||||
|
UGCEventSystem.AddListener(EventEnum.ChangeFX, self.ChangeFX, self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local TempRescueOtherComp = self:GetCharacterRescueOtherComponent()
|
local TempRescueOtherComp = self:GetCharacterRescueOtherComponent()
|
||||||
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
|
||||||
|
|
||||||
if UE.IsValid(TempRescueOtherComp) and UE.IsValid(TempPreViewActor) then
|
if UE.IsValid(TempRescueOtherComp) and UE.IsValid(TempPreViewActor) then
|
||||||
-- 配置倒地粒子 没有用这个方法
|
-- 配置倒地粒子 没有用这个方法
|
||||||
@ -89,8 +94,33 @@ function UGCPlayerPawn:OnPostGetWeapon(Weapon)
|
|||||||
self:WeaponAttachEffect(Weapon)
|
self:WeaponAttachEffect(Weapon)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 覆盖拖尾特效的颜色
|
||||||
|
function UGCPlayerPawn:OverrideFXColor(FXType)
|
||||||
|
--UGCLogSystem.Log("[UGCPlayerPawn_OverrideFXColor] FXType:%s", tostring(FXType))
|
||||||
|
if FXType ~= EFXType.MuzzleTailed then return end
|
||||||
|
if not UE.IsValid(self.MuzzleTailedParticleComp) then return end
|
||||||
|
|
||||||
|
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
TempPreViewActor:SetParticleCompColor(self.MuzzleTailedParticleComp, EFXType.MuzzleTailed)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 替换FX
|
||||||
|
function UGCPlayerPawn:ChangeFX(FXType)
|
||||||
|
UGCLogSystem.Log("[UGCPlayerPawn_ChangeFX] FXType:%s", tostring(FXType))
|
||||||
|
if FXType ~= EFXType.MuzzleTailed then return end
|
||||||
|
if not UE.IsValid(self.MuzzleTailedParticleComp) then return end
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
local Particle = TempPreViewActor:GetNowFXFromFXType(FXType)
|
||||||
|
self.MuzzleTailedParticleComp:SetTemplate(Particle)
|
||||||
|
self:OverrideFXColor(EFXType.MuzzleTailed)
|
||||||
|
UGCLogSystem.Log("[UGCPlayerPawn_ChangeFX] Succeed")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
UGCPlayerPawn.BoundOnceEffectWeapons = {}
|
UGCPlayerPawn.BoundOnceEffectWeapons = {}
|
||||||
function UGCPlayerPawn:UpdateFX()
|
function UGCPlayerPawn:UpdateFX()
|
||||||
UGCLogSystem.Log("[UGCPlayerPawn_UpdateFX] PawnName:%s", KismetSystemLibrary.GetObjectName(self))
|
UGCLogSystem.Log("[UGCPlayerPawn_UpdateFX] PawnName:%s", KismetSystemLibrary.GetObjectName(self))
|
||||||
@ -104,6 +134,7 @@ function UGCPlayerPawn:UpdateFX()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function UGCPlayerPawn:WeaponAttachEffect(Weapon)
|
function UGCPlayerPawn:WeaponAttachEffect(Weapon)
|
||||||
|
if UGCGameSystem.IsServer() then return end
|
||||||
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
if UE.IsValid(TempPreViewActor) then
|
if UE.IsValid(TempPreViewActor) then
|
||||||
if UE.IsValid(Weapon) then
|
if UE.IsValid(Weapon) then
|
||||||
@ -142,7 +173,8 @@ function UGCPlayerPawn:WeaponAttachEffect(Weapon)
|
|||||||
UGCLogSystem.Log("[UGCPlayerPawn_WeaponAttachEffect] 22222222222222222222222222222")
|
UGCLogSystem.Log("[UGCPlayerPawn_WeaponAttachEffect] 22222222222222222222222222222")
|
||||||
UGCLogSystem.Log("[UGCPlayerPawn_WeaponAttachEffect] Bind TailedMuzzle")
|
UGCLogSystem.Log("[UGCPlayerPawn_WeaponAttachEffect] Bind TailedMuzzle")
|
||||||
self.BoundOnceEffectWeapons[#self.BoundOnceEffectWeapons + 1] = Weapon
|
self.BoundOnceEffectWeapons[#self.BoundOnceEffectWeapons + 1] = Weapon
|
||||||
GameplayStatics.SpawnEmitterAttached(MuzzleTailedParticle, SKMesh, "MuzzleEffect", {X=0,Y=0,Z=0}, {Roll = 0, Pitch = 0, Yaw = 0}, {X=1,Y=1,Z=1}, EAttachLocation.SnapToTarget, true)
|
self.MuzzleTailedParticleComp = GameplayStatics.SpawnEmitterAttached(MuzzleTailedParticle, SKMesh, "MuzzleEffect", {X=0,Y=0,Z=0}, {Roll = 0, Pitch = 0, Yaw = 0}, {X=1,Y=1,Z=1}, EAttachLocation.SnapToTarget, true)
|
||||||
|
self:OverrideFXColor(EFXType.MuzzleTailed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- 子弹拖尾特效
|
-- 子弹拖尾特效
|
||||||
|
@ -56,6 +56,11 @@ function BP_BulletTailFX:ActiveFly(Rot, Pos, Velocity, ParticleSystemTemplate)
|
|||||||
end
|
end
|
||||||
self.BulletFXComp:SetActive(true, true)
|
self.BulletFXComp:SetActive(true, true)
|
||||||
|
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
TempPreViewActor:SetParticleCompColor(self.BulletFXComp, EFXType.Bullet)
|
||||||
|
end
|
||||||
|
|
||||||
self.ProjectileMovement.Velocity = Velocity
|
self.ProjectileMovement.Velocity = Velocity
|
||||||
|
|
||||||
self.BulletFXComp:SetHiddenInGame(false, true);
|
self.BulletFXComp:SetHiddenInGame(false, true);
|
||||||
|
@ -14,3 +14,4 @@ require(Prefix .. 'UGCSendRPCSystem')
|
|||||||
require(Prefix .. 'PlayerScoreSystem')
|
require(Prefix .. 'PlayerScoreSystem')
|
||||||
require(Prefix .. 'MyVehicleSystem')
|
require(Prefix .. 'MyVehicleSystem')
|
||||||
require(Prefix .. 'MyWeaponSystem')
|
require(Prefix .. 'MyWeaponSystem')
|
||||||
|
require(Prefix .. 'WidgetLibrary')
|
52
FX_Preview/Script/Global/System/WidgetLibrary.lua
Normal file
52
FX_Preview/Script/Global/System/WidgetLibrary.lua
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
WidgetLibrary = WidgetLibrary or {}
|
||||||
|
|
||||||
|
|
||||||
|
--- 设置
|
||||||
|
---@param widget UUserWidget
|
||||||
|
---@param offset float
|
||||||
|
function WidgetLibrary.SetWidgetToRightBorder(widget, offset)
|
||||||
|
if not widget then return end
|
||||||
|
local slot = WidgetLayoutLibrary.SlotAsCanvasSlot(widget)
|
||||||
|
slot:SetAnchors({ Minimum = { X = 1, Y = 0 }, Maximum = { X = 1, Y = 0 } })
|
||||||
|
slot:SetAlignment({ X = 1, Y = 0 })
|
||||||
|
local offsets = slot:GetOffsets()
|
||||||
|
slot:SetOffsets({ Left = offset, Right = offsets.Right, Bottom = offsets.Bottom, Top = offsets.Top })
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 为防止被清除做出的全局处理
|
||||||
|
function WidgetLibrary.BindButtonClicked(TargetButton, Func, Obj)
|
||||||
|
TargetButton.OnClicked:Add(Func, Obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 为防止被清除做出的全局处理
|
||||||
|
function WidgetLibrary.BindButtonPressed(TargetButton, Func, Obj)
|
||||||
|
TargetButton.OnPressed:Add(Func, Obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 为防止被清除做出的全局处理
|
||||||
|
function WidgetLibrary.BindButtonReleased(TargetButton, Func, Obj)
|
||||||
|
TargetButton.OnReleased:Add(Func, Obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 绑定UI文本
|
||||||
|
function WidgetLibrary.TextBlockBindingPropertyText(TargetTextBlock, Func, Obj)
|
||||||
|
TargetTextBlock:BindingProperty("Text", Func, Obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 直接绑定按键点击打开WidgetManager的页面
|
||||||
|
function WidgetLibrary.ButtonOnClickShowPanel(TargetButton, UIType, IsClose)
|
||||||
|
TargetButton.OnClicked:Add(
|
||||||
|
function()
|
||||||
|
if IsClose then
|
||||||
|
WidgetManager:ClosePanel(UIType)
|
||||||
|
else
|
||||||
|
WidgetManager:ShowPanel(UIType, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function WidgetLibrary.SliderOnValueChanged(Slider, Func, Obj)
|
||||||
|
Slider.OnValueChanged:Add(Func, Obj)
|
||||||
|
end
|
||||||
|
|
@ -1,13 +1,19 @@
|
|||||||
---@class WB_FX_Main_C:UUserWidget
|
---@class WB_FX_Main_C:UUserWidget
|
||||||
---@field NewButton_ShowPanel UNewButton
|
---@field NewButton_ShowPanel UNewButton
|
||||||
|
---@field REINST_WB_PreviewFX_C_0 UWB_PreviewFX_C
|
||||||
|
---@field WB_PreviewFX UWB_PreviewFX_C
|
||||||
--Edit Below--
|
--Edit Below--
|
||||||
local WB_FX_Main = { bInitDoOnce = false }
|
local WB_FX_Main = { bInitDoOnce = false }
|
||||||
|
|
||||||
--[==[ Construct
|
|
||||||
function WB_FX_Main:Construct()
|
function WB_FX_Main:Construct()
|
||||||
|
self.WB_PreviewFX:LuaInit()
|
||||||
|
WidgetLibrary.BindButtonClicked(self.NewButton_ShowPanel, self.ShowPreviewFXPanel, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_FX_Main:ShowPreviewFXPanel()
|
||||||
|
self.WB_PreviewFX:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||||||
end
|
end
|
||||||
-- Construct ]==]
|
|
||||||
|
|
||||||
-- function WB_FX_Main:Tick(MyGeometry, InDeltaTime)
|
-- function WB_FX_Main:Tick(MyGeometry, InDeltaTime)
|
||||||
|
|
||||||
|
@ -6,20 +6,97 @@
|
|||||||
---@field WidgetSwitcher_BindColor UWidgetSwitcher
|
---@field WidgetSwitcher_BindColor UWidgetSwitcher
|
||||||
---@field Setting_PickUp_BP USetting_Pickup_UIBP_C
|
---@field Setting_PickUp_BP USetting_Pickup_UIBP_C
|
||||||
--Edit Below--
|
--Edit Below--
|
||||||
local WB_Item_Slide = { bInitDoOnce = false }
|
local WB_Item_FXType = {
|
||||||
|
bInitDoOnce = false;
|
||||||
|
IsBind = false
|
||||||
|
}
|
||||||
|
|
||||||
--[==[ Construct
|
--[==[ Construct
|
||||||
function WB_Item_Slide:Construct()
|
function WB_Item_FXType:Construct()
|
||||||
|
|
||||||
end
|
end
|
||||||
-- Construct ]==]
|
-- Construct ]==]
|
||||||
|
|
||||||
-- function WB_Item_Slide:Tick(MyGeometry, InDeltaTime)
|
-- function WB_Item_FXType:Tick(MyGeometry, InDeltaTime)
|
||||||
|
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- function WB_Item_Slide:Destruct()
|
-- function WB_Item_FXType:Destruct()
|
||||||
|
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
return WB_Item_Slide
|
function WB_Item_FXType:LuaInit()
|
||||||
|
if self.bInitDoOnce then return end self.bInitDoOnce = true
|
||||||
|
|
||||||
|
WidgetLibrary.BindButtonClicked(self.NewButton_ResetColor, self.ResetColor, self)
|
||||||
|
WidgetLibrary.BindButtonClicked(self.NewButton_Change, self.NextFx, self)
|
||||||
|
WidgetLibrary.BindButtonClicked(self.NewButton_BindColor, self.ChangeBindColor, self)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
FXTypeName = {
|
||||||
|
[EFXType.Muzzle] = "枪口火焰",
|
||||||
|
[EFXType.MuzzleTailed] = "枪口拖尾",
|
||||||
|
[EFXType.Kill] = "击杀效果",
|
||||||
|
[EFXType.Bullet] = "弹道",
|
||||||
|
[EFXType.Hit] = "命中效果",
|
||||||
|
}
|
||||||
|
function WB_Item_FXType:SetType(InType)
|
||||||
|
self:LuaInit()
|
||||||
|
self.FXType = InType
|
||||||
|
if FXTypeName[self.FXType] then
|
||||||
|
self.TextBlock_TypeName:SetText(FXTypeName[self.FXType])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:GetFXType()
|
||||||
|
return self.FXType
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:ResetColor()
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
TempPreViewActor:SetOverrideColor(self.FXType, nil)
|
||||||
|
self:SetBindColor(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:NextFx()
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
TempPreViewActor:SetNextFX(self.FXType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:ChangeBindColor()
|
||||||
|
self:SetBindColor(not self.IsBind)
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:SetBindColor(InIsBind)
|
||||||
|
if self.IsBind ~= InIsBind then
|
||||||
|
self.IsBind = InIsBind
|
||||||
|
self.WidgetSwitcher_BindColor:SetActiveWidgetIndex(self.IsBind and 1 or 0)
|
||||||
|
self:BindChangeCallBackNotify()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:GetIsBindColor()
|
||||||
|
return self.IsBind
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:BindChangeCallBackNotify()
|
||||||
|
if self.CallBackFunc then
|
||||||
|
if self.CallBackObj then
|
||||||
|
self.CallBackFunc(self.CallBackObj, self.FXType, self.IsBind)
|
||||||
|
else
|
||||||
|
self.CallBackFunc(self.FXType, self.IsBind)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_FXType:BindLockCallBack(InFunc, InObj)
|
||||||
|
self.CallBackFunc = InFunc
|
||||||
|
self.CallBackObj = InObj
|
||||||
|
end
|
||||||
|
|
||||||
|
return WB_Item_FXType
|
@ -5,16 +5,87 @@
|
|||||||
---@field ProgressBar_SlideMode UProgressBar
|
---@field ProgressBar_SlideMode UProgressBar
|
||||||
---@field SlideMode_Value UTextBlock
|
---@field SlideMode_Value UTextBlock
|
||||||
---@field Slider_SlideMode USlider
|
---@field Slider_SlideMode USlider
|
||||||
---@field TextBlock_Range UTextBlock
|
---@field TextBlock_Name UTextBlock
|
||||||
---@field Setting_PickUp_BP USetting_Pickup_UIBP_C
|
---@field Setting_PickUp_BP USetting_Pickup_UIBP_C
|
||||||
--Edit Below--
|
--Edit Below--
|
||||||
local WB_Item_Slide = { bInitDoOnce = false }
|
local WB_Item_Slide = {
|
||||||
|
bInitDoOnce = false;
|
||||||
|
Interval = 256.;
|
||||||
|
MinVal = 0;
|
||||||
|
MaxVal = 255
|
||||||
|
}
|
||||||
|
|
||||||
--[==[ Construct
|
|
||||||
function WB_Item_Slide:Construct()
|
function WB_Item_Slide:Construct()
|
||||||
|
self:LuaInit()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function WB_Item_Slide:LuaInit()
|
||||||
|
if self.bInitDoOnce then return ; end self.bInitDoOnce = true
|
||||||
|
WidgetLibrary.SliderOnValueChanged(self.Slider_SlideMode, self.UpdateVal, self)
|
||||||
|
WidgetLibrary.BindButtonClicked(self.Button_SlideMode_add, self.AddVal, self)
|
||||||
|
WidgetLibrary.BindButtonClicked(self.Button_SlideMode_minus, self.SubVal, self)
|
||||||
|
self.Slider_SlideMode:SetStepSize(1./self.Interval)
|
||||||
|
self:UpdateVal()
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:SetID(InID)
|
||||||
|
self.ID = InID
|
||||||
|
local NameList = {"R", "G", "B"}
|
||||||
|
local RGBColor = {
|
||||||
|
{R = 1, G = 0, B = 0, A = 1 },
|
||||||
|
{R = 0, G = 1, B = 0, A = 1 },
|
||||||
|
{R = 0, G = 0, B = 1, A = 1 },
|
||||||
|
}
|
||||||
|
if NameList[InID] then
|
||||||
|
self.TextBlock_Name:SetText(NameList[InID])
|
||||||
|
self.ProgressBar_SlideMode:SetFillColorAndOpacity(RGBColor[InID])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function WB_Item_Slide:GetVal()
|
||||||
|
return math.floor(math.clamp(KismetMathLibrary.Round(self.Slider_SlideMode:GetValue() * self.Interval + self.MinVal), self.MinVal, self.MaxVal) + 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:GetSlideVal()
|
||||||
|
return self.Slider_SlideMode:GetValue()
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:AddVal()
|
||||||
|
local TargetVal = math.clamp(self.Slider_SlideMode:GetValue() + 1./self.Interval, 0, 1)
|
||||||
|
self.Slider_SlideMode:SetValue(TargetVal)
|
||||||
|
self:UpdateVal()
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:SubVal()
|
||||||
|
local TargetVal = math.clamp(self.Slider_SlideMode:GetValue() - 1./self.Interval, 0, 1)
|
||||||
|
self.Slider_SlideMode:SetValue(TargetVal)
|
||||||
|
self:UpdateVal()
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:UpdateVal()
|
||||||
|
local Val = self:GetVal()
|
||||||
|
local SlideVal = self:GetSlideVal()
|
||||||
|
self.SlideMode_Value:SetText(Val)
|
||||||
|
self.ProgressBar_SlideMode:SetPercent(SlideVal)
|
||||||
|
self:CallBackNotify()
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:CallBackNotify()
|
||||||
|
if self.CallBackFunc then
|
||||||
|
if self.CallBackObj then
|
||||||
|
self.CallBackFunc(self.CallBackObj, self.ID, self:GetSlideVal())
|
||||||
|
else
|
||||||
|
self.CallBackFunc(self.ID, self:GetSlideVal())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_Item_Slide:BindValueCallBack(InFunc, InObj)
|
||||||
|
self.CallBackFunc = InFunc
|
||||||
|
self.CallBackObj = InObj
|
||||||
end
|
end
|
||||||
-- Construct ]==]
|
|
||||||
|
|
||||||
-- function WB_Item_Slide:Tick(MyGeometry, InDeltaTime)
|
-- function WB_Item_Slide:Tick(MyGeometry, InDeltaTime)
|
||||||
|
|
||||||
|
@ -1,24 +1,88 @@
|
|||||||
---@class WB_PreviewFX_C:UUserWidget
|
---@class WB_PreviewFX_C:UUserWidget
|
||||||
---@field Image_Color UImage
|
---@field Image_Color UImage
|
||||||
---@field NewButton_Close UNewButton
|
---@field NewButton_Close UNewButton
|
||||||
|
---@field VerticalBox_FXItemPanel UVerticalBox
|
||||||
---@field WB_Item_Slide_B UWB_Item_Slide_C
|
---@field WB_Item_Slide_B UWB_Item_Slide_C
|
||||||
---@field WB_Item_Slide_G UWB_Item_Slide_C
|
---@field WB_Item_Slide_G UWB_Item_Slide_C
|
||||||
---@field WB_Item_Slide_R UWB_Item_Slide_C
|
---@field WB_Item_Slide_R UWB_Item_Slide_C
|
||||||
--Edit Below--
|
--Edit Below--
|
||||||
local WB_PreviewFX = { bInitDoOnce = false }
|
local WB_PreviewFX = {
|
||||||
|
bInitDoOnce = false;
|
||||||
|
NowColor = {R = 1., G = 1., B = 1., A = 1.}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
--[==[ Construct
|
|
||||||
function WB_PreviewFX:Construct()
|
function WB_PreviewFX:Construct()
|
||||||
|
self:LuaInit()
|
||||||
end
|
end
|
||||||
-- Construct ]==]
|
|
||||||
|
|
||||||
-- function WB_PreviewFX:Tick(MyGeometry, InDeltaTime)
|
function WB_PreviewFX:LuaInit()
|
||||||
|
if self.bInitDoOnce then return ; end
|
||||||
|
|
||||||
-- end
|
WidgetLibrary.BindButtonClicked(self.NewButton_Close, self.CloseSelf, self)
|
||||||
|
|
||||||
|
local RGBSlide = {
|
||||||
|
self.WB_Item_Slide_R,
|
||||||
|
self.WB_Item_Slide_G,
|
||||||
|
self.WB_Item_Slide_B,
|
||||||
|
}
|
||||||
|
for i, v in pairs(RGBSlide) do
|
||||||
|
v:LuaInit()
|
||||||
|
v:SetID(i)
|
||||||
|
v:BindValueCallBack(self.UpdateColor, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1, self.VerticalBox_FXItemPanel:GetChildrenCount() do
|
||||||
|
local Item = self.VerticalBox_FXItemPanel:GetChildAt(i - 1)
|
||||||
|
if i <= table.getCount(EFXType) then
|
||||||
|
Item:SetType(i)
|
||||||
|
Item:BindLockCallBack(self.LockChange, self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_PreviewFX:CloseSelf()
|
||||||
|
self:SetVisibility(ESlateVisibility.Collapsed)
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_PreviewFX:UpdateColor(ColorID, Val)
|
||||||
|
UGCLogSystem.Log("[WB_PreviewFX_UpdateColor] ColorID:%s, Val:%s", tostring(ColorID), tostring(Val))
|
||||||
|
if ColorID == 1 then
|
||||||
|
self.NowColor.R = Val
|
||||||
|
elseif ColorID == 2 then
|
||||||
|
self.NowColor.G = Val
|
||||||
|
elseif ColorID == 3 then
|
||||||
|
self.NowColor.B = Val
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Image_Color:SetColorAndOpacity(self.NowColor)
|
||||||
|
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
for i = 1, self.VerticalBox_FXItemPanel:GetChildrenCount() do
|
||||||
|
local Item = self.VerticalBox_FXItemPanel:GetChildAt(i - 1)
|
||||||
|
if i <= table.getCount(EFXType) then
|
||||||
|
if Item:GetIsBindColor() then
|
||||||
|
UGCLogSystem.Log("[WB_PreviewFX_UpdateColor] i:%s", tostring(i))
|
||||||
|
TempPreViewActor:SetOverrideColor(i, self.NowColor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function WB_PreviewFX:LockChange(FXType, IsBind)
|
||||||
|
if IsBind then
|
||||||
|
local TempPreViewActor = UGCGameSystem.GameState:GetPreViewFXActor()
|
||||||
|
if UE.IsValid(TempPreViewActor) then
|
||||||
|
TempPreViewActor:SetOverrideColor(FXType, self.NowColor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- function WB_PreviewFX:Destruct()
|
|
||||||
|
|
||||||
-- end
|
|
||||||
|
|
||||||
return WB_PreviewFX
|
return WB_PreviewFX
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user