当前位置: 首页>>代码示例>>C++>>正文


C++ FName::GetIndex方法代码示例

本文整理汇总了C++中FName::GetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ FName::GetIndex方法的具体用法?C++ FName::GetIndex怎么用?C++ FName::GetIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FName的用法示例。


在下文中一共展示了FName::GetIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: R_FindCustomTranslation

int R_FindCustomTranslation(FName name)
{
	switch (name)
	{
	case NAME_Ice:
		// Ice is a special case which will remain in its original slot.
		return TRANSLATION(TRANSLATION_Standard, 7);

	case NAME_None:
		return 0;

	case NAME_RainPillar1:
	case NAME_RainPillar2:
	case NAME_RainPillar3:
	case NAME_RainPillar4:
	case NAME_RainPillar5:
	case NAME_RainPillar6:
	case NAME_RainPillar7:
	case NAME_RainPillar8:
		return TRANSLATION(TRANSLATION_RainPillar, name.GetIndex() - NAME_RainPillar1);

	case NAME_Player1:
	case NAME_Player2:
	case NAME_Player3:
	case NAME_Player4:
	case NAME_Player5:
	case NAME_Player6:
	case NAME_Player7:
	case NAME_Player8:
		return TRANSLATION(TRANSLATION_Players, name.GetIndex() - NAME_Player1);

	}
	int *t = customTranslationMap.CheckKey(FName(name, true));
	return (t != nullptr)? *t : -1;
}
开发者ID:emileb,项目名称:gzdoom,代码行数:35,代码来源:r_translate.cpp

示例2: WriteUserInfo

void WriteUserInfo(FArchive &arc, userinfo_t &info)
{
	TMapIterator<FName, FBaseCVar *> it(info);
	TMap<FName, FBaseCVar *>::Pair *pair;
	FName name;
	UCVarValue val;
	int i;

	while (it.NextPair(pair))
	{
		name = pair->Key;
		arc << name;
		switch (name.GetIndex())
		{
		case NAME_Skin:
			arc.WriteString(skins[info.GetSkin()].name);
			break;

		case NAME_PlayerClass:
			i = info.GetPlayerClassNum();
			arc.WriteString(i == -1 ? "Random" : PlayerClasses[i].Type->Meta.GetMetaString(APMETA_DisplayName));
			break;

		default:
			val = pair->Value->GetGenericRep(CVAR_String);
			arc.WriteString(val.String);
			break;
		}
	}
	name = NAME_None;
	arc << name;
}
开发者ID:Jadeon,项目名称:gzdoom,代码行数:32,代码来源:d_netinfo.cpp

示例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;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:44,代码来源:CoreNet.cpp

示例4: MakeUniqueObjectName

FName VObject::MakeUniqueObjectName(const VClass* InClass, FName BaseName /* = NAME_None */)
{
	check(InClass);
	VClass* Class = (VClass*)InClass;
	if( BaseName == NAME_None )
	{
		BaseName = InClass->GetClassName();
	}

	EName BaseNameIndex = (EName)BaseName.GetIndex();
	FName TestName;
	do
	{
		TestName = FName(BaseNameIndex, ++(Class->_ClassUnique));
	} 
	while (StaticFindObject(InClass, TestName));

	return TestName;
}
开发者ID:xukunn1226,项目名称:VRI3,代码行数:19,代码来源:VObjec.cpp


注:本文中的FName::GetIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。