void FShooterMainMenu::HostTeamDeathMatch() { EMap SelectedMap = GetSelectedMap(); AShooterPlayerController_Menu * ShooterPC = Cast<AShooterPlayerController_Menu>(PCOwner); FString StartStr = FString::Printf(TEXT("/Game/Maps/%s?game=TDM?listen%s?%s=%d"), *MapNames[(int)SelectedMap], bIsLanMatch ? TEXT("?bIsLanMatch") : TEXT(""), *AShooterGameMode::GetBotsCountOptionName(), BotsCountOpt); CreateSplitScreenPlayers(); if (ShooterPC != NULL && ShooterPC->CreateGame(LOCTEXT("TDM","TDM").ToString(), StartStr)) { // Set presence for playing in a map if(ShooterPC->PlayerState && ShooterPC->PlayerState->UniqueId.IsValid()) { const auto Presence = Online::GetPresenceInterface(); if(Presence.IsValid()) { FPresenceProperties Props; Props.Add(DefaultPresenceKey, FVariantData(FString("InGame"))); Presence->SetPresence(*ShooterPC->PlayerState->UniqueId, Props); } } FSlateApplication::Get().SetFocusToGameViewport(); LockAndHideMenu(); DisplayLoadingScreen(); } }
bool AShooterPlayerController::SetPause(bool bPause, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/) { const bool Result = APlayerController::SetPause(bPause, CanUnpauseDelegate); // Update rich presence. const auto PresenceInterface = Online::GetPresenceInterface(); const auto Events = Online::GetEventsInterface(); if(PresenceInterface.IsValid() && PlayerState->UniqueId.IsValid()) { FPresenceProperties Props; if(Result && bPause) { Props.Add(DefaultPresenceKey, FString("Paused")); } else { Props.Add(DefaultPresenceKey, FString("InGame")); } PresenceInterface->SetPresence(*PlayerState->UniqueId, Props); } if(Events.IsValid() && PlayerState->UniqueId.IsValid()) { FOnlineEventParms Params; Params.Add( TEXT( "GameplayModeId" ), FVariantData( (int32)1 ) ); Params.Add( TEXT( "DifficultyLevelId" ), FVariantData( (int32)0 ) ); if(Result && bPause) { Events->TriggerEvent(*PlayerState->UniqueId, TEXT("PlayerSessionPause"), Params); } else { Events->TriggerEvent(*PlayerState->UniqueId, TEXT("PlayerSessionResume"), Params); } } return Result; }