engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 成员函数 | Protected 属性 | 友元 | 所有成员列表
ULocalPlayer类 参考

Each player that is active on the current client has a LocalPlayer. 更多...

#include <LocalPlayer.h>

继承自 UPlayer .

Public 成员函数

virtual FSceneView * CalcSceneView (class FSceneViewFamily *ViewFamily, FVector &OutViewLocation, FRotator &OutViewRotation, FViewport *Viewport, class FViewElementDrawer *ViewDrawer=NULL, EStereoscopicPass StereoPass=eSSP_FULL)
 Calculate the view settings for drawing from this view actor 更多...
 
bool CalcSceneViewInitOptions (struct FSceneViewInitOptions &OutInitOptions, FViewport *Viewport, class FViewElementDrawer *ViewDrawer=NULL, EStereoscopicPass StereoPass=eSSP_FULL)
 Calculate the view init settings for drawing from this view actor 更多...
 
void CleanupViewState ()
 Clear cached view state. 更多...
 
virtual void FinishDestroy () override
 Called to finish destroying the object. 更多...
 
FUniqueNetIdRepl GetCachedUniqueNetId () const
 Retrieves this player's unique net ID that was previously cached 更多...
 
int32 GetControllerId () const
 Returns the controller ID for the player
 
UGameInstance * GetGameInstance () const
 Get the game instance associated with this local player 更多...
 
virtual FString GetGameLoginOptions () const
 Retrieves any game-specific login options for this player if this function returns a non-empty string, the returned option or options be added passed in to the level loading and connection code. 更多...
 
virtual FString GetNickname () const
 Retrieves this player's name/tag from the online subsystem if this function returns a non-empty string, the returned name will replace the "Name" URL parameter passed around in the level loading and connection code, which normally comes from DefaultEngine.ini 更多...
 
bool GetPixelBoundingBox (const FBox &ActorBox, FVector2D &OutLowerLeft, FVector2D &OutUpperRight, const FVector2D *OptionalAllotedSize=nullptr)
 This function will give you two points in Pixel Space that surround the World Space box. 更多...
 
bool GetPixelPoint (const FVector &InPoint, FVector2D &OutPoint, const FVector2D *OptionalAllotedSize=nullptr)
 This function will give you a point in Pixel Space from a World Space position 更多...
 
FUniqueNetIdRepl GetPreferredUniqueNetId () const
 Retrieves the preferred unique net id. 更多...
 
virtual bool GetProjectionData (FViewport *Viewport, EStereoscopicPass StereoPass, FSceneViewProjectionData &ProjectionData) const
 Helper function for deriving various bits of data needed for projection 更多...
 
FReply & GetSlateOperations ()
 Getter for slate operations.
 
TSharedPtr< FSlateUser > GetSlateUser ()
 Get the SlateUser that this LocalPlayer corresponds to
 
template<typename TSubsystemClass >
TSubsystemClass * GetSubsystem () const
 Get a Subsystem of specified type
 
template<typename TSubsystemClass >
const TArray< TSubsystemClass * > & GetSubsystemArray () const
 Get all Subsystem of specified type, this is only necessary for interfaces that can have multiple implementations instanced at a time. 更多...
 
ULocalPlayerSubsystem * GetSubsystemBase (TSubclassOf< ULocalPlayerSubsystem > SubsystemClass) const
 Get a Subsystem of specified type
 
FUniqueNetIdRepl GetUniqueNetIdFromCachedControllerId () const
 Retrieves this player's unique net ID from the online subsystem 更多...
 
virtual UWorld * GetWorld () const override
 Get the world the players actor belongs to 更多...
 
bool HandleDNCommand (const TCHAR *Cmd, FOutputDevice &Ar)
 Exec command handlers
 
virtual void InitOnlineSession ()
 Called to initialize the online delegates
 
bool IsCachedUniqueNetIdPairedWithControllerId () const
 Returns true if the cached unique net id, is the one assigned to the controller id from the OSS
 
