搬了lyra的hudlayout

This commit is contained in:
2023-08-28 03:38:23 +08:00
parent b9666b7fe7
commit c90b2d2956
343 changed files with 10665 additions and 2 deletions

View File

@@ -0,0 +1,54 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO; // for Path
public class ModularGameplayActors : ModuleRules
{
public ModularGameplayActors(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"ModularGameplay",
"AIModule",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}

View File

@@ -0,0 +1,27 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularAIController.h"
#include "Components/GameFrameworkComponentManager.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularAIController)
void AModularAIController::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularAIController::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularAIController::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}

View File

@@ -0,0 +1,28 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularCharacter.h"
#include "Components/GameFrameworkComponentManager.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularCharacter)
void AModularCharacter::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularCharacter::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}

View File

@@ -0,0 +1,29 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularGameMode.h"
#include "ModularGameState.h"
#include "ModularPawn.h"
#include "ModularPlayerController.h"
#include "ModularPlayerState.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularGameMode)
AModularGameModeBase::AModularGameModeBase(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
GameStateClass = AModularGameStateBase::StaticClass();
PlayerControllerClass = AModularPlayerController::StaticClass();
PlayerStateClass = AModularPlayerState::StaticClass();
DefaultPawnClass = AModularPawn::StaticClass();
}
AModularGameMode::AModularGameMode(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
GameStateClass = AModularGameState::StaticClass();
PlayerControllerClass = AModularPlayerController::StaticClass();
PlayerStateClass = AModularPlayerState::StaticClass();
DefaultPawnClass = AModularPawn::StaticClass();
}

View File

@@ -0,0 +1,64 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularGameState.h"
#include "Components/GameFrameworkComponentManager.h"
#include "Components/GameStateComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularGameState)
void AModularGameStateBase::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularGameStateBase::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularGameStateBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}
void AModularGameState::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularGameState::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularGameState::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}
void AModularGameState::HandleMatchHasStarted()
{
Super::HandleMatchHasStarted();
TArray<UGameStateComponent*> ModularComponents;
GetComponents(ModularComponents);
for (UGameStateComponent* Component : ModularComponents)
{
Component->HandleMatchHasStarted();
}
}

View File

@@ -0,0 +1,5 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Modules/ModuleManager.h"
IMPLEMENT_MODULE(FDefaultModuleImpl, ModularGameplayActors);

View File

@@ -0,0 +1,27 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularPawn.h"
#include "Components/GameFrameworkComponentManager.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularPawn)
void AModularPawn::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularPawn::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}

View File

@@ -0,0 +1,49 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularPlayerController.h"
#include "Components/ControllerComponent.h"
#include "Components/GameFrameworkComponentManager.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularPlayerController)
void AModularPlayerController::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularPlayerController::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}
void AModularPlayerController::ReceivedPlayer()
{
// Player controllers always get assigned a player and can't do much until then
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::ReceivedPlayer();
TArray<UControllerComponent*> ModularComponents;
GetComponents(ModularComponents);
for (UControllerComponent* Component : ModularComponents)
{
Component->ReceivedPlayer();
}
}
void AModularPlayerController::PlayerTick(float DeltaTime)
{
Super::PlayerTick(DeltaTime);
TArray<UControllerComponent*> ModularComponents;
GetComponents(ModularComponents);
for (UControllerComponent* Component : ModularComponents)
{
Component->PlayerTick(DeltaTime);
}
}

View File

