feat(评分系统): 实现多维度游戏评分统计与结算
- 扩展 GameScoreStats 数据结构,新增战绩、输出、防御、构建和效率五个维度的统计字段 - 在战斗、治疗、购卡、刷新等关键节点实时采集评分数据 - 实现评分数据重置机制,确保每局数据独立 - 重构总分计算逻辑,采用五维加权评分模型 - 新增初始金币收入统计,完善资源利用效率评估
This commit is contained in:
@@ -48,6 +48,32 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
@property(Node)
|
||||
mvp_node=null!
|
||||
|
||||
// ======================== 结算 UI 绑定 ========================
|
||||
@property({ type: Label, tooltip: "总分文本" })
|
||||
total_score_label: Label = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "战绩分节点 (需包含 score_label 和 progress_bar 子节点)" })
|
||||
combat_node: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "输出分节点 (需包含 score_label 和 progress_bar 子节点)" })
|
||||
output_node: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "防御分节点 (需包含 score_label 和 progress_bar 子节点)" })
|
||||
defense_node: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "构建分节点 (需包含 score_label 和 progress_bar 子节点)" })
|
||||
build_node: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "效率分节点 (需包含 score_label 和 progress_bar 子节点)" })
|
||||
efficiency_node: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "亮点成就标签的容器" })
|
||||
highlights_container: Node = null!;
|
||||
|
||||
@property({ type: Prefab, tooltip: "亮点成就标签预制体" })
|
||||
highlight_prefab: Prefab = null!;
|
||||
|
||||
/** 调试日志开关 */
|
||||
debugMode: boolean = false;
|
||||
/** 奖励等级(预留) */
|
||||
@@ -334,39 +360,41 @@ export class VictoryComp extends CCComp {
|
||||
*/
|
||||
private calculateTotalScore() {
|
||||
const s = smc.vmdata.scores;
|
||||
let totalScore = 0;
|
||||
|
||||
// 1. 战绩分:衡量生存能力——活几回合、赢几场。
|
||||
s.score_combat = (s.wave_win_count * 100)
|
||||
- (s.wave_remain_monsters * 15)
|
||||
+ (s.wave_all_alive_count * 50)
|
||||
+ (s.passed_wave_20 ? 500 : 0);
|
||||
|
||||
// 1. 战斗行为分
|
||||
totalScore += s.crt_count * ScoreWeights.CRT_KILL;
|
||||
totalScore += s.wf_count * ScoreWeights.WF_TRIGGER;
|
||||
totalScore += s.dod_count * ScoreWeights.DODGE_SUCCESS;
|
||||
totalScore += s.back_count * ScoreWeights.BACK_SUCCESS;
|
||||
totalScore += s.stun_count * ScoreWeights.STUN_SUCCESS;
|
||||
totalScore += s.freeze_count * ScoreWeights.FREEZE_SUCCESS;
|
||||
// 2. 输出分:衡量伤害能力——团队火力如何。
|
||||
s.score_output = Math.floor(s.total_dmg / 100) * 10
|
||||
+ (s.crt_count * 5)
|
||||
+ (s.wf_count * 5)
|
||||
+ (s.highest_dmg * 2);
|
||||
|
||||
// 2. 伤害转化分
|
||||
totalScore += s.total_dmg * ScoreWeights.DMG_FACTOR;
|
||||
totalScore += s.avg_dmg * ScoreWeights.AVG_DMG_FACTOR;
|
||||
totalScore += s.thorns_dmg * ScoreWeights.THORNS_DMG_FACTOR;
|
||||
totalScore += s.crit_dmg_total * ScoreWeights.CRIT_DMG_FACTOR;
|
||||
// 3. 防御分:衡量生存能力——团队多能扛。
|
||||
s.score_defense = (s.shield_block_count * 5)
|
||||
+ Math.floor(s.heal_total / 50) * 10
|
||||
+ (s.dead_trigger_count * 8);
|
||||
|
||||
// 3. 击杀得分
|
||||
totalScore += s.melee_kill_count * ScoreWeights.KILL_MELEE;
|
||||
totalScore += s.remote_kill_count * ScoreWeights.KILL_REMOTE;
|
||||
totalScore += s.elite_kill_count * ScoreWeights.KILL_ELITE;
|
||||
totalScore += s.boss_kill_count * ScoreWeights.KILL_BOSS;
|
||||
// 4. 构建分:衡量阵容构建质量——团队配合程度。
|
||||
s.score_build = 0; // 待完善
|
||||
|
||||
// 4. 生存得分
|
||||
totalScore += s.heal_total * ScoreWeights.HEAL_FACTOR;
|
||||
totalScore += s.lifesteal_total * ScoreWeights.LIFESTEAL_FACTOR;
|
||||
|
||||
// 5. 资源得分
|
||||
totalScore += s.exp_total * ScoreWeights.EXP_FACTOR;
|
||||
totalScore += s.gold_total * ScoreWeights.GOLD_FACTOR;
|
||||
// 5. 效率分:衡量资源利用——金币花得值不值。
|
||||
const goldRatio = s.gold_earned > 0 ? (s.gold_spent / s.gold_earned) : 0;
|
||||
const refreshRatio = s.refresh_count > 0 ? (s.refresh_hit_count / s.refresh_count) : 0;
|
||||
s.score_efficiency = Math.floor(goldRatio * 100) + Math.floor(refreshRatio * 50);
|
||||
|
||||
// 取整并存储
|
||||
s.score = Math.floor(totalScore);
|
||||
mLogger.log(this.debugMode, 'VictoryComp', `[VictoryComp] 结算总分: ${s.score}`);
|
||||
s.score = Math.floor(s.score_combat + s.score_output + s.score_defense + s.score_build + s.score_efficiency);
|
||||
mLogger.log(this.debugMode, 'VictoryComp', `[VictoryComp] 结算总分: ${s.score}`, {
|
||||
combat: s.score_combat,
|
||||
output: s.score_output,
|
||||
defense: s.score_defense,
|
||||
build: s.score_build,
|
||||
efficiency: s.score_efficiency
|
||||
});
|
||||
}
|
||||
|
||||
// ======================== 操作入口 ========================
|
||||
|
||||
Reference in New Issue
Block a user