refactor: Simplify tag display name retrieval and enhance null checks in utility functions
This commit is contained in:
@@ -40,15 +40,14 @@ FText UDA_GameTagRegistry::GetTagDisplayName(const FGameplayTag& Tag) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
UGameplayTagsManager& TagManager = UGameplayTagsManager::Get();
|
UGameplayTagsManager& TagManager = UGameplayTagsManager::Get();
|
||||||
FString DevComment;
|
FText DisplayName = TagManager.GetTagDisplayNameText(Tag);
|
||||||
FString DisplayName = TagManager.GetTagDevCommentAndDisplayName(Tag, DevComment);
|
|
||||||
|
|
||||||
if (DisplayName.IsEmpty())
|
if (DisplayName.IsEmpty())
|
||||||
{
|
{
|
||||||
return FText::FromName(Tag.GetTagName());
|
return FText::FromName(Tag.GetTagName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return FText::FromString(DisplayName);
|
return DisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDA_GameTagRegistry::ValidateTag(const FGameplayTag& Tag) const
|
bool UDA_GameTagRegistry::ValidateTag(const FGameplayTag& Tag) const
|
||||||
|
|||||||
@@ -16,7 +16,18 @@
|
|||||||
|
|
||||||
UGI_GameFramework* UFL_GameUtilities::GetGameFramework(const UObject* WorldContextObject)
|
UGI_GameFramework* UFL_GameUtilities::GetGameFramework(const UObject* WorldContextObject)
|
||||||
{
|
{
|
||||||
return GetSubsystemSafe<UGI_GameFramework>(WorldContextObject);
|
if (!WorldContextObject)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
UWorld* World = WorldContextObject->GetWorld();
|
||||||
|
if (!World)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Cast<UGI_GameFramework>(World->GetGameInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
UGameInstanceSubsystem* UFL_GameUtilities::GetSubsystemByClass(const UObject* WorldContextObject,
|
UGameInstanceSubsystem* UFL_GameUtilities::GetSubsystemByClass(const UObject* WorldContextObject,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
// UE5 Modular Game Framework — BPC_StateManager Implementation
|
// UE5 Modular Game Framework — BPC_StateManager Implementation
|
||||||
|
|
||||||
#include "Player/BPC_StateManager.h"
|
#include "Player/BPC_StateManager.h"
|
||||||
|
#include "Player/BPC_HealthSystem.h"
|
||||||
|
#include "Player/BPC_StressSystem.h"
|
||||||
|
#include "Player/BPC_StaminaSystem.h"
|
||||||
|
#include "Player/BPC_MovementStateSystem.h"
|
||||||
#include "GameplayTagsManager.h"
|
#include "GameplayTagsManager.h"
|
||||||
|
|
||||||
DEFINE_LOG_CATEGORY_STATIC(LogStateManager, Log, All);
|
DEFINE_LOG_CATEGORY_STATIC(LogStateManager, Log, All);
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
// UE5 Modular Game Framework — BPC_DamageReceptionSystem Implementation
|
// UE5 Modular Game Framework — BPC_DamageReceptionSystem Implementation
|
||||||
|
|
||||||
#include "Weapons/BPC_DamageReceptionSystem.h"
|
#include "Weapons/BPC_DamageReceptionSystem.h"
|
||||||
|
#include "Player/BPC_HealthSystem.h"
|
||||||
|
#include "Weapons/BPC_ShieldDefenseSystem.h"
|
||||||
|
#include "Weapons/BPC_HitReactionSystem.h"
|
||||||
|
|
||||||
DEFINE_LOG_CATEGORY_STATIC(LogFrameworkDamage, Log, All);
|
DEFINE_LOG_CATEGORY_STATIC(LogFrameworkDamage, Log, All);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user