LifePlay-Revival/Source/LifePlay/LPVersionSubsystem.cpp

24 lines
859 B
C++
Raw Normal View History

// Portage UE 5.5 - voir LPVersionSubsystem.h
#include "LPVersionSubsystem.h"
#include "Engine/GameInstance.h"
#include "GeneralProjectSettings.h"
#include "LifePlay.h"
#include "UObject/UnrealType.h"
void ULPVersionSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
UGameInstance* GI = GetGameInstance();
const FStrProperty* Prop = GI ? CastField<FStrProperty>(GI->GetClass()->FindPropertyByName(TEXT("version_text"))) : nullptr;
const FString Version = GetDefault<UGeneralProjectSettings>()->ProjectVersion;
if (!Prop)
{
UE_LOG(LogLifePlay, Warning, TEXT("Version : GI.version_text introuvable sur %s, version %s non affichee"), *GetNameSafe(GI), *Version);
return;
}
Prop->SetPropertyValue_InContainer(GI, Version);
UE_LOG(LogLifePlay, Display, TEXT("Version affichee : LifePlay %s"), *Version);
}