58. Broadcasting Data Table Rows
This commit is contained in:
@ -2,6 +2,9 @@
|
||||
#include "AbilitySystem/GasaAbilitySystemComponent_Inlines.h"
|
||||
#include "AbilitySystem/GasaAttributeSet.h"
|
||||
#include "GameplayEffectTypes.h"
|
||||
#include "GasaDevOptions.h"
|
||||
#include "TaggedMessageRow.h"
|
||||
using namespace Gasa;
|
||||
|
||||
|
||||
|
||||
@ -30,6 +33,20 @@ void UHostWidgetController::MaxManaChanged( FOnAttributeChangeData const& Attrib
|
||||
}
|
||||
#pragma endregion Attribute Changed Callbacks
|
||||
|
||||
void UHostWidgetController::OnEffectAppliedAssetTags( FGameplayTagContainer const& AssetTags )
|
||||
{
|
||||
UDataTable* TaggedMessages = GetDevOptions()->TaggedMessageTable.Get();
|
||||
for ( FGameplayTag const& Tag : AssetTags )
|
||||
{
|
||||
FGameplayTag MessageTagCategory = FGameplayTag::RequestGameplayTag( FName( "Message" ) );
|
||||
if ( ! Tag.MatchesTag( MessageTagCategory ) )
|
||||
continue;
|
||||
|
||||
FTaggedMessageRow* Row = TaggedMessages->FindRow<FTaggedMessageRow>( Tag.GetTagName(), TEXT( "" ) );
|
||||
OnTaggedAssetMessage.Broadcast( *Row );
|
||||
}
|
||||
}
|
||||
|
||||
void UHostWidgetController::BroadcastInitialValues()
|
||||
{
|
||||
// This function is managed by: GenGasa/GenGasa_HostWidgetController.cpp
|
||||
@ -66,4 +83,6 @@ void UHostWidgetController::BindCallbacksToDependencies()
|
||||
FOnGameplayAttributeValueChange& MaxManaAttributeChangedDelegate =
|
||||
AbilitySystem->GetGameplayAttributeValueChangeDelegate( GasaAttribs->GetMaxManaAttribute() );
|
||||
MaxManaAttributeChangedDelegate.AddUObject( this, &ThisClass::MaxManaChanged );
|
||||
|
||||
AbilitySystem->Event_OnEffectAppliedAssetTags.AddUObject( this, &UHostWidgetController::OnEffectAppliedAssetTags );
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "TaggedMessageRow.h"
|
||||
#include "WidgetController.h"
|
||||
#include "HostWidgetController.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam( FAttributeFloatChangedSig, float, NewValue );
|
||||
|
||||
UCLASS( Blueprintable, BlueprintType )
|
||||
@ -30,6 +33,11 @@ public:
|
||||
void MaxManaChanged( FOnAttributeChangeData const& Data );
|
||||
#pragma endregion Attribute Events
|
||||
|
||||
UPROPERTY( BlueprintAssignable, Category = "Messages" )
|
||||
FTaggedMessageRowSig OnTaggedAssetMessage;
|
||||
|
||||
void OnEffectAppliedAssetTags( FGameplayTagContainer const& AssetTags );
|
||||
|
||||
#pragma region WidgetController
|
||||
void BroadcastInitialValues() override;
|
||||
void BindCallbacksToDependencies() override;
|
||||
|
28
Project/Source/Gasa/UI/TaggedMessageRow.h
Normal file
28
Project/Source/Gasa/UI/TaggedMessageRow.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "GasaCommon.h"
|
||||
#include "Engine/DataTable.h"
|
||||
#include "Templates/SubclassOf.h"
|
||||
|
||||
#include "TaggedMessageRow.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FTaggedMessageRow : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
FGameplayTag Tag;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
FText Message;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
TSubclassOf<UGasaUserWidget> MessageTemplate;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
UTexture2D* Image;
|
||||
};
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTaggedMessageRowSig, FTaggedMessageRow, Message);
|
Reference in New Issue
Block a user