//////////////////////////////////////////////// // ihaiu-code-fgui生成 // https://www.npmjs.com/package/ihaiu-code-fgui //////////////////////////////////////////////// export default class FguiSoundKey { private static _idDict: Map; static get idDict(): Map { if (!this._idDict) { this.init(); } return this._idDict; } private static _extDict: Map; static get extDict(): Map { if (!this._extDict) { this.init(); } return this._extDict; } public static getId(key: string): string { if (!this.idDict.has(key)) { console.error("SoundKey 不存在 key=" + key); return ""; } return this.idDict.get(key); } public static getUrl(key: string): string { return `ui://${this.SoundPackageId}${this.getId(key)}` } public static getResName(key: string): string { return `${this.SoundPackageName}_${this.getId(key)}${this.extDict.get(key)}`; } public static getPath(key: string): string { return this.FguiResRoot + this.getResName(key); } private static init() { let dict = this._idDict = new Map(); >:FOREACH list:< dict.set( ">:[1]:<", ">:[2]:<"); >:ENDFOREACH:< let exts = this._extDict = new Map(); >:FOREACH list:< exts.set( ">:[1]:<", ">:[3]:<"); >:ENDFOREACH:< } static FguiResRoot = "./res/fgui/"; static SoundPackageName = ">:packageName:<"; static SoundPackageId = ">:packageId:<"; >:FOREACH list:< public static >:[0]:< = ">:[1]:<"; >:ENDFOREACH:< }