feat(游戏统计): 添加游戏单局统计数据接口和实现
添加 GameScoreStats 接口用于记录游戏单局的各种统计数据,包括战斗、伤害、生存和资源统计 在 SingletonModuleComp 中实现 scores 对象来存储这些统计数据
This commit is contained in:
@@ -7,7 +7,7 @@ import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
|||||||
import { GameEvent } from "./config/GameEvent";
|
import { GameEvent } from "./config/GameEvent";
|
||||||
import * as exp from "constants";
|
import * as exp from "constants";
|
||||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||||
import { Attrs } from "./config/HeroAttrs";
|
import { Attrs, GameScoreStats } from "./config/HeroAttrs";
|
||||||
import { time } from "console";
|
import { time } from "console";
|
||||||
import { getLevelExp } from "../map/RogueConfig";
|
import { getLevelExp } from "../map/RogueConfig";
|
||||||
/**
|
/**
|
||||||
@@ -65,8 +65,33 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
max_mission:4,//最大关卡
|
max_mission:4,//最大关卡
|
||||||
coin:0,
|
coin:0,
|
||||||
time:15*60,//游戏时间
|
time:15*60,//游戏时间
|
||||||
score:0,
|
|
||||||
},
|
},
|
||||||
|
scores: {
|
||||||
|
score: 0, // 基础得分
|
||||||
|
|
||||||
|
// 战斗统计
|
||||||
|
crt_count: 0, // 暴击次数
|
||||||
|
wf_count: 0, // 风怒次数
|
||||||
|
dod_count: 0, // 闪避次数
|
||||||
|
back_count: 0, // 击退次数
|
||||||
|
stun_count: 0, // 击晕次数
|
||||||
|
freeze_count: 0, // 冰冻次数
|
||||||
|
|
||||||
|
// 伤害统计
|
||||||
|
total_dmg: 0, // 总伤害
|
||||||
|
atk_count: 0, // 攻击次数
|
||||||
|
avg_dmg: 0, // 平均伤害
|
||||||
|
thorns_dmg: 0, // 反伤伤害
|
||||||
|
crit_dmg_total: 0, // 暴击伤害总额
|
||||||
|
|
||||||
|
// 生存统计
|
||||||
|
heal_total: 0, // 治疗总量
|
||||||
|
lifesteal_total: 0, // 吸血总量
|
||||||
|
|
||||||
|
// 资源统计
|
||||||
|
exp_total: 0, // 经验总数
|
||||||
|
gold_total: 0, // 金币总数
|
||||||
|
} as GameScoreStats,
|
||||||
hero:{
|
hero:{
|
||||||
name:'',
|
name:'',
|
||||||
path:'',
|
path:'',
|
||||||
|
|||||||
@@ -211,4 +211,34 @@ export const isRatioAttr = (attrType: Attrs): boolean => {
|
|||||||
return AttrsType[attrType] === BType.RATIO;
|
return AttrsType[attrType] === BType.RATIO;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏单局统计数据接口
|
||||||
|
*/
|
||||||
|
export interface GameScoreStats {
|
||||||
|
score: number; // 基础得分
|
||||||
|
|
||||||
|
// 战斗统计
|
||||||
|
crt_count: number; // 暴击次数
|
||||||
|
wf_count: number; // 风怒次数
|
||||||
|
dod_count: number; // 闪避次数
|
||||||
|
back_count: number; // 击退次数
|
||||||
|
stun_count: number; // 击晕次数
|
||||||
|
freeze_count: number; // 冰冻次数
|
||||||
|
|
||||||
|
// 伤害统计
|
||||||
|
total_dmg: number; // 总伤害
|
||||||
|
atk_count: number; // 攻击次数 (用于计算平均伤害)
|
||||||
|
avg_dmg: number; // 平均伤害
|
||||||
|
thorns_dmg: number; // 反伤伤害
|
||||||
|
crit_dmg_total: number; // 暴击伤害总额
|
||||||
|
|
||||||
|
// 生存统计
|
||||||
|
heal_total: number; // 治疗总量
|
||||||
|
lifesteal_total: number;// 吸血总量
|
||||||
|
|
||||||
|
// 资源统计
|
||||||
|
exp_total: number; // 经验总数
|
||||||
|
gold_total: number; // 金币总数
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user