59. Message Widget

This commit is contained in:
Edward R. Gonzalez 2024-04-26 21:36:09 -04:00
parent 22385f63bb
commit ed6dbf89e9
7 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,6 @@
{
"ColumnWidths":
{
"TextStyle": 1099
}
}

View File

@ -14,11 +14,14 @@ using namespace Gasa;
void UGasaAbilitySystemComp::OnAbilityActorInfoSet() void UGasaAbilitySystemComp::OnAbilityActorInfoSet()
{ {
if ( ! OnGameplayEffectAppliedDelegateToSelf.IsBoundToObject(this))
OnGameplayEffectAppliedDelegateToSelf.AddUObject(this, & ThisClass::EffectApplied);
} }
void UGasaAbilitySystemComp::EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec, void UGasaAbilitySystemComp::EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec,
FActiveGameplayEffectHandle ActiveEffect) FActiveGameplayEffectHandle ActiveEffect)
{ {
Log("EFFECT APPLIED?");
FGameplayTagContainer Tags; FGameplayTagContainer Tags;
Spec.GetAllAssetTags(Tags); Spec.GetAllAssetTags(Tags);
Event_OnEffectAppliedAssetTags.Broadcast(Tags); Event_OnEffectAppliedAssetTags.Broadcast(Tags);
@ -27,6 +30,4 @@ void UGasaAbilitySystemComp::EffectApplied(UAbilitySystemComponent* AbilitySyste
void UGasaAbilitySystemComp::InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor) void UGasaAbilitySystemComp::InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor)
{ {
Super::InitAbilityActorInfo(InOwnerActor, InAvatarActor); Super::InitAbilityActorInfo(InOwnerActor, InAvatarActor);
OnGameplayEffectAppliedDelegateToSelf.AddUObject(this, & ThisClass::EffectApplied);
} }

View File

@ -17,7 +17,6 @@ public:
FEffectAssetTagsSig Event_OnEffectAppliedAssetTags; FEffectAssetTagsSig Event_OnEffectAppliedAssetTags;
// TODO(Ed): If hes only using this to bind the EffectApplied to a delegate, then just use the init override instead.
void OnAbilityActorInfoSet(); void OnAbilityActorInfoSet();
void EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec, FActiveGameplayEffectHandle ActiveEffect); void EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec, FActiveGameplayEffectHandle ActiveEffect);
@ -25,4 +24,4 @@ public:
#pragma region AbilitySystemComponent #pragma region AbilitySystemComponent
void InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor) override; void InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor) override;
#pragma endregion AbilitySystemComponent #pragma endregion AbilitySystemComponent
}; };

View File

@ -158,7 +158,9 @@ void AGasaCharacter::PossessedBy(AController* NewController)
#if 0 #if 0
if (bAutoAbilitySystem) if (bAutoAbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this); AbilitySystem->InitAbilityActorInfo(this, this);
}
#endif #endif
} }
@ -181,7 +183,10 @@ void AGasaCharacter::BeginPlay()
// TODO(Ed): Find out if this is the best spot todo this // TODO(Ed): Find out if this is the best spot todo this
// There is also OnPossessed, PostInitializeComponents, etc... // There is also OnPossessed, PostInitializeComponents, etc...
if (bAutoAbilitySystem) if (bAutoAbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this); AbilitySystem->InitAbilityActorInfo(this, this);
Cast<UGasaAbilitySystemComp>(AbilitySystem)->OnAbilityActorInfoSet();
}
} }
void AGasaCharacter::Tick(float DeltaSeconds) void AGasaCharacter::Tick(float DeltaSeconds)

View File

@ -232,8 +232,7 @@ void AGasaGameMode::HandleSeamlessTravelPlayer(AController*& Controller)
void AGasaGameMode::InitializeHUDForPlayer_Implementation(APlayerController* NewPlayer) void AGasaGameMode::InitializeHUDForPlayer_Implementation(APlayerController* NewPlayer)
{ {
// Super::InitializeHUDForPlayer_Implementation(NewPlayer); Super::InitializeHUDForPlayer_Implementation(NewPlayer);
NewPlayer->ClientSetHUD(HUDClass);
} }
void AGasaGameMode::InitSeamlessTravelPlayer(AController* NewController) void AGasaGameMode::InitSeamlessTravelPlayer(AController* NewController)

View File

@ -19,6 +19,7 @@
#include "GasaGameInstance.h" #include "GasaGameInstance.h"
#include "GasaGameState.h" #include "GasaGameState.h"
#include "GasaPlayerState.h" #include "GasaPlayerState.h"
#include "AbilitySystem/GasaAbilitySystemComponent.h"
#include "Actors/CameraMount.h" #include "Actors/CameraMount.h"
#include "UI/GasaHUD.h" #include "UI/GasaHUD.h"
#include "UI/WidgetController.h" #include "UI/WidgetController.h"
@ -75,7 +76,8 @@ void AGasaPlayerController::NetOwner_OnReady()
{ {
PlayerChar->AbilitySystem = PS->AbilitySystem; PlayerChar->AbilitySystem = PS->AbilitySystem;
PlayerChar->Attributes = PS->Attributes; PlayerChar->Attributes = PS->Attributes;
PlayerChar->AbilitySystem->InitAbilityActorInfo(PS, this); PS->AbilitySystem->InitAbilityActorInfo(PS, PlayerChar);
Cast<UGasaAbilitySystemComp>(PS->AbilitySystem)->OnAbilityActorInfoSet();
} }
Cam->AttachToActor(PlayerChar, FAttachmentTransformRules::KeepRelativeTransform); Cam->AttachToActor(PlayerChar, FAttachmentTransformRules::KeepRelativeTransform);
} }

View File

@ -14,8 +14,6 @@ void AGasaHUD::InitHostWidget(FWidgetControllerData const* WidgetControllerData)
HostWidgetController = NewObject<UHostWidgetController>(this, GetDevOptions()->Template_HostWidgetController.Get()); HostWidgetController = NewObject<UHostWidgetController>(this, GetDevOptions()->Template_HostWidgetController.Get());
HostWidgetController->Data = (* WidgetControllerData); HostWidgetController->Data = (* WidgetControllerData);
HostWidget->SetWidgetController(HostWidgetController); HostWidget->SetWidgetController(HostWidgetController);
HostWidgetController->BindCallbacksToDependencies();
HostWidgetController->BroadcastInitialValues(); HostWidgetController->BroadcastInitialValues();
HostWidget->AddToViewport(); HostWidget->AddToViewport();
} }