Repository navigation
Expand file tree
/
Copy pathGameData.h
More file actions
1633 lines (1441 loc) · 65.6 KB
/
Copy pathGameData.h
File metadata and controls
1633 lines (1441 loc) · 65.6 KB
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
// SPDX-License-Identifier: MIT
/**
* @file GameData.h
* @brief 比赛数据中心定义
* @details 负责管理比赛中的所有核心数据,包括机器人状态、比赛进程、基地血量等。
* 作为数据中心,它接收来自网络的更新,并向UI组件发送信号。
* @author Clear
* @date 2025-11-29
* @copyright Copyright (c) 2025 Fudan University EGA Team (复旦大学星云 EGA 机器人战队).
*/
#ifndef GAMEDATA_H
#define GAMEDATA_H
#include "MatchProfile.h"
#include "../network/Protocol.h"
#include "TimedEventRules.h"
#include <QDateTime>
#include <QHash>
#include <QImage>
#include <QList>
#include <QMap>
#include <QMutex>
#include <QObject>
#include <QString>
#include <QTimer>
#include <QVariant>
#include <QJsonObject>
#include <QtGlobal>
namespace robomaster {
class RobotStatus;
class GameInfo;
class GameStatus;
class Event;
class VideoControl;
class RoboMasterMessage;
class GlobalUnitStatus;
class GlobalLogisticsStatus;
class GlobalSpecialMechanism;
class RadarInfoToClient;
class RobotPathPlanInfo;
class RobotInjuryStat;
class SentryStatusSync;
class RobotModuleStatus; // 模块状态 Protobuf 前向声明
class RobotStaticStatus;
class RobotDynamicStatus;
class TechCoreMotionStateSync;
class DeployModeStatusSync;
class AirSupportStatusSync;
class RuneStatusSync;
class RobotPosition;
class GroundRobotPosition;
class MapRobotData;
class RadarMarkData;
class Buff;
class PenaltyInfo;
class RefereeWarningData;
} // namespace robomaster
class PopupStateMachine;
/**
* @enum RobotStatus
* @brief 机器人状态枚举
*/
enum class RobotStatus {
NORMAL = 0, // 正常
OFFLINE = 1, // 离线
DAMAGED = 2, // 受损
DESTROYED = 3, // 被摧毁
INVINCIBLE = 4, // 无敌状态
REVIVING = 5, // 复活中
// 为了兼容其他文件中的使用,添加别名
Normal = NORMAL,
Dead = DESTROYED,
Disconnected = OFFLINE,
YellowCard = 6, // 黄牌
RedCard = 7, // 红牌
Punished = 8 // 被罚下
};
/**
* @enum GameStage
* @brief 比赛阶段枚举
* @details 按照 RoboMaster 2026 官方协议定义:
* 0: 未开始比赛
* 1: 准备阶段
* 2: 十五秒裁判系统自检阶段
* 3: 五秒倒计时
* 4: 比赛中
* 5: 比赛结算中
*/
enum class GameStage {
NOT_STARTED = 0, // 未开始比赛
PREPARATION = 1, // 准备阶段
SELF_CHECK = 2, // 十五秒裁判系统自检阶段
COUNTDOWN = 3, // 五秒倒计时
BATTLE = 4, // 比赛中
SETTLEMENT = 5 // 比赛结算中
};
/**
* @enum SpeedLockState
* @brief 射速超限锁定状态
*/
enum class SpeedLockState {
Normal = 0,
Locked15s = 1,
Locked20s = 2,
PermanentLocked = 3
};
/**
* @struct RobotData
* @brief 机器人数据结构
* @details 存储单个机器人的完整状态信息。
*/
#include "CustomDataTypes.h"
struct RobotData {
/**
* @struct BuffTimedData
* @brief 单个 Buff 的完整状态
*/
struct BuffTimedData {
qint32 level; // 协议上报 buff_level(可正可负)
quint32 maxTime; // 协议上报 buff_max_time(秒)
quint32 leftTimeAtSync; // 协议上报时刻 buff_left_time(秒)
BuffTimedData()
: level(0), maxTime(0), leftTimeAtSync(0) {}
void clear() {
level = 0;
maxTime = 0;
leftTimeAtSync = 0;
}
};
/**
* @struct BuffBundle
* @brief 将机器人全部 Buff 状态打包,避免在 RobotData 扩散大量组合字段
*/
struct BuffBundle {
BuffTimedData attack; // 1: 攻击增益
BuffTimedData defenseOrVulnerability; // 2: 防御增益/负防增益(易伤)
BuffTimedData cooling; // 3: 射击热量冷却增益
BuffTimedData chassisPower; // 4: 底盘功率增益
BuffTimedData recovery; // 5: 回血增益
BuffTimedData remoteAmmo; // 6: 可兑换允许发弹量
BuffTimedData terrainPrewarn; // 7: 地形跨越增益(预警)
//调用该方法可获取buff数据写入
BuffTimedData *byType(quint8 buffType) {
switch (buffType) {
case 1:
return &attack;
case 2:
return &defenseOrVulnerability;
case 3:
return &cooling;
case 4:
return &chassisPower;
case 5:
return &recovery;
case 6:
return &remoteAmmo;
case 7:
return &terrainPrewarn;
default:
return nullptr;
}
}
//只读访问buff信息
const BuffTimedData *byType(quint8 buffType) const {
switch (buffType) {
case 1:
return &attack;
case 2:
return &defenseOrVulnerability;
case 3:
return &cooling;
case 4:
return &chassisPower;
case 5:
return &recovery;
case 6:
return &remoteAmmo;
case 7:
return &terrainPrewarn;
default:
return nullptr;
}
}
//把所有buff相关数据重置
void clear() {
attack.clear();
defenseOrVulnerability.clear();
cooling.clear();
chassisPower.clear();
recovery.clear();
remoteAmmo.clear();
terrainPrewarn.clear();
}
};
quint8 robotId; // 机器人ID (1-7: 红方, 101-107: 蓝方)
RobotType type; // 机器人类型 (步兵/英雄/工程等)
TeamColor team; // 所属队伍颜色 (红/蓝)
RobotStatus status; // 当前状态 (正常/离线/复活中等)
QString name; // 机器人名称
quint8 level; // 当前等级 (1-3)
quint16 currentHP; // 当前血量
quint16 maxHP; // 最大血量
quint16 currentRoundMaxHP; // 当前局已记录的最大血量
quint16 experience; // 当前经验值
quint16 maxExperience; // 当前等级总经验需求(当前经验 + 距离升级仍需经验)
quint8 heroRigMode; //英雄机器人机构类型
quint8 infantry17mmMode; //步兵机器人机构类型
quint8 shooterPerformanceSelection; // 性能体系-发射机构
quint8 chassisPerformanceSelection; //性能体系-底盘类型
quint16 launchingFrequency; // 当前射速 (发/秒)
quint16 tabShootSpeedLimit; // Tab 面板射速上限显示值(m/s,工程为 0)
quint16 firerate; // 射速 (发/秒,兼容旧代码)
bool isClientConnected; // 客户端是否已连接
bool isControllerConnected; // 遥控器是否已连接
bool canRemoteAmmo; // RobotDynamicStatus.can_remote_ammo:可远程兑换弹丸
bool canRemoteHeal; // RobotDynamicStatus.can_remote_heal:可远程兑换血量
quint32 buffMask; // 增益效果位掩码
//底盘相关
quint16 power; // 当前底盘功率 (W)
quint16 maxPower; // 底盘功率上限 (W)
quint16 bufferEnergy; // 缓冲能量 (J)
quint16 maxBufferEnergy; // 缓冲能量上限 (J)
quint16 currentChassisEnergy; // 当前底盘能量 (J)
quint16 maxChassisEnergy; // 底盘能量上限 (J)
quint16 chassisOverPowerCutSeconds; // 协议下发的超功率断电剩余时间
//弹丸射击相关
float muzzleVelocity; // 射击初速度 (m/s)
float shootSpeedLimit; // 射击初速度上限 (m/s)
SpeedLockState speedLockState; // 射速超限锁定状态
quint16 speedLockSeconds; // 射速超限剩余锁定时间
// 弹量相关
quint16 allowedAmmo17mm; // 17mm 允许发弹量
quint16 allowedAmmo42mm; // 42mm 允许发弹量
quint16 fortressBonusAmmo; // 堡垒额外弹药 (测试/增益)
bool isOutOfCombat; // 是否脱战 (6s内未受到伤害且未发射弹丸)
quint16 outOfCombatCountdown; // 脱战倒计时 (秒)
quint8 yellowCardCount; // 黄牌数量
// Buff 新协议全量状态(含 level / maxTime / leftTimeAtSync)
BuffBundle buffs; // 新版 Buff 全量打包状态(含时间)
QDateTime lastDamageTime; // 上次受到伤害的时间
QDateTime lastFireTime; // 上次发射弹丸的时间
bool chassisEnabled; // 底盘是否使能 (0=禁用/锁定, 1=使能)
// 热量相关
quint16 currentHeat; // 当前枪口热量
quint16 heatLimit; // 枪口热量上限
quint16 coolingValue; // 枪口热量冷却值
bool isHeatOverLimit; // 新增:热量超限标记 (用于驱动UI变红)
quint16 q2HeatThreshold; // 二级热量阈值 (Q2)
bool shooterLocked; // 射击机构是否被锁定 (裁判系统状态)
bool shooterPermanentLocked; // 是否被永久锁定 (超过Q2)
quint16 heatLockSeconds; // 热量超限预计解锁倒计时
// 模式与标志位
float posX; // 机器人X坐标 (m)
float posY; // 机器人Y坐标 (m)
float angle; // 机器人朝向角度 (度)
QDateTime lastPositionTime; // 仅由坐标消息更新时间
bool hasPositionHeading = false;
quint8 isHighLight; // 雷达特殊标识(保留协议原值,如 0/1/2)
QDateTime lastUpdateTime; // 最后更新时间
bool hasTabGlobalSnapshot; // Tab 面板是否收到过 GlobalUnitStatus 对应槽位快照
quint16 tabGlobalCurrentHP; // Tab 面板使用的 GlobalUnitStatus 槽位血量
bool tabStaticConnected; // Tab 面板使用的 RobotStaticStatus 连接态
RobotData()
: robotId(0), type(RobotType::INFANTRY_3), team(TeamColor::RED),
status(RobotStatus::OFFLINE), name(), level(1), currentHP(0),
maxHP(600), currentRoundMaxHP(0), experience(0), maxExperience(1000), heroRigMode(0),
infantry17mmMode(0), shooterPerformanceSelection(0),
chassisPerformanceSelection(0), launchingFrequency(0),
tabShootSpeedLimit(0), firerate(0), isClientConnected(false),
isControllerConnected(false),
canRemoteAmmo(false), canRemoteHeal(false), buffMask(0), power(0),
maxPower(0), bufferEnergy(0), maxBufferEnergy(60),
currentChassisEnergy(0), maxChassisEnergy(0),
chassisOverPowerCutSeconds(0), muzzleVelocity(0.0f),
shootSpeedLimit(25.0f),
speedLockState(SpeedLockState::Normal), speedLockSeconds(0),
allowedAmmo17mm(0), allowedAmmo42mm(0), fortressBonusAmmo(0),
isOutOfCombat(true), outOfCombatCountdown(0), yellowCardCount(0),
chassisEnabled(false), currentHeat(0), heatLimit(0), coolingValue(0),
isHeatOverLimit(false), q2HeatThreshold(340), shooterLocked(false),
shooterPermanentLocked(false), heatLockSeconds(0), posX(0.0f),
posY(0.0f), angle(0.0f), isHighLight(0), lastUpdateTime(),
hasTabGlobalSnapshot(false), tabGlobalCurrentHP(0),
tabStaticConnected(false) {}
// ===== 自定义 UI 数据字段 (来自 CustomByteBlock) =====
bool fricEnabled = false;
bool rammerEnabled = false;
int chassisMode = 0;
bool spinMode = false;
bool followMode = false;
bool chassisProtect = false;
bool chassisWarning = false;
float superCapEnergyPercent = 0.0f;
float gimbalChassisAngle = 0.0f;
uint8_t targetDistance = 0;
int8_t ballisticCompensation = 0;
};
/**
* @struct BaseData
* @brief 基地数据结构
*/
struct BaseData {
TeamColor team; // 所属队伍颜色
quint16 currentHP; // 当前血量 (0-5000)
quint16 maxHP; // 最大血量
quint16 virtualShield; // 虚拟护盾值
bool isInvincible; // 是否处于无敌状态
quint8 status; // 基地状态 (0:无敌, 1:无敌解除, 2:开甲)
QDateTime lastUpdateTime; // 最后更新时间
BaseData()
: team(TeamColor::RED), currentHP(5000), maxHP(5000), virtualShield(0),
isInvincible(true), status(0) {}
};
/**
* @struct OutpostData
* @brief 前哨站数据结构
*/
struct OutpostData {
TeamColor team; // 所属队伍颜色
quint16 currentHP; // 当前血量 (0-1500)
quint16 maxHP; // 最大血量
bool isDestroyed; // 是否已被摧毁
quint8 status; // 前哨站状态 (0-2:存活, 3:不可重建, 4:可重建, 5:重建中)
quint8 rebuildCount; // 剩余重建次数
quint8 maxRebuildCount; // 最大重建次数
QDateTime lastUpdateTime; // 最后更新时间
OutpostData()
: team(TeamColor::RED), currentHP(1500), maxHP(1500), isDestroyed(false),
status(0), rebuildCount(2), maxRebuildCount(2) {
}
};
struct OutpostHealthSample {
qint64 timestampMs = 0;
quint16 hp = 0;
};
struct BaseHealthSample {
qint64 timestampMs = 0;
quint16 hp = 0;
};
/**
* @struct GameState
* @brief 比赛状态数据结构
*/
struct GameState {
quint8 gameType; // 比赛类型 (1=机甲大师赛)
GameStage gameProgress; // 当前比赛阶段
quint16 gameTime; // 比赛剩余时间 (秒)
quint16 stageElapsed; // 当前阶段已过时间 (秒)
quint16 redScore; // 红方比分
quint16 blueScore; // 蓝方比分
quint8 currentRound; // 当前回合数
quint8 lastRound; // 上局回合数(暂无为0)
bool gameStarted; // 比赛是否已开始
bool gameEnded; // 比赛是否已结束
bool isPaused; // 比赛是否处于技术暂停
quint64 syncTimeStamp; // 同步时间戳 (用于比赛时间校准)
QString currentEvent; // 当前事件描述文本
QDateTime lastUpdateTime; // 最后更新时间
GameState()
: gameType(1), gameProgress(GameStage::NOT_STARTED), gameTime(420),
stageElapsed(0),
redScore(0), blueScore(0), currentRound(1), lastRound(0),gameStarted(false),
gameEnded(false), isPaused(false), syncTimeStamp(0),
currentEvent(""), lastUpdateTime(QDateTime::currentDateTime()) {}
};
/**
* @struct BuffPointData
* @brief 增益点数据结构
*/
struct BuffPointData {
quint8 pointId; // 增益点ID
TeamColor controllingTeam; // 控制该增益点的队伍
quint16 energyValue; // 当前能量值
quint16 maxEnergyValue; // 最大能量值
quint16 cooldownTime; // 冷却剩余时间 (秒)
bool isActivated; // 是否已激活
bool isAvailable; // 是否可用
QDateTime lastUpdateTime; // 最后更新时间
BuffPointData()
: pointId(0), controllingTeam(TeamColor::RED), energyValue(0),
maxEnergyValue(1000), cooldownTime(0), isActivated(false),
isAvailable(true) {}
};
/**
* @struct DamageRecord
* @brief 伤害记录结构
*/
struct DamageRecord {
quint8 attackerId; // 攻击者机器人ID
quint8 victimId; // 受击者机器人ID
quint16 damage; // 伤害值
quint8 armorId; // 受击装甲板ID (0-4)
quint8 hurtType; // 伤害类型 (弹丸/碰撞/超热量等)
QDateTime timestamp; // 伤害发生时间戳
DamageRecord()
: attackerId(0), victimId(0), damage(0), armorId(0), hurtType(0) {}
};
/**
* @struct TeamDamageStats
* @brief 队伍伤害统计
*/
struct TeamDamageStats {
quint32 totalDamageDealt; // 队伍总输出伤害
quint32 totalDamageReceived; // 队伍总承受伤害
quint16 killCount; // 击杀数量
quint16 deathCount; // 死亡数量
TeamDamageStats()
: totalDamageDealt(0), totalDamageReceived(0), killCount(0),
deathCount(0) {}
};
/**
* @struct KillRecord
* @brief 击杀记录结构体
*/
struct KillRecord {
quint8 killerId; // 击杀者ID (0表示未知/环境伤害)
quint8 victimId; // 被击杀者ID
int killStreak; // 连杀数
bool isFirstBlood; // 是否一血
QDateTime timestamp;// 发生时间
KillRecord() : killerId(0), victimId(0), killStreak(0), isFirstBlood(false), timestamp(QDateTime::currentDateTime()) {}
KillRecord(quint8 kId, quint8 vId, int streak, bool fb)
: killerId(kId), victimId(vId), killStreak(streak), isFirstBlood(fb), timestamp(QDateTime::currentDateTime()) {}
};
/**
* @struct RuneData
* @brief 能量机关状态数据结构
*/
struct RuneData {
int status; // 1:未激活, 2:正在激活, 3:已激活
int activatedArms; // 已激活灯臂数 (0-5)
int type; // 0:小符, 1:大符 (需结合 event_id 或其他字段判断)
float averageRings; // 平均环数(V1.3.0 起为浮点)
bool isActivatable;
bool wasActivatable;
QList<float> groupAverageRings; // 每组平均环数,按协议或 event.param 填充
QList<int> groupDeltas; // 每组增量/差值,按协议或 event.param 填充
int activationStartRemainingTime; // 激活开始时的比赛剩余时间 (秒)
RuneData()
: status(1), activatedArms(0), type(0), averageRings(0.0f),
isActivatable(false), wasActivatable(false),
activationStartRemainingTime(-1) {}
};
struct TechCoreMotionStateData {
quint32 maximumDifficultyLevel = 0;
quint32 basicState = 0;
quint32 putinState = 0;
quint32 moveState = 0;
quint32 rotateState = 0;
quint32 enemyCoreStatus = 0;
quint32 remainTimeAll = 0;
quint32 remainTimeStep = 0;
};
struct TeamLogisticsStatusData {
quint32 remainingEconomy = 0;
quint64 totalEconomyObtained = 0;
quint32 techLevel = 0;
quint32 encryptionLevel = 0;
};
/**
* @struct SentryPathData
* @brief 哨兵路径规划数据结构(归一化到地图宽高)
*/
struct SentryPathData {
float startX; // 哨兵起始X坐标 (0.0 - 1.0, 左下角为原点)
float startY; // 哨兵起始Y坐标 (0.0 - 1.0, 左下角为原点)
QList<float> pathDeltasX; // 路径X增量列表(相对地图宽度归一化)
QList<float> pathDeltasY; // 路径Y增量列表(相对地图高度归一化)
SentryPathData() : startX(0.0f), startY(0.0f) {}
};
/**
* @class GameData
* @brief 比赛数据管理类
* @details 核心数据类,维护所有比赛实体的状态,并提供信号槽机制以驱动UI更新。
*/
class GameData : public QObject {
Q_OBJECT
/**
* @brief QML属性定义
* @details 通过 Q_PROPERTY 将 C++ 方法暴露为 QML 属性
*/
// === QML 属性绑定 ===
// === qml面板数据连接 ===
Q_PROPERTY(int redScore READ redScore NOTIFY gameStateUpdated)
Q_PROPERTY(int blueScore READ blueScore NOTIFY gameStateUpdated)
Q_PROPERTY(int currentRound READ currentRound NOTIFY gameStateUpdated)
Q_PROPERTY(int remainingTime READ getGameTime NOTIFY gameTimeUpdated)
Q_PROPERTY(QString gamePhase READ gamePhaseString NOTIFY gameStateUpdated)
Q_PROPERTY(bool is_paused READ is_paused NOTIFY gameStateUpdated)
Q_PROPERTY(int redEconomy READ redEconomy NOTIFY economyUpdated)
Q_PROPERTY(int blueEconomy READ blueEconomy NOTIFY economyUpdated)
Q_PROPERTY(int currentTeamEconomy READ currentTeamEconomy NOTIFY currentTeamEconomyChanged)
Q_PROPERTY(int redBaseHealth READ redBaseHealth NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(int redBaseMaxHealth READ redBaseMaxHealth NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(int blueBaseHealth READ blueBaseHealth NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(int blueBaseMaxHealth READ blueBaseMaxHealth NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(bool blueBaseInvincible READ blueBaseInvincible NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(bool redBaseInvincible READ redBaseInvincible NOTIFY baseHealthUpdatedProxy)
Q_PROPERTY(int redDefenseBonus READ redDefenseBonus NOTIFY dataChanged)
Q_PROPERTY(int blueDefenseBonus READ blueDefenseBonus NOTIFY dataChanged)
// === minimap面板数据绑定 ===
Q_PROPERTY(bool isRedRuneActive READ isRedRuneActive NOTIFY redRuneStatusUpdated)
Q_PROPERTY(bool isBlueRuneActive READ isBlueRuneActive NOTIFY blueRuneStatusUpdated)
Q_PROPERTY(int runeStatus READ runeStatusValue NOTIFY runeStatusChanged)
Q_PROPERTY(int runeType READ runeTypeValue NOTIFY runeStatusChanged)
Q_PROPERTY(bool runeActivatable READ runeActivatable NOTIFY runeStatusChanged)
Q_PROPERTY(int runeActivatedArms READ activatedRuneArms NOTIFY runeStatusChanged)
Q_PROPERTY(float runeAverageRings READ runeAverageRings NOTIFY runeStatusChanged)
Q_PROPERTY(int runeActivationStartRemainingTime READ runeActivationStartRemainingTime NOTIFY runeStatusChanged)
Q_PROPERTY(QVariantList runeGroupAverageRings READ runeGroupAverageRings NOTIFY runeStatusChanged)
Q_PROPERTY(QVariantList runeGroupDeltas READ runeGroupDeltas NOTIFY runeStatusChanged)
Q_PROPERTY(int currentRobotId READ currentRobotId NOTIFY myRobotUpdated)
Q_PROPERTY(int matchProfileIndex READ matchProfileIndex NOTIFY matchProfileChanged)
Q_PROPERTY(bool uses2027Protocol READ uses2027Protocol NOTIFY matchProfileChanged)
Q_PROPERTY(bool hasBases READ hasBases NOTIFY matchProfileChanged)
Q_PROPERTY(bool hasControlPoints READ hasControlPoints NOTIFY matchProfileChanged)
Q_PROPERTY(qreal fieldWidth READ fieldWidth NOTIFY matchProfileChanged)
Q_PROPERTY(qreal fieldHeight READ fieldHeight NOTIFY matchProfileChanged)
Q_PROPERTY(QString mapBackground READ mapBackground NOTIFY matchProfileChanged)
Q_PROPERTY(QVariantMap territoryStatus READ territoryStatus NOTIFY dataChanged)
Q_PROPERTY(bool redOutpostDead READ redOutpostDead NOTIFY outpostDestroyed)
Q_PROPERTY(bool blueOutpostDead READ blueOutpostDead NOTIFY outpostDestroyed)
Q_PROPERTY(float sentryStartX READ sentryStartX NOTIFY sentryPathUpdated)
Q_PROPERTY(float sentryStartY READ sentryStartY NOTIFY sentryPathUpdated)
Q_PROPERTY(QVariantList sentryPathDeltasX READ sentryPathDeltasX NOTIFY sentryPathUpdated)
Q_PROPERTY(QVariantList sentryPathDeltasY READ sentryPathDeltasY NOTIFY sentryPathUpdated)
Q_PROPERTY(QVariantList miniMapMarkers READ getMiniMapMarkers NOTIFY robotPositionUpdated)
Q_PROPERTY(QVariantMap myRobot READ getMyRobot NOTIFY myRobotUpdated)
// Hero 视频帧(由 VideoReceiver 提供的 QImage)
Q_PROPERTY(QImage heroFrame READ heroFrame NOTIFY heroFrameUpdated)
Q_PROPERTY(bool hasHeroFrame READ hasHeroFrame NOTIFY heroFrameUpdated)
Q_PROPERTY(quint64 heroFrameRevision READ heroFrameRevision NOTIFY heroFrameUpdated)
Q_PROPERTY(QString heroFrameSource READ heroFrameSource NOTIFY heroFrameUpdated)
Q_PROPERTY(QString heroFrameDataUrl READ heroFrameDataUrl NOTIFY heroFrameUpdated)
Q_PROPERTY(QString redTeamName READ redTeamName NOTIFY myRobotUpdated)
Q_PROPERTY(int redOutpostHealth READ redOutpostHealth NOTIFY
outpostHealthUpdatedProxy)
Q_PROPERTY(int redOutpostMaxHealth READ redOutpostMaxHealth NOTIFY outpostHealthUpdatedProxy)
Q_PROPERTY(int blueOutpostHealth READ blueOutpostHealth NOTIFY
outpostHealthUpdatedProxy)
Q_PROPERTY(int blueOutpostMaxHealth READ blueOutpostMaxHealth NOTIFY outpostHealthUpdatedProxy)
Q_PROPERTY(bool redOutpostDestroyed READ redOutpostDestroyed NOTIFY
outpostHealthUpdatedProxy)
Q_PROPERTY(bool blueOutpostDestroyed READ blueOutpostDestroyed NOTIFY
outpostHealthUpdatedProxy)
Q_PROPERTY(int redOutpostRebuildCount READ redOutpostRebuildCount NOTIFY
outpostRebuildCountProxy)
Q_PROPERTY(int blueOutpostRebuildCount READ blueOutpostRebuildCount NOTIFY
outpostRebuildCountProxy)
Q_PROPERTY(int redOutpostMaxRebuildCount READ redOutpostMaxRebuildCount NOTIFY
outpostRebuildCountProxy)
Q_PROPERTY(int blueOutpostMaxRebuildCount READ blueOutpostMaxRebuildCount NOTIFY
outpostRebuildCountProxy)
Q_PROPERTY(QString blueTeamName READ blueTeamName NOTIFY myRobotUpdated)
// === leftbotton 面板 机器人数据列表 ===
Q_PROPERTY(int currentHealth READ currentHealth NOTIFY myRobotUpdated)
Q_PROPERTY(int maxHealth READ maxHealth NOTIFY myRobotUpdated)
Q_PROPERTY(int chassisEnergy READ chassisEnergy NOTIFY myRobotUpdated)
Q_PROPERTY(int maxChassisEnergy READ maxChassisEnergy NOTIFY myRobotUpdated)
Q_PROPERTY(int bufferEnergy READ bufferEnergyValue NOTIFY myRobotUpdated)
Q_PROPERTY(int maxBufferEnergy READ maxBufferEnergy NOTIFY myRobotUpdated)
Q_PROPERTY(int robotId READ robotIdValue NOTIFY myRobotUpdated)
Q_PROPERTY(int robotLevel READ robotLevel NOTIFY myRobotUpdated)
Q_PROPERTY(int yellowCardCount READ yellowCardCount NOTIFY myRobotUpdated) //重置
Q_PROPERTY(QString outOfCombatStatus READ outOfCombatStatus NOTIFY myRobotUpdated) //数据绑定
Q_PROPERTY(QString chassisStatus READ chassisStatus NOTIFY myRobotUpdated) //数据绑定
Q_PROPERTY(QVariantList moduleStates READ moduleStates NOTIFY moduleListChanged)
Q_PROPERTY(bool isOutOfCombat READ isOutOfCombat NOTIFY myRobotUpdated)
Q_PROPERTY(bool canRemoteHeal READ canRemoteHeal NOTIFY myRobotUpdated) //可远程兑换血量
Q_PROPERTY(bool canRemoteAmmo READ canRemoteAmmo NOTIFY myRobotUpdated) //可远程兑换弹丸
Q_PROPERTY(bool canRemoteExchange READ canRemoteExchange NOTIFY myRobotUpdated) //可进行远程兑换
Q_PROPERTY(int currentExp READ currentExp NOTIFY myRobotUpdated)
Q_PROPERTY(int maxExp READ maxExp NOTIFY myRobotUpdated)
//增益(统一走打包结构)
Q_PROPERTY(QVariantMap buffTimedData READ buffTimedData NOTIFY myRobotUpdated)
// 能量机关状态(RuneStatusSync 打包给 QML)
Q_PROPERTY(QVariantMap runeStatusData READ runeStatusData NOTIFY runeStatusDataChanged)
// 飞镖命中消息打包给 qml
Q_PROPERTY(QVariantMap dartMessageData READ dartMessageData
NOTIFY dartMessageDataChanged)
// === tab面板 当前机器人属性 (我的机器人面板使用) ===
Q_PROPERTY(QVariantList redTeamData READ getRedRobotsDataQml NOTIFY dataChanged)
Q_PROPERTY(QVariantList blueTeamData READ getBlueRobotsDataQml NOTIFY dataChanged)
Q_PROPERTY(int redDartHits READ redDartHits NOTIFY dataChanged)
Q_PROPERTY(int blueDartHits READ blueDartHits NOTIFY dataChanged)
Q_PROPERTY(int dartTotal READ dartTotal CONSTANT) // 固定常量
Q_PROPERTY(int redTotalDamage READ redTotalDamage NOTIFY injuryStatsUpdated)
Q_PROPERTY(int blueTotalDamage READ blueTotalDamage NOTIFY injuryStatsUpdated)
Q_PROPERTY(int redRobotTotalHP READ redRobotTotalHP NOTIFY dataChanged)
Q_PROPERTY(int blueRobotTotalHP READ blueRobotTotalHP NOTIFY dataChanged)
// === ~ 面板伤害统计 ===
Q_PROPERTY(
QVariantList moduleData READ getModuleData NOTIFY moduleListChanged)
Q_PROPERTY(int damage17mm READ damage17mm NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damage17mmPercent READ damage17mmPercent NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damage42mm READ damage42mm NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damage42mmPercent READ damage42mmPercent NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageCollision READ damageCollision NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageCollisionPercent READ damageCollisionPercent NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageOffline READ damageOffline NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageOfflinePercent READ damageOfflinePercent NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageWarning READ damageWarning NOTIFY injuryStatsUpdated)
Q_PROPERTY(int damageWarningPercent READ damageWarningPercent NOTIFY injuryStatsUpdated)
// === 消息系统 ===
Q_PROPERTY(QVariantList systemMessages READ getSystemMessages NOTIFY
systemMessagesChanged)
Q_PROPERTY(QVariantList robotMessages READ getRobotMessages NOTIFY
robotMessagesChanged)
Q_PROPERTY(bool kickedAll READ kickedAll NOTIFY kickAllStateChanged)
Q_PROPERTY(QVariantList activePopups READ activePopups NOTIFY activePopupsChanged)
Q_PROPERTY(QVariantMap robotRespawnStatus READ robotRespawnStatus NOTIFY robotRespawnStatusUpdated)
// === 自定义 UI 数据 (通过 CustomByteBlock 接收) ===
Q_PROPERTY(QVariantMap myRobotCustomData READ getMyRobotCustomData NOTIFY robotCustomDataUpdated)
Q_PROPERTY(bool customUIEnabled READ customUIEnabled WRITE setCustomUIEnabled NOTIFY customUIEnabledChanged)
// === 兑换系统 ===
Q_PROPERTY(int ammo17mmExchangeCount READ ammo17mmExchangeCount NOTIFY exchangeCountsUpdated)
Q_PROPERTY(int ammo42mmExchangeCount READ ammo42mmExchangeCount NOTIFY exchangeCountsUpdated)
Q_PROPERTY(int engineerPer10sReward READ engineerPer10sReward NOTIFY engineerRewardUpdated)
Q_PROPERTY(int deployModeStatus READ deployModeStatus NOTIFY deployModeStatusChanged)
Q_PROPERTY(int airSupportStatus READ airSupportStatus NOTIFY airSupportStatusUpdated)
Q_PROPERTY(int airSupportLeftTime READ airSupportLeftTime NOTIFY airSupportStatusUpdated)
Q_PROPERTY(int airSupportCostCoins READ airSupportCostCoins NOTIFY airSupportStatusUpdated)
Q_PROPERTY(int airSupportIsBeingTargeted READ airSupportIsBeingTargeted NOTIFY airSupportStatusUpdated)
Q_PROPERTY(int airSupportShooterStatus READ airSupportShooterStatus NOTIFY airSupportStatusUpdated)
Q_PROPERTY(int siloTargetId READ siloTargetId NOTIFY siloStatusChanged)
Q_PROPERTY(int siloGateState READ siloGateState NOTIFY siloStatusChanged)
Q_PROPERTY(bool siloOnline READ siloOnline NOTIFY siloStatusChanged)
Q_PROPERTY(uint maximumDifficultyLevel READ maximumDifficultyLevel NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint techCoreBasicState READ techCoreBasicState NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint techCorePutinState READ techCorePutinState NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint techCoreMoveState READ techCoreMoveState NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint techCoreRotateState READ techCoreRotateState NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint enemyStatus READ enemyStatus NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint remainTimeAll READ remainTimeAll NOTIFY techCoreMotionStateSyncUpdated)
Q_PROPERTY(uint remainTimeStep READ remainTimeStep NOTIFY techCoreMotionStateSyncUpdated)
public:
explicit GameData(QObject *parent = nullptr);
~GameData();
// 机器人数据访问器
const QList<RobotData> &getAllRobots() const { return m_robots; }
const QList<RobotData> getRobotsByTeam(TeamColor team) const;
/**
* @brief 根据机器人ID获取其机器人类型
* @param robotId 机器人ID (1-7, 101-107)
* @return RobotType 对应的机器人类型
*/
static RobotType getRobotTypeById(quint8 robotId);
const RobotData *getRobotById(quint8 robotId) const;
const RobotData *getCurrentRobot() const;
void setCurrentRobotId(quint8 robotId) {
if (m_currentRobotId == robotId)
return;
const bool teamChanged = (m_currentRobotId >= 100) != (robotId >= 100);
m_currentRobotId = robotId;
resetDashboardSeat(teamChanged);
emit myRobotUpdated();
if (teamChanged) {
emit currentTeamEconomyChanged();
emit runeStatusDataChanged();
}
}
quint8 getCurrentRobotId() const { return m_currentRobotId; }
RM::MatchProfile matchProfile() const { return m_matchProfile; }
void setMatchProfile(RM::MatchProfile profile);
int matchProfileIndex() const { return static_cast<int>(m_matchProfile); }
bool uses2027Protocol() const { return RM::is2027(m_matchProfile); }
bool hasBases() const {
return m_matchProfile != RM::MatchProfile::Rmul3v3 &&
m_matchProfile != RM::MatchProfile::Rmul1v1;
}
bool hasControlPoints() const {
return uses2027Protocol() && m_matchProfile != RM::MatchProfile::Rmul1v1;
}
qreal fieldWidth() const { return RM::fieldSize(m_matchProfile).width(); }
qreal fieldHeight() const { return RM::fieldSize(m_matchProfile).height(); }
QString mapBackground() const;
QVariantMap territoryStatus() const { return m_territoryStatus; }
QVariantMap dashboardData() const;
QJsonObject teamHeavyStatus() const;
void updateTeamHeavyStatus(const QJsonObject &status);
void updateDashboardSentry(const robomaster::SentryStatusSync &data);
bool isFieldPosition(qreal x, qreal y) const;
QPointF normalizedMapPosition(qreal x, qreal y) const;
// ===== 自定义 UI 数据访问器 =====
Q_INVOKABLE QVariantMap getMyRobotCustomData() const;
RobotData& getRobotDataRef(quint8 robotId);
// 基地数据访问器
const BaseData &getRedBase() const { return m_redBase; }
const BaseData &getBlueBase() const { return m_blueBase; }
const BaseData &getBaseByTeam(TeamColor team) const;
// 前哨站数据访问器
const OutpostData &getRedOutpost() const { return m_redOutpostData; }
const OutpostData &getBlueOutpost() const { return m_blueOutpostData; }
const OutpostData &getOutpostByTeam(TeamColor team) const;
// QML 属性访问器
int redScore() const { return m_gameState.redScore; }
int blueScore() const { return m_gameState.blueScore; }
int redRoundScoreDelta() const;
int blueRoundScoreDelta() const;
int currentRound() const { return m_gameState.currentRound; }
QString gamePhaseString() const;
int redEconomy() const { return m_redEconomy; }
int blueEconomy() const { return m_blueEconomy; }
quint32 redRemainingEconomy() const {
return m_redLogisticsStatus.remainingEconomy;
}
quint32 blueRemainingEconomy() const {
return m_blueLogisticsStatus.remainingEconomy;
}
quint64 redTotalEconomyObtained() const {
return m_redLogisticsStatus.totalEconomyObtained;
}
quint64 blueTotalEconomyObtained() const {
return m_blueLogisticsStatus.totalEconomyObtained;
}
quint32 redTechLevel() const { return m_redLogisticsStatus.techLevel; }
quint32 blueTechLevel() const { return m_blueLogisticsStatus.techLevel; }
quint32 redEncryptionLevel() const {
return m_redLogisticsStatus.encryptionLevel;
}
quint32 blueEncryptionLevel() const {
return m_blueLogisticsStatus.encryptionLevel;
}
int allyFortressOccupationSec() const { return m_allyFortressOccupationSec; }
int enemyFortressOccupationSec() const { return m_enemyFortressOccupationSec; }
int currentTeamEconomy() const {
return m_currentRobotId >= 100 ? m_blueEconomy : m_redEconomy;
}
int redBaseHealth() const { return m_redBase.currentHP; }
int redBaseMaxHealth() const { return m_redBase.maxHP; }
int blueBaseHealth() const { return m_blueBase.currentHP; }
int blueBaseMaxHealth() const { return m_blueBase.maxHP; }
bool redBaseInvincible() const { return m_redBase.isInvincible; }
bool blueBaseInvincible() const { return m_blueBase.isInvincible; }
int redBaseStatus() const { return m_redBase.status; }
int blueBaseStatus() const { return m_blueBase.status; }
int redOutpostHealth() const { return m_redOutpostData.currentHP; }
int redOutpostMaxHealth() const { return m_redOutpostData.maxHP; }
int blueOutpostHealth() const { return m_blueOutpostData.currentHP; }
int blueOutpostMaxHealth() const { return m_blueOutpostData.maxHP; }
int enemyOutpostHealth() const {
const RobotData *robot = getCurrentRobot();
const bool myIsRed =
robot ? (robot->team == TeamColor::RED) : (m_currentRobotId < 100);
return myIsRed ? m_blueOutpostData.currentHP : m_redOutpostData.currentHP;
}
bool customUIEnabled() const { return m_customUIEnabled; }
void setCustomUIEnabled(bool v);
bool redOutpostDestroyed() const { return m_redOutpostData.isDestroyed; }
bool blueOutpostDestroyed() const { return m_blueOutpostData.isDestroyed; }
int redOutpostRebuildCount() const { return m_redOutpostData.rebuildCount; }
int blueOutpostRebuildCount() const { return m_blueOutpostData.rebuildCount; }
int redOutpostMaxRebuildCount() const { return m_redOutpostData.maxRebuildCount; }
int blueOutpostMaxRebuildCount() const { return m_blueOutpostData.maxRebuildCount; }
static QString enemyTeamName() {
const QString envName = qEnvironmentVariable("RM_ENEMY_TEAM_NAME").trimmed();
return envName.isEmpty() ? QStringLiteral("对方战队") : envName;
}
QString redTeamName() const {
return m_currentRobotId < 100 ? QStringLiteral("中国石油大学(北京) SPR")
: enemyTeamName();
}
QString blueTeamName() const {
return m_currentRobotId < 100 ? enemyTeamName()
: QStringLiteral("中国石油大学(北京) SPR");
}
// 当前机器人属性访问器 (我的机器人面板使用)
int currentHealth() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->currentHP : 0;
}
int maxHealth() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->maxHP : 600;
}
int chassisEnergy() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->currentChassisEnergy : 0;
}
int maxChassisEnergy() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->maxChassisEnergy : 0;
}
int bufferEnergyValue() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->bufferEnergy : 0;
}
int maxBufferEnergy() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->maxBufferEnergy : 0;
}
int robotIdValue() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->robotId : 1;
}
int robotLevel() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->level : 1;
}
int yellowCardCount() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->yellowCardCount : 0;
}
QString outOfCombatStatus()const;
QString chassisStatus() const;
bool isOutOfCombat() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->isOutOfCombat : true;
}
bool canRemoteHeal() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->canRemoteHeal : false;
}
bool canRemoteAmmo() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->canRemoteAmmo : false;
}
bool canRemoteExchange() const {
return canRemoteHeal() || canRemoteAmmo();
}
//增益
QVariantMap buffTimedData() const;
QVariantMap runeStatusData() const;
QVariantMap dartMessageData() const;
int currentExp() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->experience : 0;
}
int maxExp() const {
const RobotData *robot = getCurrentRobot();
return robot ? robot->maxExperience : 1000;
}
// 兑换计数访问器
int ammo17mmExchangeCount() const { return m_ammo17mmExchangeCount; }
int ammo42mmExchangeCount() const { return m_ammo42mmExchangeCount; }
int engineerPer10sReward() const { return m_engineerPer10sReward; }
int deployModeStatus() const { return m_deployModeStatus; }
int airSupportStatus() const { return m_airSupportStatus; }
int airSupportLeftTime() const { return m_airSupportLeftTime; }
int airSupportCostCoins() const { return m_airSupportCostCoins; }
int airSupportIsBeingTargeted() const {
return m_airSupportIsBeingTargeted;
}
int airSupportShooterStatus() const { return m_airSupportShooterStatus; }
int siloTargetId() const { return m_siloTargetId; }
int siloGateState() const { return m_siloGateState; }
uint maximumDifficultyLevel() const {
return m_techCoreMotionState.maximumDifficultyLevel;
}
bool siloOnline() const;
void setEngineerPer10sReward(int value) {
if (m_engineerPer10sReward == value)
return;
m_engineerPer10sReward = value;
emit engineerRewardUpdated();
}
uint techCoreBasicState() const { return m_techCoreMotionState.basicState; }
uint techCorePutinState() const { return m_techCoreMotionState.putinState; }
uint techCoreMoveState() const { return m_techCoreMotionState.moveState; }
uint techCoreRotateState() const { return m_techCoreMotionState.rotateState; }
uint enemyStatus() const {
return m_techCoreMotionState.enemyCoreStatus;
}
uint remainTimeAll() const {
return m_techCoreMotionState.remainTimeAll;
}
uint remainTimeStep() const {
return m_techCoreMotionState.remainTimeStep;
}
uint techCoreMaximumDifficultyLevel() const {
return m_techCoreMotionState.maximumDifficultyLevel;
}
// Q_INVOKABLE 方法
Q_INVOKABLE void incrementAmmo17mmExchangeCount();
Q_INVOKABLE void incrementAmmo42mmExchangeCount();
Q_INVOKABLE QVariantMap getRobotInfo(int robotId) const;
Q_INVOKABLE bool isRobotConnected(int robotId) const; // 基于 RobotStaticStatus.connection_state
Q_INVOKABLE bool isAerialConnected() const; // 我方空中机器人在线检测(查当前队伍的 AERIAL 类型机器人)
Q_INVOKABLE bool isSiloConnected() const; // 基于 RobotStaticStatus / RobotModuleStatus 判断飞镖模块在线
// 比赛状态访问器
const GameState &getGameState() const { return m_gameState; }
GameStage getCurrentStage() const { return m_gameState.gameProgress; }
quint16 getGameTime() const { return m_gameState.gameTime; }
bool isGameActive() const {
return m_gameState.gameStarted && !m_gameState.gameEnded;
}
bool is_paused() const { return m_gameState.isPaused; }
bool isRedRuneActive() const { return m_isRedRuneActive; }
bool isBlueRuneActive() const { return m_isBlueRuneActive; }
int runeStatusValue() const { return m_runeData.status; }
int runeTypeValue() const { return m_runeData.type; }
bool runeActivatable() const { return m_runeData.isActivatable; }
int activatedRuneArms() const;
float runeAverageRings() const { return m_runeData.averageRings; }
int runeActivationStartRemainingTime() const { return m_runeData.activationStartRemainingTime; }
QVariantList runeGroupAverageRings() const;
QVariantList runeGroupDeltas() const;
int currentRobotId() const { return m_currentRobotId; }
bool redOutpostDead() const { return m_redOutpostData.isDestroyed; }