Skip to content

Instantly share code, notes, and snippets.

@dorgonman
Created June 30, 2018 16:24
Show Gist options
  • Save dorgonman/1e141fc4cb10353aa395fa37c9ec8e74 to your computer and use it in GitHub Desktop.
Save dorgonman/1e141fc4cb10353aa395fa37c9ec8e74 to your computer and use it in GitHub Desktop.
wordpress_post1583_06.cpp
void AMyGameModeBase::OnSpectatorReady()
{
++NumReadySpectator;
UE_LOG(LogTemp, Log, TEXT("OnSpectatorReady NumReadySpectator: %d"), NumReadySpectator);
}
void AMyGameModeBase::OnSpectatorLeave()
{
--NumReadySpectator;
UE_LOG(LogTemp, Log, TEXT("OnSpectatorLeave NumReadySpectator: %d"), NumReadySpectator);
}
APlayerController* AMyGameModeBase::Login(UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
auto pc = Super::Login(NewPlayer, InRemoteRole, Portal, Options, UniqueId, ErrorMessage);
if (pc->PlayerState->bIsSpectator)
{
OnSpectatorReady();
}
return pc;
}
void AMyGameModeBase::Logout(AController* Exiting)
{
if (Exiting->PlayerState && Exiting->PlayerState->bIsSpectator)
{
OnSpectatorLeave();
}
Super::Logout(Exiting);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment