playBgm开始时间;resumeBgm从暂停点恢复

This commit is contained in:
ckcz123 2020-05-05 15:29:01 +08:00
parent 3b50761098
commit 8ee28cd26d
5 changed files with 19 additions and 14 deletions

View File

@ -1361,7 +1361,7 @@ animate_s
/* animate_s
tooltip : animate显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=animate%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%8A%A8%E7%94%BB
default : ["zone","hero",false]
default : ["zone","hero",false,false]
colour : this.soundColor
if (EvalString_0) {
if(MotaActionFunctions.pattern.id2.test(EvalString_0)) {
@ -1665,16 +1665,17 @@ return code;
*/;
playBgm_s
: '播放背景音乐' EvalString '持续到下个本事件' Bool Newline
: '播放背景音乐' EvalString '开始播放秒数' Int '持续到下个本事件' Bool Newline
/* playBgm_s
tooltip : playBgm: 播放背景音乐
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=playbgm%EF%BC%9A%E6%92%AD%E6%94%BE%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90
default : ["bgm.mp3", true]
default : ["bgm.mp3", 0, true]
colour : this.soundColor
Int_0 = Int_0 ? (', "startTime": '+Int_0) : '';
Bool_0 = Bool_0 ? ', "keep": true' : '';
var code = '{"type": "playBgm", "name": "'+EvalString_0+'"'+Bool_0+'},\n';
var code = '{"type": "playBgm", "name": "'+EvalString_0+'"'+Int_0+Bool_0+'},\n';
return code;
*/;
@ -1691,14 +1692,15 @@ return code;
*/;
resumeBgm_s
: '恢复背景音乐' Newline
: '恢复背景音乐' '从暂停位置继续播放' Bool Newline
/* resumeBgm_s
tooltip : resumeBgm: 恢复背景音乐
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=resumebgm%EF%BC%9A%E6%81%A2%E5%A4%8D%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90
colour : this.soundColor
var code = '{"type": "resumeBgm"},\n';
Bool_0 = Bool_0 ? ', "resume": true' : '';
var code = '{"type": "resumeBgm"' + Bool_0 + '},\n';
return code;
*/;
@ -3419,7 +3421,7 @@ ActionParser.prototype.parseAction = function() {
break;
case "playBgm":
this.next = MotaActionBlocks['playBgm_s'].xmlText([
data.name,data.keep||false,this.next]);
data.name,data.startTime||0,data.keep||false,this.next]);
break
case "pauseBgm":
this.next = MotaActionBlocks['pauseBgm_s'].xmlText([
@ -3427,7 +3429,7 @@ ActionParser.prototype.parseAction = function() {
break
case "resumeBgm":
this.next = MotaActionBlocks['resumeBgm_s'].xmlText([
this.next]);
data.resume||false,this.next]);
break
case "loadBgm":
this.next = MotaActionBlocks['loadBgm_s'].xmlText([

View File

@ -2306,6 +2306,7 @@ control.prototype.pauseBgm = function () {
if (main.mode!='play')return;
try {
if (core.musicStatus.playingBgm) {
core.musicStatus.pauseTime = core.material.bgms[core.musicStatus.playingBgm].currentTime;
core.material.bgms[core.musicStatus.playingBgm].pause();
core.musicStatus.playingBgm = null;
}
@ -2318,10 +2319,11 @@ control.prototype.pauseBgm = function () {
}
////// 恢复背景音乐的播放 //////
control.prototype.resumeBgm = function () {
control.prototype.resumeBgm = function (resumeTime) {
if (main.mode!='play')return;
try {
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm);
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm,
resumeTime ? core.musicStatus.pauseTime : 0);
}
catch (e) {
console.log("无法恢复BGM");

View File

@ -47,7 +47,7 @@ function core() {
'data': null,
'fog': null,
},
"tip": {},
"tip": null,
"asyncId": {}
}
this.musicStatus = {
@ -55,6 +55,7 @@ function core() {
'bgmStatus': false, // 是否播放BGM
'soundStatus': true, // 是否播放SE
'playingBgm': null, // 正在播放的BGM
'pauseTime': 0, // 上次暂停的时间
'lastBgm': null, // 上次播放的bgm
'gainNode': null,
'playingSounds': {}, // 正在播放的SE

View File

@ -1572,7 +1572,7 @@ events.prototype._action_insert = function (data, x, y, prefix) {
}
events.prototype._action_playBgm = function (data, x, y, prefix) {
core.playBgm(data.name);
core.playBgm(data.name, data.startTime || 0);
core.setFlag("__bgm__", data.keep ? data.name : null);
core.doAction();
}
@ -1583,7 +1583,7 @@ events.prototype._action_pauseBgm = function (data, x, y, prefix) {
}
events.prototype._action_resumeBgm = function (data, x, y, prefix) {
core.resumeBgm();
core.resumeBgm(data.resume);
core.doAction();
}

View File

@ -5,7 +5,7 @@
(已完成!\b[up,null]可实现此效果) 4. 建议显示文章的\b[]提供top和bottom这两种新写法来实现在顶部或底部显示对话框目前只有startText、firstArrive、eachArrive、useItemEvent和公共事件等没有当前点的事件中才能用up和down来临时实现这种效果否则就得设置剧情文本的属性这在频繁来回切换时是致命的就像《无上之光》RMXP版地上40层一样
5. 建议优化core.splitLines()来避免把单词打断和触犯标点禁则,如点号和右标号禁止用于行首,左标号禁止用于行尾
(已完成!) 6. core.drawAnimate()和对应的事件建议增加一个boolean型参数来表示坐标是绝对坐标即当前的实现还是在视野中的相对坐标以13*13为例相对坐标总是在0~12之间以实现形如“在视野正中心播放某某动画”的需求小地图可以写6,6大地图怎么办
7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来以用于一些演出比如适当的剧情处直接从高潮开始。同理可以让“暂停背景音乐”记录下当前播放到了第几秒并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
(已完成!) 7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来以用于一些演出比如适当的剧情处直接从高潮开始。同理可以让“暂停背景音乐”记录下当前播放到了第几秒并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
8. 系统设置菜单中“音量”和“步时”的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
9. 建议给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”用来实现一些如新新2的QTE录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点