Parse queue music and sound
This commit is contained in:
parent
c8edde1dfc
commit
cde50d8467
@ -69,7 +69,7 @@ Parser.prototype.statement = function() {
|
||||
if (this.match(token, TokenType.COMMAND)) return this.command();
|
||||
if (this.match(token, TokenType.SCENE)) return this.scene();
|
||||
if (this.match(token, TokenType.PLAY)) return this.play();
|
||||
// if (this.match(token, TokenType.QUEUE)) return this.queue();
|
||||
if (this.match(token, TokenType.QUEUE)) return this.queue();
|
||||
if (this.match(token, TokenType.STOP)) return this.stop();
|
||||
if (this.match(token, TokenType.SHOW)) return this.show();
|
||||
if (this.match(token, TokenType.HIDE)) return this.hide();
|
||||
@ -328,6 +328,24 @@ Parser.prototype.playAmbience = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
Parser.prototype.queue = function() {
|
||||
if (this.match(TokenType.MUSIC)) return this.queueMusic();
|
||||
if (this.match(TokenType.SOUND)) return this.queueSound();
|
||||
return false;
|
||||
};
|
||||
|
||||
Parser.prototype.queueMusic = function() {
|
||||
var name = this.consumeMusicName();
|
||||
ViewActivity.getInstance().addMusicToQueue(name);
|
||||
return false;
|
||||
};
|
||||
|
||||
Parser.prototype.queueSound = function() {
|
||||
var name = this.consumeMusicName();
|
||||
ViewActivity.getInstance().addSoundToQueue(name);
|
||||
return false;
|
||||
};
|
||||
|
||||
Parser.prototype.stop = function() {
|
||||
if (this.match(TokenType.MUSIC)) {
|
||||
var fade = this.matchFade();
|
||||
|
@ -323,6 +323,24 @@ Views.prototype.createMenuItemClickFunction = function (index, menu) {
|
||||
Views.prototype.showGameMenuDialog = function (menu) {
|
||||
};
|
||||
|
||||
Views.prototype.addMusicToQueue = function (name) {
|
||||
if (!this.musicPlayerAudio.paused) {
|
||||
// Если музыка играет, просто добавляем в очередь
|
||||
this.musicQueue.push(name);
|
||||
} else {
|
||||
// Воспроизводим
|
||||
this.music(name, this.NO_FADE);
|
||||
}
|
||||
};
|
||||
|
||||
Views.prototype.addSoundToQueue = function (name) {
|
||||
if (!this.soundPlayerAudio.paused) {
|
||||
this.soundQueue.push(name);
|
||||
} else {
|
||||
this.sound(name, false, this.NO_FADE);
|
||||
}
|
||||
};
|
||||
|
||||
Views.prototype.music = function (name, fade) {
|
||||
try {
|
||||
this.stopMusic(this.musicPlayerAudio.fade);
|
||||
|
Loading…
Reference in New Issue
Block a user