本文整理汇总了C++中FGameplayTag::NetSerialize方法的典型用法代码示例。如果您正苦于以下问题:C++ FGameplayTag::NetSerialize方法的具体用法?C++ FGameplayTag::NetSerialize怎么用?C++ FGameplayTag::NetSerialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGameplayTag
的用法示例。
在下文中一共展示了FGameplayTag::NetSerialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NetSerialize
bool FMinimalReplicationTagCountMap::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
const int32 CountBits = UAbilitySystemGlobals::Get().MinimalReplicationTagCountBits;
const int32 MaxCount = ((1 << CountBits)-1);
if (Ar.IsSaving())
{
int32 Count = TagMap.Num();
if (Count > MaxCount)
{
ABILITY_LOG(Error, TEXT("FMinimapReplicationTagCountMap has too many tags (%d). This will cause tags to not replicate. See FMinimapReplicationTagCountMap::NetSerialize"), TagMap.Num());
Count = MaxCount;
}
Ar.SerializeBits(&Count, CountBits);
for(auto& It : TagMap)
{
FGameplayTag& Tag = It.Key;
Tag.NetSerialize(Ar, Map, bOutSuccess);
if (--Count <= 0)
{
break;
}
}
}
else
{
int32 Count = TagMap.Num();
Ar.SerializeBits(&Count, CountBits);
// Reset our local map
for(auto& It : TagMap)
{
It.Value = 0;
}
// See what we have
while(Count-- > 0)
{
FGameplayTag Tag;
Tag.NetSerialize(Ar, Map, bOutSuccess);
TagMap.FindOrAdd(Tag) = 1;
}
if (Owner)
{
// Update our tags with owner tags
for(auto& It : TagMap)
{
Owner->SetTagMapCount(It.Key, It.Value);
}
}
}
bOutSuccess = true;
return true;
}