This commit is contained in:
Riley Labrecque
2025-03-30 17:07:09 -07:00
parent e7bb839178
commit 1b9765621f
41 changed files with 780 additions and 289 deletions
+58 -1
View File
@@ -68,6 +68,15 @@ public:
AddMenuItem( COverlayExamplesMenu::MenuItem_t( "Set Notification Position: Bottom Left", { OverlayExample_t::k_EOverlayExampleItem_Notification_SetPosition, "2" } ) );
AddMenuItem( COverlayExamplesMenu::MenuItem_t( "Set Notification Position: Bottom Right", { OverlayExample_t::k_EOverlayExampleItem_Notification_SetPosition, "3" } ) );
if ( m_pOverlayExamples->BHasLastGamePhase() )
{
AddMenuItem( COverlayExamplesMenu::MenuItem_t( "Show last match", { OverlayExample_t::k_EOverlayExampleItem_Timeline_OpenOverlayToGamePhase } ) );
}
if ( m_pOverlayExamples->BHasLastTimelineEvent() )
{
AddMenuItem( COverlayExamplesMenu::MenuItem_t( "Show last crash into sun", { OverlayExample_t::k_EOverlayExampleItem_Timeline_OpenOverlayToTimelineEvent } ) );
}
AddMenuItem( COverlayExamplesMenu::MenuItem_t( "Return to main menu", { OverlayExample_t::k_EOverlayExampleItem_BackToMenu, NULL } ) );
PopSelectedItem();
@@ -195,6 +204,13 @@ void COverlayExamples::RunFrame()
SteamUtils()->SetOverlayNotificationPosition( (ENotificationPosition)atoi( m_delayedCommand.m_pchExtraCommandData ) );
break;
case OverlayExample_t::k_EOverlayExampleItem_Timeline_OpenOverlayToGamePhase:
SteamTimeline()->OpenOverlayToGamePhase( m_strLastGamePhaseIDToShow.c_str() );
break;
case OverlayExample_t::k_EOverlayExampleItem_Timeline_OpenOverlayToTimelineEvent:
SteamTimeline()->OpenOverlayToTimelineEvent( m_ulLastCrashIntoSunEventIDToShow );
break;
default:
break;
}
@@ -218,6 +234,20 @@ void COverlayExamples::OnMenuSelection( OverlayExample_t selection )
//-----------------------------------------------------------------------------
void COverlayExamples::Show()
{
if ( SpaceWarClient()->GetLastGamePhaseID() )
{
SteamAPICall_t hSteamAPICall = SteamTimeline()->DoesGamePhaseRecordingExist( std::to_string( SpaceWarClient()->GetLastGamePhaseID() ).c_str() );
m_SteamCallResultDoesGamePhaseRecordingExist.Set( hSteamAPICall, this, &COverlayExamples::OnDoesGamePhaseRecordingExist );
}
m_strLastGamePhaseIDToShow.erase();
if ( SpaceWarClient()->GetLastCrashIntoSunEvent() )
{
SteamAPICall_t hSteamAPICall = SteamTimeline()->DoesEventRecordingExist( SpaceWarClient()->GetLastCrashIntoSunEvent() );
m_SteamCallResultDoesEventRecordingExist.Set( hSteamAPICall, this, &COverlayExamples::OnDoesEventRecordingExist );
}
m_pMenu->Rebuild();
}
@@ -229,4 +259,31 @@ void COverlayExamples::OnScreenshotRequested( ScreenshotRequested_t *pCallback )
void COverlayExamples::OnSteamScreenshotReady( ScreenshotReady_t *pCallback )
{
}
}
void COverlayExamples::OnDoesEventRecordingExist( SteamTimelineEventRecordingExists_t *pCallback, bool bIOFailure )
{
if ( bIOFailure || !pCallback->m_bRecordingExists )
{
// nothing to do here. We didn't show these items when showing the menu
return;
}
m_ulLastCrashIntoSunEventIDToShow = pCallback->m_ulEventID;
m_pMenu->Rebuild();
}
void COverlayExamples::OnDoesGamePhaseRecordingExist( SteamTimelineGamePhaseRecordingExists_t *pCallback, bool bIOFailure )
{
if ( bIOFailure || ( pCallback->m_ulRecordingMS == 0 && pCallback->m_unClipCount == 0 ) )
{
// nothing to do here. We didn't show these items when showing the menu
return;
}
m_strLastGamePhaseIDToShow = pCallback->m_rgchPhaseID;
m_pMenu->Rebuild();
}