bool IsPrimaryPlayer () const
 Determines whether this player is the first and primary player on their machine. 更多...
 
virtual void PlayerAdded (class UGameViewportClient *InViewportClient, int32 InControllerID)
 Called at creation time for internal setup
 
virtual void PlayerRemoved ()
 Called when the player is removed from the viewport client
 
virtual void PostInitProperties () override
 Called after the C++ constructor and after the properties have been initialized, including those loaded from config. 更多...
 
virtual void SendSplitJoin (TArray< FString > &Options)
 Send a splitscreen join command to the server to allow a splitscreen player to connect to the game the client must already be connected to a server for this function to work 更多...
 
void SetCachedUniqueNetId (TSharedPtr< const FUniqueNetId > NewUniqueNetId)
 Sets the players current cached unique net id
 
virtual void SetControllerId (int32 NewControllerId)
 Change the ControllerId for this player; if the specified ControllerId is already taken by another player, changes the ControllerId for the other player to the ControllerId currently in use by this player. 更多...
 
virtual bool SpawnPlayActor (const FString &URL, FString &OutError, UWorld *InWorld)
 Create an actor for this player. 更多...
 
 ULocalPlayer (FVTableHelper &Helper)
 DO NOT USE. 更多...
 

静态 Public 成员函数

template<typename TSubsystemClass >
static FORCEINLINE TSubsystemClass * GetSubsystem (const ULocalPlayer *LocalPlayer)
 Get a Subsystem of specified type from the provided LocalPlayer returns nullptr if the Subsystem cannot be found or the LocalPlayer is null
 

Public 属性

TEnumAsByte< enum EAspectRatioAxisConstraint > AspectRatioAxisConstraint
 How to constrain perspective viewport FOV
 
uint32 bSentSplitJoin:1
 set when we've sent a split join request
 
FUniqueNetIdRepl CachedUniqueNetId
 The FUniqueNetId which this player is associated with.
 
FVector LastViewLocation
 The location of the player's view the previous frame.
 
FVector2D Origin
 The coordinates for the upper left corner of the master viewport subregion allocated to this player. 更多...
 
TSubclassOf< class APlayerController > PendingLevelPlayerControllerClass
 The class of PlayerController to spawn for players logging in.
 
FVector2D Size
 The size of the master viewport subregion allocated to this player. 更多...
 
class UGameViewportClient * ViewportClient
 The master viewport containing this player's view.
 

Protected 成员函数

void ExecMacro (const TCHAR *Filename, FOutputDevice &Ar)
 
virtual void GetViewPoint (FMinimalViewInfo &OutViewInfo, EStereoscopicPass StereoPass=eSSP_FULL) const
 Retrieve the viewpoint of this player. 更多...
 

Protected 属性

FReply SlateOperations
 FReply used to defer some slate operations.
 

友元

class FLockedViewState
 Locked view state needs access to GetViewPoint.
 

详细描述

Each player that is active on the current client has a LocalPlayer.

It stays active across maps There may be several spawned in the case of splitscreen/coop. There may be 0 spawned on servers.

示例
/github/workspace/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

构造及析构函数说明

◆ ULocalPlayer()

ULocalPlayer::ULocalPlayer ( FVTableHelper &  Helper)
inline

DO NOT USE.

This constructor is for internal usage only for hot-reload purposes.

成员函数说明

◆ CalcSceneView()

virtual FSceneView * ULocalPlayer::CalcSceneView ( class FSceneViewFamily *  ViewFamily,
FVector &  OutViewLocation,
FRotator &  OutViewRotation,
FViewport *  Viewport,
class FViewElementDrawer *  ViewDrawer = NULL,
EStereoscopicPass  StereoPass = eSSP_FULL 
)
virtual

Calculate the view settings for drawing from this view actor

