RealtimeStyleTransferRuntime/Source/LyraGame/System/LyraGameInstance.cpp

58 lines
1.8 KiB
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraGameInstance.h"
2022-09-13 07:18:28 +00:00
#include "CommonSessionSubsystem.h"
#include "Components/GameFrameworkComponentManager.h"
#include "Engine/LocalPlayer.h"
#include "GameplayTagContainer.h"
#include "LyraGameplayTags.h"
#include "Misc/AssertionMacros.h"
2022-05-23 18:41:30 +00:00
#include "Player/LyraPlayerController.h"
2022-09-13 07:18:28 +00:00
#include "Templates/Casts.h"
#include "Engine/LocalPlayer.h"
2022-05-23 18:41:30 +00:00
ULyraGameInstance::ULyraGameInstance(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void ULyraGameInstance::Init()
{
Super::Init();
2022-09-13 07:18:28 +00:00
// Register our custom init states
UGameFrameworkComponentManager* ComponentManager = GetSubsystem<UGameFrameworkComponentManager>(this);
if (ensure(ComponentManager))
{
const FLyraGameplayTags& GameplayTags = FLyraGameplayTags::Get();
ComponentManager->RegisterInitState(GameplayTags.InitState_Spawned, false, FGameplayTag());
ComponentManager->RegisterInitState(GameplayTags.InitState_DataAvailable, false, GameplayTags.InitState_Spawned);
ComponentManager->RegisterInitState(GameplayTags.InitState_DataInitialized, false, GameplayTags.InitState_DataAvailable);
ComponentManager->RegisterInitState(GameplayTags.InitState_GameplayReady, false, GameplayTags.InitState_DataInitialized);
}
2022-05-23 18:41:30 +00:00
}
void ULyraGameInstance::Shutdown()
{
Super::Shutdown();
}
ALyraPlayerController* ULyraGameInstance::GetPrimaryPlayerController() const
{
return Cast<ALyraPlayerController>(Super::GetPrimaryPlayerController(false));
2022-09-13 07:18:28 +00:00
}
bool ULyraGameInstance::CanJoinRequestedSession() const
{
// Temporary first pass: Always return true
// This will be fleshed out to check the player's state
if (!Super::CanJoinRequestedSession())
{
return false;
}
return true;
}