本文整理汇总了C++中FGameplayTag::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ FGameplayTag::ToString方法的具体用法?C++ FGameplayTag::ToString怎么用?C++ FGameplayTag::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGameplayTag
的用法示例。
在下文中一共展示了FGameplayTag::ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPropertyValueChanged
void FGameplayTagCustomization::OnPropertyValueChanged()
{
TagName = TEXT("");
if (StructPropertyHandle.IsValid() && EditableContainers.Num() > 0)
{
TArray<void*> RawStructData;
StructPropertyHandle->AccessRawData(RawStructData);
if (RawStructData.Num() > 0)
{
FGameplayTag* Tag = (FGameplayTag*)(RawStructData[0]);
FGameplayTagContainer* Container = EditableContainers[0].TagContainer;
if (Tag && Container)
{
Container->RemoveAllTags();
Container->AddTag(*Tag);
TagName = Tag->ToString();
}
}
}
}
示例2: BuildEditableContainerList
void FGameplayTagCustomization::BuildEditableContainerList()
{
EditableContainers.Empty();
if(StructPropertyHandle.IsValid())
{
TArray<void*> RawStructData;
StructPropertyHandle->AccessRawData(RawStructData);
TArray<UObject*> OuterObjects;
StructPropertyHandle->GetOuterObjects(OuterObjects);
FGameplayTag* Tag = (FGameplayTag*)(RawStructData[0]);
if (Tag->IsValid())
{
TagName = Tag->ToString();
TagContainer->AddTag(*Tag);
}
EditableContainers.Add(SGameplayTagWidget::FEditableGameplayTagContainerDatum(OuterObjects[0], TagContainer.Get()));
}
}
示例3: BuildEditableContainerList
void FGameplayTagCustomization::BuildEditableContainerList()
{
EditableContainers.Empty();
if(StructPropertyHandle.IsValid() && StructPropertyHandle->GetProperty())
{
TArray<void*> RawStructData;
StructPropertyHandle->AccessRawData(RawStructData);
if (RawStructData.Num() > 0)
{
FGameplayTag* Tag = (FGameplayTag*)(RawStructData[0]);
if (Tag->IsValid())
{
TagName = Tag->ToString();
TagContainer->AddTag(*Tag);
}
}
EditableContainers.Add(SGameplayTagWidget::FEditableGameplayTagContainerDatum(nullptr, TagContainer.Get()));
}
}
示例4: HandleGameplayCue
void UGameplayCueManager::HandleGameplayCue(AActor* TargetActor, FGameplayTag GameplayCueTag, EGameplayCueEvent::Type EventType, const FGameplayCueParameters& Parameters)
{
if (DisableGameplayCues)
{
return;
}
if (GameplayCueRunOnDedicatedServer == 0 && IsDedicatedServerForGameplayCue())
{
return;
}
#if WITH_EDITOR
if (GIsEditor && TargetActor == nullptr && UGameplayCueManager::PreviewComponent)
{
TargetActor = Cast<AActor>(AActor::StaticClass()->GetDefaultObject());
}
#endif
if (TargetActor == nullptr)
{
ABILITY_LOG(Warning, TEXT("UGameplayCueManager::HandleGameplayCue called on null TargetActor. GameplayCueTag: %s."), *GameplayCueTag.ToString());
return;
}
IGameplayCueInterface* GameplayCueInterface = Cast<IGameplayCueInterface>(TargetActor);
bool bAcceptsCue = true;
if (GameplayCueInterface)
{
bAcceptsCue = GameplayCueInterface->ShouldAcceptGameplayCue(TargetActor, GameplayCueTag, EventType, Parameters);
}
if (DisplayGameplayCues)
{
FString DebugStr = FString::Printf(TEXT("%s - %s"), *GameplayCueTag.ToString(), *EGameplayCueEventToString(EventType) );
FColor DebugColor = FColor::Green;
DrawDebugString(TargetActor->GetWorld(), FVector(0.f, 0.f, 100.f), DebugStr, TargetActor, DebugColor, DisplayGameplayCueDuration);
}
CurrentWorld = TargetActor->GetWorld();
// Don't handle gameplay cues when world is tearing down
if (!GetWorld() || GetWorld()->bIsTearingDown)
{
return;
}
// Give the global set a chance
check(GlobalCueSet);
if (bAcceptsCue)
{
GlobalCueSet->HandleGameplayCue(TargetActor, GameplayCueTag, EventType, Parameters);
}
// Use the interface even if it's not in the map
if (GameplayCueInterface && bAcceptsCue)
{
GameplayCueInterface->HandleGameplayCue(TargetActor, GameplayCueTag, EventType, Parameters);
}
CurrentWorld = nullptr;
}
示例5: UpdateTagMap_Internal
void FGameplayTagCountContainer::UpdateTagMap_Internal(const FGameplayTag& Tag, int32 CountDelta)
{
const bool bTagAlreadyExplicitlyExists = ExplicitTags.HasTag(Tag, EGameplayTagMatchType::Explicit, EGameplayTagMatchType::Explicit);
// Need special case handling to maintain the explicit tag list correctly, adding the tag to the list if it didn't previously exist and a
// positive delta comes in, and removing it from the list if it did exist and a negative delta comes in.
if (!bTagAlreadyExplicitlyExists)
{
// Brand new tag with a positive delta needs to be explicitly added
if (CountDelta > 0)
{
ExplicitTags.AddTag(Tag);
}
// Block attempted reduction of non-explicit tags, as they were never truly added to the container directly
else
{
// only warn about tags that are in the container but will not be removed because they aren't explicitly in the container
if (ExplicitTags.HasTag(Tag, EGameplayTagMatchType::IncludeParentTags, EGameplayTagMatchType::Explicit))
{
ABILITY_LOG(Warning, TEXT("Attempted to remove tag: %s from tag count container, but it is not explicitly in the container!"), *Tag.ToString());
}
return;
}
}
// Update the explicit tag count map. This has to be separate than the map below because otherwise the count of nested tags ends up wrong
int32& ExistingCount = ExplicitTagCountMap.FindOrAdd(Tag);
ExistingCount = FMath::Max(ExistingCount + CountDelta, 0);
// If our new count is 0, remove us from the explicit tag list
if (ExistingCount <= 0)
{
// Remove from the explicit list
ExplicitTags.RemoveTag(Tag);
}
// Check if change delegates are required to fire for the tag or any of its parents based on the count change
FGameplayTagContainer TagAndParentsContainer = IGameplayTagsModule::Get().GetGameplayTagsManager().RequestGameplayTagParents(Tag);
for (auto CompleteTagIt = TagAndParentsContainer.CreateConstIterator(); CompleteTagIt; ++CompleteTagIt)
{
const FGameplayTag& CurTag = *CompleteTagIt;
// Get the current count of the specified tag. NOTE: Stored as a reference, so subsequent changes propogate to the map.
int32& TagCount = GameplayTagCountMap.FindOrAdd(CurTag);
const int32 OldCount = TagCount;
// Apply the delta to the count in the map
TagCount = FMath::Max(TagCount + CountDelta, 0);
// If a significant change (new addition or total removal) occurred, trigger related delegates
if (OldCount == 0 || TagCount == 0)
{
OnAnyTagChangeDelegate.Broadcast(CurTag, TagCount);
FOnGameplayEffectTagCountChanged* CountChangeDelegate = GameplayTagEventMap.Find(CurTag);
if (CountChangeDelegate)
{
CountChangeDelegate->Broadcast(CurTag, TagCount);
}
}
}
}