move map url to else case

This commit is contained in:
psy 2021-01-14 11:48:06 +01:00
parent f431e769cc
commit 8d67947bc1

View File

@ -598,7 +598,6 @@ export class GameScene extends ResizableScene implements CenterListener {
if (url === undefined) {
audioManager.unloadAudio();
} else {
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
const audioPath = url as string;
let realAudioPath = '';
@ -607,9 +606,10 @@ export class GameScene extends ResizableScene implements CenterListener {
realAudioPath = audioPath;
} else {
// local file, include it relative to map directory
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
realAudioPath = mapDirUrl + '/' + url;
}
audioManager.loadAudio(realAudioPath);
if (loop) {