This commit is contained in:
oc 2018-12-08 00:03:31 +08:00
parent 334f7e932e
commit ae720ee477
9 changed files with 56 additions and 7 deletions

View File

@ -1651,8 +1651,8 @@ Arithmetic_List
;
Weather_List
: '无'|'雨'|'雪'
/*Weather_List ['','rain','snow']*/;
: '无'|'雨'|'雪'|'雾'
/*Weather_List ['','rain','snow','fog']*/;
B_0_List
: '不改变'|'不可通行'|'可以通行'

View File

@ -376,7 +376,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"weather": {
"_leaf": true,
"_type": "textarea",
"_data": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\"或\"snow\"代表雨雪第二项为1-10之间的数代表强度。\n如[\"rain\", 8]代表8级雨天。"
"_data": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\"\"snow\"或\"fog\"代表雨雪雾第二项为1-10之间的数代表强度。\n如[\"rain\", 8]代表8级雨天。"
},
"bgm": {
"_leaf": true,

View File

@ -361,7 +361,7 @@ floorId指定的是目标楼层的唯一标识符ID
在每层楼的剧本文件里存在一个weather选项表示该层楼的默认天气。
``` js
// 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪第二项为1-10之间的数代表强度。
// 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain""snow"或"fog"代表雨雪雾第二项为1-10之间的数代表强度。
"weather": ["snow",5]
```

View File

@ -1035,6 +1035,8 @@ async可选如果为true则会异步执行即不等待当前事件执行
name为天气选项。目前只支持`rain`和`snow`,即雨天和雪天。
从V2.5.3开始,也支持雾天`fog`。
level为天气的强度等级在1-10之间。1级为最弱10级为最强。
如果想改回晴天则直接不加任何参数。

View File

@ -212,6 +212,37 @@ control.prototype.setRequestAnimationFrame = function () {
core.canvas.weather.fill();
}
else if (core.animateFrame.weather.type == 'fog' && core.animateFrame.weather.level > 0) {
core.clearMap('weather');
if (core.animateFrame.weather.fog) {
var w = 416, h = 416;
core.setAlpha('weather', 0.5);
core.animateFrame.weather.nodes.forEach(function (p) {
core.canvas.weather.drawImage(core.animateFrame.weather.fog, p.x - ox, p.y - oy, w, h);
p.x += p.xs;
p.y += p.ys;
if (p.x > core.bigmap.width*32 - w/2) {
p.x = core.bigmap.width*32 - w/2 - 1;
p.xs = -p.xs;
}
if (p.x < -w/2) {
p.x = -w/2+1;
p.xs = -p.xs;
}
if (p.y > core.bigmap.height*32 - h/2) {
p.y = core.bigmap.height*32 - h/2 - 1;
p.ys = -p.ys;
}
if (p.y < -h/2) {
p.y = -h/2+1;
p.ys = -p.ys;
}
})
core.setAlpha('weather',1);
}
}
core.animateFrame.weather.time = timestamp;
@ -1438,7 +1469,7 @@ control.prototype.snipe = function (snipes) {
control.prototype.setWeather = function (type, level) {
// 非雨雪
if (type!='rain' && type!='snow') {
if (type!='rain' && type!='snow' && type!='fog') {
core.clearMap('weather')
core.animateFrame.weather.type = null;
core.animateFrame.weather.level = 0;
@ -1485,6 +1516,18 @@ control.prototype.setWeather = function (type, level) {
})
}
}
else if (type=='fog') {
if (core.animateFrame.weather.fog) {
for (var a=0;a<level/10;a++) {
core.animateFrame.weather.nodes.push({
'x': Math.random()*core.bigmap.width*32 - 208,
'y': Math.random()*core.bigmap.height*32 - 208,
'xs': Math.random() * 4 - 2,
'ys': Math.random() * 4 - 2
})
}
}
}
}
////// 更改画面色调 //////

View File

@ -43,6 +43,7 @@ function core() {
'level': 0,
'nodes': [],
'data': null,
'fog': null,
},
"asyncId": {}
}
@ -329,6 +330,9 @@ core.prototype.init = function (coreData, callback) {
}
core.material.ground.src = "project/images/ground.png";
core.animateFrame.weather.fog = new Image();
core.animateFrame.weather.fog.src = "project/images/fog.png";
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
core.loader.load(function () {

View File

@ -1396,6 +1396,7 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
if (index<core.floorIds.length-1) floorId = core.floorIds[index+1];
else floorId=core.status.floorId;
}
if (main.mode!='play') time = 0;
if (!core.isset(time)) time = core.values.floorChangeTime;
if (!core.isset(time)) time = 800;

View File

@ -757,9 +757,8 @@ utils.prototype.show = function (obj, speed, callback) {
////// 动画使某对象消失 //////
utils.prototype.hide = function (obj, speed, callback) {
obj.style.display = 'none';
if (!core.isset(speed) || main.mode!='play'){
obj.style.opacity = 0;
obj.style.display = 'none';
if (core.isset(callback)) callback();
return;
}

BIN
project/images/fog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB