Merge branch 'v2.0' into status-canvas
This commit is contained in:
commit
04cbc7697a
@ -1651,8 +1651,8 @@ Arithmetic_List
|
||||
;
|
||||
|
||||
Weather_List
|
||||
: '无'|'雨'|'雪'
|
||||
/*Weather_List ['','rain','snow']*/;
|
||||
: '无'|'雨'|'雪'|'雾'
|
||||
/*Weather_List ['','rain','snow','fog']*/;
|
||||
|
||||
B_0_List
|
||||
: '不改变'|'不可通行'|'可以通行'
|
||||
@ -1675,8 +1675,8 @@ Global_Attribute_List
|
||||
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor']*/;
|
||||
|
||||
Global_Value_List
|
||||
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'
|
||||
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed']*/;
|
||||
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间'
|
||||
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed', 'floorChangeTime']*/;
|
||||
|
||||
Bool: 'TRUE'
|
||||
| 'FALSE'
|
||||
@ -1904,7 +1904,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
case "autoText": // 自动剧情文本
|
||||
data.time=this.isset(data.time)?data.time:MotaActionBlocks['autoText_s'].fieldDefault[3];
|
||||
this.next = MotaActionBlocks['autoText_s'].xmlText([
|
||||
'','','',data.time,this.EvalString(data.text),this.next]);
|
||||
'','','',data.time||0,this.EvalString(data.text),this.next]);
|
||||
break;
|
||||
case "comment": // 注释
|
||||
this.next = MotaActionBlocks['comment_s'].xmlText([data.text,this.next]);
|
||||
@ -1916,7 +1916,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
if (!/^\w+\.png$/.test(data.background))
|
||||
data.background=setTextfunc(data.background);
|
||||
this.next = MotaActionBlocks['setText_s'].xmlText([
|
||||
data.position,data.offset,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time,this.next]);
|
||||
data.position,data.offset,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time||0,this.next]);
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
@ -2069,10 +2069,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
case "animateImage": // 显示图片
|
||||
if(data.action == 'show'){
|
||||
this.next = MotaActionBlocks['animateImage_0_s'].xmlText([
|
||||
data.name,data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.next]);
|
||||
data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]);
|
||||
} else if (data.action == 'hide') {
|
||||
this.next = MotaActionBlocks['animateImage_1_s'].xmlText([
|
||||
data.name,data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.next]);
|
||||
data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]);
|
||||
}
|
||||
break;
|
||||
case "showGif": // 显示动图
|
||||
@ -2086,7 +2086,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "moveImage": // 移动图片
|
||||
this.next = MotaActionBlocks['moveImage_0_s'].xmlText([
|
||||
data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time, data.keep||false, data.async||false, this.next
|
||||
data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time||0, data.keep||false, data.async||false, this.next
|
||||
]);
|
||||
break;
|
||||
case "setFg": // 颜色渐变
|
||||
@ -2147,7 +2147,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break
|
||||
case "setVolume":
|
||||
this.next = MotaActionBlocks['setVolume_s'].xmlText([
|
||||
data.value, data.time, data.async||false, this.next]);
|
||||
data.value, data.time||0, data.async||false, this.next]);
|
||||
break
|
||||
case "setValue":
|
||||
this.next = MotaActionBlocks['setValue_s'].xmlText([
|
||||
@ -2246,7 +2246,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "sleep": // 等待多少毫秒
|
||||
this.next = MotaActionBlocks['sleep_s'].xmlText([
|
||||
data.time,this.next]);
|
||||
data.time||0,this.next]);
|
||||
break;
|
||||
case "wait": // 等待用户操作
|
||||
this.next = MotaActionBlocks['wait_s'].xmlText([
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -389,6 +389,11 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "全局动画时间,即怪物振动频率,一般300比较合适"
|
||||
},
|
||||
"floorChangeTime": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "默认楼层切换时间"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -197,7 +197,12 @@ editor.prototype.fetchMapFromCore = function(){
|
||||
var mapArray = core.maps.save(core.status.maps, core.status.floorId);
|
||||
editor.map = mapArray.map(function (v) {
|
||||
return v.map(function (v) {
|
||||
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
||||
var x = parseInt(v), y = editor.indexs[x];
|
||||
if (!core.isset(y)) {
|
||||
printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?");
|
||||
y = [0];
|
||||
}
|
||||
return editor.ids[y[0]]
|
||||
})
|
||||
});
|
||||
editor.currentFloorId = core.status.floorId;
|
||||
@ -210,7 +215,12 @@ editor.prototype.fetchMapFromCore = function(){
|
||||
}
|
||||
editor[name]=mapArray.map(function (v) {
|
||||
return v.map(function (v) {
|
||||
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
||||
var x = parseInt(v), y = editor.indexs[x];
|
||||
if (!core.isset(y)) {
|
||||
printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?");
|
||||
y = [0];
|
||||
}
|
||||
return editor.ids[y[0]]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@ -587,15 +587,16 @@ editor_mode = function (editor) {
|
||||
tempCanvas.imageSmoothingEnabled = false;
|
||||
tempCanvas.drawImage(image, 0, 0);
|
||||
var imgData = tempCanvas.getImageData(0, 0, image.width, image.height);
|
||||
var trans = 0, white = 0;
|
||||
var trans = 0, white = 0, black=0;
|
||||
for (var i=0;i<image.width;i++) {
|
||||
for (var j=0;j<image.height;j++) {
|
||||
var pixel = getPixel(imgData, i, j);
|
||||
if (pixel[3]==0) trans++;
|
||||
if (pixel[0]==255 && pixel[1]==255 && pixel[2]==255 && pixel[3]==255) white++;
|
||||
if (pixel[0]==0 && pixel[1]==0 && pixel[2]==0 && pixel[3]==255) black++;
|
||||
}
|
||||
}
|
||||
if (white>trans*10 && confirm("看起来这张图片是以白色为底色,是否自动调整为透明底色?")) {
|
||||
if (white>black && white>trans*10 && confirm("看起来这张图片是以纯白为底色,是否自动调整为透明底色?")) {
|
||||
for (var i=0;i<image.width;i++) {
|
||||
for (var j=0;j<image.height;j++) {
|
||||
var pixel = getPixel(imgData, i, j);
|
||||
@ -608,6 +609,19 @@ editor_mode = function (editor) {
|
||||
tempCanvas.putImageData(imgData, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
if (black>white && black>trans*10 && confirm("看起来这张图片是以纯黑为底色,是否自动调整为透明底色?")) {
|
||||
for (var i=0;i<image.width;i++) {
|
||||
for (var j=0;j<image.height;j++) {
|
||||
var pixel = getPixel(imgData, i, j);
|
||||
if (pixel[0]==0 && pixel[1]==0 && pixel[2]==0 && pixel[3]==255) {
|
||||
setPixel(imgData, i, j, [0,0,0,0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
tempCanvas.clearRect(0, 0, image.width, image.height);
|
||||
tempCanvas.putImageData(imgData, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Step 2: 检测长宽比
|
||||
var ysize = selectAppend.value.indexOf('48') === -1 ? 32 : 48;
|
||||
@ -651,10 +665,6 @@ editor_mode = function (editor) {
|
||||
callback(image);
|
||||
}
|
||||
image.src = content;
|
||||
if (image.complete) {
|
||||
callback(image);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
printe(e);
|
||||
|
||||
@ -318,7 +318,7 @@ floorId指定的是目标楼层的唯一标识符(ID)。
|
||||
另外一点是,V2.5.2以后,对话框`\b`可以根据文字长度来自动控制文本框宽度,其基本控制原理如下:
|
||||
|
||||
- 如果用户存在手动换行`\n`,则选取**最长的一段话**作为文本框宽度。
|
||||
- 如果用户不存在手动换行,则会将文本框宽度调整为**尽量刚好达到三行**的最佳宽度。
|
||||
- 如果用户不存在手动换行,则会将文本框宽度调整为X行半的最佳宽度。
|
||||
- 文本框宽度存在上下界,最终宽度一定会控制在该范围内。
|
||||
|
||||
该自动调整仅对`\b`的对话框效果有效。非对话框仍然会绘制整个界面的宽度。
|
||||
@ -361,7 +361,7 @@ floorId指定的是目标楼层的唯一标识符(ID)。
|
||||
在每层楼的剧本文件里存在一个weather选项,表示该层楼的默认天气。
|
||||
|
||||
``` js
|
||||
// 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
|
||||
// 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain","snow"或"fog"代表雨雪雾,第二项为1-10之间的数代表强度。
|
||||
"weather": ["snow",5]
|
||||
```
|
||||
|
||||
|
||||
@ -1035,6 +1035,8 @@ async可选,如果为true则会异步执行(即不等待当前事件执行
|
||||
|
||||
name为天气选项。目前只支持`rain`和`snow`,即雨天和雪天。
|
||||
|
||||
从V2.5.3开始,也支持雾天`fog`。
|
||||
|
||||
level为天气的强度等级,在1-10之间。1级为最弱,10级为最强。
|
||||
|
||||
如果想改回晴天则直接不加任何参数。
|
||||
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////// 更改画面色调 //////
|
||||
|
||||
@ -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 () {
|
||||
@ -759,8 +763,8 @@ core.prototype.animateBlock = function (loc,type,time,callback) {
|
||||
}
|
||||
|
||||
////// 将某个块从禁用变成启用状态 //////
|
||||
core.prototype.showBlock = function(x, y, floodId) {
|
||||
core.maps.showBlock(x,y,floodId);
|
||||
core.prototype.showBlock = function(x, y, floorId) {
|
||||
core.maps.showBlock(x,y,floorId);
|
||||
}
|
||||
|
||||
////// 将某个块从启用变成禁用状态,但是并不删除它 //////
|
||||
|
||||
@ -918,6 +918,11 @@ events.prototype.doAction = function() {
|
||||
this.doAction();
|
||||
break;
|
||||
case "setGlobalAttribute":
|
||||
if (typeof data.value == 'string') {
|
||||
if ((data.value.charAt(0)=='"' && data.value.charAt(data.value.length-1)=='"')
|
||||
|| (data.value.charAt(0)=="'" && data.value.charAt(data.value.length-1)=="'"))
|
||||
data.value = data.value.substring(1, data.value.length-1);
|
||||
}
|
||||
core.status.globalAttribute[data.name] = data.value;
|
||||
core.control.updateGlobalAttribute(data.name);
|
||||
core.setFlag('globalAttribute', core.status.globalAttribute);
|
||||
@ -1391,10 +1396,12 @@ 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;
|
||||
|
||||
var displayAnimate=(!core.isset(time) || time>=100) && !core.status.replay.replaying;
|
||||
var displayAnimate = time>=100 && !core.status.replay.replaying;
|
||||
|
||||
time = time || 800;
|
||||
time /= 20;
|
||||
core.lockControl();
|
||||
core.stopHero();
|
||||
|
||||
@ -238,7 +238,7 @@ loader.prototype.loadMusic = function () {
|
||||
console.log(ee);
|
||||
core.material.sounds[t] = null;
|
||||
}
|
||||
}, function () {
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
core.material.sounds[t] = null;
|
||||
}, null, 'arraybuffer');
|
||||
|
||||
@ -403,6 +403,11 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width)
|
||||
|
||||
// 如果不存在手动换行,则二分自动换行
|
||||
if (allLines.length == 1) {
|
||||
var w = core.canvas[canvas].measureText(allLines[0]).width;
|
||||
if (w<min_width*2.3) return core.clamp(w / 1.4, min_width, max_width);
|
||||
if (w<max_width*2.2) return core.clamp(w / 2.4, min_width, max_width);
|
||||
return core.clamp(w / 3.4, min_width, max_width);
|
||||
/*
|
||||
var prefer_lines = 3;
|
||||
var start = Math.floor(min_width), end = Math.floor(max_width);
|
||||
while (start < end) {
|
||||
@ -413,6 +418,7 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width)
|
||||
start = mid + 1;
|
||||
}
|
||||
return mid;
|
||||
*/
|
||||
}
|
||||
// 存在手动换行:以最长的为准
|
||||
else {
|
||||
|
||||
@ -735,14 +735,10 @@ utils.prototype.copy = function (data) {
|
||||
|
||||
////// 动画显示某对象 //////
|
||||
utils.prototype.show = function (obj, speed, callback) {
|
||||
if (!core.isset(speed)) {
|
||||
obj.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
obj.style.display = 'block';
|
||||
if (main.mode!='play'){
|
||||
if (!core.isset(speed) && main.mode!='play') {
|
||||
obj.style.opacity = 1;
|
||||
if (core.isset(callback)) {callback();}
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
obj.style.opacity = 0;
|
||||
@ -761,15 +757,12 @@ utils.prototype.show = function (obj, speed, callback) {
|
||||
|
||||
////// 动画使某对象消失 //////
|
||||
utils.prototype.hide = function (obj, speed, callback) {
|
||||
if (!core.isset(speed)) {
|
||||
if (!core.isset(speed) || main.mode!='play'){
|
||||
obj.style.display = 'none';
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
if (main.mode!='play'){
|
||||
obj.style.display = 'none';
|
||||
if (core.isset(callback)) {callback();}
|
||||
return;
|
||||
}
|
||||
obj.style.opacity = 1;
|
||||
var opacityVal = 1;
|
||||
var hideAnimate = window.setInterval(function () {
|
||||
opacityVal -= 0.03;
|
||||
|
||||
@ -338,7 +338,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"purify": 3,
|
||||
"hatred": 2,
|
||||
"moveSpeed": 100,
|
||||
"animateSpeed": 300
|
||||
"animateSpeed": 300,
|
||||
"floorChangeTime": 800,
|
||||
},
|
||||
"flags": {
|
||||
"enableFloor": true,
|
||||
|
||||
@ -724,6 +724,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 55: // 快捷键7:绑定为轻按,方便手机版操作
|
||||
core.getNextItem();
|
||||
break;
|
||||
case 118: // F7:开启debug模式
|
||||
core.debug();
|
||||
break;
|
||||
|
||||
BIN
project/images/fog.png
Normal file
BIN
project/images/fog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
BIN
常用工具/便捷PS工具.exe
BIN
常用工具/便捷PS工具.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user