/
Demographics.lua
543 lines (416 loc) · 20.8 KB
/
Demographics.lua
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
include( "IconSupport" );
----------------------------------------------------------------
----------------------------------------------------------------
local m_PopulationTable = {};
local m_FoodTable = {};
local m_ProductionTable = {};
local m_GoldTable = {};
local m_LandTable = {};
local m_ArmyTable = {};
local m_ApprovalTable = {};
local m_LiteracyTable = {};
local m_bIsEndGame = (ContextPtr:GetID() == "EndGameDemographics");
----------------------------------------------------------------
----------------------------------------------------------------
function BuildTables()
for i = 0, GameDefines.MAX_MAJOR_CIVS do
m_PopulationTable[ i ] = 0;
m_FoodTable[ i ] = 0;
m_ProductionTable[ i ] = 0;
m_GoldTable[ i ] = 0;
m_LandTable[ i ] = 0;
m_ArmyTable[ i ] = 0;
m_ApprovalTable[ i ] = 0;
m_LiteracyTable[ i ] = 0;
m_PopulationTable[ i ] = GetPopulationValue( i );
m_FoodTable[ i ] = GetFoodValue( i );
m_ProductionTable[ i ] = GetProductionValue( i );
m_GoldTable[ i ] = GetGoldValue( i );
m_LandTable[ i ] = GetLandValue( i );
m_ArmyTable[ i ] = GetArmyValue( i );
m_ApprovalTable[ i ] = GetApprovalValue( i );
m_LiteracyTable[ i ] = GetLiteracyValue( i );
end
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetBest( table, iPlayer )
local highest = nil;
local highestID = iPlayer;
for i = 0, GameDefines.MAX_MAJOR_CIVS do
local pPlayer = Players[i];
if(pPlayer:IsAlive() and not pPlayer:IsMinorCiv()) then
if( highest == nil or table[i] > highest ) then
highest = table[i];
highestID = i;
end
end
end
return { highest, highestID };
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetAverage( table, iPlayer )
local accum = 0;
local count = 0;
for i = 0, GameDefines.MAX_MAJOR_CIVS do
local pPlayer = Players[i];
if(pPlayer:IsAlive() and not pPlayer:IsMinorCiv()) then
count = count + 1;
accum = accum + table[i];
end
end
return accum / count;
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetWorst( table, iPlayer )
local lowest = nil;
local lowestID = iPlayer;
for i = 0, GameDefines.MAX_MAJOR_CIVS do
local pPlayer = Players[i];
if(pPlayer:IsAlive() and not pPlayer:IsMinorCiv()) then
if( lowest == nil or table[i] <= lowest ) then
lowest = table[i];
lowestID = i;
end
end
end
return { lowest, lowestID };
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetRank( table, iPlayer )
local playerVal = table[iPlayer];
local rank = 1;
for i = 0, GameDefines.MAX_MAJOR_CIVS do
local pPlayer = Players[i];
if(pPlayer:IsAlive() and not pPlayer:IsMinorCiv()) then
if( table[i] > playerVal ) then
rank = rank + 1;
end
end
end
return rank;
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetPopulationValue( iPlayer )
return Players[iPlayer]:GetRealPopulation();
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildPopulationEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_POPULATION" );
instance.Value:SetText( Locale.ToNumber(m_PopulationTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_POPULATION_MEASURE") );
local best = GetBest( m_PopulationTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_POPULATION_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_PopulationTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_POPULATION_MEASURE") );
local worst = GetWorst( m_PopulationTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###" ) );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_POPULATION_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_PopulationTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetFoodValue( iPlayer )
return Players[iPlayer]:CalculateTotalYield(YieldTypes.YIELD_FOOD);
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildFoodEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_FOOD" );
instance.Value:SetText( Locale.ToNumber(m_FoodTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_FOOD_MEASURE") );
local best = GetBest( m_FoodTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_FOOD_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_FoodTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_FOOD_MEASURE") );
local worst = GetWorst( m_FoodTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###" ) );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_FOOD_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_FoodTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetProductionValue( iPlayer )
return Players[iPlayer]:CalculateTotalYield(YieldTypes.YIELD_PRODUCTION);
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildProductionEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_PRODUCTION" );
instance.Value:SetText( Locale.ToNumber(m_ProductionTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_PRODUCTION_MEASURE") );
local best = GetBest( m_ProductionTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_PRODUCTION_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_ProductionTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_PRODUCTION_MEASURE") );
local worst = GetWorst( m_ProductionTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###" ) );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_PRODUCTION_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_ProductionTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetGoldValue( iPlayer )
return Players[iPlayer]:CalculateGrossGold();
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildGoldEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_GOLD" );
instance.Value:SetText( Locale.ToNumber(m_GoldTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_GOLD_MEASURE") );
local best = GetBest( m_GoldTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_GOLD_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_GoldTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_GOLD_MEASURE") );
local worst = GetWorst( m_GoldTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###" ) );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_GOLD_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_GoldTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetLandValue( iPlayer )
return Players[iPlayer]:GetNumPlots() * 10000;
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildLandEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_LAND" );
instance.Value:SetText( Locale.ToNumber(m_LandTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_LAND_MEASURE") );
local best = GetBest( m_LandTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_LAND_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_LandTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_LAND_MEASURE") );
local worst = GetWorst( m_LandTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###" ) );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_LAND_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_LandTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetArmyValue( iPlayer )
return math.sqrt( Players[iPlayer]:GetMilitaryMight() ) * 5000;
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildArmyEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_ARMY" );
instance.Value:SetText( Locale.ToNumber(m_ArmyTable[ iPlayer ], "#,###,###,###" ));
instance.ValueTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_ARMY_MEASURE") );
local best = GetBest( m_ArmyTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#,###,###,###") );
instance.BestTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_ARMY_MEASURE") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_ArmyTable, iPlayer ), "#,###,###,###" ) );
instance.AverageTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_ARMY_MEASURE") );
local worst = GetWorst( m_ArmyTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#,###,###,###") );
instance.WorstTT:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_DEMOGRAPHICS_ARMY_MEASURE") );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_ArmyTable, iPlayer ), "#") );
end
function SetIcon(iPlayerID, control, controlBG, controlShadow)
local pPlayer = Players[iPlayerID];
local iTeam = pPlayer:GetTeam();
local pTeam = Teams[iTeam];
-- Active player
if (pPlayer:GetID() == Game.GetActivePlayer()) then
CivIconHookup( iPlayerID, 32, control, controlBG, controlShadow, false, true);
-- Haven't yet met this player
elseif (not pTeam:IsHasMet(Game.GetActiveTeam())) then
CivIconHookup( -1, 32, control, controlBG, controlShadow, false, true);
-- Met players
else
CivIconHookup( iPlayerID, 32, control, controlBG, controlShadow, false, true);
end
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetApprovalValue( iPlayer )
local value = Players[iPlayer]:GetExcessHappiness();
if( value < 0 ) then
return 0;
elseif( value > 100 ) then
return 100;
end
return value;
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildApprovalEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_APPROVAL" );
instance.Value:SetText( Locale.ToNumber(m_ApprovalTable[ iPlayer ], "#'%'" ));
local best = GetBest( m_ApprovalTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#'%'") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_ApprovalTable, iPlayer ), "#'%'" ) );
local worst = GetWorst( m_ApprovalTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#'%'" ) );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_ApprovalTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function GetLiteracyValue( iPlayer )
local pTeamTechs = Teams[ Players[ iPlayer ]:GetTeam() ]:GetTeamTechs();
local iWriting = GameInfoTypes[ "TECH_WRITING" ];
if( iWriting ~= nil and
not pTeamTechs:HasTech( iWriting ) ) then
return 0;
end
local iCount = 0;
for row in GameInfo.Technologies() do
if( pTeamTechs:HasTech( row.ID ) ) then
iCount = iCount + 1;
end
end
return 100 * iCount / #GameInfo.Technologies;
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildLiteracyEntry( iPlayer )
local instance = {};
ContextPtr:BuildInstanceForControl( "Entry", instance, Controls.MainStack );
instance.Name:LocalizeAndSetText( "TXT_KEY_DEMOGRAPHICS_LITERACY" );
instance.Value:SetText( Locale.ToNumber(m_LiteracyTable[ iPlayer ], "#'%'" ));
local best = GetBest( m_LiteracyTable, iPlayer );
SetIcon(best[2], instance.BestIcon, instance.BestIconBG, instance.BestIconShadow);
instance.Best:SetText( Locale.ToNumber(best[1], "#'%'") );
instance.Average:SetText( Locale.ToNumber( GetAverage( m_LiteracyTable, iPlayer ), "#'%'" ) );
local worst = GetWorst( m_LiteracyTable, iPlayer );
SetIcon(worst[2], instance.WorstIcon, instance.WorstIconBG, instance.WorstIconShadow);
instance.Worst:LocalizeAndSetText( Locale.ToNumber(worst[1], "#'%'" ) );
instance.Rank:SetText( Locale.ToNumber(GetRank( m_LiteracyTable, iPlayer ), "#") );
end
----------------------------------------------------------------
----------------------------------------------------------------
function BuildList( iPlayer )
Controls.MainStack:DestroyAllChildren();
BuildPopulationEntry( iPlayer );
BuildFoodEntry( iPlayer );
BuildProductionEntry( iPlayer );
BuildGoldEntry( iPlayer );
BuildLandEntry( iPlayer );
BuildArmyEntry( iPlayer );
BuildApprovalEntry( iPlayer );
BuildLiteracyEntry( iPlayer );
Controls.MainStack:CalculateSize();
Controls.MainStack:ReprocessAnchoring();
Controls.BigStack:ReprocessAnchoring();
CivIconHookup( iPlayer, 64, Controls.Icon, Controls.CivIconBG, Controls.CivIconShadow, false, true);
end
----------------------------------------------------------------
----------------------------------------------------------------
function OnPlayerPulldown( iPlayerID )
BuildList( iPlayerID );
end
-- Controls.PlayerPulldown:RegisterSelectionCallback( OnPlayerPulldown );
----------------------------------------------------------------
----------------------------------------------------------------
function ShowHideHandler( bIsHide, bIsInit )
if( not bIsInit ) then
if( not bIsHide ) then
BuildTables();
BuildList( Game.GetActivePlayer() );
if( not m_bIsEndGame ) then
UI.incTurnTimerSemaphore();
Events.SerialEventGameMessagePopupShown(m_PopupInfo);
end
else
Events.SerialEventGameMessagePopupProcessed.CallImmediate(ButtonPopupTypes.BUTTONPOPUP_DEMOGRAPHICS, 0);
if( not m_bIsEndGame ) then
UI.decTurnTimerSemaphore();
end
end
end
end
ContextPtr:SetShowHideHandler( ShowHideHandler );
BuildTables();
BuildList( Game.GetActivePlayer() );
if( m_bIsEndGame ) then
Controls.BGBlock:SetHide( true );
Controls.InGameSet:SetHide( true );
end
-------------------------------------------------
-- On Popup
-------------------------------------------------
function OnPopup( popupInfo )
-- End game is its own deal that shouldn't come up when we hit a hotkey or something
if (m_bIsEndGame) then
return
end
if( popupInfo.Type == ButtonPopupTypes.BUTTONPOPUP_DEMOGRAPHICS ) then
m_PopupInfo = popupInfo;
if( m_PopupInfo.Data1 == 1 ) then
if( ContextPtr:IsHidden() == false ) then
OnBack();
else
UIManager:QueuePopup( ContextPtr, PopupPriority.InGameUtmost );
end
else
UIManager:QueuePopup( ContextPtr, PopupPriority.Demographics );
end
end
end
Events.SerialEventGameMessagePopup.Add( OnPopup );
----------------------------------------------------------------
----------------------------------------------------------------
function OnBack()
print("Dequeuing demographics");
UIManager:DequeuePopup( ContextPtr );
end
Controls.BackButton:RegisterCallback( Mouse.eLClick, OnBack );
----------------------------------------------------------------
-- Key Down Processing
----------------------------------------------------------------
function InputHandler( uiMsg, wParam, lParam )
if( uiMsg == KeyEvents.KeyDown ) then
if( wParam == Keys.VK_RETURN or wParam == Keys.VK_ESCAPE ) then
OnBack();
return true;
end
end
end
if( not m_bIsEndGame ) then
ContextPtr:SetInputHandler( InputHandler );
end
----------------------------------------------------------------
-- 'Active' (local human) player has changed
----------------------------------------------------------------
Events.GameplaySetActivePlayer.Add(OnBack);