commit
87a2019f65
22
README.md
22
README.md
@ -53,6 +53,28 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏!
|
||||
|
||||
## 更新说明
|
||||
|
||||
### 2018.12.22 V2.5.3
|
||||
|
||||
* [x] 标题界面事件化;现在可以用事件流来处理标题界面了
|
||||
* [x] 动态canvas管理;无限图层,可以任意创建图层并使用
|
||||
* [x] 状态栏canvas化,可以自行对状态栏进行绘制
|
||||
* [x] 手机端新增1-7按钮,可点工具栏进行切换
|
||||
* [x] 事件编辑器可以查看最近使用图块和搜索图块
|
||||
* [x] 事件编辑器中增加增加颜色选择器
|
||||
* [x] 对话框里`\f`可以自带立绘效果
|
||||
* [x] 图片相关事件全部修改为动态canvas实现
|
||||
* [x] 新增事件:滚动字幕
|
||||
* [x] 新增事件:等待所有异步事件执行完毕
|
||||
* [x] 新增事件:画面闪烁
|
||||
* [x] BGM缓存管理;新增事件:预加载BGM
|
||||
* [x] 新增天气:雾
|
||||
* [x] 每次到达楼层执行的事件`eachArrive`
|
||||
* [x] 可以控制某些图块无全局动画效果
|
||||
* [x] 背景/前景层的素材可以全局动画/动态Autotile效果
|
||||
* [x] 可以为每个装备单独设置是否按比例增加
|
||||
* [x] 地图编辑器中选中点高亮;双击选中素材;WASD平移大地图
|
||||
* [x] 修复所有Bug,部分代码重构,大量细节优化
|
||||
|
||||
### 2018.11.30 V2.5.2
|
||||
|
||||
* [x] 怪物和NPC的行走图和朝向问题
|
||||
|
||||
@ -1118,26 +1118,19 @@ return code;
|
||||
*/;
|
||||
|
||||
setFg_0_s
|
||||
: '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? '不等待执行完毕' Bool Newline
|
||||
: '更改画面色调' EvalString '动画时间' Int? '不等待执行完毕' Bool Newline
|
||||
|
||||
|
||||
/* setFg_0_s
|
||||
tooltip : setFg: 更改画面色调,动画时间可不填
|
||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setfg%EF%BC%9A%E6%9B%B4%E6%94%B9%E7%94%BB%E9%9D%A2%E8%89%B2%E8%B0%83
|
||||
default : [255,255,255,1,500,false]
|
||||
default : ["255,255,255,1",500,false]
|
||||
colour : this.soundColor
|
||||
var limit = function(v,min,max) {
|
||||
if(v>max) return max;
|
||||
if(v<min) return min;
|
||||
return v;
|
||||
}
|
||||
Number_0 = limit(Number_0,0,255);
|
||||
Number_1 = limit(Number_1,0,255);
|
||||
Number_2 = limit(Number_2,0,255);
|
||||
Number_3 = limit(Number_3,0,1);
|
||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
||||
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
||||
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
|
||||
var async = Bool_0?', "async": true':'';
|
||||
var code = '{"type": "setFg", "color": ['+Number_0+','+Number_1+','+Number_2+','+Number_3+']'+Int_0 +async+'},\n';
|
||||
var code = '{"type": "setFg", "color": ['+EvalString_0+']'+Int_0 +async+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -1157,25 +1150,18 @@ return code;
|
||||
*/;
|
||||
|
||||
screenFlash_s
|
||||
: '画面闪烁' Number ',' Number ',' Number '强度' Number '单次时间' Int '执行次数' Int? '不等待执行完毕' Bool Newline
|
||||
: '画面闪烁' EvalString '单次时间' Int '执行次数' Int? '不等待执行完毕' Bool Newline
|
||||
|
||||
/* screenFlash_s
|
||||
tooltip : screenFlash: 画面闪烁,动画时间可不填
|
||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=screenFlash%EF%BC%9A%E7%94%BB%E9%9D%A2%E9%97%AA%E7%83%81
|
||||
default : [255,255,255,1,500,1,false]
|
||||
default : ["255,255,255,1",500,1,false]
|
||||
colour : this.soundColor
|
||||
var limit = function(v,min,max) {
|
||||
if(v>max) return max;
|
||||
if(v<min) return min;
|
||||
return v;
|
||||
}
|
||||
Number_0 = limit(Number_0,0,255);
|
||||
Number_1 = limit(Number_1,0,255);
|
||||
Number_2 = limit(Number_2,0,255);
|
||||
Number_3 = limit(Number_3,0,1);
|
||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
||||
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
||||
Int_1 = Int_1!=='' ?(', "times": '+Int_1):'';
|
||||
var async = Bool_0?', "async": true':'';
|
||||
var code = '{"type": "screenFlash", "color": ['+Number_0+','+Number_1+','+Number_2+','+Number_3+'], "time": '+Int_0 +Int_1+async+'},\n';
|
||||
var code = '{"type": "screenFlash", "color": ['+EvalString_0+'], "time": '+Int_0 +Int_1+async+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2155,10 +2141,8 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "setFg": // 颜色渐变
|
||||
if(this.isset(data.color)){
|
||||
var alpha = data.color[3];
|
||||
if (alpha==undefined || alpha==null) alpha=1;
|
||||
this.next = MotaActionBlocks['setFg_0_s'].xmlText([
|
||||
data.color[0],data.color[1],data.color[2],alpha,data.time||0,data.async||false,this.next]);
|
||||
data.color,data.time||0,data.async||false,this.next]);
|
||||
} else {
|
||||
this.next = MotaActionBlocks['setFg_1_s'].xmlText([
|
||||
data.time||0,data.async||false,this.next]);
|
||||
@ -2166,7 +2150,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "screenFlash": // 画面闪烁
|
||||
this.next = MotaActionBlocks['screenFlash_s'].xmlText([
|
||||
data.color[0],data.color[1],data.color[2],data.color[3]||1,data.time||500,data.times||1,data.async||false,this.next]);
|
||||
data.color,data.time||500,data.times||1,data.async||false,this.next]);
|
||||
break;
|
||||
case "setWeather": // 更改天气
|
||||
this.next = MotaActionBlocks['setWeather_s'].xmlText([
|
||||
|
||||
21
_server/colorPicker/LICENSE.md
Normal file
21
_server/colorPicker/LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Peter Dematté
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
5
_server/colorPicker/color.all.min.js
vendored
Normal file
5
_server/colorPicker/color.all.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
288
_server/colorPicker/jsColor.js
Normal file
288
_server/colorPicker/jsColor.js
Normal file
@ -0,0 +1,288 @@
|
||||
(function (window) {
|
||||
window.jsColorPicker = function(selectors, config) {
|
||||
var renderCallback = function(colors, mode) {
|
||||
var options = this,
|
||||
input = options.input,
|
||||
patch = options.patch,
|
||||
RGB = colors.RND.rgb,
|
||||
HSL = colors.RND.hsl,
|
||||
AHEX = options.isIE8 ? (colors.alpha < 0.16 ? '0' : '') +
|
||||
(Math.round(colors.alpha * 100)).toString(16).toUpperCase() + colors.HEX : '',
|
||||
RGBInnerText = RGB.r + ',' + RGB.g + ',' + RGB.b,
|
||||
RGBAText = RGBInnerText + ',' + colors.alpha,
|
||||
isAlpha = colors.alpha !== 1 && !options.isIE8,
|
||||
colorMode = input.getAttribute('data-colorMode');
|
||||
|
||||
patch.style.cssText =
|
||||
'color:' + (colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd') + ';' + // Black...???
|
||||
'background-color: rgba(' + RGBAText + ');' +
|
||||
'filter:' + (options.isIE8 ? 'progid:DXImageTransform.Microsoft.gradient(' + // IE<9
|
||||
'startColorstr=#' + AHEX + ',' + 'endColorstr=#' + AHEX + ')' : '');
|
||||
|
||||
input.value = RGBAText;
|
||||
|
||||
if (options.displayCallback) {
|
||||
options.displayCallback(colors, mode, options);
|
||||
}
|
||||
},
|
||||
extractValue = function(elm) {
|
||||
var val = elm.value || elm.getAttribute('value') || elm.style.backgroundColor || "0,0,0,1";
|
||||
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+,[0-9. ]+$/.test(val)) return "rgba("+val+")";
|
||||
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+$/.test(val)) return "rgba("+val+",1)";
|
||||
return null;
|
||||
},
|
||||
actionCallback = function(event, action) {
|
||||
var options = this,
|
||||
colorPicker = colorPickers.current;
|
||||
|
||||
if (action === 'toMemory') {
|
||||
var memos = colorPicker.nodes.memos,
|
||||
backgroundColor = '',
|
||||
opacity = 0,
|
||||
cookieTXT = [];
|
||||
|
||||
for (var n = 0, m = memos.length; n < m; n++) {
|
||||
backgroundColor = memos[n].style.backgroundColor;
|
||||
opacity = memos[n].style.opacity;
|
||||
opacity = Math.round((opacity === '' ? 1 : opacity) * 100) / 100;
|
||||
cookieTXT.push(backgroundColor.
|
||||
replace(/, /g, ',').
|
||||
replace('rgb(', 'rgba(').
|
||||
replace(')', ',' + opacity + ')')
|
||||
);
|
||||
}
|
||||
cookieTXT = '\'' + cookieTXT.join('\',\'') + '\'';
|
||||
ColorPicker.docCookies('colorPickerMemos' + (options.noAlpha ? 'NoAlpha' : ''), cookieTXT);
|
||||
} else if (action === 'resizeApp') {
|
||||
ColorPicker.docCookies('colorPickerSize', colorPicker.color.options.currentSize);
|
||||
} else if (action === 'modeChange') {
|
||||
var mode = colorPicker.color.options.mode;
|
||||
|
||||
ColorPicker.docCookies('colorPickerMode', mode.type + '-' + mode.z);
|
||||
}
|
||||
},
|
||||
createInstance = function(elm, config) {
|
||||
var initConfig = {
|
||||
klass: window.ColorPicker,
|
||||
input: elm,
|
||||
patch: elm,
|
||||
isIE8: !!document.all && !document.addEventListener, // Opera???
|
||||
// *** animationSpeed: 200,
|
||||
// *** draggable: true,
|
||||
margin: {left: -1, top: 2},
|
||||
customBG: '#FFFFFF',
|
||||
// displayCallback: displayCallback,
|
||||
/* --- regular colorPicker options from this point --- */
|
||||
color: extractValue(elm),
|
||||
initStyle: 'display: none',
|
||||
mode: ColorPicker.docCookies('colorPickerMode') || 'hsv-h',
|
||||
// memoryColors: (function(colors, config) {
|
||||
// return config.noAlpha ?
|
||||
// colors.replace(/\,\d*\.*\d*\)/g, ',1)') : colors;
|
||||
// })($.docCookies('colorPickerMemos'), config || {}),
|
||||
memoryColors: ColorPicker.docCookies('colorPickerMemos' +
|
||||
((config || {}).noAlpha ? 'NoAlpha' : '')),
|
||||
size: ColorPicker.docCookies('colorPickerSize') || 1,
|
||||
renderCallback: renderCallback,
|
||||
actionCallback: actionCallback
|
||||
};
|
||||
|
||||
for (var n in config) {
|
||||
initConfig[n] = config[n];
|
||||
}
|
||||
return new initConfig.klass(initConfig);
|
||||
},
|
||||
doEventListeners = function(elm, multiple, off) {
|
||||
var onOff = off ? 'removeEventListener' : 'addEventListener',
|
||||
inputListener = function(e) {
|
||||
var index = multiple ? Array.prototype.indexOf.call(elms, this) : 0,
|
||||
colorPicker = colorPickers[index] ||
|
||||
(colorPickers[index] = createInstance(this, config)),
|
||||
options = colorPicker.color.options;
|
||||
|
||||
options.color = extractValue(elm); // brings color to default on reset
|
||||
//检查颜色合法性
|
||||
if (options.color != null && options.color == options.color.match(/rgba\([0-9 ]+,[0-9 ]+,[0-9 ]+,[0-9. ]+\)/)[0]) {
|
||||
var chec = options.color.match(/[0-9.]+/g);
|
||||
if (chec.length != 4)
|
||||
return;
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (chec[i] != chec[i].match(/\d+/)[0] || +chec[i] < 0 || +chec[i] > 255)
|
||||
return;
|
||||
}
|
||||
if (chec[3] != chec[3].match(/\d+(\.\d+)?/)[0] || parseFloat(chec[3]) > 1 || parseFloat(chec[3] < 0))
|
||||
return;
|
||||
if (!multiple) {
|
||||
colorPicker.setColor(extractValue(elm), undefined, undefined, true);
|
||||
colorPicker.saveAsBackground();
|
||||
}
|
||||
colorPickers.current = colorPickers[index];
|
||||
}
|
||||
}
|
||||
focusListener = function(e) {
|
||||
elm = document.getElementById("colorPicker");
|
||||
var input = elm,
|
||||
position = window.ColorPicker.getOrigin(input),
|
||||
index = multiple ? Array.prototype.indexOf.call(elms, elm) : 0,
|
||||
colorPicker = colorPickers[index] ||
|
||||
(colorPickers[index] = createInstance(elm, config)),
|
||||
options = colorPicker.color.options,
|
||||
colorPickerUI = colorPicker.nodes.colorPicker,
|
||||
appendTo = (options.appendTo || document.body),
|
||||
isStatic = /static/.test(window.getComputedStyle(appendTo).position),
|
||||
atrect = isStatic ? {left: 0, top: 0} : appendTo.getBoundingClientRect(),
|
||||
waitTimer = 0;
|
||||
|
||||
options.color = extractValue(elm); // brings color to default on reset
|
||||
colorPickerUI.style.cssText =
|
||||
'position: absolute;' + (!colorPickers[index].cssIsReady ? 'display: none;' : '') +
|
||||
'left:' + (position.left + options.margin.left - atrect.left) + 'px;' +
|
||||
'top:' + (position.top + +input.offsetHeight + options.margin.top - atrect.top) + 'px;';
|
||||
|
||||
if (!multiple) {
|
||||
options.input = elm;
|
||||
options.patch = elm; // check again???
|
||||
colorPicker.setColor(extractValue(elm), undefined, undefined, true);
|
||||
colorPicker.saveAsBackground();
|
||||
}
|
||||
colorPickers.current = colorPickers[index];
|
||||
appendTo.appendChild(colorPickerUI);
|
||||
waitTimer = setInterval(function() { // compensating late style on onload in colorPicker
|
||||
if (colorPickers.current.cssIsReady) {
|
||||
waitTimer = clearInterval(waitTimer);
|
||||
colorPickerUI.style.display = 'block';
|
||||
}
|
||||
}, 10);
|
||||
},
|
||||
mousDownListener = function(e) {
|
||||
var colorPicker = colorPickers.current,
|
||||
colorPickerUI = (colorPicker ? colorPicker.nodes.colorPicker : undefined),
|
||||
animationSpeed = colorPicker ? colorPicker.color.options.animationSpeed : 0,
|
||||
isColorPicker = colorPicker && (function(elm) {
|
||||
while (elm) {
|
||||
if ((elm.className || '').indexOf('cpPanel') !== -1) return elm;
|
||||
elm = elm.parentNode;
|
||||
}
|
||||
return false;
|
||||
})(e.target),
|
||||
inputIndex = Array.prototype.indexOf.call(elms, e.target);
|
||||
|
||||
if (isColorPicker && Array.prototype.indexOf.call(colorPickers, isColorPicker)) {
|
||||
if (e.target === colorPicker.nodes.exit) {
|
||||
colorPickerUI.parentNode.style.display = 'none';
|
||||
document.activeElement.blur();
|
||||
} else {
|
||||
// ...
|
||||
}
|
||||
} else if (inputIndex !== -1) {
|
||||
// ...
|
||||
} else if (colorPickerUI) {
|
||||
colorPickerUI.parentNode.style.display = 'none';
|
||||
}
|
||||
};
|
||||
button = document.getElementById("colorSwitch");
|
||||
button[onOff]('click', focusListener);
|
||||
elm[onOff]('input', inputListener);
|
||||
|
||||
if (!colorPickers.evt || off) {
|
||||
colorPickers.evt = true; // prevent new eventListener for window
|
||||
|
||||
window[onOff]('mousedown', mousDownListener);
|
||||
}
|
||||
},
|
||||
// this is a way to prevent data binding on HTMLElements
|
||||
colorPickers = window.jsColorPicker.colorPickers || [],
|
||||
elms = document.querySelectorAll(selectors),
|
||||
testColors = new window.Colors({customBG: config.customBG, allMixDetails: true});
|
||||
|
||||
window.jsColorPicker.colorPickers = colorPickers;
|
||||
|
||||
for (var n = 0, m = elms.length; n < m; n++) {
|
||||
var elm = elms[n];
|
||||
|
||||
if (config === 'destroy') {
|
||||
doEventListeners(elm, (config && config.multipleInstances), true);
|
||||
if (colorPickers[n]) {
|
||||
colorPickers[n].destroyAll();
|
||||
}
|
||||
} else {
|
||||
var color = extractValue(elm);
|
||||
var value = color.split('(');
|
||||
|
||||
testColors.setColor(color);
|
||||
if (config && config.init) {
|
||||
config.init(elm, testColors.colors);
|
||||
}
|
||||
elm.setAttribute('data-colorMode', value[1] ? value[0].substr(0, 3) : 'HEX');
|
||||
doEventListeners(elm, (config && config.multipleInstances), false);
|
||||
if (config && config.readOnly) {
|
||||
elm.readOnly = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return window.jsColorPicker.colorPickers;
|
||||
};
|
||||
|
||||
window.ColorPicker.docCookies = function(key, val, options) {
|
||||
var encode = encodeURIComponent, decode = decodeURIComponent,
|
||||
cookies, n, tmp, cache = {},
|
||||
days;
|
||||
|
||||
if (val === undefined) { // all about reading cookies
|
||||
cookies = document.cookie.split(/;\s*/) || [];
|
||||
for (n = cookies.length; n--; ) {
|
||||
tmp = cookies[n].split('=');
|
||||
if (tmp[0]) cache[decode(tmp.shift())] = decode(tmp.join('=')); // there might be '='s in the value...
|
||||
}
|
||||
|
||||
if (!key) return cache; // return Json for easy access to all cookies
|
||||
else return cache[key]; // easy access to cookies from here
|
||||
} else { // write/delete cookie
|
||||
options = options || {};
|
||||
|
||||
if (val === '' || options.expires < 0) { // prepare deleteing the cookie
|
||||
options.expires = -1;
|
||||
// options.path = options.domain = options.secure = undefined; // to make shure the cookie gets deleted...
|
||||
}
|
||||
|
||||
if (options.expires !== undefined) { // prepare date if any
|
||||
days = new Date();
|
||||
days.setDate(days.getDate() + options.expires);
|
||||
}
|
||||
|
||||
document.cookie = encode(key) + '=' + encode(val) +
|
||||
(days ? '; expires=' + days.toUTCString() : '') +
|
||||
(options.path ? '; path=' + options.path : '') +
|
||||
(options.domain ? '; domain=' + options.domain : '') +
|
||||
(options.secure ? '; secure' : '');
|
||||
}
|
||||
};
|
||||
})(this);
|
||||
|
||||
// Added
|
||||
var colors = jsColorPicker('input.color', {
|
||||
customBG: '#222',
|
||||
readOnly: false,
|
||||
// patch: false,
|
||||
init: function(elm, colors) { // colors is a different instance (not connected to colorPicker)
|
||||
elm.style.backgroundColor = elm.value;
|
||||
elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd';
|
||||
},
|
||||
appendTo: document.getElementById("colorPanel"),
|
||||
size: 1,
|
||||
});
|
||||
function doHide() {
|
||||
var oDiv = document.getElementById("colorPanel");
|
||||
if (oDiv.style.display == "none"){
|
||||
oDiv.style.display = "inline-block";
|
||||
} else {
|
||||
oDiv.style.display = "none";
|
||||
}
|
||||
}
|
||||
function copyColor() {
|
||||
var colorPicker = document.getElementById("colorPicker");
|
||||
colorPicker.select();
|
||||
document.execCommand("Copy");
|
||||
doHide();
|
||||
}
|
||||
@ -18,6 +18,29 @@ body {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.cp-app {
|
||||
z-index: 250;
|
||||
}
|
||||
|
||||
#colorPanel {
|
||||
position: absolute;
|
||||
left: 130px;
|
||||
top: 30px;
|
||||
width: 168px;
|
||||
height: 205px;
|
||||
z-index: 240;
|
||||
padding: 4px 6px;
|
||||
background-color: #F5F5F5;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
|
||||
}
|
||||
|
||||
#colorPicker {
|
||||
margin: 2px 0;
|
||||
border-radius: 3px;
|
||||
width: 104px;
|
||||
}
|
||||
|
||||
#left, #mid, #right {
|
||||
border-radius: 2px;
|
||||
box-sizing: border-box;
|
||||
|
||||
@ -555,13 +555,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "是否循环计算临界;如果此项为true则使用循环法(而不是回合数计算法)来算临界"
|
||||
},
|
||||
"loopStep": {
|
||||
"_leaf": true,
|
||||
"_type": "textbox",
|
||||
"_range": "thiseval==null || thiseval>0",
|
||||
"_data": "循环计算临界时,每次攻击增加量为原始攻击的多少分之一。\n例如,5000就代表循环中每次攻击增加量是原始攻击的1/5000(向上取整)。\n默认值5000。"
|
||||
"_data": "是否循环计算临界;如果此项为true则使用循环法(而不是回合数计算法)来算临界\n从V2.5.3开始,对于大数据的循环法将改为使用二分法进行计算"
|
||||
},
|
||||
"startUsingCanvas": {
|
||||
"_leaf": true,
|
||||
|
||||
@ -181,6 +181,11 @@
|
||||
<div style="position: relative; display: inline-block; margin-left: 10px">
|
||||
<div class="searchLogo"></div>
|
||||
<input type="text" id="searchBlock" placeholder="搜索图块"/>
|
||||
<button id = "colorSwitch" class="cpPanel" onclick="doHide()" style="margin-left:5px">颜色选择器</button>
|
||||
<div id="colorPanel" class="cpPanel" style="display: none">
|
||||
<input class="color" id="colorPicker" value="255,215,0,1"/>
|
||||
<button onclick="copyColor()">复制</button>
|
||||
</div>
|
||||
</div>
|
||||
<xml id="toolbox" style="display:none">
|
||||
</xml>
|
||||
@ -494,6 +499,9 @@ if (location.protocol.indexOf("http")!=0) {
|
||||
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
|
||||
<script src="_server/CodeMirror/jshint.min.js"></script>
|
||||
<script src="_server/CodeMirror/codeMirror.plugin.min.js"></script>
|
||||
<!-- colorPicker -->
|
||||
<script type="text/javascript" src="_server/colorPicker/color.all.min.js"></script>
|
||||
<script type="text/javascript" src="_server/colorPicker/jsColor.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -210,16 +210,45 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
|
||||
}
|
||||
}
|
||||
else { // 暴力for循环法
|
||||
|
||||
// V2.5.3以后,大数据改为二分法进行计算
|
||||
var LOOP_MAX_VALUE = 1;
|
||||
pre = info.damage;
|
||||
var per_add = Math.ceil(hero_atk / (core.flags.loopStep||5000));
|
||||
if (per_add<0) per_add = 1;
|
||||
for (var atk=hero_atk+per_add;atk<=mon_hp+mon_def;atk+=per_add) {
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (nextInfo==null) break;
|
||||
if (pre>nextInfo.damage) {
|
||||
pre = nextInfo.damage;
|
||||
list.push([atk-hero_atk, Math.floor(info.damage-nextInfo.damage)]);
|
||||
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
|
||||
if (hero_atk <= LOOP_MAX_VALUE) { // 循环法
|
||||
for (var atk=hero_atk+1;atk<=mon_hp+mon_def;atk++) {
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (nextInfo==null) break;
|
||||
if (pre>nextInfo.damage) {
|
||||
pre = nextInfo.damage;
|
||||
list.push([atk-hero_atk, info.damage-nextInfo.damage]);
|
||||
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
|
||||
if (list.length>=number) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // 二分法算临界
|
||||
var calNext = function (currAtk, maxAtk) {
|
||||
var start = Math.floor(currAtk), end = Math.floor(maxAtk);
|
||||
if (start>end) return null;
|
||||
|
||||
while (start<end) {
|
||||
var mid = Math.floor((start+end)/2);
|
||||
var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, mid, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (nextInfo == null) return null;
|
||||
if (pre>nextInfo.damage) end = mid;
|
||||
else start = mid+1;
|
||||
}
|
||||
var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, start, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
return nextInfo==null||nextInfo.damage>=pre?null:[start,nextInfo.damage];
|
||||
}
|
||||
var currAtk = hero_atk;
|
||||
while (true) {
|
||||
var next = calNext(currAtk+1, mon_hp+mon_def, pre);
|
||||
if (next == null) break;
|
||||
currAtk = next[0];
|
||||
pre = next[1];
|
||||
list.push([currAtk-hero_atk, info.damage-pre]);
|
||||
if (pre<=0 && !core.flags.enableNegativeDamage) break;
|
||||
if (list.length>=number) break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,7 +382,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"hatredDecrease": true,
|
||||
"betweenAttackCeil": false,
|
||||
"useLoop": false,
|
||||
"loopStep": 5000,
|
||||
"startUsingCanvas": false,
|
||||
"startDirectly": false,
|
||||
"statusCanvas": false,
|
||||
|
||||
@ -632,14 +632,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
damage=Math.max(0, damage);
|
||||
|
||||
return {
|
||||
"mon_hp": mon_hp,
|
||||
"mon_atk": mon_atk,
|
||||
"mon_def": mon_def,
|
||||
"init_damage": init_damage,
|
||||
"per_damage": per_damage,
|
||||
"hero_per_damage": hero_per_damage,
|
||||
"turn": turn,
|
||||
"damage": damage
|
||||
"mon_hp": Math.floor(mon_hp),
|
||||
"mon_atk": Math.floor(mon_atk),
|
||||
"mon_def": Math.floor(mon_def),
|
||||
"init_damage": Math.floor(init_damage),
|
||||
"per_damage": Math.floor(per_damage),
|
||||
"hero_per_damage": Math.floor(hero_per_damage),
|
||||
"turn": Math.floor(turn),
|
||||
"damage": Math.floor(damage)
|
||||
};
|
||||
},
|
||||
"updateEnemys": function () {
|
||||
@ -703,7 +703,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
case 90: // Z:转向
|
||||
core.turnHero();
|
||||
break;
|
||||
case 86: // V:打开快捷商店列表
|
||||
case 75: case 86: // V:打开快捷商店列表
|
||||
core.openQuickShop(true);
|
||||
break;
|
||||
case 32: // SPACE:轻按
|
||||
|
||||
22
更新说明.txt
22
更新说明.txt
@ -1,5 +1,27 @@
|
||||
HTML5魔塔样板V2.5.2
|
||||
|
||||
标题界面事件化;现在可以用事件流来处理标题界面了
|
||||
动态canvas管理;无限图层,可以任意创建图层并使用
|
||||
状态栏canvas化,可以自行对状态栏进行绘制
|
||||
手机端新增1-7按钮,可点工具栏进行切换
|
||||
事件编辑器可以查看最近使用图块和搜索图块
|
||||
事件编辑器中增加增加颜色选择器
|
||||
对话框里`\f`可以自带立绘效果
|
||||
图片相关事件全部修改为动态canvas实现
|
||||
新增事件:滚动字幕
|
||||
新增事件:等待所有异步事件执行完毕
|
||||
新增事件:画面闪烁
|
||||
BGM缓存管理;新增事件:预加载BGM
|
||||
新增天气:雾
|
||||
每次到达楼层执行的事件`eachArrive`
|
||||
可以控制某些图块无全局动画效果
|
||||
背景/前景层的素材可以全局动画/动态Autotile效果
|
||||
可以为每个装备单独设置是否按比例增加
|
||||
地图编辑器中选中点高亮;双击选中素材;WASD平移大地图
|
||||
修复所有Bug,部分代码重构,大量细节优化
|
||||
|
||||
HTML5魔塔样板V2.5.2
|
||||
|
||||
怪物和NPC的行走图和朝向问题(详见文档)
|
||||
可以引入WindowSkin作为对话框的背景素材
|
||||
允许使用\t[标题,1.png]来绘制大头像图
|
||||
|
||||
Loading…
Reference in New Issue
Block a user