文档

支持

Authentication for Unreal Engine

Authentication for Unreal Engine

类 Authentication 子系统

Reference the Authentication Subsystem class for handling connections to Unity Authentication.
阅读时间7 分钟最后更新于 4 天前

用于处理 Unity Authentication 系统连接的子系统。
Include(包括)
#include "AuthenticationSubsystem.h"
语法
UCLASS()class AUTHENTICATION_API UAuthenticationSubsystem : public UGameInstanceSubsystem

构造函数

UAuthenticationSubsystem()

Authentication 子系统的默认构造函数。

声明

UAuthenticationSubsystem()

UAuthenticationSubsystem(FVTableHelper&)

用于前向声明的覆盖构造函数。

声明

UAuthenticationSubsystem(FVTableHelper& Helper)

参数

Name

描述

Helper用于调用专用热重载构造函数的辅助类。

析构函数

UAuthenticationSubsystem()

Authentication 子系统的默认析构函数。

声明

virtual ~UAuthenticationSubsystem()

覆盖

Initialize(FSubsystemCollectionBase&)

初始化 USubsystem 的覆盖。

声明

virtual void Initialize(FSubsystemCollectionBase& Collection) override

Deinitialize()

初始化 USubsystem 的覆盖。

声明

virtual void Deinitialize() override

ShouldCreateSubsystem(UObject*)

初始化 USubsystem 的覆盖。

声明

virtual bool ShouldCreateSubsystem(UObject* Outer) const override

方法

SignInAnonymously(FAuthenticationSignInOptions, Unity::Services::Core::THandler<FAuthenticationResponse>)

匿名登录当前用户。不需要任何凭据,并且会话仅限于当前设备。

声明

void SignInAnonymously(FAuthenticationSignInOptions Options, Unity::Services::Core::THandler<FAuthenticationResponse> ResponseHandler)

参数

Name

类型

描述

Options
FAuthenticationSignInOptions登录选项。
ResponseHandler
THandler
<
FAuthenticationResponse
>
当 API 返回一个响应时执行的处理程序。

GetUserInfo(Unity::Services::Core::THandler<FAuthenticationUserResponse>)

返回当前玩家的玩家信息,例如帐户创建时间和关联的外部 ID。

声明

void GetUserInfo(Unity::Services::Core::THandler<FAuthenticationUserResponse> ResponseHandler)

参数

Name

类型

描述

ResponseHandler
THandler
<
FAuthenticationUserResponse
>
当 API 返回一个响应时执行的处理程序。

DeleteUser(Unity::Services::Core::THandler<bool>)

永久删除当前登录的用户。

声明

void DeleteUser(Unity::Services::Core::THandler<bool> ResponseHandler)

参数

Name

类型

描述

ResponseHandler
THandler
<bool>
当 API 返回一个响应时执行的处理程序。

RegisterStateChangedCallback(Unity::Services::Core::THandler<FAuthenticationStateChangedResponse>)

挂接到在身份验证状态更改时执行的委托。

声明

void RegisterStateChangedCallback(Unity::Services::Core::THandler<FAuthenticationStateChangedResponse> ResponseHandler)

参数

Name

类型

描述

ResponseHandler
THandler
<
FAuthenticationStateChangedResponse
>
在身份验证状态更改时执行的处理程序。

SignOut(bool)

在提供的配置文件名称下注销当前用户。

声明

bool SignOut(bool bClearCredentials = false)

参数

Name

类型

描述

bClearCredentials
bool
清除用于登录同一帐户的会话令牌的选项。

SwitchProfile(const FString&)

将当前配置文件切换为新的配置文件名称。如果在该名称下未找到配置文件,则会创建新的配置文件。

声明

void SwitchProfile(const FString& ProfileName) const

参数

参数名称

参数类型

描述

ProfileName
FString要切换到的配置文件的名称,如果尚不存在,则会添加该名称。

ProfileExists(const FString&)

检查配置文件是否存在。

声明

const bool ProfileExists(const FString& ProfileName) const

参数

Name

类型

描述

ProfileName
FString要检查的配置文件的名称。

返回

类型

描述

bool
如果配置文件存在,为 true,否则为 false。

GetCurrentProfileName()

返回当前配置文件的名称。

声明

const FString GetCurrentProfileName() const

返回

类型

描述

FString当前配置文件的名称。

GetProfileNames()

返回所有活跃玩家配置文件名称。

声明

const TArray<FString> GetProfileNames() const

返回

类型

描述

TArray<FString>所有活跃玩家配置文件名称。

RegisterProfileChangedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileChangedResponse>)

挂接到在玩家配置文件更改时执行的处理程序。

声明

void RegisterProfileChangedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileChangedResponse> ResponseHandler)

参数

Name

类型

描述

ResponseHandler
THandler
<
FAuthenticationPlayerProfileChangedResponse
>
在玩家配置文件更改时执行的处理程序。

RegisterProfileDeletedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)

挂接到在玩家配置文件被删除时执行的处理程序。

声明

void RegisterProfileDeletedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)

参数

Name

类型

描述

ResponseHandler
THandler
<
FAuthenticationPlayerProfileDeletedResponse
>
在玩家配置文件被删除时执行的处理程序。

IsSignedIn()

检查用户是否已登录。

声明

bool IsSignedIn() const

返回

类型

描述

bool
如果用户已登录,为 true,否则为 false。

IsAnonymous()

检查用户是否匿名登录。

声明

bool IsAnonymous() const

返回

类型

描述

bool
如果用户匿名登录,为 true,否则为 false。

IsAuthorized()

检查用户是否仍然被授权。

声明

bool IsAuthorized() const

返回

类型

描述

bool
如果用户被授权,为 true,否则为 false。

IsExpired()

检查用户会话是否到期。

声明

bool IsExpired() const

返回

类型

描述

bool
如果用户会话已到期,为 true,否则为 false。

SessionTokenExists()

检查是否为当前配置文件存储了现有会话令牌。

声明

bool SessionTokenExists() const

返回

类型

描述

bool
如果为当前配置文件存储了现有会话令牌,则为 true。

GetUnityProjectId()

返回 Unity Project ID。

声明

const FGuid GetUnityProjectId() const

返回

类型

描述

FGuidUnity Project ID。

GetUnityEnvironmentName()

返回 Unity 环境名称。

声明

const FString GetUnityEnvironmentName() const

返回

类型

描述

FStringUnity 环境名称。

GetAccessToken()

返回当前用户的访问令牌。

声明

FString GetAccessToken() const

返回

类型

描述

FString如果当前用户已登录,为当前用户的访问令牌字符串,否则为空字符串。

GetSessionToken()

返回当前用户的会话令牌。

声明

const const FString GetSessionToken() const

返回

类型

描述

FString如果当前用户已登录,为当前用户的会话令牌字符串,否则为空字符串。

GetUserId()

当前登录用户的 ID。

声明

const FString GetUserId() const

返回

类型

描述

FString如果当前用户已登录,为当前用户的 ID,否则为空字符串。

GetState()

Authentication 子系统的当前状态。

声明

const EAuthenticationStates GetState() const

返回

类型

描述

EAuthenticationStatesAuthentication 子系统的当前状态。

SetUnityProjectId(FGuid)

设置 Unity Project ID。

声明

void SetUnityProjectId(FGuid Value)

参数

Name

类型

描述

FGuid新的 Unity Project ID。

SetUnityEnvironmentName(FString)

设置 Unity 环境名称。

声明

void SetUnityEnvironmentName(FString Value)

参数

Name

类型

描述

FString新的 Unity 环境 ID。