Files
oops-plugin-framework/assets/module/config/BuildTimeConstants.ts
2025-12-13 23:32:56 +08:00

24 lines
772 B
TypeScript

/*
* @Author: dgflash
* @Date: 2021-07-03 16:13:17
* @LastEditors: dgflash
* @LastEditTime: 2022-08-02 14:25:27
*/
import * as buildTimeConstants from 'cc/env';
const keys = (Object.keys(buildTimeConstants) as (keyof typeof buildTimeConstants)[]).sort();
/* 游戏运行环境 */
export class BuildTimeConstants {
toString() {
const keyNameMaxLen = keys.reduce((len, key) => Math.max(len, key.length), 0);
const enviroment = `${keys.map((key) => {
const value = buildTimeConstants[key];
const valueRep = typeof value === 'boolean' ? (value ? 'true' : 'false') : value;
return `\n${key.padStart(keyNameMaxLen, ' ')} : ${valueRep}`;
})}`;
console.log(enviroment);
}
}