Skip to content
Snippets Groups Projects
Commit b1c59b3a authored by Giovanni Vindiola's avatar Giovanni Vindiola :speech_balloon:
Browse files

Updated RedpointEOS Plugin from upstream experimental UE v5.1 support.

parent 5323d637
No related branches found
No related tags found
No related merge requests found
Subproject commit 27c449e8e5e378d7b51b482d12cd01cc962b81de
Subproject commit d31be030f60231f8a95b253e5dba9bafc3bf8fcf
......@@ -5,6 +5,7 @@
#include <ArnoEOSSubsystem.h>
#include "RedpointEOSInterfaces/Private/Interfaces/OnlineLobbyInterface.h"
#include <arnocMain/arnocMainGameModeBase.h>
void AARNOPlayerController::OnLoginComplete(const FString& PlayerName, const FVoiceChatResult& Result)
{
......@@ -25,6 +26,20 @@ void AARNOPlayerController::SetupInputComponent()
// InputComponent->BindAction("PushToTalk", IE_Released, this, &AARNOPlayerController::MuteVOIP);
}
void AARNOPlayerController::OnNetCleanup(UNetConnection* Connection)
{
if (GetLocalRole() == ROLE_Authority && PlayerState != NULL)
{
AarnocMainGameModeBase* GameMode = Cast<AarnocMainGameModeBase>(GetWorld()->GetAuthGameMode());
if (GameMode)
{
GameMode->PreLogout(this);
}
}
Super::OnNetCleanup(Connection);
}
void AARNOPlayerController::DoLogin()
{
IVoiceChat* VoiceChat = IVoiceChat::Get();
......
......@@ -45,6 +45,7 @@ class ARNOCMAIN_API AARNOPlayerController : public APlayerController
public:
virtual void SetupInputComponent() override;
virtual void OnNetCleanup(UNetConnection* Connection) override;
UFUNCTION(BluePrintCallable)
void DoLogin();
......
......@@ -111,6 +111,48 @@ void AarnocMainGameModeBase::PostLogin(APlayerController* NewPlayer)
CustomPC));
}
void AarnocMainGameModeBase::PreLogout(APlayerController* InPlayerController)
{
check(IsValid(InPlayerController));
// This code handles logins for both the local player (listen server) and remote players (net connection).
FUniqueNetIdRepl UniqueNetIdRepl;
if (InPlayerController->IsLocalPlayerController())
{
ULocalPlayer* LocalPlayer = InPlayerController->GetLocalPlayer();
if (IsValid(LocalPlayer))
{
UniqueNetIdRepl = LocalPlayer->GetPreferredUniqueNetId();
}
else
{
UNetConnection* RemoteNetConnection = Cast<UNetConnection>(InPlayerController->Player);
check(IsValid(RemoteNetConnection));
UniqueNetIdRepl = RemoteNetConnection->PlayerId;
}
}
else
{
UNetConnection* RemoteNetConnection = Cast<UNetConnection>(InPlayerController->Player);
check(IsValid(RemoteNetConnection));
UniqueNetIdRepl = RemoteNetConnection->PlayerId;
}
// Get the unique player ID.
TSharedPtr<const FUniqueNetId> UniqueNetId = UniqueNetIdRepl.GetUniqueNetId();
check(UniqueNetId != nullptr);
// Get the online session interface.
IOnlineSubsystem* Subsystem = Online::GetSubsystem(InPlayerController->GetWorld());
IOnlineSessionPtr Session = Subsystem->GetSessionInterface();
// Unregister the player with the "MyLocalSessionName" session; this name should match the name you provided in CreateSession.
if (!Session->UnregisterPlayer(FName(TEXT("MyLocalSessionName")), *UniqueNetId))
{
// The player could not be unregistered.
}
}
AarnocMainGameModeBase::AarnocMainGameModeBase()
{
bExistingPlayersRegistered = false;
......@@ -180,7 +222,8 @@ void AarnocMainGameModeBase::Logout(AController* Exiting)
return;
}
TSharedRef<const FUniqueNetId> UserId = GetControllerUniqueNetId(PC).ToSharedRef();
//TSharedRef<const FUniqueNetId> UserId = GetControllerUniqueNetId(PC).ToSharedRef();
TSharedRef<const FUniqueNetId> UserId = PCNet->PlayerId.GetUniqueNetId().ToSharedRef();
IOnlineSubsystem* Subsystem = Online::GetSubsystem(this->GetWorld());
TSharedPtr<IOnlineIdentity, ESPMode::ThreadSafe> Identity = Subsystem->GetIdentityInterface();
......
......@@ -23,6 +23,7 @@ public:
AarnocMainGameModeBase();
virtual void PostLogin(APlayerController* NewPlayer) override;
void PreLogout(APlayerController* InPlayerController);
void RegisterExistingPlayers();
virtual void Logout(AController* Exiting) override;
TSharedPtr<const FUniqueNetId> GetControllerUniqueNetId(APlayerController* InPlayerController);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment