summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/tf_lobbypanel_comp.h
blob: 1e0d843a6dac0ef2bf2d6d3cbd0c2ce0f3f0a5c6 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef TF_LOBBYPANEL_COMP_H
#define TF_LOBBYPANEL_COMP_H

#include "cbase.h"
#include "game/client/iviewport.h"
#include "tf_lobbypanel.h"
#include "tf_leaderboardpanel.h"
#include "local_steam_shared_object_listener.h"

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

using namespace GCSDK;

class CBaseLobbyPanel;

namespace vgui
{
	class ScrollableEditablePanel;
};

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CLadderLobbyLeaderboard : public CTFLeaderboardPanel
{
	DECLARE_CLASS_SIMPLE( CLadderLobbyLeaderboard, CTFLeaderboardPanel );
public:

	CLadderLobbyLeaderboard( Panel *pParent, const char *pszPanelName );

	//-----------------------------------------------------------------------------
	// Purpose: Create leaderboard panels
	//-----------------------------------------------------------------------------
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
	virtual void PerformLayout() OVERRIDE;
	virtual void OnCommand( const char *command ) OVERRIDE;

	virtual bool GetLeaderboardData( CUtlVector< LeaderboardEntry_t* >& scores );
	virtual bool UpdateLeaderboards();

	void SetLeaderboard( const char *pszLeaderboardName, bool bGlobal );

	const char *GetLeaderboardName() const { return m_pszLeaderboardName; }
	bool IsDataValid( void ) { return m_bIsDataValid; }

private:
	const char *m_pszLeaderboardName;
	bool m_bGlobal;
	bool m_bIsDataValid;

	vgui::ScrollableEditablePanel *m_pScoreListScroller;
	EditablePanel *m_pScoreList;

	CTFTextToolTip		*m_pToolTip;
	vgui::EditablePanel		*m_pToolTipEmbeddedPanel;
};

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CLobbyPanel_Comp : public CBaseLobbyPanel, public CLocalSteamSharedObjectListener
{
	DECLARE_CLASS_SIMPLE( CLobbyPanel_Comp, CBaseLobbyPanel );

public:
	CLobbyPanel_Comp( vgui::Panel *pParent, CBaseLobbyContainerFrame* pLobbyContainer );
	virtual ~CLobbyPanel_Comp();

	//
	// Panel overrides
	//
	virtual void PerformLayout() OVERRIDE;
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
	virtual void OnCommand( const char *command ) OVERRIDE;

	virtual EMatchGroup GetMatchGroup( void ) const OVERRIDE;

	virtual void SOCreated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) OVERRIDE;
	virtual void SOUpdated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) OVERRIDE;

	virtual void OnThink() OVERRIDE;

	//
	// CGameEventListener overrides
	//
	virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;

private:
	virtual bool ShouldShowLateJoin() const OVERRIDE;
	virtual void ApplyChatUserSettings( const LobbyPlayerInfo &player,KeyValues *pKV ) const OVERRIDE;
	virtual const char* GetResFile() const OVERRIDE { return "Resource/UI/LobbyPanel_Comp.res"; }

	CPanelAnimationVarAliasType( int, m_iStatMedalWidth, "stat_medal_width", "14", "proportional_int" );
	CPanelAnimationVarAliasType( int, m_iMedalCountWidth, "stat_medal_count_width", "20", "proportional_int" );
	CPanelAnimationVarAliasType( int, m_iHasPassWidth, "has_pass_width", "12", "proportional_int" );

	CUtlVector<vgui::Label *> m_vecSearchCriteriaLabels;

	// leaderboards
	CLadderLobbyLeaderboard *m_pCompetitiveModeLeaderboard;

	vgui::HFont m_fontMedalsCount;

	enum EMatchHistorySortMethods_t
	{
		SORT_BY_RESULT = 0,
		SORT_BY_DATE,
		SORT_BY_MAP,
		SORT_BY_KDR,

		NUM_SORT_METHODS
	};

	CScrollableList* m_pMatchHistoryScroller;
	EMatchHistorySortMethods_t m_eMatchSortMethod;
	bool m_bDescendingMatchHistorySort;

	float m_flCompetitiveRankProgress;
	float m_flCompetitiveRankPrevProgress;
	float m_flRefreshPlayerListTime;
	bool m_bCompetitiveRankChangePlayedSound;
	bool m_bMatchHistoryLoaded;

	void WriteGameSettingsControls() OVERRIDE;

	int GetMedalCountForStat( EMatchGroup unLadderType, RankStatType_t nStatType, int nMedalLevel );


	void UpdateMatchDataForLocalPlayer();
	bool m_bMatchDataForLocalPlayerDirty;
};

#endif //TF_LOBBYPANEL_COMP_H