天气:晴
This commit is contained in:
parent
6e26dccaa5
commit
3ca3abe083
@ -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
|
||||
: '不改变'|'不可通行'|'可以通行'
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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<level;a++) {
|
||||
for (var a=0;a<number;a++) {
|
||||
core.animateFrame.weather.nodes.push({
|
||||
'x': Math.random()*core.bigmap.width*32,
|
||||
'y': Math.random()*core.bigmap.height*32,
|
||||
@ -2562,7 +2568,7 @@ control.prototype._setWeather_createNodes = function (type, level) {
|
||||
}
|
||||
break;
|
||||
case 'snow':
|
||||
for (var a=0;a<level;a++) {
|
||||
for (var a=0;a<number;a++) {
|
||||
core.animateFrame.weather.nodes.push({
|
||||
'x': Math.random()*core.bigmap.width*32,
|
||||
'y': Math.random()*core.bigmap.height*32,
|
||||
@ -2574,7 +2580,7 @@ control.prototype._setWeather_createNodes = function (type, level) {
|
||||
case 'fog':
|
||||
if (core.animateFrame.weather.fog) {
|
||||
core.animateFrame.weather.nodes = [{
|
||||
'level': level,
|
||||
'level': number,
|
||||
'x': 0,
|
||||
'y': -core.__PIXELS__ / 2,
|
||||
'dx': -Math.random() * 1.5,
|
||||
@ -2586,7 +2592,7 @@ control.prototype._setWeather_createNodes = function (type, level) {
|
||||
case 'cloud':
|
||||
if (core.animateFrame.weather.cloud) {
|
||||
core.animateFrame.weather.nodes = [{
|
||||
'level': level,
|
||||
'level': number,
|
||||
'x': 0,
|
||||
'y': -core.__PIXELS__ / 2,
|
||||
'dx': -Math.random() * 1.5,
|
||||
@ -2595,6 +2601,15 @@ control.prototype._setWeather_createNodes = function (type, level) {
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case 'sun':
|
||||
if (core.animateFrame.weather.sun) {
|
||||
// 直接绘制
|
||||
core.clearMap('weather');
|
||||
core.setAlpha('weather', level / 10);
|
||||
core.drawImage('weather', core.animateFrame.weather.sun, 0, 0, core.animateFrame.weather.sun.width, core.animateFrame.weather.sun.height, 0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||
core.setAlpha('weather', 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,9 +46,12 @@ function core() {
|
||||
'weather': {
|
||||
'time': 0,
|
||||
'type': null,
|
||||
'level': 1,
|
||||
'nodes': [],
|
||||
'data': null,
|
||||
'fog': null,
|
||||
'cloud': null,
|
||||
'sun': null
|
||||
},
|
||||
"tip": null,
|
||||
"asyncId": {}
|
||||
@ -429,6 +432,7 @@ core.prototype._init_others = function () {
|
||||
core.bigmap.cacheCanvas = document.createElement('canvas').getContext('2d');
|
||||
core.loadImage("materials", 'fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||
core.loadImage("materials", "cloud", function (name, img) { core.animateFrame.weather.cloud = img; })
|
||||
core.loadImage("materials", "sun", function (name, img) { core.animateFrame.weather.sun = img; })
|
||||
core.loadImage("materials", 'keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||
// 记录存档编号
|
||||
core.saves.saveIndex = core.getLocalStorage('saveIndex', 1);
|
||||
|
||||
@ -411,7 +411,8 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x
|
||||
e.damage = this.getDamage(enemy, x, y, floorId);
|
||||
e.critical = critical[0];
|
||||
e.criticalDamage = critical[1];
|
||||
e.defDamage = this.getDefDamage(enemy, 1, x, y, floorId);
|
||||
var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1;
|
||||
e.defDamage = this.getDefDamage(enemy, ratio, x, y, floorId);
|
||||
enemys.push(e);
|
||||
}
|
||||
|
||||
|
||||
@ -1635,7 +1635,7 @@ events.prototype._action_screenFlash = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_setWeather = function (data, x, y, prefix) {
|
||||
core.setWeather(data.name, data.level);
|
||||
if (data.keep && ['rain', 'snow', 'fog', 'cloud'].indexOf(data.name) >= 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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
BIN
project/materials/sun.png
Normal file
BIN
project/materials/sun.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
4
runtime.d.ts
vendored
4
runtime.d.ts
vendored
@ -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()函数
|
||||
|
||||
Loading…
Reference in New Issue
Block a user