参数
View- output view struct
OutViewLocation- output actor location
OutViewRotation- output actor rotation
Viewport- current client viewport
ViewDrawer- optional drawing in the view
StereoPass- whether we are drawing the full viewport, or a stereo left / right pass

◆ CalcSceneViewInitOptions()

bool ULocalPlayer::CalcSceneViewInitOptions ( struct FSceneViewInitOptions &  OutInitOptions,
FViewport *  Viewport,
class FViewElementDrawer *  ViewDrawer = NULL,
EStereoscopicPass  StereoPass = eSSP_FULL 
)

Calculate the view init settings for drawing from this view actor

参数
OutInitOptions- output view struct. Not every field is initialized, some of them are only filled in by CalcSceneView
Viewport- current client viewport
ViewDrawer- optional drawing in the view
StereoPass- whether we are drawing the full viewport, or a stereo left / right pass
返回
true if the view options were filled in. false in various fail conditions.

◆ CleanupViewState()

void ULocalPlayer::CleanupViewState ( )

Clear cached view state.

Suitable for calling when cleaning up the world but the view state has some references objects (usually mids) owned by the world (thus preventing GC)

◆ ExecMacro()

void ULocalPlayer::ExecMacro ( const TCHAR *  Filename,
FOutputDevice &  Ar 
)
protected
待办事项:
document

◆ FinishDestroy()

virtual void ULocalPlayer::FinishDestroy ( )
overridevirtual

Called to finish destroying the object.

After UObject::FinishDestroy is called, the object's memory should no longer be accessed.

警告
Because properties are destroyed here, Super::FinishDestroy() should always be called at the end of your child class's FinishDestroy() method, rather than at the beginning.

重载 UObject .

◆ GetCachedUniqueNetId()

FUniqueNetIdRepl ULocalPlayer::GetCachedUniqueNetId ( ) const

Retrieves this player's unique net ID that was previously cached

返回
unique Id associated with this player

◆ GetGameInstance()

UGameInstance * ULocalPlayer::GetGameInstance ( ) const

Get the game instance associated with this local player

返回
GameInstance related to local player

◆ GetGameLoginOptions()

virtual FString ULocalPlayer::GetGameLoginOptions ( ) const
inlinevirtual

Retrieves any game-specific login options for this player if this function returns a non-empty string, the returned option or options be added passed in to the level loading and connection code.

Options are in URL format, key=value, with multiple options concatenated together with an & between each key/value pair

返回
URL Option or options for this game, Empty string otherwise

◆ GetNickname()

virtual FString ULocalPlayer::GetNickname ( ) const
virtual

Retrieves this player's name/tag from the online subsystem if this function returns a non-empty string, the returned name will replace the "Name" URL parameter passed around in the level loading and connection code, which normally comes from DefaultEngine.ini

返回
Name of player if specified (by onlinesubsystem or otherwise), Empty string otherwise

◆ GetPixelBoundingBox()

bool ULocalPlayer::GetPixelBoundingBox ( const FBox &  ActorBox,
FVector2D &  OutLowerLeft,
FVector2D &  OutUpperRight,
const FVector2D *  OptionalAllotedSize = nullptr 
)

This function will give you two points in Pixel Space that surround the World Space box.

参数
ActorBoxThe World Space Box
OutLowerLeftThe Lower Left corner of the Pixel Space box
OutUpperRightThe Upper Right corner of the pixel space box
返回
False if there is no viewport, or if the box is behind the camera completely

◆ GetPixelPoint()

bool ULocalPlayer::GetPixelPoint ( const FVector &  InPoint,
FVector2D &  OutPoint,
const FVector2D *  OptionalAllotedSize = nullptr 
)

This function will give you a point in Pixel Space from a World Space position

参数
InPointThe point in world space
OutPointThe point in pixel space
返回
False if there is no viewport, or if the box is behind the camera completely

◆ GetPreferredUniqueNetId()

FUniqueNetIdRepl ULocalPlayer::GetPreferredUniqueNetId ( ) const

