Пример #1
0
void UDialogueWave::UpdateMappingProxy(FDialogueContextMapping& ContextMapping)
{
	if (ContextMapping.SoundWave)
	{
		if (!ContextMapping.Proxy)
		{
			ContextMapping.Proxy = ConstructObject<UDialogueSoundWaveProxy>(UDialogueSoundWaveProxy::StaticClass());
		}
	}
	else
	{
		ContextMapping.Proxy = NULL;
	}

	if(ContextMapping.Proxy)
	{
		ContextMapping.Proxy->SoundWave = ContextMapping.SoundWave;

		FSubtitleCue NewSubtitleCue;
		FString Key = GetContextLocalizationKey( ContextMapping.Context );

		if( !( FText::FindText( FString(), Key, NewSubtitleCue.Text )) )
		{
			Key = LocalizationGUID.ToString();

			if ( !FText::FindText( FString(), Key, /*OUT*/NewSubtitleCue.Text ) )
			{
				NewSubtitleCue.Text = FText::FromString( SpokenText );
			}
		}
		NewSubtitleCue.Time = 0.0f;
		ContextMapping.Proxy->Subtitles.Empty();
		ContextMapping.Proxy->Subtitles.Add(NewSubtitleCue);
	}
}
Пример #2
0
void UDialogueWave::UpdateMappingProxy(FDialogueContextMapping& ContextMapping)
{
	if (ContextMapping.SoundWave)
	{
		if (!ContextMapping.Proxy)
		{
			ContextMapping.Proxy = NewObject<UDialogueSoundWaveProxy>();
		}
	}
	else
	{
		ContextMapping.Proxy = NULL;
	}

	if(ContextMapping.Proxy)
	{
		// Copy the properties that the proxy shares with the sound in case it's used as a SoundBase
		ContextMapping.Proxy->SoundWave = ContextMapping.SoundWave;
		UEngine::CopyPropertiesForUnrelatedObjects(ContextMapping.SoundWave, ContextMapping.Proxy);

		FSubtitleCue NewSubtitleCue;
		FString Key = GetContextLocalizationKey( ContextMapping.Context );

		if( !( FText::FindText( FString(), Key, NewSubtitleCue.Text )) )
		{
			Key = LocalizationGUID.ToString();

			if ( !FText::FindText( FString(), Key, /*OUT*/NewSubtitleCue.Text ) )
			{
				NewSubtitleCue.Text = FText::FromString( SpokenText );
			}
		}
		NewSubtitleCue.Time = 0.0f;
		ContextMapping.Proxy->Subtitles.Empty();
		ContextMapping.Proxy->Subtitles.Add(NewSubtitleCue);
	}
}