Files
heros/assets/script/game/common/config/BoxSet.ts
panw e1f0492f34 refactor(game-config): 删除过时的配置和简化代码结构
- 移除 BoxSet.ts 中未使用的 HeroConSet 和 QualitySet 枚举定义
- 清理 Mission.ts 中冗余的得分系统及相关计算函数
- 删除 HeroUI、VmInfo 等无用状态对象
- 删除复杂得分计算逻辑及远征奖励配置相关代码
- 简化 heroSet.ts,添加 HeroConf 枚举定义优化配置管理
2025-10-22 11:13:56 +08:00

109 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: dgflash
* @Date: 2021-11-23 15:28:39
* @LastEditors: dgflash
* @LastEditTime: 2022-01-26 16:42:00
*/
/** 碰撞分组 */
export enum BoxSet {
//物理碰撞tag
SKILL_TAG=8,
ATK_RANGE = 4,
//group
DEFAULT = 1,
MONSTER = 2,
HERO = 4,
MONSTER_SKILL = 8,
HERO_SKILL = 16,
PLAYER=32,
BOSS=64,
BOX_WIDTH = 64,
BOX_HEIGHT = 64,
//地图边界
LETF_END = -420,
RIGHT_END = 420,
HERO_START = -360,
MONSTER_START = 360,
END_POINT = 360,
//游戏地平线
GAME_LINE = 0,
CSKILL_X = 320,
CSKILL_Y = 400,
//攻击距离
ATK_RANGE_X = 150,
MOVE_RANGE_X = 20,
MAX_SKILL_SY = 50,
MAX_SKILL_BY = 80,
ATK_Y = 40,
ATK_X = 10,
}
export enum GameSet {
ATK_TO_ATK_RATIO=0.1,
ATK_TO_HP_RATIO=0.2,
ATK_TO_SHIELD_RATIO=2,
ATK_LINES = 3, //英雄数
MON_GOLD_ADD =2,
MON_COIN_ADD=2,
COIN_ADD=1,
DEF_RATE=0.7,
DODGE_MAX=70,
HERO_NUM=3,
AP_UPDATE_RATE=120,
AP_CHANGE_RATE=100,
}
export enum FacSet {
HERO=0,
MON=1,
}
/** 数字格式化工具函数 */
export class NumberFormatter {
/**
* 将数字转换为易读格式
* @param num 要转换的数字
* @returns 格式化后的字符串
* 例如1234 -> "1.2k", 1234567 -> "1.2M", 1234567890 -> "1.2B"
*/
static formatNumber(num: number): string {
if (num < 1000) {
return num.toString();
} else if (num < 1000000) {
// 5位数用k表示 (1000-999999)
return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
} else if (num < 1000000000) {
// 7位数用M表示 (1000000-999999999)
return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
} else if (num < 1000000000000) {
// 10位数用B表示 (1000000000-999999999999)
return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B';
} else {
// 更大的数字用T表示
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + 'T';
}
}
/**
* 将数字转换为中文格式
* @param num 要转换的数字
* @returns 中文格式的字符串
* 例如1234 -> "1.2千", 1234567 -> "1.2百万"
*/
static formatNumberChinese(num: number): string {
if (num < 10000) {
return num.toString();
} else if (num < 100000000) {
// 万级别
return (num / 10000).toFixed(1).replace(/\.0$/, '') + '万';
} else if (num < 1000000000000) {
// 亿级别
return (num / 100000000).toFixed(1).replace(/\.0$/, '') + '亿';
} else {
// 万亿级别
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + '万亿';
}
}
}