RealtimeStyleTransferRuntime/Source/LyraGame/Player/LyraLocalPlayer.h

88 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AudioMixerBlueprintLibrary.h"
#include "CommonLocalPlayer.h"
#include "Containers/UnrealString.h"
#include "GenericTeamAgentInterface.h"
#include "HAL/Platform.h"
#include "Teams/LyraTeamAgentInterface.h"
#include "UObject/UObjectGlobals.h"
#include "UObject/WeakObjectPtrTemplates.h"
#include "LyraLocalPlayer.generated.h"
class APlayerController;
class UInputMappingContext;
class ULyraSettingsLocal;
class ULyraSettingsShared;
class UObject;
class UWorld;
struct FFrame;
struct FSwapAudioOutputResult;
/**
* ULyraLocalPlayer
*/
UCLASS()
class LYRAGAME_API ULyraLocalPlayer : public UCommonLocalPlayer, public ILyraTeamAgentInterface
{
GENERATED_BODY()
public:
ULyraLocalPlayer();
//~UObject interface
virtual void PostInitProperties() override;
//~End of UObject interface
//~UPlayer interface
virtual void SwitchController(class APlayerController* PC) override;
//~End of UPlayer interface
//~ULocalPlayer interface
virtual bool SpawnPlayActor(const FString& URL, FString& OutError, UWorld* InWorld) override;
virtual void InitOnlineSession() override;
//~End of ULocalPlayer interface
//~ILyraTeamAgentInterface interface
virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
virtual FGenericTeamId GetGenericTeamId() const override;
virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() override;
//~End of ILyraTeamAgentInterface interface
public:
UFUNCTION()
ULyraSettingsLocal* GetLocalSettings() const;
UFUNCTION()
ULyraSettingsShared* GetSharedSettings() const;
protected:
void OnAudioOutputDeviceChanged(const FString& InAudioOutputDeviceId);
UFUNCTION()
void OnCompletedAudioDeviceSwap(const FSwapAudioOutputResult& SwapResult);
private:
void OnPlayerControllerChanged(APlayerController* NewController);
UFUNCTION()
void OnControllerChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam);
private:
UPROPERTY(Transient)
mutable TObjectPtr<ULyraSettingsShared> SharedSettings;
UPROPERTY(Transient)
mutable TObjectPtr<const UInputMappingContext> InputMappingContext;
UPROPERTY()
FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate;
UPROPERTY()
TWeakObjectPtr<APlayerController> LastBoundPC;
};