Skip to content
This repository was archived by the owner on Nov 8, 2020. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified EOSBasic/Content/Blueprints/BP_PlayerController.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2019-2020, Gaslight Games Ltd


#include "EOSBlueprintLibrary.h"

// Engine Includes
#include "OnlineSubsystem.h"
#include "Interfaces/OnlineIdentityInterface.h"

// EOS Plugin Includes
#include "OnlineSubsystemEOS.h"
#include "OnlineSubsystemEOSCommon.h"


bool UEOSBlueprintLibrary::RequestLoginByType(FString Id, FString Token, EEOSLoginType Type)
{
IOnlineSubsystem* SubSystem = IOnlineSubsystem::Get(EOS_SUBSYSTEM);

if (SubSystem != nullptr)
{
IOnlineIdentityPtr OnlineIdentity = SubSystem->GetIdentityInterface();

if (OnlineIdentity != nullptr)
{
FString TypeAsString = UEOSCommon::EEOSLoginTypeToString(Type);
FOnlineAccountCredentials Credentials(TypeAsString, Id, Token);
return OnlineIdentity->Login(0, Credentials);
}
}

return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ bool FOnlineIdentityEOS::Login( int32 LocalUserNum, const FOnlineAccountCredenti
FString MessageText = FString::Printf( TEXT( "Logging In with Dev Auth Tool | ID: %s | Token: %s." ), *AccountCredentials.Id, *AccountCredentials.Token );
UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText );

Credentials.Id = TCHAR_TO_UTF8( *AccountCredentials.Id );
Credentials.Token = TCHAR_TO_UTF8( *AccountCredentials.Token );
Credentials.Type = EOS_ELoginCredentialType::EOS_LCT_Developer;
EEOSLoginType LoginType = UEOSCommon::EEOSLoginTypeFromString(AccountCredentials.Type);

switch (LoginType) {
case EEOSLoginType::LT_DeveloperTool:
Credentials.Id = TCHAR_TO_UTF8(*AccountCredentials.Id);
Credentials.Token = TCHAR_TO_UTF8(*AccountCredentials.Token);
Credentials.Type = EOS_ELoginCredentialType::EOS_LCT_Developer;
break;
case EEOSLoginType::LT_EpicPortal:
Credentials.Type = EOS_ELoginCredentialType::EOS_LCT_AccountPortal;
break;
}


LoginOptions.Credentials = &Credentials;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2019-2020, Gaslight Games Ltd

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "OnlineSubsystemEOSCommon.h"
#include "EOSBlueprintLibrary.generated.h"

/**
*
*/
UCLASS()
class ONLINESUBSYSTEMEOS_API UEOSBlueprintLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()

public:
UFUNCTION(BlueprintCallable, Category = "EOS Basic", meta = (DisplayName = "Request Login"))
static bool RequestLoginByType(FString Id, FString Token, EEOSLoginType Type);
};
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,31 @@ FString UEOSCommon::EOSResultToString( EOS_EResult Result )

return "Unknown";
}

FString UEOSCommon::EEOSLoginTypeToString(EEOSLoginType LoginType) {

switch (LoginType)
{

case EEOSLoginType::LT_DeveloperTool:
return "Dev";
case EEOSLoginType::LT_EpicPortal:
return "EpicPortal";
}

return "Unknown";
}

EEOSLoginType UEOSCommon::EEOSLoginTypeFromString(FString EEOSLoginType) {
if( EEOSLoginType.Equals("Dev") )
{
return EEOSLoginType::LT_DeveloperTool;
}
else if( EEOSLoginType.Equals("EpicPortal") )
{
return EEOSLoginType::LT_EpicPortal;
}

//TODO: What do I do for a default?
return EEOSLoginType::LT_DeveloperTool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ enum class EEOSEcom : uint8
EE_UnknownError UMETA( DisplayName = "Unknown Error" )
};

UENUM(BlueprintType)
enum class EEOSLoginType : uint8
{
LT_DeveloperTool UMETA( DisplayName = "Developer Tool" ),
LT_EpicPortal UMETA( DisplayName = "Epic Portal" )
};

class UEOSCommon
{
Expand Down Expand Up @@ -131,4 +137,8 @@ class UEOSCommon
* @return FString result of the conversion.
*/
static FString EOSResultToString( EOS_EResult Result );

static FString EEOSLoginTypeToString( EEOSLoginType LoginType );

static EEOSLoginType EEOSLoginTypeFromString( FString EEOSLoginType );
};
4 changes: 3 additions & 1 deletion EOSBasic/Source/EOSBasic/Player/BasicPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// EOS Plugin Includes
#include "OnlineSubsystemEOS.h"
//TODO: why can't this be a .h? Isn't the static method defined there?
#include "OnlineSubsystemEOSCommon.cpp"


bool ABasicPlayerController::RequestLogin( FString Id, FString Token, FString Type )
Expand All @@ -28,4 +30,4 @@ bool ABasicPlayerController::RequestLogin( FString Id, FString Token, FString Ty
}

return false;
}
}
1 change: 1 addition & 0 deletions EOSBasic/Source/EOSBasic/Player/BasicPlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "OnlineSubsystemEOSCommon.h"
#include "BasicPlayerController.generated.h"

/**
Expand Down