Compare commits
3 Commits
80035ce1e5
...
bcd45e95ac
Author | SHA1 | Date | |
---|---|---|---|
bcd45e95ac | |||
87ad06c460 | |||
5f0631e4e9 |
BIN
Content/Blueprints/Game/BP_AuraGM.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Game/BP_AuraGM.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/UI/HUD/BP_AuraHUD.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/UI/HUD/BP_AuraHUD.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/UI/Overlay/WBP_Overlay.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/UI/Overlay/WBP_Overlay.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/UI/ProgressBar/WBP_GlobeProgressBar.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/UI/ProgressBar/WBP_GlobeProgressBar.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/UI/ProgressBar/WBP_HealthGlobe.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/UI/ProgressBar/WBP_HealthGlobe.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/UI/ProgressBar/WBP_ManaGlow.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/UI/ProgressBar/WBP_ManaGlow.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -7,7 +7,9 @@
|
|||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "GameFramework/SpringArmComponent.h"
|
#include "GameFramework/SpringArmComponent.h"
|
||||||
|
#include "Player/AuraPlayerController.h"
|
||||||
#include "Player/AuraPlayerState.h"
|
#include "Player/AuraPlayerState.h"
|
||||||
|
#include "UI/HUD/AuraHUD.h"
|
||||||
|
|
||||||
AAuraCharacter::AAuraCharacter()
|
AAuraCharacter::AAuraCharacter()
|
||||||
{
|
{
|
||||||
@ -36,6 +38,8 @@ void AAuraCharacter::PossessedBy(AController* NewController)
|
|||||||
|
|
||||||
// Init ability actor info for the Server
|
// Init ability actor info for the Server
|
||||||
InitAbilityActorInfo();
|
InitAbilityActorInfo();
|
||||||
|
|
||||||
|
InitHUD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAuraCharacter::OnRep_PlayerState()
|
void AAuraCharacter::OnRep_PlayerState()
|
||||||
@ -44,6 +48,8 @@ void AAuraCharacter::OnRep_PlayerState()
|
|||||||
|
|
||||||
// Init ability actor info for the Client
|
// Init ability actor info for the Client
|
||||||
InitAbilityActorInfo();
|
InitAbilityActorInfo();
|
||||||
|
|
||||||
|
InitHUD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAuraCharacter::InitAbilityActorInfo()
|
void AAuraCharacter::InitAbilityActorInfo()
|
||||||
@ -55,3 +61,13 @@ void AAuraCharacter::InitAbilityActorInfo()
|
|||||||
AttributeSet = AuraPlayerState->GetAttributeSet();
|
AttributeSet = AuraPlayerState->GetAttributeSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AAuraCharacter::InitHUD() const
|
||||||
|
{
|
||||||
|
const auto AuraPlayerState = GetPlayerState<AAuraPlayerState>();
|
||||||
|
check(AuraPlayerState);
|
||||||
|
|
||||||
|
if(const auto AuraPlayerController = Cast<AAuraPlayerController>(GetController()))
|
||||||
|
if(const auto HUD = Cast<AAuraHUD>(AuraPlayerController->GetHUD()))
|
||||||
|
HUD->InitOverlay(AuraPlayerController, AuraPlayerState, AbilitySystemComponent, AttributeSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -23,9 +23,8 @@ void AAuraPlayerController::BeginPlay()
|
|||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
check(AuraContext);
|
check(AuraContext);
|
||||||
|
|
||||||
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
if(UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
||||||
check(Subsystem);
|
Subsystem->AddMappingContext(AuraContext, 0);
|
||||||
Subsystem->AddMappingContext(AuraContext, 0);
|
|
||||||
|
|
||||||
bShowMouseCursor = true;
|
bShowMouseCursor = true;
|
||||||
DefaultMouseCursor = EMouseCursor::Default;
|
DefaultMouseCursor = EMouseCursor::Default;
|
||||||
|
35
Source/Aura/Private/UI/HUD/AuraHUD.cpp
Normal file
35
Source/Aura/Private/UI/HUD/AuraHUD.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/HUD/AuraHUD.h"
|
||||||
|
|
||||||
|
#include "UI/Widget/AuraUserWidget.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "UI/WidgetController/OverlayWidgetController.h"
|
||||||
|
|
||||||
|
UOverlayWidgetController* AAuraHUD::GetOverlayWidgetController(const FWidgetControllerParams& WCParams)
|
||||||
|
{
|
||||||
|
if (OverlayWidgetController != nullptr) return OverlayWidgetController;
|
||||||
|
|
||||||
|
OverlayWidgetController = NewObject<UOverlayWidgetController>(this, OverlayWidgetControllerClass);
|
||||||
|
OverlayWidgetController->SetWidgetControllerParams(WCParams);
|
||||||
|
|
||||||
|
return OverlayWidgetController;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AAuraHUD::InitOverlay(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS)
|
||||||
|
{
|
||||||
|
checkf(OverlayWidgetClass, TEXT("Overlay Widget Class uninitialized, please fill out BP_AuraHUD"))
|
||||||
|
checkf(OverlayWidgetControllerClass, TEXT("Overlay Widget Controller Class uninitialized, please fill out BP_AuraHUD"))
|
||||||
|
|
||||||
|
UUserWidget* Widget = CreateWidget<UUserWidget>(GetWorld(), OverlayWidgetClass);
|
||||||
|
OverlayWidget = Cast<UAuraUserWidget>(Widget);
|
||||||
|
|
||||||
|
const FWidgetControllerParams WidgetControllerParams(PC, PS, ASC, AS);
|
||||||
|
const auto WidgetController = GetOverlayWidgetController(WidgetControllerParams);
|
||||||
|
|
||||||
|
OverlayWidget->SetWidgetController(WidgetController);
|
||||||
|
|
||||||
|
Widget->AddToViewport();
|
||||||
|
}
|
||||||
|
|
@ -3,3 +3,10 @@
|
|||||||
|
|
||||||
#include "UI/WidgetController/AuraWidgetController.h"
|
#include "UI/WidgetController/AuraWidgetController.h"
|
||||||
|
|
||||||
|
void UAuraWidgetController::SetWidgetControllerParams(const FWidgetControllerParams& Params)
|
||||||
|
{
|
||||||
|
PlayerController = Params.PlayerController;
|
||||||
|
PlayerState = Params.PlayerState;
|
||||||
|
AbilitySystemComponent = Params.AbilitySystemComponent;
|
||||||
|
AttributeSet = Params.AttributeSet;
|
||||||
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/WidgetController/OverlayWidgetController.h"
|
||||||
|
|
@ -31,4 +31,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void InitAbilityActorInfo();
|
void InitAbilityActorInfo();
|
||||||
|
|
||||||
|
void InitHUD() const;
|
||||||
};
|
};
|
||||||
|
39
Source/Aura/Public/UI/HUD/AuraHUD.h
Normal file
39
Source/Aura/Public/UI/HUD/AuraHUD.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/HUD.h"
|
||||||
|
#include "AuraHUD.generated.h"
|
||||||
|
|
||||||
|
class UAttributeSet;
|
||||||
|
class UAbilitySystemComponent;
|
||||||
|
struct FWidgetControllerParams;
|
||||||
|
class UOverlayWidgetController;
|
||||||
|
class UAuraUserWidget;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class AURA_API AAuraHUD : public AHUD
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAuraUserWidget> OverlayWidget;
|
||||||
|
|
||||||
|
UOverlayWidgetController* GetOverlayWidgetController(const FWidgetControllerParams& WCParams);
|
||||||
|
|
||||||
|
void InitOverlay(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
TSubclassOf<UAuraUserWidget> OverlayWidgetClass;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UOverlayWidgetController> OverlayWidgetController;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
TSubclassOf<UOverlayWidgetController> OverlayWidgetControllerClass;
|
||||||
|
};
|
@ -3,11 +3,36 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "AbilitySystemComponent.h"
|
||||||
#include "UObject/NoExportTypes.h"
|
#include "UObject/NoExportTypes.h"
|
||||||
#include "AuraWidgetController.generated.h"
|
#include "AuraWidgetController.generated.h"
|
||||||
|
|
||||||
class UAttributeSet;
|
class UAttributeSet;
|
||||||
class UAbilitySystemComponent;
|
class UAbilitySystemComponent;
|
||||||
|
|
||||||
|
USTRUCT(BlueprintType)
|
||||||
|
struct FWidgetControllerParams
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
FWidgetControllerParams() {}
|
||||||
|
FWidgetControllerParams(APlayerController* PC, APlayerState* PS, UAbilitySystemComponent* ASC, UAttributeSet* AS)
|
||||||
|
: PlayerController(PC), PlayerState(PS), AbilitySystemComponent(ASC), AttributeSet(AS)
|
||||||
|
{}
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
TObjectPtr<APlayerController> PlayerController = nullptr;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
TObjectPtr<APlayerState> PlayerState = nullptr;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent = nullptr;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
TObjectPtr<UAttributeSet> AttributeSet = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -16,6 +41,10 @@ class AURA_API UAuraWidgetController : public UObject
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void SetWidgetControllerParams(const FWidgetControllerParams& Params);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
|
UPROPERTY(BlueprintReadOnly, Category="WidgetController")
|
||||||
TObjectPtr<APlayerController> PlayerController;
|
TObjectPtr<APlayerController> PlayerController;
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "UI/WidgetController/AuraWidgetController.h"
|
||||||
|
#include "OverlayWidgetController.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class AURA_API UOverlayWidgetController : public UAuraWidgetController
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
Reference in New Issue
Block a user