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