front: external audio file support
This commit is contained in:
parent
db6809fe00
commit
287934f7c4
|
@ -620,9 +620,14 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||
if (url === undefined) {
|
||||
audioManager.unloadAudio();
|
||||
} else {
|
||||
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
||||
const realAudioPath = mapDirUrl + '/' + url;
|
||||
audioManager.loadAudio(realAudioPath);
|
||||
// keep external url untouched
|
||||
if (typeof url === 'string' && url.match(/^https?:\/\//)) {
|
||||
audioManager.loadAudio(url);
|
||||
} else {
|
||||
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
||||
const realAudioPath = mapDirUrl + '/' + url;
|
||||
audioManager.loadAudio(realAudioPath);
|
||||
}
|
||||
|
||||
if (loop) {
|
||||
audioManager.loop();
|
||||
|
|
Loading…
Reference in a new issue