summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/store/v2/tf_store_panel2.cpp
blob: 89fa857f0917176fb3e1b2cdbea7fe5bfaf28c93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//


#include "cbase.h"
#include "store/v2/tf_store_panel2.h"
#include "store/v2/tf_store_page2.h"
#include "store/v2/tf_store_page_maps2.h"
#include "store/store_page_halloween.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CTFStorePanel2::CTFStorePanel2( vgui::Panel *parent ) : CTFBaseStorePanel(parent)
{
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStorePanel2::ApplySchemeSettings( vgui::IScheme *pScheme )
{
	BaseClass::ApplySchemeSettings( pScheme );
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStorePanel2::ShowPanel( bool bShow )
{
	BaseClass::ShowPanel( bShow );

	// Base class should turn this on
	if ( bShow && m_bOGSLogging )
	{
		EconUI()->Gamestats_Store( IE_STORE2_ENTERED );
	}

	Panel *pCheckOutButton = FindChildByName( "CheckOutButton" );
	if ( pCheckOutButton )
	{
		pCheckOutButton->RequestFocus();
	}
}

void CTFStorePanel2::OnAddToCart( void )
{
	Panel *pCheckOutButton = FindChildByName( "CheckOutButton" );
	if ( pCheckOutButton )
	{
		pCheckOutButton->RequestFocus();
	}
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStorePanel2::OnThink()
{
	BaseClass::OnThink();
}

void CTFStorePanel2::OnKeyCodePressed( vgui::KeyCode code )
{
	// ESC cancels
	if ( code == KEY_XBUTTON_B )
	{
		OnCommand( "close" );
	}
	else
	{
		BaseClass::OnKeyCodePressed( code );
	}
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStorePanel2::PostTransactionCompleted( void )
{
	BaseClass::PostTransactionCompleted();
}

//-----------------------------------------------------------------------------
// Purpose: Static store page factory.
//-----------------------------------------------------------------------------
CStorePage *CTFStorePanel2::CreateStorePage( const CEconStoreCategoryManager::StoreCategory_t *pPageData )
{
	if ( pPageData )
	{
		if ( !Q_strcmp( pPageData->m_pchPageClass, "CStorePage_SpecialPromo" ) )
			return new CTFStorePage_SpecialPromo( this, pPageData );

		if ( !Q_strcmp( pPageData->m_pchPageClass, "CStorePage_Maps" ) )
			return new CTFStorePage_Maps2( this, pPageData );

		if ( !Q_strcmp( pPageData->m_pchPageClass, "CStorePage_Popular" ) )
			return new CTFStorePage_Popular( this, pPageData );
	}

	// Default, standard store page.
	return new CTFStorePage2( this, pPageData );
}