コード例 #1
0
/*Description: Sets the state on a Player Animation*/
void APoseidonCharacter::AnimationBool(FName Animation, bool newState)
{
	if (AnimationBP)
	{
		UBoolProperty* BoolProp = FindField<UBoolProperty>(AnimationBP->GetClass(), Animation);
		if (BoolProp != NULL)
		{
			BoolProp->SetPropertyValue_InContainer(AnimationBP, newState);
		}
	}
}
コード例 #2
0
void APoseidonCharacter::EndScene()
{
	if (IsEndScene == false)
	{
		PlayerHUD->ChangeCrosshair(EReticleEnum::RE_NO_RETICLE);
		APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
		UUserWidget* WidgetInstance = CreateWidget<UUserWidget>(PlayerController, WidgetCreditsClass);
		WidgetInstance->AddToViewport();
		FName shouldLoop = FName("ShouldLoop");
		UBoolProperty* BoolProp = FindField<UBoolProperty>(WidgetInstance->GetClass(), shouldLoop);
		if (BoolProp != NULL)
		{
			BoolProp->SetPropertyValue_InContainer(WidgetInstance, false);
		}
		IsEndScene = true;

	}
}
コード例 #3
0
ファイル: SQLiteDatabase.cpp プロジェクト: TonyMenji/Hayabusa
void USQLiteDatabase::AssignResultsToObjectProperties(const SQLiteResultValue& ResultValue, UObject* ObjectToPopulate)
{
	auto propertyMap = CollectProperties(ObjectToPopulate);
	for (SQLiteResultField field : ResultValue.Fields)
	{
		if (propertyMap.Contains(field.Name))
		{
			UProperty* targetProperty = propertyMap[field.Name];

			if (field.Type == SQLiteResultValueTypes::Integer)
			{
				UInt64Property* int64prop = NULL;
				UIntProperty* int32prop = NULL;
				UInt16Property* int16prop = NULL;
				UInt8Property* int8prop = NULL;
				UBoolProperty* boolProp = NULL;

				if ((int64prop = Cast<UInt64Property>(targetProperty)) != NULL)
				{
					int64prop->SetPropertyValue_InContainer(ObjectToPopulate, field.IntValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
				}
				else if ((int32prop = Cast<UIntProperty>(targetProperty)) != NULL)
				{
					int32prop->SetPropertyValue_InContainer(ObjectToPopulate, (int32)field.IntValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
				}
				else if ((int16prop = Cast<UInt16Property>(targetProperty)) != NULL)
				{
					int16prop->SetPropertyValue_InContainer(ObjectToPopulate, (int16)field.IntValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
				}
				else if ((int8prop = Cast<UInt8Property>(targetProperty)) != NULL)
				{
					int8prop->SetPropertyValue_InContainer(ObjectToPopulate, (int8)field.IntValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
				}
				else if ((boolProp = Cast<UBoolProperty>(targetProperty)) != NULL)
				{
					boolProp->SetPropertyValue_InContainer(ObjectToPopulate, field.IntValue > 0);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%d'"), *field.Name, field.IntValue));
				}
			}

			else if (field.Type == SQLiteResultValueTypes::Float)
			{
				UDoubleProperty* doubleProp = NULL;
				UFloatProperty* floatProp = NULL;
				if ((doubleProp = Cast<UDoubleProperty>(targetProperty)) != NULL)
				{
					doubleProp->SetPropertyValue_InContainer(ObjectToPopulate, field.DoubleValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%f'"), *field.Name, field.DoubleValue));
				}
				else if ((floatProp = Cast<UFloatProperty>(targetProperty)) != NULL)
				{
					floatProp->SetPropertyValue_InContainer(ObjectToPopulate, (float)field.DoubleValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%f'"), *field.Name, field.DoubleValue));
				}
			}

			else if (field.Type == SQLiteResultValueTypes::Text)
			{
				UStrProperty* strProp = NULL;
				if ((strProp = Cast<UStrProperty>(targetProperty)) != NULL)
				{
					strProp->SetPropertyValue_InContainer(ObjectToPopulate, field.StringValue);
					LOGSQLITE(Verbose, *FString::Printf(TEXT("Property '%s' was set to '%s'"), *field.Name, *field.StringValue.Mid(0, 64)));
				}
			}

		}
	}
}