音频播放bug修复

This commit is contained in:
2025-09-25 11:20:03 +08:00
parent b5de68d76b
commit 25daff6d8c
14 changed files with 270 additions and 327 deletions
+4
View File
@@ -4,4 +4,8 @@
Lock,
UnKnown,
}
export enum AudioConfig {
MainBGM = "sound/mainBGM",
}
}
-60
View File
@@ -1,60 +0,0 @@
import { _decorator } from "cc";
import Utils from "../Common/Utils";
const { ccclass, property } = _decorator;
//配置表管理器
@ccclass('Resource')
export default class Resource {
static instance: Resource = null;
private _config = {};//策划数值表
static getInstance() {
if (!this.instance) this.init();
return this.instance;
}
//初始化
static init() {
if (!this.instance) {
this.instance = new Resource();
(window as any).Resource = this;
}
}
/**加载子包时添加 */
static addSubJsonConfig(name, tab) {
let _instance = this.getInstance();
if (!_instance._config) _instance._config = {};
if (!_instance._config[name]) _instance._config[name] = {};
let json_SS, json_key1, json_key2
for (const key in tab) {
json_SS = tab[key];
if (!json_key1){
json_key1 = json_SS.id ? "id" : "ID" //默认用id
}
json_key2 = json_SS[json_key1]
_instance._config[name][json_key2] = json_SS;
}
}
/**
* 获取表数据
* @param table 表名
*/
static getConfig(table: string) {
if (!table) {
Utils.Log('策划数值表名为空!', table);
return null;
}
let _instance = this.getInstance();
if (!_instance._config) _instance._config = {};
if (!_instance._config[table]) {
// _instance._config[table] = {};
Utils.Error("配置表未找到:", table)
return null;
}
let config_D = _instance._config[table];
return config_D;
}
}
@@ -1,9 +0,0 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "34d91d70-8aac-44b4-9b4a-1a60185b2235",
"files": [],
"subMetas": {},
"userData": {}
}