第三方账户关联

可以在一个游戏账户中关联或解除关联多个第三方账户。

账户关联功能


如要使用Google、Facebook、NAVER等第三方账户的关联功能,请使用下列代码。

UENUM()
namespace ENLinkingType
{
    enum Type
    {
        NONE,
        GOOGLEPLAY,
        GAMECENTER,
        GOOGLE,
        FACEBOOK,
        NAVER,
        TWITTER,
        LINE,
        APPLE,
        THIRDPARTYSDK
    };
}

if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
    FGamePotSDKPluginModule::GetSharedGamePotSdk()->createLinking(ENLinkingType::Type linkingType);

void ASampleGameModeBase::OnCreateLinkingSuccess(FNUserInfo NUserInfo) {
        // 账户关联成功
}

void ASampleGameModeBase::OnCreateLinkingCancel() {
        // 玩家取消账户关联时

}
void ASampleGameModeBase::OnCreateLinkingFailure(FNError NError) {
        // 账户关联失败。请使用NError.message显示错误消息。
}

关联列表确认功能


如要确认与账户关联的第三方账户列表,请使用下列代码。

if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
     TArray<FNLinkingInfo> linkedList = FGamePotSDKPluginModule::GetSharedGamePotSdk()->getLinkedList();


//定义链接信息
USTRUCT()
struct FNLinkingInfo
{
    UPROPERTY()
    ENLinkingType::Type provider;     // 账户关联信息(Google、FaceBook、NAVER、Apple…)
}
}

解除关联功能


如要使用解除与第三方账户的关联功能,请使用下列代码。

if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
    FGamePotSDKPluginModule::GetSharedGamePotSdk()->deleteLinking(ENLinkingType::Type linkType);

void ASampleGameModeBase::OnDeleteLinkingSuccess() {
/// 账户关联解除成功
}

void ASampleGameModeBase::OnDeleteLinkingFailure(FNError NError) {
    /// 账户关联解除失败。请使用NError.message显示错误消息。
}

Last updated