@@ -0,0 +1,56 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModularPlayerState.h"
#include "Components/GameFrameworkComponentManager.h"
#include "Components/PlayerStateComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ModularPlayerState)
void AModularPlayerState::PreInitializeComponents()
{
Super::PreInitializeComponents();
UGameFrameworkComponentManager::AddGameFrameworkComponentReceiver(this);
}
void AModularPlayerState::BeginPlay()
{
UGameFrameworkComponentManager::SendGameFrameworkComponentExtensionEvent(this, UGameFrameworkComponentManager::NAME_GameActorReady);
Super::BeginPlay();
}
void AModularPlayerState::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
UGameFrameworkComponentManager::RemoveGameFrameworkComponentReceiver(this);
Super::EndPlay(EndPlayReason);
}
void AModularPlayerState::Reset()
{
Super::Reset();
TArray<UPlayerStateComponent*> ModularComponents;
GetComponents(ModularComponents);
for (UPlayerStateComponent* Component : ModularComponents)
{
Component->Reset();
}
}
void AModularPlayerState::CopyProperties(APlayerState* PlayerState)
{
Super::CopyProperties(PlayerState);
TInlineComponentArray<UPlayerStateComponent*> PlayerStateComponents;
GetComponents(PlayerStateComponents);
for (UPlayerStateComponent* SourcePSComp : PlayerStateComponents)
{
if (UPlayerStateComponent* TargetComp = Cast<UPlayerStateComponent>(static_cast<UObject*>(FindObjectWithOuter(PlayerState, SourcePSComp->GetClass(), SourcePSComp->GetFName()))))
{
SourcePSComp->CopyProperties(TargetComp);
}
}
}

View File

@@ -0,0 +1,23 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AIController.h"
#include "ModularAIController.generated.h"
class UObject;
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularAIController : public AAIController
{
GENERATED_BODY()
public:
//~ Begin AActor Interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor Interface
};

View File

@@ -0,0 +1,23 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Character.h"
#include "ModularCharacter.generated.h"
class UObject;
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularCharacter : public ACharacter
{
GENERATED_BODY()
public:
//~ Begin AActor Interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor Interface
};

View File

@@ -0,0 +1,29 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/GameMode.h"
#include "ModularGameMode.generated.h"
class UObject;
/** Pair this with a ModularGameStateBase */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularGameModeBase : public AGameModeBase
{
GENERATED_BODY()
public:
AModularGameModeBase(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
};
/** Pair this with a ModularGameState */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularGameMode : public AGameMode
{
GENERATED_BODY()
public:
AModularGameMode(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
};

View File

@@ -0,0 +1,43 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/GameState.h"
#include "ModularGameState.generated.h"
class UObject;
/** Pair this with a ModularGameModeBase */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularGameStateBase : public AGameStateBase
{
GENERATED_BODY()
public:
//~ Begin AActor interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor interface
};
/** Pair this with a ModularGameState */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularGameState : public AGameState
{
GENERATED_BODY()
public:
//~ Begin AActor interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor interface
protected:
//~ Begin AGameState interface
virtual void HandleMatchHasStarted() override;
//~ Begin AGameState interface
};

View File

@@ -0,0 +1,24 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Pawn.h"
#include "ModularPawn.generated.h"
class UObject;
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularPawn : public APawn
{
GENERATED_BODY()
public:
//~ Begin AActor interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor interface
};

View File

@@ -0,0 +1,27 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/PlayerController.h"
#include "ModularPlayerController.generated.h"
class UObject;
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularPlayerController : public APlayerController
{
GENERATED_BODY()
public:
//~ Begin AActor interface
virtual void PreInitializeComponents() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~ End AActor interface
//~ Begin APlayerController interface
virtual void ReceivedPlayer() override;
virtual void PlayerTick(float DeltaTime) override;
//~ End APlayerController interface
};

View File

@@ -0,0 +1,31 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/PlayerState.h"
#include "ModularPlayerState.generated.h"
namespace EEndPlayReason { enum Type : int; }
class UObject;
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class MODULARGAMEPLAYACTORS_API AModularPlayerState : public APlayerState
{
GENERATED_BODY()
public:
//~ Begin AActor interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void Reset() override;
//~ End AActor interface
protected:
//~ Begin APlayerState interface
virtual void CopyProperties(APlayerState* PlayerState);
//~ End APlayerState interface
};