File size: 2,883 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CommonLocalPlayer.h"
#include "Teams/LyraTeamAgentInterface.h"
#include "LyraLocalPlayer.generated.h"
#define UE_API LYRAGAME_API
struct FGenericTeamId;
class APlayerController;
class UInputMappingContext;
class ULyraSettingsLocal;
class ULyraSettingsShared;
class UObject;
class UWorld;
struct FFrame;
struct FSwapAudioOutputResult;
/**
* ULyraLocalPlayer
*/
UCLASS(MinimalAPI)
class ULyraLocalPlayer : public UCommonLocalPlayer, public ILyraTeamAgentInterface
{
GENERATED_BODY()
public:
UE_API ULyraLocalPlayer();
//~UObject interface
UE_API virtual void PostInitProperties() override;
//~End of UObject interface
//~UPlayer interface
UE_API virtual void SwitchController(class APlayerController* PC) override;
//~End of UPlayer interface
//~ULocalPlayer interface
UE_API virtual bool SpawnPlayActor(const FString& URL, FString& OutError, UWorld* InWorld) override;
UE_API virtual void InitOnlineSession() override;
//~End of ULocalPlayer interface
//~ILyraTeamAgentInterface interface
UE_API virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
UE_API virtual FGenericTeamId GetGenericTeamId() const override;
UE_API virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() override;
//~End of ILyraTeamAgentInterface interface
/** Gets the local settings for this player, this is read from config files at process startup and is always valid */
UFUNCTION()
UE_API ULyraSettingsLocal* GetLocalSettings() const;
/** Gets the shared setting for this player, this is read using the save game system so may not be correct until after user login */
UFUNCTION()
UE_API ULyraSettingsShared* GetSharedSettings() const;
/** Starts an async request to load the shared settings, this will call OnSharedSettingsLoaded after loading or creating new ones */
UE_API void LoadSharedSettingsFromDisk(bool bForceLoad = false);
protected:
UE_API void OnSharedSettingsLoaded(ULyraSettingsShared* LoadedOrCreatedSettings);
UE_API void OnAudioOutputDeviceChanged(const FString& InAudioOutputDeviceId);
UFUNCTION()
UE_API void OnCompletedAudioDeviceSwap(const FSwapAudioOutputResult& SwapResult);
UE_API void OnPlayerControllerChanged(APlayerController* NewController);
UFUNCTION()
UE_API void OnControllerChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam);
private:
UPROPERTY(Transient)
mutable TObjectPtr<ULyraSettingsShared> SharedSettings;
FUniqueNetIdRepl NetIdForSharedSettings;
UPROPERTY(Transient)
mutable TObjectPtr<const UInputMappingContext> InputMappingContext;
UPROPERTY()
FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate;
UPROPERTY()
TWeakObjectPtr<APlayerController> LastBoundPC;
};
#undef UE_API
|