|
|
@@ -127,7 +127,7 @@ export class AudioManager extends Component {
|
|
|
console.log(`[AudioManager] 发起音乐播放请求#${requestId}: ${musicPath}`);
|
|
|
|
|
|
try {
|
|
|
- const bundlePath = musicPath.replace('data/', '');
|
|
|
+ const bundlePath = musicPath.replace('data/', '').replace(/\.(mp3|wav|ogg)$/i, '');
|
|
|
const clip = await this.bundleLoader.loadAssetFromBundle<AudioClip>('data', bundlePath, AudioClip);
|
|
|
|
|
|
// 若在加载期间有新的播放请求,丢弃本次播放
|
|
|
@@ -221,7 +221,7 @@ export class AudioManager extends Component {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const cleanPath = sfxPath.replace('data/', '');
|
|
|
+ const cleanPath = sfxPath.replace('data/', '').replace(/\.(mp3|wav|ogg)$/i, '');
|
|
|
const bundlePath = cleanPath;
|
|
|
const clip = await this.bundleLoader.loadAssetFromBundle<AudioClip>('data', bundlePath, AudioClip);
|
|
|
|