From ed6dbf89e92d8c90dbb4778b16a79a4a4797cfdd Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 26 Apr 2024 21:36:09 -0400 Subject: [PATCH] 59. Message Widget --- .../DataTableEditorLayout/DT_StyleText_Defaults.json | 6 ++++++ .../Gasa/AbilitySystem/GasaAbilitySystemComponent.cpp | 5 +++-- .../Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.h | 3 +-- Project/Source/Gasa/Characters/GasaCharacter.cpp | 5 +++++ Project/Source/Gasa/Game/GasaGameMode.cpp | 3 +-- Project/Source/Gasa/Game/GasaPlayerController.cpp | 4 +++- Project/Source/Gasa/UI/GasaHUD.cpp | 2 -- 7 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 Project/Saved/AssetData/DataTableEditorLayout/DT_StyleText_Defaults.json diff --git a/Project/Saved/AssetData/DataTableEditorLayout/DT_StyleText_Defaults.json b/Project/Saved/AssetData/DataTableEditorLayout/DT_StyleText_Defaults.json new file mode 100644 index 0000000..bce1518 --- /dev/null +++ b/Project/Saved/AssetData/DataTableEditorLayout/DT_StyleText_Defaults.json @@ -0,0 +1,6 @@ +{ + "ColumnWidths": + { + "TextStyle": 1099 + } +} \ No newline at end of file diff --git a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.cpp b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.cpp index 5390b4e..e9b9165 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.cpp +++ b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.cpp @@ -14,11 +14,14 @@ using namespace Gasa; void UGasaAbilitySystemComp::OnAbilityActorInfoSet() { + if ( ! OnGameplayEffectAppliedDelegateToSelf.IsBoundToObject(this)) + OnGameplayEffectAppliedDelegateToSelf.AddUObject(this, & ThisClass::EffectApplied); } void UGasaAbilitySystemComp::EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec, FActiveGameplayEffectHandle ActiveEffect) { + Log("EFFECT APPLIED?"); FGameplayTagContainer Tags; Spec.GetAllAssetTags(Tags); Event_OnEffectAppliedAssetTags.Broadcast(Tags); @@ -27,6 +30,4 @@ void UGasaAbilitySystemComp::EffectApplied(UAbilitySystemComponent* AbilitySyste void UGasaAbilitySystemComp::InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor) { Super::InitAbilityActorInfo(InOwnerActor, InAvatarActor); - - OnGameplayEffectAppliedDelegateToSelf.AddUObject(this, & ThisClass::EffectApplied); } diff --git a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.h b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.h index a258758..b6cf1ae 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.h +++ b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystemComponent.h @@ -17,7 +17,6 @@ public: 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 EffectApplied(UAbilitySystemComponent* AbilitySystem, FGameplayEffectSpec const& Spec, FActiveGameplayEffectHandle ActiveEffect); @@ -25,4 +24,4 @@ public: #pragma region AbilitySystemComponent void InitAbilityActorInfo(AActor* InOwnerActor, AActor* InAvatarActor) override; #pragma endregion AbilitySystemComponent -}; +}; \ No newline at end of file diff --git a/Project/Source/Gasa/Characters/GasaCharacter.cpp b/Project/Source/Gasa/Characters/GasaCharacter.cpp index 05c1ef2..d0cd676 100644 --- a/Project/Source/Gasa/Characters/GasaCharacter.cpp +++ b/Project/Source/Gasa/Characters/GasaCharacter.cpp @@ -158,7 +158,9 @@ void AGasaCharacter::PossessedBy(AController* NewController) #if 0 if (bAutoAbilitySystem) + { AbilitySystem->InitAbilityActorInfo(this, this); + } #endif } @@ -181,7 +183,10 @@ void AGasaCharacter::BeginPlay() // TODO(Ed): Find out if this is the best spot todo this // There is also OnPossessed, PostInitializeComponents, etc... if (bAutoAbilitySystem) + { AbilitySystem->InitAbilityActorInfo(this, this); + Cast(AbilitySystem)->OnAbilityActorInfoSet(); + } } void AGasaCharacter::Tick(float DeltaSeconds) diff --git a/Project/Source/Gasa/Game/GasaGameMode.cpp b/Project/Source/Gasa/Game/GasaGameMode.cpp index 26f5c75..0f516cd 100644 --- a/Project/Source/Gasa/Game/GasaGameMode.cpp +++ b/Project/Source/Gasa/Game/GasaGameMode.cpp @@ -232,8 +232,7 @@ void AGasaGameMode::HandleSeamlessTravelPlayer(AController*& Controller) void AGasaGameMode::InitializeHUDForPlayer_Implementation(APlayerController* NewPlayer) { - // Super::InitializeHUDForPlayer_Implementation(NewPlayer); - NewPlayer->ClientSetHUD(HUDClass); + Super::InitializeHUDForPlayer_Implementation(NewPlayer); } void AGasaGameMode::InitSeamlessTravelPlayer(AController* NewController) diff --git a/Project/Source/Gasa/Game/GasaPlayerController.cpp b/Project/Source/Gasa/Game/GasaPlayerController.cpp index a961b00..f82e224 100644 --- a/Project/Source/Gasa/Game/GasaPlayerController.cpp +++ b/Project/Source/Gasa/Game/GasaPlayerController.cpp @@ -19,6 +19,7 @@ #include "GasaGameInstance.h" #include "GasaGameState.h" #include "GasaPlayerState.h" +#include "AbilitySystem/GasaAbilitySystemComponent.h" #include "Actors/CameraMount.h" #include "UI/GasaHUD.h" #include "UI/WidgetController.h" @@ -75,7 +76,8 @@ void AGasaPlayerController::NetOwner_OnReady() { PlayerChar->AbilitySystem = PS->AbilitySystem; PlayerChar->Attributes = PS->Attributes; - PlayerChar->AbilitySystem->InitAbilityActorInfo(PS, this); + PS->AbilitySystem->InitAbilityActorInfo(PS, PlayerChar); + Cast(PS->AbilitySystem)->OnAbilityActorInfoSet(); } Cam->AttachToActor(PlayerChar, FAttachmentTransformRules::KeepRelativeTransform); } diff --git a/Project/Source/Gasa/UI/GasaHUD.cpp b/Project/Source/Gasa/UI/GasaHUD.cpp index c3997a5..c47b5c7 100644 --- a/Project/Source/Gasa/UI/GasaHUD.cpp +++ b/Project/Source/Gasa/UI/GasaHUD.cpp @@ -14,8 +14,6 @@ void AGasaHUD::InitHostWidget(FWidgetControllerData const* WidgetControllerData) HostWidgetController = NewObject(this, GetDevOptions()->Template_HostWidgetController.Get()); HostWidgetController->Data = (* WidgetControllerData); HostWidget->SetWidgetController(HostWidgetController); - HostWidgetController->BindCallbacksToDependencies(); - HostWidgetController->BroadcastInitialValues(); HostWidget->AddToViewport(); }