diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 909387e9..8d49f688 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3963,8 +3963,8 @@ UnaryOperator_List /*UnaryOperator_List ['Math.floor', 'Math.ceil', 'Math.round', 'Math.trunc', 'Math.abs', 'Math.sqrt', 'typeof']*/; Weather_List - : '无'|'雨'|'雪'|'雾'|'云' - /*Weather_List ['null','rain','snow','fog','cloud']*/; + : '无'|'雨'|'雪'|'晴'|'雾'|'云' + /*Weather_List ['null','rain','snow','sun','fog','cloud']*/; B_0_List : '不改变'|'不可通行'|'可以通行' diff --git a/_server/table/comment.js b/_server/table/comment.js index 236f5e1b..916bdffd 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -515,7 +515,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "textarea", "_docs": "天气", - "_data": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\",\"snow\"或\"fog\"代表雨雪雾,第二项为1-10之间的数代表强度。\n如[\"rain\", 8]代表8级雨天。" + "_data": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\",\"snow\", \"sun\", \"fog\", \"cloud\“代表对应的天气,第二项为1-10之间的数代表强度。\n如[\"rain\", 8]代表8级雨天。" }, "bgm": { "_leaf": true, @@ -528,7 +528,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { }).toString(), "_onconfirm": (function (previous, current) { if (current.length == 0) return null; - return current[0]; + if (current.length == 1) return current[0]; + return current; }).toString(), "_docs": "背景音乐", "_data": "到达该层后默认播放的BGM" diff --git a/libs/control.js b/libs/control.js index 44d106a0..74a092b8 100644 --- a/libs/control.js +++ b/libs/control.js @@ -243,7 +243,7 @@ control.prototype._animationFrame_weather_snow = function () { ctx.moveTo(p.x - ox, p.y - oy); ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true); // update - p.x += Math.sin(angle) * 2; + p.x += Math.sin(angle) * core.animateFrame.weather.level; p.y += Math.cos(angle + p.d) + 1 + p.r / 2; if (p.x > core.bigmap.width*32 + 5 || p.x < -5 || p.y > core.bigmap.height*32) { if (Math.random() > 1 / 3) { @@ -308,6 +308,10 @@ control.prototype._animationFrame_weather_cloud = function () { this.__animateFrame_weather_image(core.animateFrame.weather.cloud); } +control.prototype._animationFrame_weather_sun = function () { + // do nothing here. +} + control.prototype._animateFrame_tip = function (timestamp) { if (core.animateFrame.tip == null) return; var tip = core.animateFrame.tip; @@ -2536,22 +2540,24 @@ control.prototype.setWeather = function (type, level) { core.animateFrame.weather.nodes = []; return; } - // 当前天气:则忽略 - if (type==core.animateFrame.weather.type && level == null) return; + if (level == null) level = core.animateFrame.weather.level; level = core.clamp(parseInt(level) || 5, 1, 10); - level *= parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__)); + // 当前天气:则忽略 + if (type==core.animateFrame.weather.type && level == core.animateFrame.weather.level) return; // 计算当前的宽高 core.createCanvas('weather', 0, 0, core.__PIXELS__, core.__PIXELS__, 80); core.animateFrame.weather.type = type; + core.animateFrame.weather.level = level; core.animateFrame.weather.nodes = []; this._setWeather_createNodes(type, level); } control.prototype._setWeather_createNodes = function (type, level) { + var number = level * parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__)); switch (type) { case 'rain': - for (var a=0;a= 0) + if (data.keep && ['rain', 'snow', 'sun', 'fog', 'cloud'].indexOf(data.name) >= 0) core.setFlag('__weather__', [data.name, data.level]); else core.removeFlag('__weather__'); core.doAction(); diff --git a/libs/ui.js b/libs/ui.js index 5e515ca7..69898eca 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2053,6 +2053,7 @@ ui.prototype._drawBook_drawEmpty = function () { ui.prototype._drawBook_drawOne = function (floorId, index, enemy, pageinfo, selected) { // --- 区域规划:每个区域总高度默认为62,宽度为 PIXEL var top = pageinfo.per_height * index + pageinfo.padding_top; // 最上面margin默认是12px + enemy.floorId = floorId; // 横向规划: // 22 + 42 = 64 是头像框 this._drawBook_drawBox(index, enemy, top, pageinfo); @@ -2210,7 +2211,7 @@ ui.prototype._drawBook_drawRow3 = function (index, enemy, top, left, width, posi core.fillText('ui', core.formatBigNumber(enemy.critical||0), col1 + 30, position, null, b13); core.fillText('ui', '减伤', col2, position, null, f13); core.fillText('ui', core.formatBigNumber(enemy.criticalDamage||0), col2 + 30, position, null, b13); - core.fillText('ui', '1防', col3, position, null, f13); + core.fillText('ui', '加防', col3, position, null, f13); core.fillText('ui', core.formatBigNumber(enemy.defDamage||0), col3 + 30, position, null, b13); } diff --git a/project/materials/sun.png b/project/materials/sun.png new file mode 100644 index 00000000..6c3c585e Binary files /dev/null and b/project/materials/sun.png differ diff --git a/runtime.d.ts b/runtime.d.ts index 3ae707cb..23405a5d 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -554,10 +554,10 @@ declare class control { /** * 设置天气,不计入存档。如需长期生效请使用core.events._action_setWeather()函数 * @example core.setWeather('fog', 10); // 设置十级大雾天 - * @param type 新天气的类型,不填视为晴天 + * @param type 新天气的类型,不填视为无天气 * @param level 新天气(晴天除外)的级别,必须为不大于10的正整数,不填视为5 */ - setWeather(type?: 'rain' | 'snow' | 'fog' | 'cloud', level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void + setWeather(type?: 'rain' | 'snow' | 'sun' | 'fog' | 'cloud', level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void /** * 更改画面色调,不计入存档。如需长期生效请使用core.events._action_setCurtain()函数