resume bgm
This commit is contained in:
parent
2ae0de551d
commit
49daef63fb
@ -137,7 +137,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['setWeather_s'].xmlText(),
|
||||
MotaActionBlocks['playBgm_s'].xmlText(),
|
||||
MotaActionBlocks['pauseBgm_s'].xmlText(),
|
||||
// MotaActionBlocks['resumeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['resumeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['loadBgm_s'].xmlText(),
|
||||
MotaActionBlocks['freeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['playSound_s'].xmlText(),
|
||||
|
||||
@ -2604,6 +2604,7 @@ control.prototype.playBgm = function (bgm) {
|
||||
if (!core.musicStatus.bgmStatus) {
|
||||
try {
|
||||
core.musicStatus.playingBgm = bgm;
|
||||
core.musicStatus.lastBgm = bgm;
|
||||
core.material.bgms[bgm].pause();
|
||||
}
|
||||
catch (e) {
|
||||
@ -2637,6 +2638,7 @@ control.prototype.playBgm = function (bgm) {
|
||||
core.material.bgms[bgm].currentTime = 0;
|
||||
core.material.bgms[bgm].play();
|
||||
core.musicStatus.playingBgm = bgm;
|
||||
core.musicStatus.lastBgm = bgm;
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法播放BGM "+bgm);
|
||||
@ -2667,7 +2669,7 @@ control.prototype.resumeBgm = function () {
|
||||
|
||||
// 恢复BGM
|
||||
try {
|
||||
core.playBgm(core.musicStatus.playingBgm);
|
||||
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法恢复BGM");
|
||||
|
||||
@ -53,6 +53,7 @@ function core() {
|
||||
'bgmStatus': false, // 是否播放BGM
|
||||
'soundStatus': true, // 是否播放SE
|
||||
'playingBgm': null, // 正在播放的BGM
|
||||
'lastBgm': null, // 上次播放的bgm
|
||||
'gainNode': null,
|
||||
'playingSounds': {}, // 正在播放的SE
|
||||
'volume': 1.0, // 音量
|
||||
|
||||
@ -967,12 +967,10 @@ events.prototype.doAction = function() {
|
||||
core.pauseBgm();
|
||||
this.doAction();
|
||||
break
|
||||
/*
|
||||
case "resumeBgm":
|
||||
core.resumeBgm();
|
||||
this.doAction();
|
||||
break
|
||||
*/
|
||||
case "loadBgm":
|
||||
if (core.platform.isPC)
|
||||
core.loadBgm(data.name);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user