lua trace report
This commit is contained in:
parent
c0ef7cc758
commit
92014012cb
@ -92,3 +92,10 @@ ManualIPAddress=
|
||||
[CoreRedirects]
|
||||
+ClassRedirects=(OldName="/Script/zworld.UNameRegisterLibrary",NewName="/Script/zworld.NameRegisterLibrary")
|
||||
|
||||
[/Script/Sentry.SentrySettings]
|
||||
Dsn="https://9a2113114ebcbcc2d857b5918862b4a4@sentry-pan01.yingxiong.com/1"
|
||||
EnableAutoLogAttachment=False
|
||||
AttachStacktrace=False
|
||||
AttachGpuDump=False
|
||||
AutomaticBreadcrumbsForLogs=(bOnFatalLog=False,bOnErrorLog=False,bOnWarningLog=False,bOnInfoLog=False,bOnDebugLog=False)
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ UsePakFile=True
|
||||
bUseIoStore=True
|
||||
bUseZenStore=False
|
||||
bMakeBinaryConfig=False
|
||||
bGenerateChunks=False
|
||||
bGenerateChunks=True
|
||||
bGenerateNoChunks=False
|
||||
bChunkHardReferencesOnly=False
|
||||
bForceOneChunkPerFile=False
|
||||
|
||||
@ -29,7 +29,7 @@ BindKey(M, "Q", "Pressed", function(self, Key)
|
||||
local Rot = UE.FRotator(Pitch, Yaw, Roll)
|
||||
local Quat = UKismetMathLibrary.Conv_RotatorToQuaternion(Rot)
|
||||
local ToRot = UKismetMathLibrary.Quat_Rotator(Quat)
|
||||
self:PrintRot("Rot", Rot)
|
||||
self:PrintRot("Rot", Rot.test)
|
||||
self:PrintQuat("Quat", Quat)
|
||||
self:PrintRot("NewRot", ToRot)
|
||||
|
||||
|
||||
@ -33,5 +33,16 @@ function class:ReceiveTick(dt)
|
||||
gWorld:lateTick(dt)
|
||||
end
|
||||
end
|
||||
|
||||
function class:UploadLuaCallError(ErrorMsg)
|
||||
print("ouczbs::UploadLuaCallError", ErrorMsg)
|
||||
local EMSentrySubsystem = UE.USubsystemBlueprintLibrary.GetWorldSubsystem(self, UE.UEMSentrySubsystem)
|
||||
if EMSentrySubsystem then
|
||||
SceneId = 101
|
||||
SceneName = "Login"
|
||||
PlayerLocation = "10.2,20.30,40.30"
|
||||
EMSentrySubsystem:ReportLuaTrace(ErrorMsg, {
|
||||
SceneId = SceneId, SceneName = tostring(SceneName), Location = PlayerLocation
|
||||
})
|
||||
end
|
||||
end
|
||||
return class
|
||||
@ -18,7 +18,7 @@
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "Sentry",
|
||||
"Type": "CookedOnly",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default",
|
||||
"WhitelistPlatforms": [ "Win64", "Mac", "Android", "IOS", "Linux", "LinuxArm64" ]
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
public class zworldTarget : TargetRules
|
||||
{
|
||||
|
||||
@ -1,126 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#include "CrashActor.h"
|
||||
DEFINE_LOG_CATEGORY(LogCrash);
|
||||
// Sets default values
|
||||
ACrashActor::ACrashActor()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void ACrashActor::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
void TestCrash(int CrashFrame) {
|
||||
auto FN = [=]() {
|
||||
int* ptr = nullptr;
|
||||
*ptr = CrashFrame + 6;
|
||||
};
|
||||
FN();
|
||||
}
|
||||
ETestCrashType CrashNameToEnum(const FString& CrashName) {
|
||||
UEnum* CrashEnumPtr = nullptr;
|
||||
if (!CrashEnumPtr)
|
||||
{
|
||||
CrashEnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("ETestCrashType"), true);
|
||||
}
|
||||
|
||||
if (!CrashEnumPtr)
|
||||
{
|
||||
return ETestCrashType::NullPointer;
|
||||
}
|
||||
return static_cast<ETestCrashType>(CrashEnumPtr->GetValueByNameString(CrashName));
|
||||
}
|
||||
void CrashTest(FString CrashName) {
|
||||
ETestCrashType Type = CrashNameToEnum(CrashName);
|
||||
switch (Type)
|
||||
{
|
||||
case ETestCrashType::NullPointer:
|
||||
{
|
||||
volatile char* ptr = nullptr;
|
||||
*ptr += 1;
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::ArrayOutOfBounds:
|
||||
{
|
||||
TArray<int32> emptyArray;
|
||||
emptyArray[0] = 10;
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::BadFunctionPtr:
|
||||
{
|
||||
void(*funcPointer)() = nullptr;
|
||||
funcPointer();
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::IllegalAccess:
|
||||
{
|
||||
int* addrPtr = reinterpret_cast<int*>(0x12345678);
|
||||
*addrPtr = 10;
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::StackOverflow:
|
||||
{
|
||||
using CrashRecursiveFnType = void (*)(int counter);
|
||||
static CrashRecursiveFnType CrashFn;
|
||||
CrashFn = [](int counter)
|
||||
{
|
||||
volatile int data[1024]; // 每次递归分配额外栈空间加速溢出
|
||||
UE_LOG(LogTemp, Warning, TEXT("Depth: %d"), counter);
|
||||
CrashFn(data[0] + 1); // 无限递归
|
||||
};
|
||||
CrashFn(1);
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::CrashOOM:
|
||||
{
|
||||
// 持续分配内存直到崩溃
|
||||
TArray<void*> MemoryBlocks;
|
||||
while (true)
|
||||
{
|
||||
// 每次分配 100MB(调整数值适配测试环境)
|
||||
void* Block = FMemory::Malloc(100 * 1024 * 1024);
|
||||
if (!Block)
|
||||
{
|
||||
// 分配失败时主动崩溃或记录日志
|
||||
UE_LOG(LogTemp, Fatal, TEXT("OOM崩溃触发!"));
|
||||
break;
|
||||
}
|
||||
MemoryBlocks.Add(Block);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::Assert:
|
||||
{
|
||||
char* assertPtr = nullptr;
|
||||
check(assertPtr != nullptr);
|
||||
}
|
||||
break;
|
||||
case ETestCrashType::Ensure:
|
||||
{
|
||||
char* ensurePtr = nullptr;
|
||||
ensure(ensurePtr != nullptr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Uknown app termination type!"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Called every frame
|
||||
void ACrashActor::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
CrashFrame = 100;
|
||||
if (Frame++ >= CrashFrame) {
|
||||
UE_LOG(LogTemp, Error, TEXT("ACrashActor:BeforeCrash"));
|
||||
CrashTest("CrashOOM");
|
||||
//TestCrash(CrashFrame);
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "CrashActor.generated.h"
|
||||
UENUM()
|
||||
enum class ETestCrashType : uint8
|
||||
{
|
||||
NullPointer UMETA(DisplayName = "NullPointer"),
|
||||
ArrayOutOfBounds UMETA(DisplayName = "ArrayOutOfBounds"),
|
||||
BadFunctionPtr UMETA(DisplayName = "BadFunctionPtr"),
|
||||
IllegalAccess UMETA(DisplayName = "IllegalAccess"),
|
||||
StackOverflow UMETA(DisplayName = "StackOverflow"),
|
||||
CrashOOM UMETA(DisplayName = "CrashOOM"),
|
||||
Assert UMETA(DisplayName = "Assert"),
|
||||
Ensure UMETA(DisplayName = "Ensure")
|
||||
};
|
||||
UCLASS()
|
||||
class ZWORLD_API ACrashActor : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
ACrashActor();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
UPROPERTY()
|
||||
int Frame = 0;
|
||||
UPROPERTY()
|
||||
int CrashFrame = 666;
|
||||
};
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogCrash, Log, All);
|
||||
@ -1,73 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "FXComponent.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "NiagaraDataChannel.h"
|
||||
#include "NiagaraDataChannelHandler.h"
|
||||
#include "NiagaraDataChannel_Islands.h"
|
||||
#include "NameRegisterLibrary.h"
|
||||
#include "NiagaraDataChannelAccessor.h"
|
||||
// Sets default values for this component's properties
|
||||
UFXComponent::UFXComponent()
|
||||
{
|
||||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||
// off to improve performance if you don't need them.
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UFXComponent::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// ...
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called every frame
|
||||
void UFXComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
UObject* UFXComponent::PlayFX(UObject* FXAsset, USceneComponent* MeshComp, FName SocketName, FVector LocalOffset, FRotator LocalRotation, int32 DataChannelCount, FFXSpawnInfo SpawnInfo) {
|
||||
UObject* FXObject = nullptr;
|
||||
if (UNiagaraSystem* NiagaraAsset = Cast<UNiagaraSystem>(FXAsset))
|
||||
{
|
||||
FXObject = SpawnSystemAttached(NiagaraAsset, MeshComp, SocketName, LocalOffset, LocalRotation, SpawnInfo);
|
||||
}else if (UNiagaraDataChannelAsset* NDCAsset = Cast<UNiagaraDataChannelAsset>(FXAsset))
|
||||
{
|
||||
FNiagaraDataChannelSearchParameters SearchParams = (GetOwner()->GetActorLocation());
|
||||
FXObject = UNiagaraDataChannelLibrary::WriteToNiagaraDataChannel(this, NDCAsset, SearchParams, DataChannelCount,
|
||||
true, true, true, *GetOwner()->GetName());
|
||||
if (auto NDCWriter = Cast<UNiagaraDataChannelWriter>(FXObject))
|
||||
{
|
||||
NDCWriter->WritePosition(UNameRegisterLibrary::Name_Position, 0, LocalOffset);
|
||||
NDCWriter->WriteVector(UNameRegisterLibrary::Name_Rotation, 0, FVector(LocalRotation.Pitch, LocalRotation.Yaw, LocalRotation.Roll));
|
||||
NDCWriter->WriteQuat(UNameRegisterLibrary::Name_Quaternion, 0, LocalRotation.Quaternion());
|
||||
}
|
||||
}
|
||||
return FXObject;
|
||||
}
|
||||
|
||||
UNiagaraComponent* UFXComponent::SpawnSystemAttached(UNiagaraSystem* SystemTemplate,
|
||||
USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, FRotator Rotation, FFXSpawnInfo SpawnInfo)
|
||||
{
|
||||
UNiagaraComponent* FXObject = UNiagaraFunctionLibrary::SpawnSystemAttached(SystemTemplate, AttachToComponent, AttachPointName, Location, Rotation,
|
||||
SpawnInfo.LocationType, SpawnInfo.bAutoDestroy, SpawnInfo.bAutoActivate, SpawnInfo.PoolingMethod, SpawnInfo.bPreCullCheck);
|
||||
if (FXObject)
|
||||
{
|
||||
FXObject->SetTickBehavior(SpawnInfo.TickBehavior);
|
||||
}
|
||||
return FXObject;
|
||||
}
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "FXEnum.h"
|
||||
#include "FXComponent.generated.h"
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class ZWORLD_API UFXComponent : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UFXComponent();
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "FX Component")
|
||||
UObject* PlayFX(UObject* FXAsset, USceneComponent* MeshComp, FName SocketName, FVector LocalOffset, FRotator LocalRotation, int32 DataChannelCount, FFXSpawnInfo SpawnInfo);
|
||||
//void test(UNiagaraSystem* SystemTemplate, USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, FRotator Rotation, FFXSpawnInfo SpawnInfo) {};
|
||||
static UNiagaraComponent* SpawnSystemAttached(UNiagaraSystem* SystemTemplate, USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, FRotator Rotation, FFXSpawnInfo SpawnInfo);
|
||||
|
||||
};
|
||||
@ -1,74 +0,0 @@
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
#include "NiagaraComponentPoolMethodEnum.h"
|
||||
#include "NiagaraTickBehaviorEnum.h"
|
||||
#include "FXEnum.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EFXPriorityType : uint8
|
||||
{
|
||||
Low = 0,
|
||||
|
||||
Level_Low = 5,
|
||||
|
||||
DeadBorn = 10,
|
||||
|
||||
PhantomHit = 15,
|
||||
|
||||
PhantomBuff = 20,
|
||||
|
||||
PhantomSkill = 30,
|
||||
|
||||
PlayerHit = 40,
|
||||
|
||||
MonsterHit = 45,
|
||||
|
||||
Medium = 50,
|
||||
|
||||
Level_Medium = 55,
|
||||
|
||||
MonsterBuff = 60,
|
||||
|
||||
PlayerBuff = 70,
|
||||
|
||||
MonsterSkill = 80,
|
||||
|
||||
PlayerSkill = 90,
|
||||
|
||||
DropEffect = 97,
|
||||
|
||||
Level_High = 98,
|
||||
|
||||
High = 99,
|
||||
|
||||
Always = 100,
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FFXSpawnInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
EFXPriorityType PriorityType = EFXPriorityType::Low;
|
||||
UPROPERTY()
|
||||
TEnumAsByte<EAttachLocation::Type> LocationType = EAttachLocation::Type::KeepRelativeOffset;
|
||||
UPROPERTY()
|
||||
ENCPoolMethod PoolingMethod = ENCPoolMethod::None;
|
||||
UPROPERTY()
|
||||
bool bPreCullCheck = true;
|
||||
UPROPERTY()
|
||||
bool bFXPriorityBind = false;
|
||||
UPROPERTY()
|
||||
bool bIsDataChannel = false;
|
||||
UPROPERTY()
|
||||
bool bAutoDestroy = true;
|
||||
UPROPERTY()
|
||||
bool bAutoActivate = true;
|
||||
UPROPERTY()
|
||||
int EffectMaxNum = 0;
|
||||
UPROPERTY()
|
||||
float PlayFXCD = 0;
|
||||
UPROPERTY()
|
||||
ENiagaraTickBehavior TickBehavior = ENiagaraTickBehavior::UseComponentTickGroup;
|
||||
};
|
||||
@ -1,10 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "MMOGameInstance.h"
|
||||
|
||||
void UMMOGameInstance::OnStart()
|
||||
{
|
||||
Super::OnStart();
|
||||
OverrideInitGame();
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UnLuaInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "MMOGameInstance.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class ZWORLD_API UMMOGameInstance : public UGameInstance, public IUnLuaInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual FString GetModuleName_Implementation() const override
|
||||
{
|
||||
return TEXT("MMOGameInstance");
|
||||
}
|
||||
virtual void OnStart() override;
|
||||
public:
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Override C++")
|
||||
void OverrideInitGame();
|
||||
};
|
||||
@ -1,9 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "NameRegisterLibrary.h"
|
||||
|
||||
const FName UNameRegisterLibrary::Name_Position = FName("Position");
|
||||
const FName UNameRegisterLibrary::Name_Rotation = FName("Rotation");
|
||||
const FName UNameRegisterLibrary::Name_Quaternion = FName("Quaternion");
|
||||
const FName UNameRegisterLibrary::Name_Normal = FName("Normal");
|
||||
@ -1,24 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "NameRegisterLibrary.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class ZWORLD_API UNameRegisterLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
#pragma region 静态变量区
|
||||
public:
|
||||
const static FName Name_Position;
|
||||
const static FName Name_Rotation;
|
||||
const static FName Name_Quaternion;
|
||||
const static FName Name_Normal;
|
||||
#pragma endregion
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,289 +0,0 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UnLuaInterface.h"
|
||||
#include "Subsystems/WorldSubsystem.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "NiagaraArrayBatchSubsystem.generated.h"
|
||||
|
||||
class UNiagaraDataChannelHandler_Islands;
|
||||
class UNiagaraSystem;
|
||||
class UNiagaraComponent;
|
||||
|
||||
template<typename T>
|
||||
struct FNiagaraBatchData
|
||||
{
|
||||
FNiagaraBatchData(uint32 InDataUid, T InData)
|
||||
: DataUid(InDataUid)
|
||||
, Data(InData)
|
||||
{
|
||||
}
|
||||
|
||||
uint32 DataUid;
|
||||
T Data;
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ENiagaraBatchDataType : uint8
|
||||
{
|
||||
Vector,
|
||||
Float,
|
||||
Int32,
|
||||
Color,
|
||||
Quat,
|
||||
Bool,
|
||||
Vector2D,
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FNiagaraBatchProperty
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
ENiagaraBatchDataType Type;
|
||||
FName Name;
|
||||
};
|
||||
|
||||
struct FNiagaraArrayBatchData
|
||||
{
|
||||
friend class UNiagaraArrayBatchSubsystem;
|
||||
friend struct FNABParticleData;
|
||||
friend struct FNABIsland;
|
||||
|
||||
private:
|
||||
void ConsumeData();
|
||||
|
||||
private:
|
||||
TWeakObjectPtr<UNiagaraComponent> NiagaraComponent;
|
||||
|
||||
TMap<FName, TArray<FNiagaraBatchData<FVector>>> VectorData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<float>>> FloatData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<int32>>> IntData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<FLinearColor>>> ColorData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<FQuat>>> QuatData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<bool>>> BoolData;
|
||||
TMap<FName, TArray<FNiagaraBatchData<FVector2D>>> Vector2DData;
|
||||
|
||||
bool bDirty = false;
|
||||
};
|
||||
|
||||
USTRUCT()
|
||||
struct FNABIsland
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// UE_NONCOPYABLE(FNABIsland)
|
||||
|
||||
friend class UNiagaraArrayBatchSubsystem;
|
||||
|
||||
public:
|
||||
|
||||
FNABIsland() {};
|
||||
~FNABIsland();
|
||||
|
||||
void Init(const FVector& Extent);
|
||||
void Tick();
|
||||
|
||||
FORCEINLINE bool Contains(FVector Point) const
|
||||
{
|
||||
return Bounds.ComputeSquaredDistanceFromBoxToPoint(Point) <= 0.f;
|
||||
}
|
||||
|
||||
void OnAcquired(UObject* WorldContext, FVector Location);
|
||||
void OnReleased();
|
||||
bool IsBeingUsed() const;
|
||||
FORCEINLINE bool IsDirty() const
|
||||
{
|
||||
return Data.bDirty;
|
||||
}
|
||||
|
||||
private:
|
||||
/** Current bounds of this island. The bounds of any handler systems are modified to match these bounds. */
|
||||
UPROPERTY()
|
||||
FBoxSphereBounds Bounds = FBoxSphereBounds(EForceInit::ForceInit);
|
||||
|
||||
/** Niagara components spawned for this island. */
|
||||
UPROPERTY()
|
||||
TWeakObjectPtr<UNiagaraComponent> NiagaraComponent = nullptr;
|
||||
|
||||
UPROPERTY()
|
||||
UNiagaraSystem* NiagaraSystem = nullptr;
|
||||
|
||||
/** The underlying storage for this island. */
|
||||
FNiagaraArrayBatchData Data;
|
||||
|
||||
uint32 DataUid = 0;
|
||||
|
||||
TWeakObjectPtr<class UNiagaraArrayBatchSubsystem> Subsystem = nullptr;
|
||||
};
|
||||
|
||||
|
||||
USTRUCT()
|
||||
struct FNABIslandInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
void Tick(float DeltaTime);
|
||||
|
||||
/** All currently active Islands for this channel. */
|
||||
UPROPERTY()
|
||||
TArray<int32> ActiveIslands;
|
||||
|
||||
/** All currently free Islands for this channel. */
|
||||
UPROPERTY()
|
||||
TArray<int32> FreeIslands;
|
||||
|
||||
/** Pool of all islands. */
|
||||
UPROPERTY()
|
||||
TArray<FNABIsland> IslandPool;
|
||||
|
||||
UPROPERTY()
|
||||
FVector Extent = FVector(5000.f, 5000.f, 2000.f);
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FNABParticleData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
uint32 ParticleID;
|
||||
int32 IslandIndex;
|
||||
FNiagaraArrayBatchData* DataPtr;
|
||||
TArray<FNiagaraBatchProperty> Propertys;
|
||||
|
||||
public:
|
||||
FNABParticleData() : FNABParticleData(0)
|
||||
{
|
||||
}
|
||||
FNABParticleData(uint32 ParticleID) : ParticleID(ParticleID), IslandIndex(0), DataPtr(nullptr)
|
||||
{
|
||||
}
|
||||
FNABParticleData(uint32 ParticleID, int32 IslandIndex, FNiagaraArrayBatchData* DataPtr)
|
||||
: ParticleID(ParticleID), IslandIndex(IslandIndex), DataPtr(DataPtr)
|
||||
{
|
||||
}
|
||||
int64 GetUUID();
|
||||
TArray<FNiagaraBatchProperty>& GetPropertys();
|
||||
FNABParticleData& WriteVector(FName Name, const FVector& Value);
|
||||
FNABParticleData& WriteQuat(FName Name, const FQuat& Value);
|
||||
FNABParticleData& WriteColor(FName Name, const FLinearColor& Value);
|
||||
FNABParticleData& WriteInt(FName Name, int32 Value);
|
||||
FNABParticleData& WriteFloat(FName Name, float Value);
|
||||
FNABParticleData& WriteBool(FName Name, bool Value);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class ZWORLD_API UNiagaraArrayBatchSubsystem : public UTickableWorldSubsystem, public IUnLuaInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual FString GetModuleName_Implementation() const override
|
||||
{
|
||||
return TEXT("BluePrints.Managers.NiagaraArrayBatchSubsystem_C");
|
||||
}
|
||||
|
||||
virtual TStatId GetStatId() const override
|
||||
{
|
||||
RETURN_QUICK_DECLARE_CYCLE_STAT(UNiagaraArrayBatchSubsystem, STATGROUP_Tickables);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static const FName ParticleIDName;
|
||||
static const FName PositionParamName;
|
||||
static const FName RotationParamName;
|
||||
static const FName TextureParamName;
|
||||
static const FName ColorParamName;
|
||||
static const FName DeadTimeName;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FNABParticleData WriteNABParticle(UNiagaraSystem* NiagaraAsset, const FVector& Location);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveNABParticle(UNiagaraSystem* NiagaraAsset, int64 DataUid, const TArray<FNiagaraBatchProperty>& Propertys);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABVector(FNABParticleData& Data, FName Name, const FVector& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABQuat(FNABParticleData& Data, FName Name, const FQuat& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABColor(FNABParticleData& Data, FName Name, const FLinearColor& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABInt(FNABParticleData& Data, FName Name, int32 Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABFloat(FNABParticleData& Data, FName Name, float Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void WriteNABBool(FNABParticleData& Data, FName Name, bool Value);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteVector(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, const FVector& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteFloat(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, float Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteInt(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, int32 Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteColor(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, const FLinearColor& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteQuat(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, const FQuat& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteBool(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, bool Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int64 WriteVector2D(UNiagaraSystem* NiagaraAsset, const FVector& Location, FName Name, const FVector2D& Value);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideVector(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, const FVector& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideFloat(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, float Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideInt(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, int32 Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideColor(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, const FLinearColor& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideQuat(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, const FQuat& Value);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OverrideBool(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid, bool Value);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveVector(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveFloat(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveInt(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveColor(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveQuat(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveBool(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveVector2D(UNiagaraSystem* NiagaraAsset, FName Name, int64 DataUid);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetNiagaraHidden(const FString& NiagaraFullName, bool bHide, FName HideTag);
|
||||
|
||||
protected:
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
/** Gets the correct island for the given location. */
|
||||
FNABIsland* FindOrCreateIsland(UNiagaraSystem* NiagaraSystem, const FVector& Location, int32& IslandIndex);
|
||||
|
||||
/** Initializes and adds a new island to the ActiveIslands list. Either retrieving from the free pool of existing inactive islands or creating a new one. */
|
||||
int32 ActivateNewIsland(UNiagaraSystem* NiagaraSystem, FNABIslandInfo& FNABIslandInfo, FVector Location);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
TMap<FString, FVector> GetNiagaraIslandExtents();
|
||||
|
||||
|
||||
protected:
|
||||
UPROPERTY()
|
||||
TMap<TWeakObjectPtr<UNiagaraSystem>, FNABIslandInfo> NiagaraIslandInfoMap;
|
||||
|
||||
UPROPERTY()
|
||||
TMap<FString, FVector> NiagaraIslandExtentsMap;
|
||||
|
||||
bool bLoadedIslandExtents = false;
|
||||
};
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using System.IO;
|
||||
using UnrealBuildTool;
|
||||
using UnrealBuildTool.Rules;
|
||||
|
||||
public class zworld : ModuleRules
|
||||
{
|
||||
@ -9,9 +11,9 @@ public class zworld : ModuleRules
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput"
|
||||
,"Niagara"});
|
||||
,"Niagara", "Json", "JsonUtilities"});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "UnLua", "Sentry" });
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "Lua", "UnLua", "Sentry" });
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
@ -20,5 +22,23 @@ public class zworld : ModuleRules
|
||||
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||
|
||||
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||
// 添加 Android UPL 配置
|
||||
if (Target.Platform == UnrealTargetPlatform.Android)
|
||||
{
|
||||
// 指定UPL文件路径
|
||||
string PluginPath = Path.Combine(ModuleDirectory, "DeepLink_APL.xml");
|
||||
AdditionalPropertiesForReceipt.Add("AndroidPlugin", PluginPath);
|
||||
}
|
||||
|
||||
if (Target.Platform == UnrealTargetPlatform.Win64 ||
|
||||
Target.Platform == UnrealTargetPlatform.Android ||
|
||||
Target.Platform == UnrealTargetPlatform.IOS)
|
||||
{
|
||||
PublicDefinitions.Add(string.Format("{0}={1}", "WITH_SENTRY", 1));
|
||||
PublicDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Sentry"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "zworld.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, zworld, "zworld" );
|
||||
@ -1,6 +0,0 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
@ -7,7 +7,10 @@
|
||||
{
|
||||
"Name": "zworld",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default"
|
||||
"LoadingPhase": "Default",
|
||||
"AdditionalDependencies": [
|
||||
"Engine"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
@ -17,8 +20,7 @@
|
||||
"TargetAllowList": [
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
,
|
||||
},
|
||||
{
|
||||
"Name": "Sentry",
|
||||
"Enabled": true,
|
||||
@ -28,7 +30,7 @@
|
||||
"Android",
|
||||
"IOS"
|
||||
],
|
||||
"BlacklistPlatforms": [
|
||||
"PlatformDenyList": [
|
||||
"Linux"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user