cstrike15_src/game/client/cstrike15/Scaleform/overwatchresolution_scaleform.cpp
2025-06-04 03:22:50 +02:00

99 lines
2.3 KiB
C++
Raw Blame History

//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#if defined( INCLUDE_SCALEFORM )
#include "overwatchresolution_scaleform.h"
#include "game/client/iviewport.h"
#include "basepanel.h"
#include "iclientmode.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
SFHudOverwatchResolutionPanel* SFHudOverwatchResolutionPanel::m_pInstance = NULL;
SFUI_BEGIN_GAME_API_DEF
SFUI_DECL_METHOD( HideFromScript ),
SFUI_END_GAME_API_DEF( SFHudOverwatchResolutionPanel, OverwatchResolution );
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
SFHudOverwatchResolutionPanel::SFHudOverwatchResolutionPanel()
{
g_pMatchFramework->GetEventsSubscription()->Subscribe( this );
}
SFHudOverwatchResolutionPanel::~SFHudOverwatchResolutionPanel()
{
g_pMatchFramework->GetEventsSubscription()->Unsubscribe( this );
}
void SFHudOverwatchResolutionPanel::OnEvent( KeyValues *pEvent )
{
/* Removed for partner depot */
}
void SFHudOverwatchResolutionPanel::LoadDialog( void )
{
if ( !m_pInstance )
{
m_pInstance = new SFHudOverwatchResolutionPanel();
SFUI_REQUEST_ELEMENT( SF_FULL_SCREEN_SLOT, g_pScaleformUI, SFHudOverwatchResolutionPanel, m_pInstance, OverwatchResolution );
}
}
void SFHudOverwatchResolutionPanel::UnloadDialog( void )
{
if ( m_pInstance )
{
m_pInstance->RemoveFlashElement();
}
}
void SFHudOverwatchResolutionPanel::PostUnloadFlash( void )
{
m_pInstance = NULL;
delete this;
}
void SFHudOverwatchResolutionPanel::FlashReady( void )
{
Show();
}
void SFHudOverwatchResolutionPanel::Show()
{
if ( FlashAPIIsValid() )
{
WITH_SLOT_LOCKED
{
m_pScaleformUI->Value_InvokeWithoutReturn( m_FlashAPI, "showPanel", NULL, 0 );
}
}
}
void SFHudOverwatchResolutionPanel::Hide( void )
{
if ( FlashAPIIsValid() )
{
WITH_SLOT_LOCKED
{
m_pScaleformUI->Value_InvokeWithoutReturn( m_FlashAPI, "hidePanel", 0, NULL );
}
}
}
void SFHudOverwatchResolutionPanel::HideFromScript( SCALEFORM_CALLBACK_ARGS_DECL )
{
UnloadDialog();
}
#endif // INCLUDE_SCALEFORM