11// Fill out your copyright notice in the Description page of Project Settings.
22
33#include " ARGameSession.h"
4-
5-
4+ #include " ARGameInstance.h"
5+ #include " ARGameMode.h"
6+ #include " ARPlayerController.h"
67
78
89FString AARGameSession::ApproveLogin (const FString& Options)
@@ -12,9 +13,6 @@ FString AARGameSession::ApproveLogin(const FString& Options)
1213 TArray<FString> OutParams;
1314 Options.ParseIntoArray (OutParams, TEXT (" ?" ));
1415
15- int32 Idx = Options.Find (" PlayerId=" );
16- int32 KeyIdx = Idx + 9 ;
17-
1816 TArray<FString> OutPlayerId;
1917 FString Left;
2018 FString PlayerId;
@@ -37,4 +35,33 @@ FString AARGameSession::ApproveLogin(const FString& Options)
3735
3836
3937 return Output;
38+ }
39+
40+ void AARGameSession::UnregisterPlayer (const APlayerController* ExitingPlayer)
41+ {
42+ #if LINUX_GAMELIFT
43+ if (const AARPlayerController* PC = Cast<AARPlayerController>(ExitingPlayer))
44+ {
45+ FString GLId = PC->GameLiftId ;
46+ FGameLiftServerSDKModule* gameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>(FName (" GameLiftServerSDK" ));
47+ FGameLiftGenericOutcome out = gameLiftSdkModule->RemovePlayerSession (GLId);
48+
49+ FString ErrorName = out.GetError ().m_errorName ;
50+ FString ErrorMessage = out.GetError ().m_errorMessage ;
51+ }
52+ #endif
53+
54+ Super::UnregisterPlayer (ExitingPlayer);
55+
56+ /* AARGameMode* GM = Cast<AARGameMode>(GetOuter());
57+ int32 NumPlayer = GM->GetNumPlayers();
58+ if (NumPlayer <= 0)
59+ {
60+ #if LINUX_GAMELIFT
61+ FString GLId = PC->GameLiftId;
62+ FGameLiftServerSDKModule* gameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>(FName("GameLiftServerSDK"));
63+ gameLiftSdkModule->TerminateGameSession();
64+ #endif
65+ }*/
66+
4067}
0 commit comments