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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "cbase.h"
#include "econ_notifications.h"
#include "hudelement.h"
#include "iclientmode.h"
#include "ienginevgui.h"
#include "vgui_avatarimage.h"
#include "vgui_controls/Controls.h"
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/TextImage.h"
#include "vgui/ILocalize.h"
#include "vgui/ISurface.h"
#include "vgui/IVGui.h"
#include "rtime.h"
#include "econ_controls.h"
#include "hud_basechat.h"
#include "hud_vote.h"
#include "inputsystem/iinputsystem.h"
#include "iinput.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
//-----------------------------------------------------------------------------
ConVar cl_notifications_show_ingame( "cl_notifications_show_ingame", "1", FCVAR_ARCHIVE, "Whether notifications should show up in-game." );
ConVar cl_notifications_max_num_visible( "cl_notifications_max_num_visible", "3", FCVAR_ARCHIVE, "How many notifications are visible in-game." );
ConVar cl_notifications_move_time( "cl_notifications_move_time", "0.5", FCVAR_ARCHIVE, "How long it takes for a notification to move." );
// notification queue holds all the notifications
class CEconNotificationQueue
{
public:
CEconNotificationQueue();
~CEconNotificationQueue();
int AddNotification( CEconNotification *pNotification );
void RemoveAllNotifications();
void RemoveNotification( int iID );
void RemoveNotification( CEconNotification *pNotification );
void RemoveNotifications( NotificationFilterFunc func );
int CountNotifications( NotificationFilterFunc func );
void VisitNotifications( CEconNotificationVisitor &visitor );
CEconNotification *GetNotification( int iID );
CEconNotification *GetNotificationByIndex( int idx );
void Update();
bool HasItems() { return m_vecNotifications.Count() != 0; }
const CUtlVector< CEconNotification *> &GetItems() { return m_vecNotifications; }
private:
int m_iIDGenerator;
CUtlVector< CEconNotification *> m_vecNotifications;
};
static CEconNotificationQueue g_notificationQueue;
CEconNotificationQueue::CEconNotificationQueue()
: m_iIDGenerator(0)
{
}
CEconNotificationQueue::~CEconNotificationQueue()
{
}
int CEconNotificationQueue::AddNotification( CEconNotification *pNotification )
{
int iID = ++m_iIDGenerator;
pNotification->m_iID = iID;
m_vecNotifications.AddToTail( pNotification );
return iID;
}
void CEconNotificationQueue::RemoveAllNotifications()
{
m_vecNotifications.PurgeAndDeleteElements();
}
void CEconNotificationQueue::RemoveNotification( int iID )
{
FOR_EACH_VEC( m_vecNotifications, i )
{
CEconNotification *pNotification = m_vecNotifications[i];
if ( pNotification->GetID() == iID )
{
delete pNotification;
m_vecNotifications.Remove( i );
return;
}
}
}
void CEconNotificationQueue::RemoveNotification( CEconNotification *pNotification )
{
if ( pNotification )
{
RemoveNotification( pNotification->GetID() );
}
}
void CEconNotificationQueue::RemoveNotifications( NotificationFilterFunc func )
{
for ( int i = 0; i < m_vecNotifications.Count(); ++i)
{
CEconNotification *pNotification = m_vecNotifications[i];
if ( func( pNotification ) )
{
pNotification->MarkForDeletion();
}
}
}
int CEconNotificationQueue::CountNotifications( NotificationFilterFunc func )
{
int nResult = 0;
for ( int i = 0; i < m_vecNotifications.Count(); ++i)
{
CEconNotification *pNotification = m_vecNotifications[i];
if ( func( pNotification ) )
{
++nResult;
}
}
return nResult;
}
void CEconNotificationQueue::VisitNotifications( CEconNotificationVisitor &visitor )
{
for ( int i = 0; i < m_vecNotifications.Count(); ++i )
{
CEconNotification *pNotification = m_vecNotifications[i];
visitor.Visit( *pNotification );
}
}
CEconNotification *CEconNotificationQueue::GetNotification( int iID )
{
FOR_EACH_VEC( m_vecNotifications, i )
{
CEconNotification *pNotification = m_vecNotifications[i];
if ( pNotification->GetID() == iID )
{
return pNotification;
}
}
return NULL;
}
CEconNotification *CEconNotificationQueue::GetNotificationByIndex( int idx )
{
if ( idx < 0 || idx >= m_vecNotifications.Count() )
{
Assert( !"Invalid index passed to GetNotificationByIndex" );
return NULL;
}
return m_vecNotifications[idx];
}
void CEconNotificationQueue::Update()
{
float flNowTime = engine->Time();
for ( int i = 0; i < m_vecNotifications.Count(); )
{
CEconNotification *pNotification = m_vecNotifications[i];
if ( pNotification->GetIsInUse() == false && pNotification->GetExpireTime() >= 0 && pNotification->GetExpireTime() < flNowTime )
{
pNotification->Expired();
delete pNotification;
m_vecNotifications.Remove( i );
continue;
}
pNotification->UpdateTick();
++i;
}
}
//-----------------------------------------------------------------------------
static void ColorizeText( CEconNotification *pNotification, CExLabel *pControl, const wchar_t* wszText )
{
static wchar_t wszStrippedText[2048];
if ( pControl == NULL )
return;
pControl->GetTextImage()->ClearColorChangeStream();
if ( wszText == NULL )
{
pControl->SetText( L"" );
return;
}
Color newColor = pControl->GetFgColor();
int endIdx = 0;
int insertIdx = 0;
bool bContinue = true;
while ( bContinue )
{
bool bSetColor = false;
switch ( wszText[endIdx] )
{
case 0:
bContinue = false;
break;
case COLOR_NORMAL:
case COLOR_USEOLDCOLORS:
newColor = pControl->GetFgColor();
bSetColor = true;
break;
case COLOR_PLAYERNAME:
newColor = g_ColorYellow;
bSetColor = true;
break;
case COLOR_LOCATION:
newColor = g_ColorDarkGreen;
bSetColor = true;
break;
case COLOR_ACHIEVEMENT:
{
vgui::IScheme *pSourceScheme = vgui::scheme()->GetIScheme( vgui::scheme()->GetScheme( "SourceScheme" ) );
if ( pSourceScheme )
{
newColor = pSourceScheme->GetColor( "SteamLightGreen", pControl->GetBgColor() );
}
else
{
newColor = pControl->GetFgColor();
}
bSetColor = true;
}
break;
case COLOR_CUSTOM:
newColor = pControl->GetFgColor();
KeyValues *pKeyValues = pNotification->GetKeyValues();
if ( pKeyValues )
{
KeyValues* pColor = pKeyValues->FindKey( "custom_color" );
if ( pColor )
{
newColor = pColor->GetColor();
}
}
bSetColor = true;
break;
}
if ( bSetColor )
{
pControl->GetTextImage()->AddColorChange( newColor, insertIdx );
}
else
{
wszStrippedText[insertIdx++] = wszText[endIdx];
}
++endIdx;
}
pControl->SetText( wszStrippedText );
}
// generic "toast" for notifications
class CGenericNotificationToast : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CGenericNotificationToast, vgui::EditablePanel );
public:
CGenericNotificationToast( vgui::Panel *parent, int iNotificationID, bool bMainMenu );
virtual ~CGenericNotificationToast();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout();
protected:
int m_iNotificationID;
vgui::Panel *m_pAvatarBG;
CAvatarImagePanel *m_pAvatar;
bool m_bMainMenu;
};
CGenericNotificationToast::CGenericNotificationToast( vgui::Panel *parent, int iNotificationID, bool bMainMenu )
: BaseClass( parent, "GenericNotificationToast" )
, m_iNotificationID( iNotificationID )
, m_pAvatar( NULL )
, m_pAvatarBG( NULL )
, m_bMainMenu( bMainMenu )
{
}
CGenericNotificationToast::~CGenericNotificationToast()
{
}
void CGenericNotificationToast::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
CEconNotification *pNotification = NotificationQueue_Get( m_iNotificationID );
bool bHighPriority = pNotification && pNotification->BHighPriority();
KeyValues *pConditions = NULL;
if ( bHighPriority )
{
pConditions = new KeyValues( "conditions" );
if ( bHighPriority )
{
KeyValues *pSubKey = new KeyValues( "if_high_priority" );
pConditions->AddSubKey( pSubKey );
}
}
if ( m_bMainMenu )
{
LoadControlSettings( "Resource/UI/Econ/GenericNotificationToastMainMenu.res", NULL, NULL, pConditions );
}
else
{
LoadControlSettings( "Resource/UI/Econ/GenericNotificationToast.res", NULL, NULL, pConditions );
}
if ( pConditions )
{
pConditions->deleteThis();
}
m_pAvatar = dynamic_cast< CAvatarImagePanel *>( FindChildByName("AvatarImage") );
m_pAvatarBG = FindChildByName("AvatarBGPanel");
if ( pNotification )
{
if ( pNotification->GetSteamID() == CSteamID() )
{
ColorizeText( pNotification, dynamic_cast< CExLabel* >( FindChildByName( "TextLabel" ) ), pNotification->GetText() );
}
else
{
ColorizeText( pNotification, dynamic_cast< CExLabel* >( FindChildByName( "AvatarTextLabel" ) ), pNotification->GetText() );
}
}
}
void CGenericNotificationToast::PerformLayout()
{
BaseClass::PerformLayout();
CSteamID steamID;
CEconNotification *pNotification = NotificationQueue_Get( m_iNotificationID );
if ( pNotification )
{
steamID = pNotification->GetSteamID();
}
int iMinHeight = 0;
if ( m_pAvatar )
{
if ( steamID != CSteamID() )
{
m_pAvatar->SetVisible( true );
m_pAvatar->SetShouldDrawFriendIcon( false );
m_pAvatar->SetPlayer( steamID, k_EAvatarSize64x64 );
// make sure there's a minimum height
// note we use iY to ensure that there's a buffer below too
int iX, iY, iWidth, iHeight;
m_pAvatar->GetBounds( iX, iY, iWidth, iHeight );
iMinHeight = 2 * iY + iHeight;
}
else
{
m_pAvatar->SetVisible( false );
m_pAvatar->ClearAvatar();
}
}
if ( m_pAvatarBG )
{
m_pAvatarBG->SetVisible( m_pAvatar != NULL && m_pAvatar->IsVisible() );
}
const char *pTextLabelName = steamID != CSteamID() ? "AvatarTextLabel" : "TextLabel";
CExLabel* pText = dynamic_cast< CExLabel *>( FindChildByName( pTextLabelName ) );
if ( pText )
{
pText->SetVisible( true );
pText->InvalidateLayout( true, false );
int iWidth, iHeight;
pText->GetSize( iWidth, iHeight );
int iContentWidth, iContentHeight;
pText->GetContentSize( iContentWidth, iContentHeight );
pText->SetSize( iWidth, iContentHeight );
int iDelta = iContentHeight - iHeight;
// resize ourselves to fit
int iContainerWidth, iContainerHeight;
GetSize( iContainerWidth, iContainerHeight );
SetSize( iContainerWidth, MAX( iContainerHeight + iDelta, iMinHeight ) );
}
}
//-----------------------------------------------------------------------------
class CNotificationToastControl : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CNotificationToastControl, vgui::EditablePanel );
public:
CNotificationToastControl( vgui::EditablePanel *pParent, vgui::EditablePanel *pNotificationToast, int iNotificationID, bool bAddControls )
: BaseClass( pParent, bAddControls ? "NotificationToastControl" : "NotificationToastContainer" )
, m_pChild( pNotificationToast )
, m_iNotificationID( iNotificationID )
, m_bAddControls( bAddControls )
, m_pTriggerButton( NULL )
, m_pAcceptButton( NULL )
, m_pDeclineButton( NULL )
, m_iOverrideHeight( 0 )
{
m_pChild->SetParent( this );
}
virtual ~CNotificationToastControl()
{
}
virtual void ApplySchemeSettings( vgui::IScheme *scheme )
{
CEconNotification *pNotification = g_notificationQueue.GetNotification( m_iNotificationID );
// It is not entirely clear why pNotification is allowed to be NULL. Weapon switching
// with pyro was causing crashes because of pNotification being NULL, and there were
// previously existing checks, but it's not clear why.
CEconNotification::EType eNotificationType = pNotification ? pNotification->NotificationType() \
: CEconNotification::eType_Basic;
bool bHighPriority = pNotification && pNotification->BHighPriority();
bool bCanDelete = false;
bool bCanAcceptDecline = false;
bool bCanTrigger = false;
bool bOneButton = false;
switch ( eNotificationType )
{
case CEconNotification::eType_AcceptDecline:
bCanAcceptDecline = true;
break;
case CEconNotification::eType_Basic:
bCanDelete = true;
bOneButton = true;
break;
case CEconNotification::eType_MustTrigger:
bCanTrigger = true;
bOneButton = true;
break;
case CEconNotification::eType_Trigger:
bCanTrigger = true;
bCanDelete = true;
break;
default:
Assert( !"Unhandled enum type" );
}
KeyValues *pConditions = NULL;
if ( bOneButton || bHighPriority )
{
pConditions = new KeyValues( "conditions" );
if ( bOneButton )
{
KeyValues *pSubKey = new KeyValues( "if_one_button" );
pConditions->AddSubKey( pSubKey );
}
if ( bHighPriority )
{
KeyValues *pSubKey = new KeyValues( "if_high_priority" );
pConditions->AddSubKey( pSubKey );
}
}
if ( m_bAddControls )
{
LoadControlSettings( "Resource/UI/Econ/NotificationToastControl.res", NULL, NULL, pConditions );
}
else
{
LoadControlSettings( "Resource/UI/Econ/NotificationToastContainer.res", NULL, NULL, pConditions );
}
if ( pConditions )
{
pConditions->deleteThis();
}
BaseClass::ApplySchemeSettings( scheme );
GetSize( m_iOriginalWidth, m_iOriginalHeight );
CExButton *pDeleteButton = dynamic_cast< CExButton *>( FindChildByName( "DeleteButton" ) );
if ( pDeleteButton && bCanDelete )
{
pDeleteButton->AddActionSignalTarget( this );
pDeleteButton->SetVisible ( pNotification != NULL );
}
if ( pNotification == NULL )
return;
if ( bCanAcceptDecline )
{
m_pAcceptButton = dynamic_cast< CExButton * >( FindChildByName( "AcceptButton" ) );
m_pDeclineButton = dynamic_cast< CExButton * >( FindChildByName( "DeclineButton" ) );
if ( m_pAcceptButton && m_pDeclineButton )
{
m_pAcceptButton->AddActionSignalTarget( this );
m_pDeclineButton->AddActionSignalTarget( this );
m_pAcceptButton->SetVisible( true );
m_pDeclineButton->SetVisible( true );
int posX, posY;
m_pAcceptButton->GetPos( posX, posY );
m_iButtonOffsetY = GetTall() - posY;
}
}
if ( bCanTrigger )
{
m_pTriggerButton = dynamic_cast< CExButton *>( FindChildByName( "TriggerButton" ) );
if ( m_pTriggerButton )
{
m_pTriggerButton->AddActionSignalTarget( this );
m_pTriggerButton->SetVisible( true );
int posX, posY;
m_pTriggerButton->GetPos( posX, posY );
m_iButtonOffsetY = GetTall() - posY;
}
}
}
virtual void PerformLayout()
{
BaseClass::PerformLayout();
m_pChild->PerformLayout();
int iWidth, iHeight;
m_pChild->GetSize( iWidth, iHeight );
// position control buttons
if ( iHeight + m_iButtonOffsetY > m_iOriginalHeight )
{
if ( m_pAcceptButton && m_pDeclineButton )
{
int posX, posY;
m_pAcceptButton->GetPos( posX, posY );
// int newPosY = iHeight;
// iHeight += m_iButtonOffsetY;
// m_pAcceptButton->SetPos( posX, newPosY );
// m_pDeclineButton->GetPos( posX, posY );
// m_pDeclineButton->SetPos( posX, newPosY );
}
else if ( m_pTriggerButton )
{
int posX, posY;
m_pTriggerButton->GetPos( posX, posY );
// posY = iHeight;
// iHeight += m_iButtonOffsetY;
// m_pTriggerButton->SetPos( posX, posY );
}
}
// position help label
CEconNotification *pNotification = g_notificationQueue.GetNotification( m_iNotificationID );
CExLabel *pHelpLabel = dynamic_cast< CExLabel* >( FindChildByName( "HelpTextLabel" ) );
if ( pHelpLabel )
{
if ( pNotification )
{
const wchar_t *pszText = NULL;
const char *pszTextKey = pNotification->GetUnlocalizedHelpText();
if ( pszTextKey )
{
pszText = g_pVGuiLocalize->Find( pszTextKey );
}
if ( pszText )
{
wchar_t wzFinal[512] = L"";
if ( ::input->IsSteamControllerActive() )
{
UTIL_ReplaceKeyBindings( pszText, 0, wzFinal, sizeof( wzFinal ), GAME_ACTION_SET_FPSCONTROLS );
}
else
{
UTIL_ReplaceKeyBindings( pszText, 0, wzFinal, sizeof( wzFinal ) );
}
ColorizeText( pNotification, pHelpLabel, wzFinal );
}
}
pHelpLabel->InvalidateLayout( true, false );
int posX, posY;
pHelpLabel->GetPos( posX, posY );
int iContentWidth, iContentHeight;
pHelpLabel->GetContentSize( iContentWidth, iContentHeight );
int iLabelWidth, iLabelHeight;
pHelpLabel->GetSize( iLabelWidth, iLabelHeight );
int iTextInsetX, iTextInsetY;
pHelpLabel->GetTextInset( &iTextInsetX, &iTextInsetY );
pHelpLabel->SetSize( iLabelWidth, iContentHeight + iTextInsetY );
posY = iHeight;
pHelpLabel->SetPos( posX, posY - iTextInsetY );
iHeight += iContentHeight + iTextInsetY;
}
// resize ourselves to fit the child height wise
int iContainerHeight = MAX( m_iOriginalHeight, iHeight );
SetSize( m_iOriginalWidth, m_iOverrideHeight != 0 ? m_iOverrideHeight : iContainerHeight );
}
virtual void OnCommand( const char *command )
{
CEconNotification *pNotification = g_notificationQueue.GetNotification( m_iNotificationID );
if ( pNotification != NULL )
{
if ( !Q_strncmp( command, "delete", ARRAYSIZE( "delete" ) ) )
{
pNotification->Deleted();
g_notificationQueue.RemoveNotification( m_iNotificationID );
return;
}
else if ( !Q_strncmp( command, "trigger", ARRAYSIZE( "trigger" ) ) )
{
pNotification->Trigger();
}
else if ( !Q_strncmp( command, "accept", ARRAYSIZE( "accept" ) ) )
{
pNotification->Accept();
}
else if ( !Q_strncmp( command, "decline", ARRAYSIZE( "decline" ) ) )
{
pNotification->Decline();
}
else
{
BaseClass::OnCommand( command );
}
}
else
{
BaseClass::OnCommand( command );
}
}
int GetOverrideHeight() const
{
return m_iOverrideHeight;
}
void SetOverrideHeight( int iHeight )
{
m_iOverrideHeight = iHeight;
}
private:
vgui::EditablePanel* m_pChild;
vgui::Panel* m_pTriggerButton;
vgui::Panel* m_pAcceptButton;
vgui::Panel* m_pDeclineButton;
int m_iNotificationID;
int m_iOriginalWidth;
int m_iOriginalHeight;
int m_iButtonOffsetY;
int m_iOverrideHeight;
bool m_bAddControls;
};
//-----------------------------------------------------------------------------
struct NotificationUIInfo_t
{
CNotificationToastControl *m_pPanel;
int m_iStartPosX;
int m_iStartPosY;
};
// notification queue panel that is a HUD element
// this is the visualization of the notifications while in game
class CNotificationQueuePanel : public CHudElement, public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CNotificationQueuePanel, vgui::EditablePanel );
public:
CNotificationQueuePanel( const char *pElementName )
: CHudElement( pElementName )
, BaseClass( NULL, "NotificationQueuePanel" )
, m_mapNotificationPanels( DefLessFunc(int) )
, m_flInvalidateTime( 0.0f )
, m_bInvalidated( false )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
SetHiddenBits( HIDEHUD_MISCSTATUS );
}
virtual ~CNotificationQueuePanel()
{
}
virtual bool ShouldDraw( void )
{
if ( !CHudElement::ShouldDraw() )
{
return false;
}
if ( engine->IsPlayingDemo() )
{
return false;
}
if ( cl_notifications_show_ingame.GetInt() == 0 )
{
return false;
}
CHudVote *pHudVote = GET_HUDELEMENT( CHudVote );
if ( pHudVote && pHudVote->IsVoteUIActive() )
{
return false;
}
return m_mapNotificationPanels.Count() > 0 || g_notificationQueue.HasItems();
}
virtual void PerformLayout( void )
{
BaseClass::PerformLayout();
// Get filtered list of only the notifications that show some in-game content
CUtlVector< CEconNotification *> notifications;
GetNotifications( notifications );
const float flMoveTime = cl_notifications_move_time.GetFloat();
float lerpPercentage = flMoveTime > 0 ? clamp( ( flMoveTime - m_flInvalidateTime ) / flMoveTime, 0.0f, 1.0f ) : 1.0f;
float flCurrTime = engine->Time();
// move the notifications around
const int kMaxVisibleNotifications = cl_notifications_max_num_visible.GetInt();
int iPosY = MIN( notifications.Count() - 1, kMaxVisibleNotifications - 1 ) * m_iOverlapOffset_Y;
int iPosX = MIN( notifications.Count() - 1, kMaxVisibleNotifications - 1 ) * m_iOverlapOffset_X;
int zpos = 100;
int iPreviousHeight = 0;
for ( int i = 0; i < notifications.Count(); ++i )
{
CEconNotification *pNotification = notifications[i];
int mapIdx = m_mapNotificationPanels.Find( pNotification->GetID() );
if ( m_mapNotificationPanels.IsValidIndex( mapIdx ) == false || pNotification->GetInGameLifeTime() < flCurrTime )
{
continue;
}
NotificationUIInfo_t &info = m_mapNotificationPanels[mapIdx];
CNotificationToastControl *pPanel = info.m_pPanel;
if ( pPanel )
{
if ( pPanel->IsVisible() == false )
{
pPanel->SetVisible( true );
}
if ( i == 0 && pPanel->GetOverrideHeight() != 0 )
{
pPanel->SetOverrideHeight( 0 );
pPanel->InvalidateLayout( true, false );
}
int iPanelX;
int iPanelY;
pPanel->GetPos( iPanelX, iPanelY );
if ( m_bInvalidated )
{
info.m_iStartPosX = iPanelX;
info.m_iStartPosY = iPanelY;
}
int iNewPosX = iPosX;
int iNewPosY = iPosY;
iNewPosX = Lerp( lerpPercentage, info.m_iStartPosX, iNewPosX );
iNewPosY = Lerp( lerpPercentage, info.m_iStartPosY, iNewPosY );
pPanel->SetPos( iNewPosX, iNewPosY );
pPanel->SetZPos( --zpos );
bool bStoppedMoving = iNewPosX == iPanelX && iNewPosY == iPosY;
// only show panels that are more than we want visible if they are moving
if ( i > kMaxVisibleNotifications - 1 )
{
if ( bStoppedMoving )
{
pPanel->SetVisible( false );
}
continue;
}
// don't poke out underneath if we are visible and stopped moving
if ( i != 0 && pPanel->GetOverrideHeight() == 0 && bStoppedMoving )
{
pPanel->SetOverrideHeight( MIN( pPanel->GetTall(), iPreviousHeight ) );
pPanel->InvalidateLayout( true, false );
}
iPreviousHeight = pPanel->GetTall();
iPosY = MAX( 0, iPosY - m_iOverlapOffset_Y );
iPosX = MAX( 0, iPosX - m_iOverlapOffset_X );
}
}
m_bInvalidated = false;
SetTall( ScreenHeight() - m_iOriginalY );
}
virtual void ApplySchemeSettings( vgui::IScheme *scheme )
{
LoadControlSettings( "Resource/UI/Econ/NotificationQueuePanel.res" );
GetBounds( m_iOriginalX, m_iOriginalY, m_iOriginalWidth, m_iOriginalHeight );
BaseClass::ApplySchemeSettings( scheme );
}
virtual void OnThink()
{
BaseClass::OnThink();
if ( IsVisible() == false )
{
return;
}
// Get filtered list of only the notifications that show some in-game content
CUtlVector< CEconNotification *> notifications;
GetNotifications( notifications );
float flCurrTime = engine->Time();
// check to see if we have a panel for each notification
int i = 0;
for ( i = 0; i < notifications.Count(); ++i )
{
CEconNotification *pNotification = notifications[i];
int mapIdx = m_mapNotificationPanels.Find( pNotification->GetID() );
if ( m_mapNotificationPanels.IsValidIndex( mapIdx ) == false || pNotification->GetInGameLifeTime() < flCurrTime )
{
m_bInvalidated = true;
// create the panel and add it to the UI
// have it slide from the bottom
CNotificationToastControl *pControl = NULL;
int iPosX = 0, iPosY = 0;
vgui::EditablePanel *pPanel = pNotification->CreateUIElement( false );
if ( pPanel )
{
pControl = new CNotificationToastControl( this, pPanel, pNotification->GetID(), false );
pControl->GetPos( iPosX, iPosY );
pControl->SetPos( iPosX, ScreenHeight() );
iPosY = ScreenHeight();
}
NotificationUIInfo_t info = { pControl, iPosX, iPosY };
m_mapNotificationPanels.Insert( pNotification->GetID(), info );
}
}
// now check to see if we have panels and there is no matching notification
i = m_mapNotificationPanels.FirstInorder();
while ( m_mapNotificationPanels.IsValidIndex( i ) )
{
int idx = i;
i = m_mapNotificationPanels.NextInorder( i );
int iID = m_mapNotificationPanels.Key( idx );
CEconNotification *pNotification = g_notificationQueue.GetNotification( iID );
if ( pNotification == NULL || pNotification->GetInGameLifeTime() < flCurrTime )
{
// fade here, cause we don't really want to re-layout
NotificationUIInfo_t &info = m_mapNotificationPanels[idx];
vgui::EditablePanel *pPanel = info.m_pPanel;
if ( pPanel )
{
pPanel->MarkForDeletion();
}
m_mapNotificationPanels.RemoveAt( idx );
m_bInvalidated = true;
}
}
if ( m_bInvalidated )
{
m_flInvalidateTime = MAX( cl_notifications_move_time.GetFloat(), 0.0f );
}
if ( m_flInvalidateTime > 0 )
{
m_flInvalidateTime -= gpGlobals->frametime;
InvalidateLayout( true, false );
}
}
protected:
typedef CUtlMap< int, NotificationUIInfo_t > tNotificationPanels;
tNotificationPanels m_mapNotificationPanels;
int m_iOriginalX;
int m_iOriginalY;
int m_iOriginalWidth;
int m_iOriginalHeight;
float m_flInvalidateTime;
bool m_bInvalidated;
CPanelAnimationVar( int, m_iVisibleBuffer, "buffer_between_visible", "5" );
CPanelAnimationVar( int, m_iOverlapOffset_X, "overlap_offset_x", "10" );
CPanelAnimationVar( int, m_iOverlapOffset_Y, "overlap_offset_y", "10" );
void GetNotifications(CUtlVector< CEconNotification *> ¬ifications )
{
const CUtlVector< CEconNotification *> &allNotifications = g_notificationQueue.GetItems();
for (int i = 0 ; i < allNotifications.Count() ; ++i )
{
CEconNotification *pNotification = allNotifications[i];
if ( pNotification->BShowInGameElements() )
{
notifications.AddToTail( pNotification );
}
}
}
};
DECLARE_HUDELEMENT( CNotificationQueuePanel );
//-----------------------------------------------------------------------------
CEconNotification::CEconNotification()
: m_pText("")
, m_pSoundFilename( NULL )
, m_flExpireTime( engine->Time() + 10.0f )
, m_pKeyValues( NULL )
, m_bInUse( false )
, m_steamID()
{
}
CEconNotification::~CEconNotification()
{
if ( m_pKeyValues )
{
m_pKeyValues->deleteThis();
}
}
void CEconNotification::SetText( const char *pText )
{
m_pText = pText;
}
void CEconNotification::AddStringToken( const char* pToken, const wchar_t* pValue )
{
if ( m_pKeyValues == NULL )
{
m_pKeyValues = new KeyValues( "CEconNotification" );
}
m_pKeyValues->SetWString( pToken, pValue );
}
void CEconNotification::SetKeyValues( KeyValues *pKeyValues )
{
if ( m_pKeyValues != NULL )
{
m_pKeyValues->deleteThis();
}
m_pKeyValues = pKeyValues->MakeCopy();
}
KeyValues *CEconNotification::GetKeyValues() const
{
return m_pKeyValues;
}
const wchar_t *CEconNotification::GetText()
{
g_pVGuiLocalize->ConstructString_safe( m_wszBuffer, m_pText, m_pKeyValues );
return m_wszBuffer;
}
int CEconNotification::GetID() const
{
return m_iID;
}
void CEconNotification::SetLifetime( float flSeconds )
{
m_flExpireTime = engine->Time() + flSeconds;
}
float CEconNotification::GetExpireTime() const
{
return m_flExpireTime;
}
float CEconNotification::GetInGameLifeTime() const
{
return m_flExpireTime; // default's to passed in time unless otherwise set (for derived classes)
}
void CEconNotification::SetIsInUse( bool bInUse)
{
m_bInUse = bInUse;
}
bool CEconNotification::GetIsInUse() const
{
return m_bInUse;
}
void CEconNotification::SetSteamID( const CSteamID &steamID )
{
m_steamID = steamID;
}
const CSteamID &CEconNotification::GetSteamID() const
{
return m_steamID;
}
void CEconNotification::MarkForDeletion()
{
// to be deleted ASAP
m_flExpireTime = 0.0f;
}
CEconNotification::EType CEconNotification::NotificationType()
{
return eType_Basic;
}
bool CEconNotification::BHighPriority()
{
return false;
}
void CEconNotification::Trigger()
{
}
void CEconNotification::Accept()
{
}
void CEconNotification::Decline()
{
}
void CEconNotification::Deleted()
{
}
void CEconNotification::Expired()
{
}
vgui::EditablePanel *CEconNotification::CreateUIElement( bool bMainMenu ) const
{
CGenericNotificationToast *pToast = new CGenericNotificationToast( NULL, m_iID, bMainMenu );
return pToast;
}
const char *CEconNotification::GetUnlocalizedHelpText()
{
switch ( NotificationType() )
{
case eType_AcceptDecline:
return "#Notification_AcceptOrDecline_Help";
case eType_MustTrigger:
case eType_Trigger:
return "#Notification_CanTrigger_Help";
default:
Assert( !"Unhandled enum value" );
// ---v
case eType_Basic:
return "#Notification_Remove_Help";
}
}
//-----------------------------------------------------------------------------
class CMainMenuNotificationsControl : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CMainMenuNotificationsControl, vgui::EditablePanel );
public:
CMainMenuNotificationsControl( vgui::EditablePanel *pParent, const char *pElementName )
: BaseClass( pParent, pElementName )
, m_mapNotificationPanels( DefLessFunc(int) )
, m_iNumItems( 0 )
{
vgui::ivgui()->AddTickSignal( GetVPanel(), 250 );
}
virtual ~CMainMenuNotificationsControl()
{
vgui::ivgui()->RemoveTickSignal( GetVPanel() );
}
virtual void PerformLayout( void )
{
BaseClass::PerformLayout();
const CUtlVector< CEconNotification *> ¬ifications = g_notificationQueue.GetItems();
// position the notifications around
// grow down
int iTotalHeight = 0;
const int kBuffer = 5;
for ( int i = 0; i < notifications.Count(); ++i )
{
CEconNotification *pNotification = notifications[i];
int mapIdx = m_mapNotificationPanels.Find( pNotification->GetID() );
if ( m_mapNotificationPanels.IsValidIndex( mapIdx ) == false )
{
continue;
}
NotificationUIInfo_t &info = m_mapNotificationPanels[mapIdx];
vgui::EditablePanel *pPanel = info.m_pPanel;
if ( pPanel )
{
int iPanelX;
int iPanelY;
int iWidth;
int iHeight;
pPanel->GetBounds( iPanelX, iPanelY, iWidth, iHeight );
int iNewPosX = iPanelX;
int iNewPosY = iTotalHeight;
pPanel->SetPos( iNewPosX, iNewPosY );
iTotalHeight += iHeight + kBuffer;
}
}
int iWidth, iHeight;
GetSize( iWidth, iHeight );
SetSize( iWidth, iTotalHeight );
if ( iTotalHeight != iHeight )
{
GetParent()->InvalidateLayout( false, false );
}
}
virtual void OnTick()
{
if ( m_iNumItems != g_notificationQueue.GetItems().Count() )
{
m_iNumItems = g_notificationQueue.GetItems().Count();
PostActionSignal( new KeyValues("Command", "command", "notifications_update" ) );
}
}
virtual void OnThink()
{
BaseClass::OnThink();
if ( IsVisible() == false )
{
return;
}
const CUtlVector< CEconNotification *> ¬ifications = g_notificationQueue.GetItems();
bool bInvalidated = false;
// check to see if we have a panel for each notification
int i = 0;
for ( i = 0; i < notifications.Count(); ++i )
{
CEconNotification *pNotification = notifications[i];
int mapIdx = m_mapNotificationPanels.Find( pNotification->GetID() );
if ( m_mapNotificationPanels.IsValidIndex( mapIdx ) == false )
{
bInvalidated = true;
CNotificationToastControl *pControl = NULL;
vgui::EditablePanel *pPanel = pNotification->CreateUIElement( true );
if ( pPanel )
{
pControl = new CNotificationToastControl( this, pPanel, pNotification->GetID(), true );
}
NotificationUIInfo_t info = { pControl, 0, 0 };
m_mapNotificationPanels.Insert( pNotification->GetID(), info );
}
}
// now check to see if we have panels and there is no matching notification
i = m_mapNotificationPanels.FirstInorder();
while ( m_mapNotificationPanels.IsValidIndex( i ) )
{
int idx = i;
i = m_mapNotificationPanels.NextInorder( i );
int iID = m_mapNotificationPanels.Key( idx );
if ( g_notificationQueue.GetNotification( iID ) == NULL )
{
NotificationUIInfo_t &info = m_mapNotificationPanels[idx];
vgui::EditablePanel *pPanel = info.m_pPanel;
if ( pPanel )
{
pPanel->MarkForDeletion();
}
m_mapNotificationPanels.RemoveAt( idx );
bInvalidated = true;
}
}
if ( bInvalidated )
{
InvalidateLayout( true, false );
}
}
protected:
typedef CUtlMap< int, NotificationUIInfo_t > tNotificationPanels;
tNotificationPanels m_mapNotificationPanels;
int m_iNumItems;
};
// Show in UI
class CNotificationsPresentPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CNotificationsPresentPanel, vgui::EditablePanel );
public:
CNotificationsPresentPanel( vgui::Panel *pParent, const char* pElementName ) : vgui::EditablePanel( pParent, "NotificationsPresentPanel" )
{
SetMouseInputEnabled( true );
}
virtual ~CNotificationsPresentPanel()
{
}
virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( "Resource/UI/Econ/NotificationsPresentPanel.res" );
for ( int i = 0; i < GetChildCount(); i++ )
{
vgui::Panel *pChild = GetChild( i );
pChild->SetMouseInputEnabled( false );
}
}
virtual void OnMousePressed(vgui::MouseCode code)
{
if ( code != MOUSE_LEFT )
return;
PostActionSignal( new KeyValues("Close") );
// audible feedback
const char *soundFilename = "ui/buttonclick.wav";
vgui::surface()->PlaySound( soundFilename );
}
};
DECLARE_BUILD_FACTORY( CNotificationsPresentPanel );
//-----------------------------------------------------------------------------
// External interface for the notification queue
int NotificationQueue_Add( CEconNotification *pNotification )
{
if ( !engine->IsInGame() || (cl_notifications_show_ingame.GetBool() && pNotification->BShowInGameElements()) )
{
vgui::surface()->PlaySound( pNotification->GetSoundFilename() );
}
return g_notificationQueue.AddNotification( pNotification );
}
CEconNotification *NotificationQueue_Get( int iID )
{
return g_notificationQueue.GetNotification( iID );
}
CEconNotification *NotificationQueue_GetByIndex( int idx )
{
return g_notificationQueue.GetNotificationByIndex( idx );
}
void NotificationQueue_RemoveAll()
{
g_notificationQueue.RemoveAllNotifications();
}
void NotificationQueue_Remove( int iID )
{
g_notificationQueue.RemoveNotification( iID );
}
void NotificationQueue_Remove( CEconNotification *pNotification )
{
g_notificationQueue.RemoveNotification( pNotification );
}
void NotificationQueue_Remove( NotificationFilterFunc func )
{
g_notificationQueue.RemoveNotifications( func );
}
int NotificationQueue_Count( NotificationFilterFunc func )
{
return g_notificationQueue.CountNotifications( func );
}
void NotificationQueue_Visit( CEconNotificationVisitor &visitor )
{
g_notificationQueue.VisitNotifications( visitor );
}
void NotificationQueue_Update()
{
g_notificationQueue.Update();
}
int NotificationQueue_GetNumNotifications()
{
return g_notificationQueue.GetItems().Count();
}
vgui::EditablePanel* NotificationQueue_CreateMainMenuUIElement( vgui::EditablePanel *pParent, const char *pElementName )
{
CMainMenuNotificationsControl *pControl = new CMainMenuNotificationsControl( pParent, pElementName );
pControl->AddActionSignalTarget( pParent );
return pControl;
}
//-----------------------------------------------------------------------------
CON_COMMAND( cl_trigger_first_notification, "Tries to accept/trigger the first notification" )
{
const CUtlVector< CEconNotification *> ¬ifications = g_notificationQueue.GetItems();
if ( notifications.Count() > 0 )
{
CEconNotification *pNotification = notifications[0];
switch ( pNotification->NotificationType() )
{
case CEconNotification::eType_AcceptDecline:
pNotification->Accept();
break;
case CEconNotification::eType_MustTrigger:
case CEconNotification::eType_Trigger:
pNotification->Trigger();
case CEconNotification::eType_Basic:
break;
default:
Assert( !"Unhandled enum value" );
}
}
}
CON_COMMAND( cl_decline_first_notification, "Tries to decline/remove the first notification" )
{
const CUtlVector< CEconNotification *> ¬ifications = g_notificationQueue.GetItems();
if ( notifications.Count() > 0 )
{
CEconNotification *pNotification = notifications[0];
switch ( pNotification->NotificationType() )
{
case CEconNotification::eType_AcceptDecline:
pNotification->Decline();
break;
case CEconNotification::eType_MustTrigger:
break; // YOU MUUUSSTTTTT
case CEconNotification::eType_Trigger:
case CEconNotification::eType_Basic:
pNotification->Deleted();
pNotification->MarkForDeletion();
break;
default:
Assert( !"Unhandled enum value" );
}
}
}
#ifdef _DEBUG
#include "confirm_dialog.h"
class CTFTestNotification : public CEconNotification
{
public:
CTFTestNotification( const char* pText, EType eType )
: CEconNotification()
, m_pText( pText )
, m_eType( eType )
{
}
virtual EType NotificationType() OVERRIDE { return m_eType; }
virtual void Trigger() OVERRIDE
{
ShowMessageBox( "", m_pText, "#GameUI_OK" );
MarkForDeletion();
}
virtual void Accept() OVERRIDE
{
ShowMessageBox( "Accept", m_pText, "#GameUI_OK" );
MarkForDeletion();
}
virtual void Decline() OVERRIDE
{
ShowMessageBox( "Decline", m_pText, "#GameUI_OK" );
MarkForDeletion();
}
private:
const char *m_pText;
EType m_eType;
};
CON_COMMAND( cl_add_notification, "Adds a notification" )
{
if ( args.ArgC() >= 2 )
{
CEconNotification::EType eType = CEconNotification::eType_Basic;
if ( args.ArgC() >= 5 )
{
eType = (CEconNotification::EType)atoi( args[4] );
}
CEconNotification *pNotification = new CTFTestNotification( args[1], eType );
pNotification->SetText( args[1] );
if ( args.ArgC() >= 3 )
{
int iLifetime = atoi( args[2] );
pNotification->SetLifetime( iLifetime );
}
if ( args.ArgC() >= 4 )
{
if ( steamapicontext && steamapicontext->SteamUser() )
{
pNotification->SetSteamID( steamapicontext->SteamUser()->GetSteamID() );
}
}
int id = NotificationQueue_Add( pNotification );
Msg( "Added notification %d\n", id);
}
}
#endif
|