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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CSACHIEVEMENTSPAGE_H
#define CSACHIEVEMENTSPAGE_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/PanelListPanel.h"
#include "vgui_controls/Label.h"
#include "tier1/KeyValues.h"
#include "vgui_controls/PropertyPage.h"
#include "vgui_controls/Button.h"
#include "c_cs_player.h"
#include "vgui_avatarimage.h"
#include "GameEventListener.h"
class CCSBaseAchievement;
class IScheme;
class CAchievementsPageGroupPanel;
class StatCard;
#define ACHIEVED_ICON_PATH "hud/icon_check.vtf"
#define LOCK_ICON_PATH "hud/icon_locked.vtf"
// Loads an achievement's icon into a specified image panel, or turns the panel off if no achievement icon was found.
bool CSLoadAchievementIconForPage( vgui::ImagePanel* pIconPanel, CCSBaseAchievement *pAchievement, const char *pszExt = NULL );
// Loads an achievement's icon into a specified image panel, or turns the panel off if no achievement icon was found.
bool CSLoadIconForPage( vgui::ImagePanel* pIconPanel, const char* pFilename, const char *pszExt = NULL );
// Updates a listed achievement item's progress bar.
void CSUpdateProgressBarForPage( vgui::EditablePanel* pPanel, CCSBaseAchievement *pAchievement, Color clrProgressBar );
////////////////////////////////////////////////////////////////////////////
// PC version
//////////////////////////////////////////////////////////////////////////
class CAchievementsPage : public vgui::PropertyPage, public CGameEventListener
{
DECLARE_CLASS_SIMPLE ( CAchievementsPage, vgui::PropertyPage );
public:
CAchievementsPage( vgui::Panel *parent, const char *name );
~CAchievementsPage();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
void UpdateTotalProgressDisplay();
virtual void UpdateAchievementDialogInfo( void );
virtual void OnPageShow();
virtual void OnThink();
virtual void ApplySettings( KeyValues *pResourceData );
virtual void OnSizeChanged( int newWide, int newTall );
virtual void FireGameEvent( IGameEvent *event );
void CreateNewAchievementGroup( int iMinRange, int iMaxRange );
void CreateOrUpdateComboItems( bool bCreate );
void UpdateAchievementList(CAchievementsPageGroupPanel* groupPanel);
void UpdateAchievementList(int minID, int maxID);
vgui::PanelListPanel *m_pAchievementsList;
vgui::ImagePanel *m_pListBG;
vgui::PanelListPanel *m_pGroupsList;
vgui::ImagePanel *m_pGroupListBG;
vgui::ImagePanel *m_pPercentageBarBackground;
vgui::ImagePanel *m_pPercentageBar;
StatCard* m_pStatCard;
int m_iFixedWidth;
bool m_bStatsDirty;
bool m_bAchievementsDirty;
typedef struct
{
int m_iMinRange;
int m_iMaxRange;
} achievement_group_t;
int m_iNumAchievementGroups;
achievement_group_t m_AchievementGroups[15];
};
class CHiddenHUDToggleButton : public vgui::Button
{
DECLARE_CLASS_SIMPLE( CHiddenHUDToggleButton, vgui::Button );
public:
CHiddenHUDToggleButton( vgui::Panel *pParent, const char *pName, const char *pText );
virtual void DoClick( void );
};
//////////////////////////////////////////////////////////////////////////
// Individual item panel, displaying stats for one achievement
class CAchievementsPageItemPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CAchievementsPageItemPanel, vgui::EditablePanel );
public:
CAchievementsPageItemPanel( vgui::PanelListPanel *parent, const char* name);
~CAchievementsPageItemPanel();
void SetAchievementInfo ( CCSBaseAchievement* pAchievement );
CCSBaseAchievement* GetAchievementInfo( void ) { return m_pSourceAchievement; }
void UpdateAchievementInfo( vgui::IScheme *pScheme );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
void ToggleShowOnHUDButton();
MESSAGE_FUNC_PTR( OnCheckButtonChecked, "CheckButtonChecked", panel );
private:
static void PreloadResourceFile();
CCSBaseAchievement* m_pSourceAchievement;
int m_iSourceAchievementIndex;
vgui::PanelListPanel *m_pParent;
vgui::Label *m_pAchievementNameLabel;
vgui::Label *m_pAchievementDescLabel;
vgui::Label *m_pPercentageText;
vgui::Label *m_pAwardDate;
vgui::ImagePanel *m_pLockedIcon;
vgui::ImagePanel *m_pAchievementIcon;
vgui::ImagePanel *m_pPercentageBarBackground;
vgui::ImagePanel *m_pPercentageBar;
vgui::CheckButton *m_pShowOnHUDButton;
vgui::IScheme *m_pSchemeSettings;
CHiddenHUDToggleButton *m_pHiddenHUDToggleButton;
CPanelAnimationVar( Color, m_clrProgressBar, "ProgressBarColor", "140 140 140 255" );
};
class CGroupButton : public vgui::Button
{
DECLARE_CLASS_SIMPLE( CGroupButton, vgui::Button );
public:
CGroupButton( vgui::Panel *pParent, const char *pName, const char *pText );
virtual void DoClick( void );
};
//////////////////////////////////////////////////////////////////////////
// Individual achievement group panel, displaying info for one achievement group
class CAchievementsPageGroupPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CAchievementsPageGroupPanel, vgui::EditablePanel );
public:
CAchievementsPageGroupPanel( vgui::PanelListPanel *parent, CAchievementsPage *owner, const char* name, int iListItemID );
~CAchievementsPageGroupPanel();
void SetGroupInfo ( const wchar_t* name, int firstAchievementID, int lastAchievementID );
void UpdateAchievementInfo( vgui::IScheme *pScheme );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
int GetFirstAchievementID() { return m_iFirstAchievementID; }
int GetLastAchievementID() { return m_iLastAchievementID; }
vgui::PanelListPanel* GetParent() { return m_pParent; }
CAchievementsPage* GetOwner() { return m_pOwner; }
void SetGroupActive(bool active) { m_bActiveButton = active; }
bool IsGroupActive() { return m_bActiveButton; }
private:
void PreloadResourceFile( void );
vgui::PanelListPanel *m_pParent;
CAchievementsPage *m_pOwner;
vgui::Label *m_pAchievementGroupLabel;
vgui::Label *m_pPercentageText;
CGroupButton *m_pGroupButton;
vgui::ImagePanel *m_pGroupIcon;
vgui::ImagePanel *m_pPercentageBarBackground;
vgui::ImagePanel *m_pPercentageBar;
vgui::IScheme *m_pSchemeSettings;
bool m_bActiveButton;
CPanelAnimationVar( Color, m_clrProgressBar, "ProgressBarColor", "140 140 140 255" );
int m_iFirstAchievementID;
int m_iLastAchievementID;
wchar_t *m_pGroupName;
};
#endif // CSACHIEVEMENTSPAGE_H
|