Download LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticDeveloperSettings.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 2.61 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticDeveloperSettings.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticDeveloperSettings.cpp
-
curl -L -o LyraCosmeticDeveloperSettings.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticDeveloperSettings.cpp
2.61 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| ULyraCosmeticDeveloperSettings::ULyraCosmeticDeveloperSettings() | |
| { | |
| } | |
| FName ULyraCosmeticDeveloperSettings::GetCategoryName() const | |
| { | |
| return FApp::GetProjectName(); | |
| } | |
| void ULyraCosmeticDeveloperSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) | |
| { | |
| Super::PostEditChangeProperty(PropertyChangedEvent); | |
| ApplySettings(); | |
| } | |
| void ULyraCosmeticDeveloperSettings::PostReloadConfig(FProperty* PropertyThatWasLoaded) | |
| { | |
| Super::PostReloadConfig(PropertyThatWasLoaded); | |
| ApplySettings(); | |
| } | |
| void ULyraCosmeticDeveloperSettings::PostInitProperties() | |
| { | |
| Super::PostInitProperties(); | |
| ApplySettings(); | |
| } | |
| void ULyraCosmeticDeveloperSettings::ApplySettings() | |
| { | |
| if (GIsEditor && (GEngine != nullptr)) | |
| { | |
| ReapplyLoadoutIfInPIE(); | |
| } | |
| } | |
| void ULyraCosmeticDeveloperSettings::ReapplyLoadoutIfInPIE() | |
| { | |
| // Update the loadout on all players | |
| UWorld* ServerWorld = ULyraDevelopmentStatics::FindPlayInEditorAuthorityWorld(); | |
| if (ServerWorld != nullptr) | |
| { | |
| ServerWorld->GetTimerManager().SetTimerForNextTick(FTimerDelegate::CreateLambda([=]() | |
| { | |
| for (TActorIterator<APlayerController> PCIterator(ServerWorld); PCIterator; ++PCIterator) | |
| { | |
| if (APlayerController* PC = *PCIterator) | |
| { | |
| if (ULyraControllerComponent_CharacterParts* CosmeticComponent = PC->FindComponentByClass<ULyraControllerComponent_CharacterParts>()) | |
| { | |
| CosmeticComponent->ApplyDeveloperSettings(); | |
| } | |
| } | |
| } | |
| })); | |
| } | |
| } | |
| void ULyraCosmeticDeveloperSettings::OnPlayInEditorStarted() const | |
| { | |
| // Show a notification toast to remind the user that there's an experience override set | |
| if (CheatCosmeticCharacterParts.Num() > 0) | |
| { | |
| FNotificationInfo Info(LOCTEXT("CosmeticOverrideActive", "Applying Cosmetic Override")); | |
| Info.ExpireDuration = 2.0f; | |
| FSlateNotificationManager::Get().AddNotification(Info); | |
| } | |
| } | |