本文整理汇总了C++中FGameplayTagContainer类的典型用法代码示例。如果您正苦于以下问题:C++ FGameplayTagContainer类的具体用法?C++ FGameplayTagContainer怎么用?C++ FGameplayTagContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FGameplayTagContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
FGameplayCueViewInfo * FGameplayCueHandler::GetBestMatchingView(EGameplayCueEvent::Type Type, const FGameplayTag BaseTag, bool InstigatorLocal, bool TargetLocal)
{
IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
FGameplayTagContainer TagAndParentsContainer = GameplayTagsModule.GetGameplayTagsManager().RequestGameplayTagParents(BaseTag);
for (auto InnerTagIt = TagAndParentsContainer.CreateConstIterator(); InnerTagIt; ++InnerTagIt)
{
FGameplayTag Tag = *InnerTagIt;
for (UGameplayCueView * Def : Definitions)
{
for (FGameplayCueViewInfo & View : Def->Views)
{
if (View.CueType == Type
&& (!View.InstigatorLocalOnly || InstigatorLocal)
&& (!View.TargetLocalOnly || TargetLocal)
&& View.Tags.HasTag(Tag, EGameplayTagMatchType::Explicit, EGameplayTagMatchType::Explicit))
{
return &View;
}
}
}
}
return NULL;
}
示例2: BuildEditableContainerList
void FGameplayTagContainerCustomization::RefreshTagList()
{
// Rebuild Editable Containers as container references can become unsafe
BuildEditableContainerList();
// Clear the list
TagNames.Empty();
// Add tags to list
for (int32 ContainerIdx = 0; ContainerIdx < EditableContainers.Num(); ++ContainerIdx)
{
FGameplayTagContainer* Container = EditableContainers[ContainerIdx].TagContainer;
if (Container)
{
for (auto It = Container->CreateConstIterator(); It; ++It)
{
TagNames.Add(MakeShareable(new FString(It->ToString())));
}
}
}
// Refresh the slate list
if( TagListView.IsValid() )
{
TagListView->RequestListRefresh();
}
}
示例3: RequirementsMet
bool FGameplayTagRequirements::RequirementsMet(const FGameplayTagContainer& Container) const
{
bool HasRequired = Container.MatchesAll(RequireTags, true);
bool HasIgnored = Container.MatchesAny(IgnoreTags, false);
return HasRequired && !HasIgnored;
}
示例4: RequestGameplayTagParents
FGameplayTagContainer UGameplayTagsManager::RequestGameplayTagParents(const FGameplayTag& GameplayTag) const
{
FGameplayTagContainer TagContainer;
TagContainer.AddTag(GameplayTag);
AddParentTags(TagContainer, GameplayTag);
return TagContainer;
}
示例5: Super
UGameplayTagReponseTable::UGameplayTagReponseTable(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// Make an empty tag query. We will actually fill the tag out prior to evaluating the query with ::MakeQuery
FGameplayTagContainer Container;
Container.AddTagFast(FGameplayTag());
Query = FGameplayEffectQuery::MakeQuery_MatchAllOwningTags(Container);
}
示例6: ABILITY_LOG
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
{
ABILITY_LOG(Warning, TEXT("Attempted to remove tag: %s from tag count container, but it is not explicitly in the container!"), *Tag.ToString());
return;
}
}
else if (CountDelta < 0)
{
// Existing tag with a negative delta that would cause a complete removal needs to be explicitly removed; Count will be updated correctly below,
// so that part is skipped for now
int32& ExistingCount = GameplayTagCountMap.FindOrAdd(Tag);
if ((ExistingCount + CountDelta) <= 0)
{
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);
}
}
}
}
示例7: Transaction
void SGameplayTagWidget::OnTagUnchecked(TSharedPtr<FGameplayTagNode> NodeUnchecked)
{
FScopedTransaction Transaction( LOCTEXT("GameplayTagWidget_RemoveTags", "Remove Gameplay Tags"));
if (NodeUnchecked.IsValid())
{
UGameplayTagsManager& TagsManager = IGameplayTagsModule::Get().GetGameplayTagsManager();
for (int32 ContainerIdx = 0; ContainerIdx < TagContainers.Num(); ++ContainerIdx)
{
UObject* OwnerObj = TagContainers[ContainerIdx].TagContainerOwner.Get();
FGameplayTagContainer* Container = TagContainers[ContainerIdx].TagContainer;
FGameplayTag Tag = TagsManager.RequestGameplayTag(NodeUnchecked->GetCompleteTag());
if (Container)
{
FGameplayTagContainer EditableContainer = *Container;
EditableContainer.RemoveTag(Tag);
TWeakPtr<FGameplayTagNode> ParentNode = NodeUnchecked->GetParentTagNode();
if (ParentNode.IsValid())
{
// Check if there are other siblings before adding parent
bool bOtherSiblings = false;
for (auto It = ParentNode.Pin()->GetChildTagNodes().CreateConstIterator(); It; ++It)
{
Tag = TagsManager.RequestGameplayTag(It->Get()->GetCompleteTag());
if (EditableContainer.HasTag(Tag, EGameplayTagMatchType::Explicit, EGameplayTagMatchType::Explicit))
{
bOtherSiblings = true;
break;
}
}
// Add Parent
if (!bOtherSiblings)
{
Tag = TagsManager.RequestGameplayTag(ParentNode.Pin()->GetCompleteTag());
EditableContainer.AddTag(Tag);
}
}
// Uncheck Children
for (const auto& ChildNode : NodeUnchecked->GetChildTagNodes())
{
UncheckChildren(ChildNode, EditableContainer);
}
SetContainer(Container, &EditableContainer, OwnerObj);
}
}
}
}
示例8: GetGameplayTagParents
FGameplayTagContainer FGameplayTagContainer::GetGameplayTagParents() const
{
FGameplayTagContainer ResultContainer;
ResultContainer.AppendTags(*this);
for (TArray<FGameplayTag>::TConstIterator TagIterator(GameplayTags); TagIterator; ++TagIterator)
{
FGameplayTagContainer ParentTags = IGameplayTagsModule::Get().GetGameplayTagsManager().RequestGameplayTagParents(*TagIterator);
ResultContainer.AppendTags(ParentTags);
}
return ResultContainer;
}
示例9: IsTagChecked
ECheckBoxState SGameplayTagWidget::IsTagChecked(TSharedPtr<FGameplayTagNode> Node) const
{
int32 NumValidAssets = 0;
int32 NumAssetsTagIsAppliedTo = 0;
if (Node.IsValid())
{
UGameplayTagsManager& TagsManager = IGameplayTagsModule::Get().GetGameplayTagsManager();
for (int32 ContainerIdx = 0; ContainerIdx < TagContainers.Num(); ++ContainerIdx)
{
FGameplayTagContainer* Container = TagContainers[ContainerIdx].TagContainer;
if (Container)
{
NumValidAssets++;
FGameplayTag Tag = TagsManager.RequestGameplayTag(Node->GetCompleteTag(), false);
if (Tag.IsValid())
{
if (Container->HasTag(Tag, EGameplayTagMatchType::Explicit, EGameplayTagMatchType::Explicit))
{
++NumAssetsTagIsAppliedTo;
}
}
}
}
}
if (NumAssetsTagIsAppliedTo == 0)
{
// Check if any children are tagged
for (auto It = Node->GetChildTagNodes().CreateConstIterator(); It; ++It)
{
if (IsTagChecked(*It) == ECheckBoxState::Checked)
{
return ECheckBoxState::Checked;
}
}
return ECheckBoxState::Unchecked;
}
else if (NumAssetsTagIsAppliedTo == NumValidAssets)
{
return ECheckBoxState::Checked;
}
else
{
return ECheckBoxState::Undetermined;
}
}
示例10: GameplayCueActivated
void FGameplayCueHandler::GameplayCueActivated(const FGameplayTagContainer& GameplayCueTags, float NormalizedMagnitude, const FGameplayEffectContextHandle& EffectContext)
{
check(Owner);
bool InstigatorLocal = EffectContext.IsLocallyControlled();
bool TargetLocal = OwnerIsLocallyControlled();
for (auto TagIt = GameplayCueTags.CreateConstIterator(); TagIt; ++TagIt)
{
if (FGameplayCueViewInfo* View = GetBestMatchingView(EGameplayCueEvent::OnActive, *TagIt, InstigatorLocal, TargetLocal))
{
View->SpawnViewEffects(Owner, NULL, EffectContext);
}
FName MatchedTag;
UFunction *Func = UAbilitySystemGlobals::Get().GetGameplayCueFunction(*TagIt, Owner->GetClass(), MatchedTag);
if (Func)
{
FGameplayCueParameters Params;
Params.NormalizedMagnitude = NormalizedMagnitude;
Params.EffectContext = EffectContext;
IGameplayCueInterface::DispatchBlueprintCustomHandler(Owner, Func, EGameplayCueEvent::OnActive, Params);
}
}
}
示例11: HandleGameplayCues
void IGameplayCueInterface::HandleGameplayCues(AActor *Self, const FGameplayTagContainer& GameplayCueTags, EGameplayCueEvent::Type EventType, FGameplayCueParameters Parameters)
{
for (auto TagIt = GameplayCueTags.CreateConstIterator(); TagIt; ++TagIt)
{
HandleGameplayCue(Self, *TagIt, EventType, Parameters);
}
}
示例12: EmitTagTokens
void UEditableGameplayTagQueryExpression::EmitTagTokens(FGameplayTagContainer const& TagsToEmit, TArray<uint8>& TokenStream, TArray<FGameplayTag>& TagDictionary, FString* DebugString) const
{
uint8 const NumTags = (uint8)TagsToEmit.Num();
TokenStream.Add(NumTags);
bool bFirstTag = true;
for (auto T : TagsToEmit)
{
int32 TagIdx = TagDictionary.AddUnique(T);
check(TagIdx <= 255);
TokenStream.Add((uint8)TagIdx);
if (DebugString)
{
if (bFirstTag == false)
{
DebugString->Append(TEXT(","));
}
DebugString->Append(TEXT(" "));
DebugString->Append(T.ToString());
}
bFirstTag = false;
}
}
示例13: AddModifier
void FGAEffectModifierContainer::AddModifier(const FGAEffectModifierSpec& ModSpec, const FGameplayTagContainer& Tags,
const FGAEffectHandle HandleIn,
TSharedPtr<FGAActiveDuration> EffectPtr)
{
FString complexString = Tags.ToString();
FString simpleString = Tags.ToStringSimple();
FName test(*simpleString);
for (const FGameplayTag& tag : Tags)
{
FGAEffectModifier& mods = Modifiers.FindOrAdd(tag);
FGAModifier modifier(ModSpec.Mod, ModSpec.DirectModifier.Value, EffectPtr);
modifier.ModifierType = ModSpec.ModifierType;
mods.AddBonus(modifier, HandleIn);
}
}
示例14: Notify_StackCountChange
void FGameplayTagCountContainer::Notify_StackCountChange(const FGameplayTag& Tag)
{
// The purpose of this function is to let anyone listening on the EGameplayTagEventType::AnyCountChange event know that the
// stack count of a GE that was backing this GE has changed. We do not update our internal map/count with this info, since that
// map only counts the number of GE/sources that are giving that tag.
FGameplayTagContainer TagAndParentsContainer = IGameplayTagsModule::Get().GetGameplayTagsManager().RequestGameplayTagParents(Tag);
for (auto CompleteTagIt = TagAndParentsContainer.CreateConstIterator(); CompleteTagIt; ++CompleteTagIt)
{
const FGameplayTag& CurTag = *CompleteTagIt;
FDelegateInfo* DelegateInfo = GameplayTagEventMap.Find(CurTag);
if (DelegateInfo)
{
int32 TagCount = GameplayTagCountMap.FindOrAdd(CurTag);
DelegateInfo->OnAnyChange.Broadcast(CurTag, TagCount);
}
}
}
示例15: FunctionCategory
void UK2Node_GameplayCueEvent::GetMenuEntries(FGraphContextMenuBuilder& Context) const
{
Super::GetMenuEntries(Context);
if (!IsCompatibleWithGraph(Context.CurrentGraph))
{
return;
}
const FString FunctionCategory(TEXT("GameplayCue Event"));
IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
FGameplayTag RootTag = GameplayTagsModule.GetGameplayTagsManager().RequestGameplayTag(FName(TEXT("GameplayCue")));
FGameplayTagContainer CueTags = GameplayTagsModule.GetGameplayTagsManager().RequestGameplayTagChildren(RootTag);
// Add a root GameplayCue function as a default
CueTags.AddTag(RootTag);
// Fixme: need to check if this function is already defined so that it can be reimplemented
// -Checking MyBlueprint->GeneratedClass isn't enough since they may have added an event and not recompiled
// -FEdGraphSchemaAction_K2AddCustomEvent does not check names/always ensures a valid name
// -FEdGraphSchemaAction_K2AddEvent does check and recenters - but it looks at EventSignatureName/EventSignatureClass for equality and that
// won't work here.
//
// Probably need a new EdGraphSchemaAction to do this properly. For now this is ok since they will get a compile error if they do drop in
// two of the same GameplayCue even Nodes and it should be pretty clear that they can't do that.
for (auto It = CueTags.CreateConstIterator(); It; ++It)
{
FGameplayTag Tag = *It;
UK2Node_GameplayCueEvent* NodeTemplate = Context.CreateTemplateNode<UK2Node_GameplayCueEvent>();
NodeTemplate->CustomFunctionName = Tag.GetTagName();
const FString Category = FunctionCategory;
const FText MenuDesc = NodeTemplate->GetNodeTitle(ENodeTitleType::ListView);
const FString Tooltip = NodeTemplate->GetTooltipText().ToString();
const FString Keywords = NodeTemplate->GetKeywords();
TSharedPtr<FEdGraphSchemaAction_K2NewNode> NodeAction = FK2ActionMenuBuilder::AddNewNodeAction(Context, Category, MenuDesc, Tooltip, 0, Keywords);
NodeAction->NodeTemplate = NodeTemplate;
}
}