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(); } }
void JabberBotSession::RunSession(void) { SetPresence(PresenceStanza::Available); JabberIqRoster rosterQuery; m_session->SendMessage(rosterQuery, false); while(m_continueRunning) { time_t now = time(NULL); while (!m_upcomingQueue.empty() && (now > m_upcomingQueue.top().Next())) { std::ostringstream message; message << "Appending " << m_upcomingQueue.top().User() << " to the list of people who get messages now" << std::endl; syslog(LOG_NOTICE, message.str().c_str()); m_sendList.insert(m_upcomingQueue.top().User()); m_upcomingQueue.pop(); } ProcessSendList(); if (m_eod < now) { time_t bod = m_eod; m_eod += 86400; m_sendList.clear(); while (!m_upcomingQueue.empty()) { m_upcomingQueue.pop(); } Dbc *cursor; m_subscriptionDb.cursor(NULL, &cursor, 0); if (NULL != cursor) { Dbt key, data; m_eod = bod + 86400; while (0 == cursor->get(&key, &data, DB_NEXT)) { std::string user((char *)key.get_data()); time_t t1 = random() % 43200; time_t t2 = random() % 43200; Upcoming newEntry(user, bod + t1 + t2); m_upcomingQueue.push(newEntry); } cursor->close(); } } sleep(1); } }
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; }