Retrieves the preferred unique net id.

This is for backwards compatibility for games that don't use the cached unique net id logic

返回
unique Id associated with this player

◆ GetProjectionData()

virtual bool ULocalPlayer::GetProjectionData ( FViewport *  Viewport,
EStereoscopicPass  StereoPass,
FSceneViewProjectionData &  ProjectionData 
) const
virtual

Helper function for deriving various bits of data needed for projection

参数
ViewportThe ViewClient's viewport
StereoPassWhether this is a full viewport pass, or a left/right eye pass
ProjectionDataThe structure to be filled with projection data
返回
False if there is no viewport, or if the Actor is null

◆ GetSubsystemArray()

template<typename TSubsystemClass >
const TArray< TSubsystemClass * > & ULocalPlayer::GetSubsystemArray ( ) const
inline

Get all Subsystem of specified type, this is only necessary for interfaces that can have multiple implementations instanced at a time.

Do not hold onto this Array reference unless you are sure the lifetime is less than that of ULocalPlayer

◆ GetUniqueNetIdFromCachedControllerId()

FUniqueNetIdRepl ULocalPlayer::GetUniqueNetIdFromCachedControllerId ( ) const

Retrieves this player's unique net ID from the online subsystem

返回
unique Id associated with this player

◆ GetViewPoint()

virtual void ULocalPlayer::GetViewPoint ( FMinimalViewInfo &  OutViewInfo,
EStereoscopicPass  StereoPass = eSSP_FULL 
) const
protectedvirtual

Retrieve the viewpoint of this player.

参数
OutViewInfo- Upon return contains the view information for the player.
StereoPass- Which stereoscopic pass, if any, to get the viewport for. This will include eye offsetting

◆ GetWorld()

virtual UWorld * ULocalPlayer::GetWorld ( ) const
overridevirtual

Get the world the players actor belongs to

返回
Returns the world of the LocalPlayer's PlayerController. NULL if the LocalPlayer does not have a PlayerController

◆ IsPrimaryPlayer()

bool ULocalPlayer::IsPrimaryPlayer ( ) const

Determines whether this player is the first and primary player on their machine.

返回
true if this player is not using splitscreen, or is the first player in the split-screen layout.

◆ PostInitProperties()

virtual void ULocalPlayer::PostInitProperties ( )
overridevirtual

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

This is called before any serialization or other setup has happened.

重载 UObject .

◆ SendSplitJoin()

virtual void ULocalPlayer::SendSplitJoin ( TArray< FString > &  Options)
virtual

Send a splitscreen join command to the server to allow a splitscreen player to connect to the game the client must already be connected to a server for this function to work

注解
this happens automatically for all viewports that exist during the initial server connect so it's only necessary to manually call this for viewports created after that if the join fails (because the server was full, for example) all viewports on this client will be disconnected
参数
Optionsarray of URL options to append.

◆ SetControllerId()

virtual void ULocalPlayer::SetControllerId ( int32  NewControllerId)
virtual

Change the ControllerId for this player; if the specified ControllerId is already taken by another player, changes the ControllerId for the other player to the ControllerId currently in use by this player.

参数
NewControllerIdthe ControllerId to assign to this player.

◆ SpawnPlayActor()

virtual bool ULocalPlayer::SpawnPlayActor ( const FString &  URL,
FString &  OutError,
UWorld *  InWorld 
)
virtual

Create an actor for this player.

参数
URL- The URL the player joined with.
OutError- If an error occurred, returns the error description.
InWorld- World in which to spawn the play actor
返回
False if an error occurred, true if the play actor was successfully spawned.

类成员变量说明

◆ Origin

FVector2D ULocalPlayer::Origin

The coordinates for the upper left corner of the master viewport subregion allocated to this player.

0-1

◆ Size

FVector2D ULocalPlayer::Size

The size of the master viewport subregion allocated to this player.

0-1


该类的文档由以下文件生成: