From 1d7caccb3253706cf05bc5381452c34359235cb0 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sun, 23 Dec 2018 17:37:26 +0800 Subject: [PATCH 1/5] Avoid preload while music off --- libs/loader.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/loader.js b/libs/loader.js index d5185100..0715d5df 100644 --- a/libs/loader.js +++ b/libs/loader.js @@ -272,6 +272,8 @@ loader.prototype.freeBgm = function (name) { loader.prototype.loadBgm = function (name) { if (!core.isset(core.material.bgms[name])) return; + // 如果没开启音乐,则不预加载 + if (!core.musicStatus.bgmStatus) return; // 是否已经预加载过 var index = core.musicStatus.cachedBgms.indexOf(name); if (index>=0) { From 07590c7aa68e9eb4254a2da1dc118b58b6b3d0b5 Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 23 Dec 2018 21:11:48 +0800 Subject: [PATCH 2/5] Fix setWeather Bug --- _server/blockly/MotaAction.g4 | 2 +- libs/events.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 94075d7b..809dd3b1 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -2154,7 +2154,7 @@ ActionParser.prototype.parseAction = function() { break; case "setWeather": // 更改天气 this.next = MotaActionBlocks['setWeather_s'].xmlText([ - data.name||'无',data.level||1,this.next]); + data.name,data.level||1,this.next]); break; case "openDoor": // 开一个门, 包括暗墙 data.loc=data.loc||['',''] diff --git a/libs/events.js b/libs/events.js index c915a462..66f5159f 100644 --- a/libs/events.js +++ b/libs/events.js @@ -835,7 +835,7 @@ events.prototype.doAction = function() { break; case "setWeather": // 更改天气 core.setWeather(data.name, data.level); - if (core.isset(data.name)) + if (data.name=='rain' || data.name=='snow' || data.name=='fog') core.setFlag('__weather__', [data.name, data.level]); else core.removeFlag('__weather__'); this.doAction(); From 4846a617b920e686439cef8b17f1725da214844d Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 23 Dec 2018 23:57:58 +0800 Subject: [PATCH 3/5] Fix snipe --- libs/control.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/control.js b/libs/control.js index 22525912..b9ddcbf0 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1240,7 +1240,7 @@ control.prototype.checkBlock = function () { var x=t.x, y=t.y, direction = t.direction; var nx = x+core.utils.scan[direction].x, ny=y+core.utils.scan[direction].y; - return nx>=0 && nx=0 && ny=0 && nx=0 && ny0) From 75a714824d06689da40b5a005a1fe550f6ad1cdb Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 24 Dec 2018 21:14:37 +0800 Subject: [PATCH 4/5] Fix WeatherList Bug --- _server/blockly/MotaAction.g4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 809dd3b1..a1021073 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -1176,7 +1176,7 @@ default : [null,1] colour : this.soundColor if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间'); var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n'; -if(Weather_List_0==='')code = '{"type": "setWeather"},\n'; +if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n'; return code; */; @@ -1703,7 +1703,7 @@ Arithmetic_List Weather_List : '无'|'雨'|'雪'|'雾' - /*Weather_List ['','rain','snow','fog']*/; + /*Weather_List ['null','rain','snow','fog']*/; B_0_List : '不改变'|'不可通行'|'可以通行' From 458fa257bc3aaea4c1fa5d1679e14dd86b3fe432 Mon Sep 17 00:00:00 2001 From: oc Date: Tue, 25 Dec 2018 00:23:32 +0800 Subject: [PATCH 5/5] Fix replay Bug --- libs/control.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/control.js b/libs/control.js index b9ddcbf0..f8eb5b89 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1528,6 +1528,7 @@ control.prototype.chooseReplayFile = function () { ////// 开始播放 ////// control.prototype.startReplay = function (list) { + if (!core.isPlaying()) return; core.status.replay.replaying=true; core.status.replay.pausing=false; core.status.replay.speed=1.0; @@ -1543,6 +1544,7 @@ control.prototype.startReplay = function (list) { ////// 更改播放状态 ////// control.prototype.triggerReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (core.status.replay.pausing) this.resumeReplay(); else this.pauseReplay(); @@ -1550,6 +1552,7 @@ control.prototype.triggerReplay = function () { ////// 暂停播放 ////// control.prototype.pauseReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.pausing = true; @@ -1559,6 +1562,7 @@ control.prototype.pauseReplay = function () { ////// 恢复播放 ////// control.prototype.resumeReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.pausing = false; @@ -1569,6 +1573,7 @@ control.prototype.resumeReplay = function () { ////// 加速播放 ////// control.prototype.speedUpReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (core.status.replay.speed==12) core.status.replay.speed=24.0; @@ -1583,6 +1588,7 @@ control.prototype.speedUpReplay = function () { ////// 减速播放 ////// control.prototype.speedDownReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (core.status.replay.speed==24) core.status.replay.speed=12.0; @@ -1598,6 +1604,7 @@ control.prototype.speedDownReplay = function () { ////// 设置播放速度 ////// control.prototype.setReplaySpeed = function (speed) { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.speed = speed; @@ -1606,6 +1613,7 @@ control.prototype.setReplaySpeed = function (speed) { ////// 停止播放 ////// control.prototype.stopReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.toReplay = []; @@ -1621,6 +1629,7 @@ control.prototype.stopReplay = function () { ////// 回退 ////// control.prototype.rewindReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1656,6 +1665,7 @@ control.prototype.rewindReplay = function () { ////// 回放时存档 ////// control.prototype.saveReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1677,6 +1687,7 @@ control.prototype.saveReplay = function () { ////// 回放时查看怪物手册 ////// control.prototype.bookReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0) return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1702,6 +1713,7 @@ control.prototype.bookReplay = function () { ////// 回放录像时浏览地图 ////// control.prototype.viewMapReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; @@ -1721,6 +1733,7 @@ control.prototype.viewMapReplay = function () { ////// 回放 ////// control.prototype.replay = function () { + if (!core.isPlaying()) return; if (!core.status.replay.replaying) return; // 没有回放 if (core.status.replay.pausing) return; // 暂停状态