-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathBaseConflict.Classes.Gamestates.GUI.pas
1678 lines (1458 loc) · 59.7 KB
/
BaseConflict.Classes.Gamestates.GUI.pas
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
unit BaseConflict.Classes.Gamestates.GUI;
interface
uses
Math,
SysUtils,
System.Generics.Collections,
Engine.Math,
Engine.GUI,
Engine.Input,
Engine.dXML,
Engine.Helferlein,
Engine.Helferlein.Windows,
Engine.Helferlein.DataStructures,
Engine.DataQuery,
BaseConflict.Entity,
BaseConflict.Api.Shop,
BaseConflict.EntityComponents.Shared,
BaseConflict.EntityComponents.Client,
BaseConflict.Constants,
BaseConflict.Constants.Cards,
BaseConflict.Constants.Client,
BaseConflict.Constants.Scenario,
BaseConflict.Settings.Client,
BaseConflict.Globals;
type
{$RTTI EXPLICIT METHODS([vcPrivate, vcPublic, vcPublished]) PROPERTIES([vcPublic, vcPublished]) FIELDS([vcPrivate, vcProtected, vcPublic])}
{$M+}
TPaginatorFilter<T : class> = class abstract
private
FOnChange : ProcCallback;
FItemList : TUltimateObjectList<T>;
procedure Filter(var Query : IDataQuery<T>); virtual; abstract;
function ResetValues : boolean; virtual;
protected
procedure CallChangeHandler;
public
property OnChange : ProcCallback read FOnChange write FOnChange;
constructor Create(const ItemList : TUltimateObjectList<T>);
procedure ApplyFilters(Paginator : TPaginator<T>); virtual;
end;
TPaginatorCardFilter<T : class> = class(TPaginatorFilter<T>)
private
FFilterForColors : SetEntityColor;
FFilterForTech : SetTechLevels;
FFilterForType : SetCardType;
FFilterForText : string;
FFilterForLeagues : SetLeagues;
FOrderBy : EnumFilterItemOrder;
procedure Filter(var FilteredItems : IDataQuery<T>); override;
function ResetValues : boolean; override;
procedure SetFilterForColors(const Value : SetEntityColor);
procedure SetFilterForTech(const Value : SetTechLevels);
procedure SetFilterForType(const Value : SetCardType);
procedure SetOrderBy(const Value : EnumFilterItemOrder);
procedure SetFilterForLeagues(const Value : SetLeagues);
public
procedure SetColor(const Color : EnumEntityColor; const Value : boolean);
property FilterForColors : SetEntityColor read FFilterForColors write SetFilterForColors;
procedure SetTech(const Tech : byte; const Value : boolean);
property FilterForTech : SetTechLevels read FFilterForTech write SetFilterForTech;
procedure SetLeague(const League : byte; const Value : boolean);
property FilterForLeague : SetLeagues read FFilterForLeagues write SetFilterForLeagues;
procedure SetType(const CardType : EnumCardType; const Value : boolean);
property FilterForType : SetCardType read FFilterForType write SetFilterForType;
procedure SetFilterForText(const Value : string);
property FilterForText : string read FFilterForText write SetFilterForText;
function OrderItems : TArray<EnumFilterItemOrder>; virtual;
property OrderBy : EnumFilterItemOrder read FOrderBy write SetOrderBy;
/// <summary> Returns whether the reset changed anything. </summary>
function Reset : boolean;
end;
TPaginatorShopFilter<T : class> = class(TPaginatorCardFilter<T>)
private
FCategoryFilter : EnumShopCategory;
function ResetValues : boolean; override;
procedure Filter(var FilteredItems : IDataQuery<T>); override;
procedure SetCategoryFilter(const Value : EnumShopCategory);
public
property Category : EnumShopCategory read FCategoryFilter write SetCategoryFilter;
end;
EnumHUDState = (hsGame, hsNone, hsVictory, hsDefeat);
RScoreboardPlayer = record
username : string;
deckname : string;
deck_icon : string;
constructor Create(const username, deckname, DeckIcon : string);
end;
THUDCommanderAbility = class
protected
FCommanderSpellData : TCommanderSpellData;
FUID : string;
public
property UID : string read FUID;
property CommanderSpellData : TCommanderSpellData read FCommanderSpellData;
constructor Create(const UID : string; CommanderSpellData : TCommanderSpellData);
destructor Destroy; override;
end;
THUDDeckSlot = class(THUDCommanderAbility)
private
FIsReady : boolean;
FCardInfo : TCardInfo;
FCurrentCharges, FMaxCharges, FSlot : integer;
FChargeProgress : single;
FHotkey : string;
FCooldownSeconds : single;
procedure SetCardInfo(const Value : TCardInfo); virtual;
procedure SetCurrentCharges(const Value : integer); virtual;
procedure SetIsReady(const Value : boolean); virtual;
procedure SetChargeProgress(const Value : single); virtual;
procedure SetMaxCharges(const Value : integer); virtual;
procedure SetSlot(const Value : integer); virtual;
procedure SetHotkey(const Value : string); virtual;
procedure SetCooldownSeconds(const Value : single); virtual;
published
property CardInfo : TCardInfo read FCardInfo write SetCardInfo;
property Slot : integer read FSlot write SetSlot;
property CurrentCharges : integer read FCurrentCharges write SetCurrentCharges;
property MaxCharges : integer read FMaxCharges write SetMaxCharges;
property ChargeProgress : single read FChargeProgress write SetChargeProgress;
property CooldownSeconds : single read FCooldownSeconds write SetCooldownSeconds;
property IsReady : boolean read FIsReady write SetIsReady;
property Hotkey : string read FHotkey write SetHotkey;
public
property CommanderSpellData : TCommanderSpellData read FCommanderSpellData;
constructor Create(CardInfo : TCardInfo; Slot : integer; CommanderSpellData : TCommanderSpellData);
procedure UpdateHotkey;
end;
ProcCommanderAbilityClick = procedure(CommanderSpellData : TCommanderSpellData; MouseEvent : EnumGUIEvent) of object;
/// <summary> Contains all values visible to the core HUD. </summary>
TIngameHUD = class
private
FCommanderAbilityClick : ProcCommanderAbilityClick;
protected
const
CARD_HINT_DELAY = 800;
BASE_IS_UNDER_ATTACK_THROTTLE = 10000;
var
FCardHintTimer, FAnnouncementTimer, FBaseIsUnderAttackTimer : TTimer;
FShouldCloseSettings : boolean;
FSpawnerJumpLastPosition : RVector2;
procedure OnNexusDamage(TeamID : integer);
strict private
FIsAnnouncementVisible : boolean;
FAnnouncementTitle, FAnnouncementSubtitle : string;
procedure SetAnnouncementSubtitle(const Value : string); virtual;
procedure SetAnnouncementTitle(const Value : string); virtual;
procedure SetIsAnnouncementVisible(const Value : boolean); virtual;
strict private
FCommanderAbilities : TObjectDictionary<string, THUDCommanderAbility>;
strict private
FShowCardHotkeys : boolean;
FShowCardNumericChargeProgress : boolean;
FDeckSlotsStage1, FDeckSlotsStage2, FDeckSlotsStage3, FDeckSlotsSpawner : TUltimateObjectList<THUDDeckSlot>;
procedure SetShowCardHotkeys(const Value : boolean); virtual;
procedure SetShowCardNumericChargeProgress(const Value : boolean); virtual;
procedure SetDeckSlotsSpawner(const Value : TUltimateObjectList<THUDDeckSlot>); virtual;
procedure SetDeckSlotsStage1(const Value : TUltimateObjectList<THUDDeckSlot>); virtual;
procedure SetDeckSlotsStage2(const Value : TUltimateObjectList<THUDDeckSlot>); virtual;
procedure SetDeckSlotsStage3(const Value : TUltimateObjectList<THUDDeckSlot>); virtual;
strict private
FHUDState : EnumHUDState;
FIsMenuOpen, FIsSettingsOpen, FHasGameStarted, FIsReconnecting : boolean;
FIsSandboxControlVisible, FIsHUDVisible, FIsSandbox, FCameraFixedToLane : boolean;
FTimeToAttack, FAttackBaseCount, FPing, FFPS : integer;
FIsPvEAttack : boolean;
FTimeToNextBossWave : integer;
FSpawnTimer, FTutorialHintText, FTutorialWindowButtonText : string;
FCardHintTextVisible, FPreventConsecutivePlaying : boolean;
FCurrentGold, FCurrentGoldCap, FCurrentTier, FCurrentGoldIncome, FCurrentWood, FCurrentWoodIncome, FTimeToNextTier,
FSpentWood, FSpentWoodToIncomeUpgrade, FIncomeUpgrades, FMaxIncomeUpgrades : integer;
FLeftTeamID, FRightTeamID, FLeftNexusHealth, FRightNexusHealth, FCameraFollowEntity : integer;
FCommanderCount, FCommanderActiveIndex : integer;
FCameraLaneXLimit : single;
FCardHintCardInfo : TCardInfo;
FCameraRotationSpeed, FCameraScrollSpeed, FCameraTiltOffset, FCameraRotationOffset, FCameraFoVOffset : single;
FCaptureMode, FCameraRotate, FIsTechnicalPanelVisible, FCameraLocked, FKeepResourcesInCaptureMode, FCameraTiltOffsetUsed,
FCameraRotationOffsetUsed, FCameraFoVOffsetUsed, FIsTutorial, FIsTutorialHintOpen, FCameraLimited, FCameraLaneXLimited : boolean;
FMousePosition : RVector2;
FTutorialHintFullscreen, FTutorialWindowBackdrop, FTutorialWindowArrowVisible : boolean;
FMouseScreenPosition : RIntVector2;
FCameraLockedSpawnerJumpEnabled, FTutorialWindowHighlight : boolean;
FTutorialWindowAnchor : EnumComponentAnchor;
FTutorialWindowPosition, FResolution : RIntVector2;
FSandboxSpawnWithOverwatchClearable, FSandboxSpawnWithOverwatch : boolean;
FCameraPosition : RVector2;
FScoreboardVisible : boolean;
FScoreboardRightTeam : TUltimateList<RScoreboardPlayer>;
FScoreboardLeftTeam : TUltimateList<RScoreboardPlayer>;
FIsBaseUnderAttack : boolean;
FIsTeamMode : boolean;
procedure SetCurrentWoodIncome(const Value : integer); virtual;
procedure SetIsTeamMode(const Value : boolean); virtual;
procedure SetIsBaseUnderAttack(const Value : boolean); virtual;
procedure SetCardHintCardInfo(const Value : TCardInfo); virtual;
procedure SetTutorialWindowArrowVisible(const Value : boolean); virtual;
procedure SetResolution(const Value : RIntVector2); virtual;
procedure SetScoreboardVisible(const Value : boolean); virtual;
procedure SetFPS(const Value : integer); virtual;
procedure SetPing(const Value : integer); virtual;
procedure SetCameraPosition(const Value : RVector2); virtual;
procedure SetPreventConsecutivePlaying(const Value : boolean); virtual;
procedure SetCameraLaneXLimit(const Value : single); virtual;
procedure SetCameraLaneXLimited(const Value : boolean); virtual;
procedure SetTutorialWindowBackdrop(const Value : boolean); virtual;
procedure SetTutorialWindowButtonText(const Value : string); virtual;
procedure SetTutorialWindowHighlight(const Value : boolean); virtual;
procedure SetTutorialWindowAnchor(const Value : EnumComponentAnchor); virtual;
procedure SetTutorialWindowPosition(const Value : RIntVector2); virtual;
procedure SetCameraLockedSpawnerJumpEnabled(const Value : boolean); virtual;
procedure SetSandboxSpawnWithOverwatch(const Value : boolean); virtual;
procedure SetSandboxSpawnWithOverwatchClearable(const Value : boolean); virtual;
procedure SetCameraFollowEntity(const Value : integer); virtual;
procedure SetCameraLimited(const Value : boolean); virtual;
procedure SetMouseScreenPosition(const Value : RIntVector2); virtual;
procedure SetTutorialHintFullscreen(const Value : boolean); virtual;
procedure SetIsTutorialHintOpen(const Value : boolean); virtual;
procedure SetTutorialHintText(const Value : string); virtual;
procedure SetMousePosition(const Value : RVector2); virtual;
procedure SetIsTutorial(const Value : boolean); virtual;
procedure SetCameraFoVOffset(const Value : single); virtual;
procedure SetCameraFoVOffsetUsed(const Value : boolean); virtual;
procedure SetCameraRotationOffsetUsed(const Value : boolean); virtual;
procedure SetCameraTiltOffsetUsed(const Value : boolean); virtual;
procedure SetCameraRotationOffset(const Value : single); virtual;
procedure SetCameraTiltOffset(const Value : single); virtual;
procedure SetCameraLocked(const Value : boolean); virtual;
procedure SetCameraScrollSpeed(const Value : single); virtual;
procedure SetKeepResourcesInCaptureMode(const Value : boolean); virtual;
procedure SetCaptureMode(const Value : boolean); virtual;
procedure SetIsTechnicalPanelVisible(const Value : boolean); virtual;
procedure SetCameraRotate(const Value : boolean); virtual;
procedure SetCameraRotationSpeed(const Value : single); virtual;
procedure SetCameraFixedToLane(const Value : boolean); virtual;
procedure SetIsReconnecting(const Value : boolean); virtual;
procedure SetIncomeUpgrades(const Value : integer); virtual;
procedure SetMaxIncomeUpgrades(const Value : integer); virtual;
procedure SetSpentWood(const Value : integer); virtual;
procedure SetSpentWoodToIncomeUpgrade(const Value : integer); virtual;
procedure SetIsSandbox(const Value : boolean); virtual;
procedure SetIsHUDVisible(const Value : boolean); virtual;
procedure SetIsSandboxControlVisible(const Value : boolean); virtual;
procedure SetCommanderActiveIndex(const Value : integer); virtual;
procedure SetCommanderCount(const Value : integer); virtual;
procedure SetIsSettingsOpen(const Value : boolean); virtual;
procedure SetLeftNexusHealth(const Value : integer); virtual;
procedure SetLeftTeamID(const Value : integer); virtual;
procedure SetRightNexusHealth(const Value : integer); virtual;
procedure SetRightTeamID(const Value : integer); virtual;
procedure SetCurrentGoldIncome(const Value : integer); virtual;
procedure SetCurrentTier(const Value : integer); virtual;
procedure SetCurrentWood(const Value : integer); virtual;
procedure SetTimeToNextTier(const Value : integer); virtual;
procedure SetCurrentGold(const Value : integer); virtual;
procedure SetCurrentGoldCap(const Value : integer); virtual;
procedure SetTimeToNextBossWave(const Value : integer); virtual;
procedure SetAttackBaseCount(const Value : integer); virtual;
procedure SetIsPvEAttack(const Value : boolean); virtual;
procedure SetTimeToAttack(const Value : integer); virtual;
procedure SetHasGameStarted(const Value : boolean); virtual;
procedure SetHUDState(const Value : EnumHUDState); virtual;
procedure SetIsMenuOpen(const Value : boolean); virtual;
procedure SetCardHintTextVisible(const Value : boolean); virtual;
procedure SetSpawnTimer(const Value : string); virtual;
published
// general
property State : EnumHUDState read FHUDState write SetHUDState;
property IsReconnecting : boolean read FIsReconnecting write SetIsReconnecting;
property IsHUDVisible : boolean read FIsHUDVisible write SetIsHUDVisible;
property IsSandboxControlVisible : boolean read FIsSandboxControlVisible write SetIsSandboxControlVisible;
property IsSandbox : boolean read FIsSandbox write SetIsSandbox;
property IsMenuOpen : boolean read FIsMenuOpen write SetIsMenuOpen;
property IsSettingsOpen : boolean read FIsSettingsOpen write SetIsSettingsOpen;
property IsTutorial : boolean read FIsTutorial write SetIsTutorial;
property IsTeamMode : boolean read FIsTeamMode write SetIsTeamMode;
property CaptureMode : boolean read FCaptureMode write SetCaptureMode;
property KeepResourcesInCaptureMode : boolean read FKeepResourcesInCaptureMode write SetKeepResourcesInCaptureMode;
property HasGameStarted : boolean read FHasGameStarted write SetHasGameStarted;
property PreventConsecutivePlaying : boolean read FPreventConsecutivePlaying write SetPreventConsecutivePlaying;
procedure Surrender;
procedure SendGameEvent(const Eventname : string);
property MousePosition : RVector2 read FMousePosition write SetMousePosition;
property MouseScreenPosition : RIntVector2 read FMouseScreenPosition write SetMouseScreenPosition;
procedure CallClientCommand(Command : EnumClientCommand); overload;
property Resolution : RIntVector2 read FResolution write SetResolution;
// nexus damage hint
procedure BaseIsUnderAttack;
property IsBaseUnderAttack : boolean read FIsBaseUnderAttack write SetIsBaseUnderAttack;
// announcements
property IsAnnouncementVisible : boolean read FIsAnnouncementVisible write SetIsAnnouncementVisible;
property AnnouncementTitle : string read FAnnouncementTitle write SetAnnouncementTitle;
property AnnouncementSubtitle : string read FAnnouncementSubtitle write SetAnnouncementSubtitle;
procedure ShowAnnouncement(const AnnouncementUID : string);
procedure ShowAnnouncementForTime(const AnnouncementUID : string; const Duration : integer = 2000);
procedure HideAnnouncement;
procedure SetAnnouncementTimer(const Duration : integer);
// technical panel
property IsTechnicalPanelVisible : boolean read FIsTechnicalPanelVisible write SetIsTechnicalPanelVisible;
property Ping : integer read FPing write SetPing;
property FPS : integer read FFPS write SetFPS;
// camera
property CameraPosition : RVector2 read FCameraPosition write SetCameraPosition;
property CameraLimited : boolean read FCameraLimited write SetCameraLimited;
property CameraFixedToLane : boolean read FCameraFixedToLane write SetCameraFixedToLane;
property CameraRotate : boolean read FCameraRotate write SetCameraRotate;
property CameraRotationSpeed : single read FCameraRotationSpeed write SetCameraRotationSpeed;
property CameraScrollSpeed : single read FCameraScrollSpeed write SetCameraScrollSpeed;
property CameraLocked : boolean read FCameraLocked write SetCameraLocked;
property CameraLaneXLimited : boolean read FCameraLaneXLimited write SetCameraLaneXLimited;
property CameraLaneXLimit : single read FCameraLaneXLimit write SetCameraLaneXLimit;
property CameraFollowEntity : integer read FCameraFollowEntity write SetCameraFollowEntity;
property CameraRotationOffset : single read FCameraRotationOffset write SetCameraRotationOffset;
property CameraRotationOffsetUsed : boolean read FCameraRotationOffsetUsed write SetCameraRotationOffsetUsed;
property CameraTiltOffset : single read FCameraTiltOffset write SetCameraTiltOffset;
property CameraTiltOffsetUsed : boolean read FCameraTiltOffsetUsed write SetCameraTiltOffsetUsed;
property CameraFoVOffset : single read FCameraFoVOffset write SetCameraFoVOffset;
property CameraFoVOffsetUsed : boolean read FCameraFoVOffsetUsed write SetCameraFoVOffsetUsed;
procedure CameraMoveTo(const Target : RVector2; TimeToMove : integer);
property CameraLockedSpawnerJumpEnabled : boolean read FCameraLockedSpawnerJumpEnabled write SetCameraLockedSpawnerJumpEnabled;
procedure SpawnerJump;
// Tutorial
property IsTutorialHintOpen : boolean read FIsTutorialHintOpen write SetIsTutorialHintOpen;
property TutorialHintText : string read FTutorialHintText write SetTutorialHintText;
property TutorialHintFullscreen : boolean read FTutorialHintFullscreen write SetTutorialHintFullscreen;
property TutorialWindowHighlight : boolean read FTutorialWindowHighlight write SetTutorialWindowHighlight;
property TutorialWindowBackdrop : boolean read FTutorialWindowBackdrop write SetTutorialWindowBackdrop;
property TutorialWindowArrowVisible : boolean read FTutorialWindowArrowVisible write SetTutorialWindowArrowVisible;
property TutorialWindowPosition : RIntVector2 read FTutorialWindowPosition write SetTutorialWindowPosition;
property TutorialWindowAnchor : EnumComponentAnchor read FTutorialWindowAnchor write SetTutorialWindowAnchor;
property TutorialWindowButtonText : string read FTutorialWindowButtonText write SetTutorialWindowButtonText;
// Sandbox
property SandboxSpawnWithOverwatch : boolean read FSandboxSpawnWithOverwatch write SetSandboxSpawnWithOverwatch;
property SandboxSpawnWithOverwatchClearable : boolean read FSandboxSpawnWithOverwatchClearable write SetSandboxSpawnWithOverwatchClearable;
// deck panel
property ShowCardHotkeys : boolean read FShowCardHotkeys write SetShowCardHotkeys;
property ShowCardNumericChargeProgress : boolean read FShowCardNumericChargeProgress write SetShowCardNumericChargeProgress;
property DeckSlotsStage1 : TUltimateObjectList<THUDDeckSlot> read FDeckSlotsStage1 write SetDeckSlotsStage1;
property DeckSlotsStage2 : TUltimateObjectList<THUDDeckSlot> read FDeckSlotsStage2 write SetDeckSlotsStage2;
property DeckSlotsStage3 : TUltimateObjectList<THUDDeckSlot> read FDeckSlotsStage3 write SetDeckSlotsStage3;
property DeckSlotsSpawner : TUltimateObjectList<THUDDeckSlot> read FDeckSlotsSpawner write SetDeckSlotsSpawner;
function RegisterDeckSlot(CardInfo : TCardInfo; SlotIndex : integer; CommanderSpellData : TCommanderSpellData) : THUDDeckSlot;
procedure DeregisterDeckSlot(DeckSlot : THUDDeckSlot);
procedure ClickDeckslot(DeckSlot : THUDDeckSlot);
procedure MousedownDeckslot(DeckSlot : THUDDeckSlot);
// generic commander abilities
function RegisterCommanderAbility(const UID : string; CommanderSpellData : TCommanderSpellData) : THUDCommanderAbility;
procedure DeregisterCommanderAbility(CommanderAbility : THUDCommanderAbility);
procedure ClickCommanderAbility(const UID : string);
procedure MousedownCommanderAbility(CommanderAbility : THUDCommanderAbility);
// card preview
property CardHintTextVisible : boolean read FCardHintTextVisible write SetCardHintTextVisible;
property CardHintCardInfo : TCardInfo read FCardHintCardInfo write SetCardHintCardInfo;
// commander switch
property CommanderCount : integer read FCommanderCount write SetCommanderCount;
property CommanderActiveIndex : integer read FCommanderActiveIndex write SetCommanderActiveIndex;
procedure CommanderChange(CommanderIndex : integer);
// GameState
property SpawnTimer : string read FSpawnTimer write SetSpawnTimer;
property LeftTeamID : integer read FLeftTeamID write SetLeftTeamID;
property LeftNexusHealth : integer read FLeftNexusHealth write SetLeftNexusHealth;
property RightTeamID : integer read FRightTeamID write SetRightTeamID;
property RightNexusHealth : integer read FRightNexusHealth write SetRightNexusHealth;
// Resources
property Gold : integer read FCurrentGold write SetCurrentGold;
property GoldCap : integer read FCurrentGoldCap write SetCurrentGoldCap;
property GoldIncome : integer read FCurrentGoldIncome write SetCurrentGoldIncome;
property Wood : integer read FCurrentWood write SetCurrentWood;
property WoodIncome : integer read FCurrentWoodIncome write SetCurrentWoodIncome;
property SpentWood : integer read FSpentWood write SetSpentWood;
property SpentWoodToIncomeUpgrade : integer read FSpentWoodToIncomeUpgrade write SetSpentWoodToIncomeUpgrade;
property IncomeUpgrades : integer read FIncomeUpgrades write SetIncomeUpgrades;
property MaxIncomeUpgrades : integer read FMaxIncomeUpgrades write SetMaxIncomeUpgrades;
property Tier : integer read FCurrentTier write SetCurrentTier;
property TimeToNextTier : integer read FTimeToNextTier write SetTimeToNextTier;
// PvE - Attack
property IsPvEAttack : boolean read FIsPvEAttack write SetIsPvEAttack;
property TimeToAttack : integer read FTimeToAttack write SetTimeToAttack;
property AttackBaseCount : integer read FAttackBaseCount write SetAttackBaseCount;
property TimeToNextBossWave : integer read FTimeToNextBossWave write SetTimeToNextBossWave;
// Scoreboard
property ScoreboardVisible : boolean read FScoreboardVisible write SetScoreboardVisible;
property ScoreboardLeftTeam : TUltimateList<RScoreboardPlayer> read FScoreboardLeftTeam;
property ScoreboardRightTeam : TUltimateList<RScoreboardPlayer> read FScoreboardRightTeam;
public
property ShouldCloseSettings : boolean read FShouldCloseSettings write FShouldCloseSettings;
property OnCommanderAbilityClick : ProcCommanderAbilityClick read FCommanderAbilityClick write FCommanderAbilityClick;
constructor Create;
procedure Idle;
procedure CallClientCommand(Command : EnumClientCommand; Param1 : RParam); overload;
procedure UpdateHotkeysInDeck;
destructor Destroy; override;
end;
HGUIMethods = class
/// <summary> Transforms int to roman numeral 8 => IIX </summary>
class function AsRoman(const Value : integer) : string;
class function IntToStr(const Value : integer) : string;
/// <summary> Transforms seconds to mm:ss </summary>
class function IntToTime(const Value : integer) : string;
/// <summary> Transforms seconds to hh:mm </summary>
class function IntToLongTime(const Value : integer) : string;
/// <summary> Transforms seconds to "24 days" or "1 day and 22 hours" or "22 hours and 12 minutes" or "22 minutes and 5 seconds" </summary>
class function IntToTimeAdaptive(const Value : integer) : string;
/// <summary> Transforms seconds to "24 days" greater a day, otherwise returns to IntToLongTime. </summary>
class function IntToTimeAdaptiveDays(const Value : integer) : string;
/// <summary> Transforms seconds to hh:mm:ss </summary>
class function IntToLongTimeDetail(const Value : integer) : string;
class function IntComma(const Value : integer) : string;
class function _0(const Key : string) : string;
class function _(const Key, Value : string) : string;
class function _d(const Key : string; Value : integer) : string;
class function _dd(const Key : string; Value, Value2 : integer) : string;
class function _ds(const Key : string; Value : integer; Value2 : string) : string;
class function _2(const Key, Value, Value2 : string) : string;
class function _sss(const Key, Value, Value2, Value3 : string) : string;
class function _pluralize(const Key : string; Value : integer) : string;
class function _pluralize_d(const Key : string; Value : integer) : string;
class function _pluralize_dd(const Key : string; Value, Value2 : integer) : string;
class function Date(const Date : TDatetime) : string;
class function FloatToStr(const Value : single) : string;
class function FloatToCooldown(const Value : single) : string;
class function Ceil(const Value : single) : integer;
class function Trunc(const Value : single) : integer;
class function Floor(const Value : single) : integer;
class function Max(const ValueA, ValueB : single) : single;
class function Min(const ValueA, ValueB : single) : single;
class function TruncChars(const Value : string; MaxChars : integer) : string;
class function LoopChars(const Times : integer; const Chars : string) : string;
class function Range(n : integer) : TArray<integer>;
class function KeybindingToStr(Keybinding : RBinding) : string;
class function KeybindingToStrRaw(Keybinding : RBinding) : string;
end;
{$M-}
{$RTTI EXPLICIT METHODS([vcPublic, vcPublished]) PROPERTIES([vcPublic, vcPublished]) FIELDS([vcPrivate, vcProtected, vcPublic])}
implementation
uses
BaseConflict.Globals.Client;
{ TPaginatorCardFilter<T> }
procedure TPaginatorCardFilter<T>.Filter(var FilteredItems : IDataQuery<T>);
begin
FilteredItems := FilteredItems.Filter(F('CardInfo.CardColors') in RQuery.From<SetEntityColor>(FilterForColors));
FilteredItems := FilteredItems.Filter(F('CardInfo.Techlevel') in RQuery.From<SetTechLevels>(FilterForTech));
FilteredItems := FilteredItems.Filter(F('CardInfo.CardType') in RQuery.From<SetCardType>(FilterForType));
FilteredItems := FilteredItems.Filter(F('League') in RQuery.From<SetLeagues>(FilterForLeague));
if FilterForText <> '' then
FilteredItems := FilteredItems.Filter(FilterForText in F('CardInfo.Name'));
case OrderBy of
foAlphabetical : FilteredItems := FilteredItems.OrderBy(['CardInfo.Name', 'League', 'ID']);
foAlphabeticalReverse : FilteredItems := FilteredItems.OrderBy(['-CardInfo.Name', 'League', 'ID']);
foTech : FilteredItems := FilteredItems.OrderBy(['CardInfo.Techlevel', 'CardInfo.Name', 'League', 'ID']);
foTechReverse : FilteredItems := FilteredItems.OrderBy(['-CardInfo.Techlevel', 'CardInfo.Name', 'League', 'ID']);
foAttack : FilteredItems := FilteredItems.OrderBy(['-CardInfo.AttackValue', 'CardInfo.Name', 'League', 'ID']);
foDefense : FilteredItems := FilteredItems.OrderBy(['-CardInfo.DefenseValue', 'CardInfo.Name', 'League', 'ID']);
foUtility : FilteredItems := FilteredItems.OrderBy(['-CardInfo.UtilityValue', 'CardInfo.Name', 'League', 'ID']);
else
// foCreated as default
FilteredItems := FilteredItems.OrderBy(['-Created', 'CardInfo.Name', 'League', 'ID']);
end;
end;
function TPaginatorCardFilter<T>.ResetValues : boolean;
begin
Result := inherited;
Result := Result or (FFilterForColors <> ALL_COLORS);
FFilterForColors := ALL_COLORS;
Result := Result or (FFilterForTech <> ALL_TECHLEVELS);
FFilterForTech := ALL_TECHLEVELS;
Result := Result or (FFilterForLeagues <> ALL_LEAGUES);
FFilterForLeagues := ALL_LEAGUES;
Result := Result or (FFilterForType <> ALL_CARDTYPES);
FFilterForType := ALL_CARDTYPES;
Result := Result or (FFilterForText <> '');
FFilterForText := '';
Result := Result or (FOrderBy <> foCreated);
FOrderBy := foCreated;
end;
function TPaginatorCardFilter<T>.OrderItems : TArray<EnumFilterItemOrder>;
begin
Result := [foCreated, foAlphabetical, foAlphabeticalReverse, foTech, foTechReverse, foAttack, foDefense, foUtility];
end;
function TPaginatorCardFilter<T>.Reset : boolean;
begin
Result := ResetValues;
CallChangeHandler;
end;
procedure TPaginatorCardFilter<T>.SetColor(const Color : EnumEntityColor; const Value : boolean);
begin
if Value and not(Color in FilterForColors) then
FilterForColors := FilterForColors + [Color]
else if not Value and (Color in FilterForColors) then
begin
// If all colors are selected, special case to select the chosen one
if [ecBlack, ecGreen, ecBlue, ecWhite, ecColorless] <= FilterForColors then
FilterForColors := FilterForColors - [ecBlack, ecGreen, ecBlue, ecWhite, ecColorless] + [Color]
else
FilterForColors := FilterForColors - [Color];
end;
end;
procedure TPaginatorCardFilter<T>.SetFilterForColors(const Value : SetEntityColor);
begin
if Value <> FFilterForColors then
begin
FFilterForColors := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetFilterForLeagues(const Value : SetLeagues);
begin
if FFilterForLeagues <> Value then
begin
FFilterForLeagues := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetFilterForTech(const Value : SetTechLevels);
begin
if FFilterForTech <> Value then
begin
FFilterForTech := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetFilterForText(const Value : string);
begin
if FFilterForText <> Value then
begin
FFilterForText := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetFilterForType(const Value : SetCardType);
begin
if FFilterForType <> Value then
begin
FFilterForType := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetLeague(const League : byte; const Value : boolean);
begin
if Value and not(League in FilterForLeague) then
FilterForLeague := FilterForLeague + [League]
else if not Value and (League in FilterForLeague) then
begin
// If all leagues are selected, special case to select the chosen one
if ALL_LEAGUES <= FilterForLeague then
FilterForLeague := FilterForLeague - ALL_LEAGUES + [League]
else
FilterForLeague := FilterForLeague - [League];
end;
end;
procedure TPaginatorCardFilter<T>.SetOrderBy(const Value : EnumFilterItemOrder);
begin
if FOrderBy <> Value then
begin
FOrderBy := Value;
CallChangeHandler;
end;
end;
procedure TPaginatorCardFilter<T>.SetTech(const Tech : byte; const Value : boolean);
begin
if Value and not(Tech in FilterForTech) then
FilterForTech := FilterForTech + [Tech]
else if not Value and (Tech in FilterForTech) then
begin
// If all tech levels are selected, special case to select the chosen one
if ALL_TECHLEVELS <= FilterForTech then
FilterForTech := FilterForTech - ALL_TECHLEVELS + [Tech]
else
FilterForTech := FilterForTech - [Tech];
end;
end;
procedure TPaginatorCardFilter<T>.SetType(const CardType : EnumCardType; const Value : boolean);
begin
if Value and not(CardType in FilterForType) then
FilterForType := FilterForType + [CardType]
else if not Value and (CardType in FilterForType) then
begin
// If all types are selected, special case to select the chosen one
if ALL_CARDTYPES <= FilterForType then
FilterForType := FilterForType - ALL_CARDTYPES + [CardType]
else
FilterForType := FilterForType - [CardType];
end;
end;
{ TPaginatorFilter<T> }
procedure TPaginatorFilter<T>.ApplyFilters(Paginator : TPaginator<T>);
var
FilteredItems : IDataQuery<T>;
begin
FilteredItems := FItemList.Query;
Filter(FilteredItems);
Paginator.Objects := FilteredItems.ToList(False);
end;
procedure TPaginatorFilter<T>.CallChangeHandler;
begin
if assigned(FOnChange) then
FOnChange();
end;
constructor TPaginatorFilter<T>.Create(const ItemList : TUltimateObjectList<T>);
begin
FItemList := ItemList;
ResetValues;
end;
function TPaginatorFilter<T>.ResetValues : boolean;
begin
// nothing to initialize
Result := False;
end;
{ TPaginatorShopFilter<T> }
procedure TPaginatorShopFilter<T>.Filter(var FilteredItems : IDataQuery<T>);
begin
FilteredItems := FilteredItems.Filter(RQuery.From<EnumShopCategory>(Category) in F('Categories'));
FilteredItems := FilteredItems.Filter(F('IsVisible'));
if Category = scCards then
begin
inherited Filter(FilteredItems);
end
else if Category = scBundles then
FilteredItems := FilteredItems.Exclude(F('IsTimeLimited')).OrderBy(['ID'])
else
FilteredItems := FilteredItems.OrderBy(['Name']);
end;
function TPaginatorShopFilter<T>.ResetValues : boolean;
begin
Result := inherited;
Result := Result or (FCategoryFilter <> scSkins);
FCategoryFilter := scSkins;
end;
procedure TPaginatorShopFilter<T>.SetCategoryFilter(const Value : EnumShopCategory);
begin
if FCategoryFilter <> Value then
begin
FCategoryFilter := Value;
CallChangeHandler;
end;
end;
{ HGUIMethods }
class function HGUIMethods.AsRoman(const Value : integer) : string;
begin
Result := HString.IntToRomanNumeral(Value);
end;
class function HGUIMethods.Ceil(const Value : single) : integer;
begin
Result := Math.Ceil(Value);
end;
class function HGUIMethods.Date(const Date : TDatetime) : string;
var
Day, Month, Year : Word;
begin
DecodeDate(Date, Year, Month, Day);
if HInternationalizer.CurrentLanguage = 'de' then Result := HString.IntMitNull(Day) + '.' + HString.IntMitNull(Month) + '.'
else Result := HString.IntMitNull(Month) + '-' + HString.IntMitNull(Day);
end;
class function HGUIMethods.FloatToCooldown(const Value : single) : string;
var
Seconds : integer;
begin
Seconds := round(Value * 10);
if Seconds < 20 then
begin
Result := IntToStr(Seconds div 10) + FormatSettings.DecimalSeparator + IntToStr(Seconds mod 10);
end
else
Result := IntToStr(Seconds div 10);
end;
class function HGUIMethods.FloatToStr(const Value : single) : string;
begin
Result := Format('%.1f', [Value]);
end;
class function HGUIMethods.Floor(const Value : single) : integer;
begin
Result := Math.Floor(Value);
end;
class function HGUIMethods.IntComma(const Value : integer) : string;
begin
Result := HString.IntToStr(Value, -1, FormatSettings.ThousandSeparator);
end;
class function HGUIMethods.IntToLongTime(const Value : integer) : string;
begin
Result := HString.IntToLongTime(Value, False);
end;
class function HGUIMethods.IntToLongTimeDetail(const Value : integer) : string;
begin
Result := HString.IntToLongTimeDetail(Value, False);
end;
class function HGUIMethods.IntToStr(const Value : integer) : string;
begin
Result := SysUtils.IntToStr(Value);
end;
class function HGUIMethods.IntToTime(const Value : integer) : string;
begin
Result := HString.IntToTime(Value, False);
end;
class function HGUIMethods.IntToTimeAdaptive(const Value : integer) : string;
var
Days, Minutes, Hours, Seconds, Ticks : integer;
begin
Ticks := Math.Max(0, Value);
Seconds := Ticks mod 60;
Minutes := (Ticks div 60) mod 60;
Hours := (Ticks div 3600) mod 24;
Days := Ticks div 86400;
if Days > 2 then
Result := Format('%d %s', [Days + 1, self._pluralize_d('§misc_time_string_day', Days + 1)])
else if Days >= 1 then
Result := Format('%d %s %s %d %s', [Days, _pluralize_d('§misc_time_string_day', Days), _0('§misc_time_string_join'), Hours, _pluralize_d('§misc_time_string_hour', Hours)])
else if Hours > 2 then
Result := Format('%d %s', [Hours + 1, self._pluralize_d('§misc_time_string_hour', Hours + 1)])
else if Hours >= 1 then
Result := Format('%d %s %s %d %s', [Hours, _pluralize_d('§misc_time_string_hour', Hours), _0('§misc_time_string_join'), Minutes, _pluralize_d('§misc_time_string_minute', Minutes)])
else if Minutes > 2 then
Result := Format('%d %s', [Minutes + 1, self._pluralize_d('§misc_time_string_minute', Minutes + 1)])
else if Minutes >= 1 then
Result := Format('%d %s %s %d %s', [Minutes, _pluralize_d('§misc_time_string_minute', Minutes), _0('§misc_time_string_join'), Seconds, _pluralize_d('§misc_time_string_second', Seconds)])
else
Result := Format('%d %s', [Seconds, self._pluralize_d('§misc_time_string_second', Seconds)]);
end;
class function HGUIMethods.IntToTimeAdaptiveDays(const Value : integer) : string;
var
Days, Ticks : integer;
begin
Ticks := Math.Max(0, Value);
Days := Ticks div 86400;
if Days >= 1 then
Result := Format('%d %s', [Days, self._pluralize_d('§misc_time_string_day', Days)])
else
Result := HGUIMethods.IntToLongTime(Ticks);
end;
class function HGUIMethods.KeybindingToStr(Keybinding : RBinding) : string;
begin
Result := Keybinding.ToString;
end;
class function HGUIMethods.KeybindingToStrRaw(Keybinding : RBinding) : string;
begin
Result := Keybinding.ToStringRaw;
end;
class function HGUIMethods.LoopChars(const Times : integer; const Chars : string) : string;
begin
Result := HString.GenerateChars(Chars, Times);
end;
class function HGUIMethods.Max(const ValueA, ValueB : single) : single;
begin
Result := Math.Max(ValueA, ValueB);
end;
class function HGUIMethods.Min(const ValueA, ValueB : single) : single;
begin
Result := Math.Min(ValueA, ValueB);
end;
class function HGUIMethods.Range(n : integer) : TArray<integer>;
var
i : integer;
begin
if n <= 0 then exit(nil);
setLength(Result, n);
for i := 0 to n - 1 do
Result[i] := i;
end;
class function HGUIMethods.Trunc(const Value : single) : integer;
begin
Result := System.Trunc(Value);
end;
class function HGUIMethods.TruncChars(const Value : string; MaxChars : integer) : string;
begin
if length(Value) > MaxChars then
begin
Result := Copy(Value, 0, MaxChars - 3) + '...';
end
else Result := Value;
end;
class function HGUIMethods._(const Key, Value : string) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value]);
end;
class function HGUIMethods._0(const Key : string) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key);
end;
class function HGUIMethods._2(const Key, Value, Value2 : string) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value, Value2]);
end;
class function HGUIMethods._d(const Key : string; Value : integer) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value]);
end;
class function HGUIMethods._dd(const Key : string; Value, Value2 : integer) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value, Value2]);
end;
class function HGUIMethods._ds(const Key : string; Value : integer; Value2 : string) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value, Value2]);
end;
class function HGUIMethods._pluralize(const Key : string; Value : integer) : string;
begin
if Value <> 1 then
Result := HInternationalizer.TranslateTextRecursive(Key + '_plural', [])
else
Result := HInternationalizer.TranslateTextRecursive(Key, []);
end;
class function HGUIMethods._pluralize_d(const Key : string; Value : integer) : string;
begin
if Value <> 1 then
Result := HInternationalizer.TranslateTextRecursive(Key + '_plural', [Value])
else
Result := HInternationalizer.TranslateTextRecursive(Key, [Value]);
end;
class function HGUIMethods._pluralize_dd(const Key : string; Value, Value2 : integer) : string;
begin
if Value <> 1 then
Result := HInternationalizer.TranslateTextRecursive(Key + '_plural', [Value, Value2])
else
Result := HInternationalizer.TranslateTextRecursive(Key, [Value, Value2]);
end;
class function HGUIMethods._sss(const Key, Value, Value2, Value3 : string) : string;
begin
Result := HInternationalizer.TranslateTextRecursive(Key, [Value, Value2, Value3]);
end;
{ TIngameHUD }
procedure TIngameHUD.CallClientCommand(Command : EnumClientCommand);
begin
GlobalEventbus.Trigger(eiClientCommand, [ord(Command), RPARAMEMPTY]);
end;
procedure TIngameHUD.BaseIsUnderAttack;
begin
FBaseIsUnderAttackTimer.Start;
if not IsBaseUnderAttack then
IsBaseUnderAttack := True;
end;
procedure TIngameHUD.CallClientCommand(Command : EnumClientCommand; Param1 : RParam);
begin
GlobalEventbus.Trigger(eiClientCommand, [ord(Command), Param1]);
end;
procedure TIngameHUD.CameraMoveTo(const Target : RVector2; TimeToMove : integer);
begin
GlobalEventbus.Trigger(eiCameraMoveTo, [Target, TimeToMove]);
end;
procedure TIngameHUD.ClickCommanderAbility(const UID : string);
var
CommanderAbility : THUDCommanderAbility;
begin
if assigned(OnCommanderAbilityClick) and FCommanderAbilities.TryGetValue(UID.ToLowerInvariant, CommanderAbility) then
OnCommanderAbilityClick(CommanderAbility.CommanderSpellData, geClick);
end;
procedure TIngameHUD.ClickDeckslot(DeckSlot : THUDDeckSlot);
begin
if assigned(OnCommanderAbilityClick) then
OnCommanderAbilityClick(DeckSlot.CommanderSpellData, geClick);
end;
procedure TIngameHUD.CommanderChange(CommanderIndex : integer);
begin
if (0 <= CommanderIndex) and (CommanderIndex < CommanderCount) then
begin
CommanderActiveIndex := CommanderIndex;
GlobalEventbus.Trigger(eiChangeCommander, [CommanderIndex]);
end;
end;
constructor TIngameHUD.Create;
begin
FAnnouncementTimer := TTimer.CreatePaused(1000);
FBaseIsUnderAttackTimer := TTimer.CreatePaused(BASE_IS_UNDER_ATTACK_THROTTLE);
FCardHintTimer := TTimer.CreatePaused(CARD_HINT_DELAY);
FCommanderActiveIndex := -1;
FIsHUDVisible := True;
FIsSandboxControlVisible := False;
FCameraRotationSpeed := Settings.GetSingleOption(coSandboxRotationSpeed);
FCameraScrollSpeed := Settings.GetSingleOption(coGameplayScrollSpeed);
FCameraRotationOffset := Settings.GetSingleOption(coSandboxRotationOffset);
FCameraTiltOffset := Settings.GetSingleOption(coSandboxTiltOffset);
FCameraFoVOffset := Settings.GetSingleOption(coSandboxFoVOffset);
FCameraLimited := True;
FSpawnerJumpLastPosition := RVector2.EMPTY;
FCameraFollowEntity := -1;
FScoreboardRightTeam := TUltimateList<RScoreboardPlayer>.Create;
FScoreboardLeftTeam := TUltimateList<RScoreboardPlayer>.Create;
FTutorialWindowArrowVisible := True;
FDeckSlotsStage1 := TUltimateObjectList<THUDDeckSlot>.Create;
FDeckSlotsStage2 := TUltimateObjectList<THUDDeckSlot>.Create;
FDeckSlotsStage3 := TUltimateObjectList<THUDDeckSlot>.Create;
FDeckSlotsSpawner := TUltimateObjectList<THUDDeckSlot>.Create;
FCommanderAbilities := TObjectDictionary<string, THUDCommanderAbility>.Create([doOwnsValues]);
end;
procedure TIngameHUD.DeregisterCommanderAbility(CommanderAbility : THUDCommanderAbility);
begin
if assigned(CommanderAbility) then
FCommanderAbilities.Remove(CommanderAbility.UID);
end;
procedure TIngameHUD.DeregisterDeckSlot(DeckSlot : THUDDeckSlot);
begin
self.DeckSlotsStage1.Remove(DeckSlot);
self.DeckSlotsStage2.Remove(DeckSlot);
self.DeckSlotsStage3.Remove(DeckSlot);
self.DeckSlotsSpawner.Remove(DeckSlot);
end;
destructor TIngameHUD.Destroy;
begin
FBaseIsUnderAttackTimer.Free;