本文整理汇总了C++中FName::GetNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ FName::GetNumber方法的具体用法?C++ FName::GetNumber怎么用?C++ FName::GetNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FName
的用法示例。
在下文中一共展示了FName::GetNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoTest
void FName::AutoTest()
{
const FName AutoTest_1("AutoTest_1");
const FName autoTest_1("autoTest_1");
const FName autoTeSt_1("autoTeSt_1");
const FName AutoTest1Find("autoTEST_1", EFindName::FNAME_Find);
const FName AutoTest_2(TEXT("AutoTest_2"));
const FName AutoTestB_2(TEXT("AutoTestB_2"));
check(AutoTest_1 != AutoTest_2);
check(AutoTest_1 == autoTest_1);
check(AutoTest_1 == autoTeSt_1);
#if WITH_CASE_PRESERVING_NAME
check(!FCString::Strcmp(*AutoTest_1.ToString(), TEXT("AutoTest_1")));
check(!FCString::Strcmp(*autoTest_1.ToString(), TEXT("autoTest_1")));
check(!FCString::Strcmp(*autoTeSt_1.ToString(), TEXT("autoTeSt_1")));
check(!FCString::Strcmp(*AutoTestB_2.ToString(), TEXT("AutoTestB_2")));
#endif
check(autoTest_1.GetComparisonIndex() == AutoTest_2.GetComparisonIndex());
check(autoTest_1.GetPlainNameString() == AutoTest_1.GetPlainNameString());
check(autoTest_1.GetPlainNameString() == AutoTest_2.GetPlainNameString());
check(*AutoTestB_2.GetPlainNameString() != *AutoTest_2.GetPlainNameString());
check(AutoTestB_2.GetNumber() == AutoTest_2.GetNumber());
check(autoTest_1.GetNumber() != AutoTest_2.GetNumber());
}
示例2: Compare
/**
* Compares name to passed in one. Sort is alphabetical ascending.
*
* @param Other Name to compare this against
* @return < 0 is this < Other, 0 if this == Other, > 0 if this > Other
*/
int32 FName::Compare( const FName& Other ) const
{
// Names match, check whether numbers match.
if( GetComparisonIndexFast() == Other.GetComparisonIndexFast() )
{
return GetNumber() - Other.GetNumber();
}
// Names don't match. This means we don't even need to check numbers.
else
{
TNameEntryArray& Names = GetNames();
const FNameEntry* const ThisEntry = GetComparisonNameEntry();
const FNameEntry* const OtherEntry = Other.GetComparisonNameEntry();
// Ansi/Wide mismatch, convert to wide
if( ThisEntry->IsWide() != OtherEntry->IsWide() )
{
return FCStringWide::Stricmp( ThisEntry->IsWide() ? ThisEntry->GetWideName() : StringCast<WIDECHAR>(ThisEntry->GetAnsiName()).Get(),
OtherEntry->IsWide() ? OtherEntry->GetWideName() : StringCast<WIDECHAR>(OtherEntry->GetAnsiName()).Get() );
}
// Both are wide.
else if( ThisEntry->IsWide() )
{
return FCStringWide::Stricmp( ThisEntry->GetWideName(), OtherEntry->GetWideName() );
}
// Both are ansi.
else
{
return FCStringAnsi::Stricmp( ThisEntry->GetAnsiName(), OtherEntry->GetAnsiName() );
}
}
}
示例3: SerializeName
bool UPackageMap::SerializeName(FArchive& Ar, FName& Name)
{
if (Ar.IsLoading())
{
uint8 bHardcoded = 0;
Ar.SerializeBits(&bHardcoded, 1);
if (bHardcoded)
{
// replicated by hardcoded index
uint32 NameIndex;
Ar.SerializeInt(NameIndex, MAX_NETWORKED_HARDCODED_NAME + 1);
Name = EName(NameIndex);
// hardcoded names never have a Number
}
else
{
// replicated by string
FString InString;
int32 InNumber;
Ar << InString << InNumber;
Name = FName(*InString, InNumber);
}
}
else if (Ar.IsSaving())
{
uint8 bHardcoded = Name.GetIndex() <= MAX_NETWORKED_HARDCODED_NAME;
Ar.SerializeBits(&bHardcoded, 1);
if (bHardcoded)
{
// send by hardcoded index
checkSlow(Name.GetNumber() <= 0); // hardcoded names should never have a Number
uint32 NameIndex = uint32(Name.GetIndex());
Ar.SerializeInt(NameIndex, MAX_NETWORKED_HARDCODED_NAME + 1);
}
else
{
// send by string
FString OutString = Name.GetPlainNameString();
int32 OutNumber = Name.GetNumber();
Ar << OutString << OutNumber;
}
}
return true;
}
示例4: NotifyHitBoxClick
void APlatformerHUD::NotifyHitBoxClick(FName BoxName)
{
Super::NotifyHitBoxClick(BoxName);
if (BoxName.GetPlainNameString() == "Letter")
{
CurrentLetter = BoxName.GetNumber();
}
if (BoxName == "Up")
{
if (HighScoreName[CurrentLetter] < 'Z')
{
HighScoreName[CurrentLetter]++;
}
}
if (BoxName == "Down")
{
if (HighScoreName[CurrentLetter] > 'A')
{
HighScoreName[CurrentLetter]--;
}
}
if (BoxName == "OK")
{
bEnterNamePromptActive = false;
if (PlayerOwner)
{
PlayerOwner->bShowMouseCursor = bEnterNamePromptActive;
}
FString EnteredName = FString();
for (int32 i=0; i < HighScoreName.Num(); i++)
{
EnteredName.AppendChar(HighScoreName[i]);
}
OnHighscoreNameAccepted.Broadcast(EnteredName);
}
}
示例5: StartRecordingNewComponents
void UActorRecording::StartRecordingNewComponents(ULevelSequence* CurrentSequence, float CurrentSequenceTime)
{
if (GetActorToRecord() != nullptr)
{
// find the new component(s)
TInlineComponentArray<USceneComponent*> NewComponents;
TArray<USceneComponent*> SceneComponents;
GetSceneComponents(SceneComponents);
for(USceneComponent* SceneComponent : SceneComponents)
{
if(ValidComponent(SceneComponent))
{
TWeakObjectPtr<USceneComponent> WeakSceneComponent(SceneComponent);
int32 FoundIndex = TrackedComponents.Find(WeakSceneComponent);
if(FoundIndex == INDEX_NONE)
{
// new component!
NewComponents.Add(SceneComponent);
}
}
}
ProcessNewComponentArray(NewComponents);
UMovieScene* MovieScene = CurrentSequence->GetMovieScene();
check(MovieScene);
FAnimationRecordingSettings ComponentAnimationSettings = AnimationSettings;
ComponentAnimationSettings.bRemoveRootAnimation = false;
ComponentAnimationSettings.bRecordInWorldSpace = false;
const USequenceRecorderSettings* Settings = GetDefault<USequenceRecorderSettings>();
if (!bRecordToPossessable)
{
FMovieSceneSpawnable* Spawnable = MovieScene->FindSpawnable(Guid);
check(Spawnable);
AActor* ObjectTemplate = CastChecked<AActor>(Spawnable->GetObjectTemplate());
for (USceneComponent* SceneComponent : NewComponents)
{
// new component, so we need to add this to our BP if it didn't come from SCS
FName NewName;
if (SceneComponent->CreationMethod != EComponentCreationMethod::SimpleConstructionScript)
{
// Give this component a unique name within its parent
NewName = *FString::Printf(TEXT("Dynamic%s"), *SceneComponent->GetFName().GetPlainNameString());
NewName.SetNumber(1);
while (FindObjectFast<UObject>(ObjectTemplate, NewName))
{
NewName.SetNumber(NewName.GetNumber() + 1);
}
USceneComponent* TemplateRoot = ObjectTemplate->GetRootComponent();
USceneComponent* AttachToComponent = nullptr;
// look for a similar attach parent in the current structure
USceneComponent* AttachParent = SceneComponent->GetAttachParent();
if(AttachParent != nullptr)
{
// First off, check if we're attached to a component that has already been duplicated into this object
// If so, the name lookup will fail, so we use a direct reference
if (TWeakObjectPtr<USceneComponent>* DuplicatedComponent = DuplicatedDynamicComponents.Find(AttachParent))
{
AttachToComponent = DuplicatedComponent->Get();
}
// If we don't have an attachment parent duplicated already, perform a name lookup
if (!AttachToComponent)
{
FName AttachName = SceneComponent->GetAttachParent()->GetFName();
TInlineComponentArray<USceneComponent*> AllChildren;
ObjectTemplate->GetComponents(AllChildren);
for (USceneComponent* Child : AllChildren)
{
CA_SUPPRESS(28182); // Dereferencing NULL pointer. 'Child' contains the same NULL value as 'AttachToComponent' did.
if (Child->GetFName() == AttachName)
{
AttachToComponent = Child;
break;
}
}
}
}
if (!AttachToComponent)
{
AttachToComponent = ObjectTemplate->GetRootComponent();
}
USceneComponent* NewTemplateComponent = Cast<USceneComponent>(StaticDuplicateObject(SceneComponent, ObjectTemplate, NewName, RF_AllFlags & ~RF_Transient));
NewTemplateComponent->AttachToComponent(AttachToComponent, FAttachmentTransformRules::KeepRelativeTransform, SceneComponent->GetAttachSocketName());
ObjectTemplate->AddInstanceComponent(NewTemplateComponent);
DuplicatedDynamicComponents.Add(SceneComponent, NewTemplateComponent);
}
else
//.........这里部分代码省略.........