2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Subsystems/GameInstanceSubsystem.h"
|
|
|
|
#include "UObject/SoftObjectPtr.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
#include "GameUIManagerSubsystem.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class FSubsystemCollectionBase;
|
2022-05-23 18:41:30 +00:00
|
|
|
class UCommonLocalPlayer;
|
2022-09-13 07:18:28 +00:00
|
|
|
class UGameUIPolicy;
|
|
|
|
class UObject;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This manager is intended to be replaced by whatever your game needs to
|
|
|
|
* actually create, so this class is abstract to prevent it from being created.
|
|
|
|
*
|
|
|
|
* If you just need the basic functionality you will start by sublcassing this
|
|
|
|
* subsystem in your own game.
|
|
|
|
*/
|
|
|
|
UCLASS(Abstract, config = Game)
|
|
|
|
class COMMONGAME_API UGameUIManagerSubsystem : public UGameInstanceSubsystem
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UGameUIManagerSubsystem() { }
|
|
|
|
|
|
|
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
|
|
|
virtual void Deinitialize() override;
|
|
|
|
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
|
|
|
|
|
|
|
|
const UGameUIPolicy* GetCurrentUIPolicy() const { return CurrentPolicy; }
|
|
|
|
UGameUIPolicy* GetCurrentUIPolicy() { return CurrentPolicy; }
|
|
|
|
|
|
|
|
virtual void NotifyPlayerAdded(UCommonLocalPlayer* LocalPlayer);
|
|
|
|
virtual void NotifyPlayerRemoved(UCommonLocalPlayer* LocalPlayer);
|
|
|
|
virtual void NotifyPlayerDestroyed(UCommonLocalPlayer* LocalPlayer);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void SwitchToPolicy(UGameUIPolicy* InPolicy);
|
|
|
|
|
|
|
|
private:
|
|
|
|
UPROPERTY(Transient)
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<UGameUIPolicy> CurrentPolicy = nullptr;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UPROPERTY(config, EditAnywhere)
|
|
|
|
TSoftClassPtr<UGameUIPolicy> DefaultUIPolicyClass;
|
|
|
|
};
|