| 6 | #include "GameFramework/PlayerState.h" |
| 7 | |
| 8 | void ALobbyGameMode::PostLogin(APlayerController* NewPlayer) |
| 9 | { |
| 10 | Super::PostLogin(NewPlayer); |
| 11 | |
| 12 | if (GameState) |
| 13 | { |
| 14 | int32 NumberOfPlayers = GameState.Get()->PlayerArray.Num(); |
| 15 | |
| 16 | if (GEngine) |
| 17 | { |
| 18 | GEngine->AddOnScreenDebugMessage( |
| 19 | 1, |
| 20 | 600.f, |
| 21 | FColor::Yellow, |
| 22 | FString::Printf(TEXT("Players in game: %d"), NumberOfPlayers) |
| 23 | ); |
| 24 | |
| 25 | APlayerState* PlayerState = NewPlayer->GetPlayerState<APlayerState>(); |
| 26 | if (PlayerState) |
| 27 | { |
| 28 | FString PlayerName = PlayerState->GetPlayerName(); |
| 29 | GEngine->AddOnScreenDebugMessage( |
| 30 | 2, |
| 31 | 60.f, |
| 32 | FColor::Cyan, |
| 33 | FString::Printf(TEXT("%s has joined the game!"), *PlayerName) |
| 34 | ); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | void ALobbyGameMode::Logout(AController* Exiting) |
| 41 | { |
nothing calls this directly
no outgoing calls
no test coverage detected