Merge pull request #4 from ckcz123/v2.x

V2.x
This commit is contained in:
AutumnOrange51 2020-05-24 16:40:03 +08:00 committed by GitHub
commit 1cc5013989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 71 additions and 45 deletions

View File

@ -558,7 +558,8 @@ return '{' + [
mainStyle_m
: '主要样式设置:' '标题界面背景图(全路径):' EvalString BGNL? Newline
: '主要样式设置:' '标题界面背景图544x422' EvalString BGNL? Newline
'竖屏标题界面背景图422x580' EvalString BGNL? Newline
'标题样式;可写 display: none 隐藏标题' EvalString BGNL? Newline
'标题按钮样式:' EvalString BGNL? Newline
'横屏状态栏背景url(...) 0 0/100% 100% no-repeat 可将图片拉伸自适配' BGNL? Newline EvalString BGNL? Newline
@ -569,19 +570,20 @@ mainStyle_m
/* mainStyle_m
tooltip : 主要样式设置
default : ["project/images/bg.jpg", "color: black", "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "background-color: black; color: white", "255,255,255,1", "rgba(255,255,255,1)", "204,204,204,1", "rgba(204,204,204,1)", "Verdana"]
default : ["project/images/bg.jpg", "project/images/bg.jpg", "color: black", "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "background-color: black; color: white", "255,255,255,1", "rgba(255,255,255,1)", "204,204,204,1", "rgba(204,204,204,1)", "Verdana"]
helpUrl : https://h5mota.com/games/template/_docs/#/event
var code = {
startBackground: EvalString_0,
startLogoStyle: EvalString_1,
startButtonsStyle: EvalString_2,
statusLeftBackground: EvalString_3,
statusTopBackground: EvalString_4,
toolsBackground: EvalString_5,
floorChangingStyle: EvalString_6,
startVerticalBackground: EvalString_1,
startLogoStyle: EvalString_2,
startButtonsStyle: EvalString_3,
statusLeftBackground: EvalString_4,
statusTopBackground: EvalString_5,
toolsBackground: EvalString_6,
floorChangingStyle: EvalString_7,
statusBarColor: JSON.parse('['+ColorString_0+']'),
borderColor: JSON.parse('['+ColorString_1+']'),
font: EvalString_7
font: EvalString_8
};
return JSON.stringify(code);
*/;

View File

@ -107,8 +107,8 @@ ActionParser.prototype.parse = function (obj,type) {
case 'mainStyle':
if(!obj) obj={};
return MotaActionBlocks['mainStyle_m'].xmlText([
obj.startBackground, obj.startLogoStyle, obj.startButtonsStyle, obj.statusLeftBackground, obj.statusTopBackground,
obj.toolsBackground, obj.floorChangingStyle,
obj.startBackground, obj.startVerticalBackground || obj.startBackground, obj.startLogoStyle, obj.startButtonsStyle,
obj.statusLeftBackground, obj.statusTopBackground, obj.toolsBackground, obj.floorChangingStyle,
obj.statusBarColor, 'rgba('+obj.statusBarColor+')', obj.borderColor, 'rgba('+obj.borderColor+')', obj.font
]);

View File

@ -28,7 +28,7 @@ editor_config.prototype.set = function(key, value, callback) {
editor_config.prototype.save = function(callback) {
fs.writeFile(this.address, JSON.stringify(this.config) ,'utf-8', function(e) {
if (e) alert("写入配置文件失败");
if (e) printe("写入配置文件失败");
if (callback instanceof Function) callback();
})
}

View File

@ -216,18 +216,18 @@ editor_mappanel_wrapper = function (editor) {
ee.preventDefault();
ee.stopPropagation();
var e=editor.uivalues.lastMoveE;
if (e.buttons == 2 && (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y))) {
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
editor.uivalues.startPos = editor.uivalues.endPos = null;
return false;
}
if (!selectBox.isSelected()) {
if (e.buttons == 2) {
if (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y)) {
// 右键点击: 弹菜单
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
} else {
// 右键拖拽: 选中区域
printf('已经选中该区域')
editor.uivalues.selectedArea = Object.assign({}, editor.uivalues.startPos, {x1: editor.uivalues.endPos.x, y1: editor.uivalues.endPos.y});
// 后续的处理
}
// 右键拖拽: 选中区域
printf('已经选中该区域')
editor.uivalues.selectedArea = Object.assign({}, editor.uivalues.startPos, {x1: editor.uivalues.endPos.x, y1: editor.uivalues.endPos.y});
// 后续的处理
} else {
// 左键拖拽: 交换
//tip.whichShow(1);
@ -286,8 +286,20 @@ editor_mappanel_wrapper = function (editor) {
editor.uivalues.stepPostfix = editor.uifunctions._fillMode_bfs(editor[editor.layerMod], editor.uivalues.stepPostfix[0].x, editor.uivalues.stepPostfix[0].y,
editor[editor.layerMod][0].length, editor[editor.layerMod].length);
}
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++)
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.info;
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++) {
var currx = editor.uivalues.stepPostfix[ii].x, curry = editor.uivalues.stepPostfix[ii].y;
editor[editor.layerMod][curry][currx] = editor.info;
// 检查上下楼梯绑定
if (editor.layerMod == 'map' && editor.info && editor.info.id == 'upFloor') {
editor.currentFloorData.changeFloor[currx+","+curry] = { "floorId": ":next", "stair": "downFloor" };
editor.drawEventBlock();
}
if (editor.layerMod == 'map' && editor.info && editor.info.id == 'downFloor') {
editor.currentFloorData.changeFloor[currx+","+curry] = { "floorId": ":before", "stair": "upFloor" };
editor.drawEventBlock();
}
}
}
// console.log(editor.map);
if (editor.info.y != null) {

View File

@ -28,7 +28,10 @@ editor_table_wrapper = function (editor) {
}
editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) {
if (value == null) value = [];
if (!(value instanceof Array)) value = [value];
if (!(value instanceof Array)) {
if (value == 0) value = [];
else value = [value];
}
keys=Array.from(keys)
prefixStrings=Array.from(prefixStrings)
for (var index = 0; index < value.length; index++) {

View File

@ -71,7 +71,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "editor.mode.checkUnique(thiseval)",
"_directory": "./project/bgms/",
"_transform": (function (one) {
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav'))
if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav'))
return one;
return null;
}).toString(),
@ -84,7 +84,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "editor.mode.checkUnique(thiseval)",
"_directory": "./project/sounds/",
"_transform": (function (one) {
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav'))
if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav'))
return one;
return null;
}).toString(),

View File

@ -1821,9 +1821,9 @@ control.prototype._syncSave_http = function (type, saves) {
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+response.msg);
}
else {
core.drawText((type=='all'?"所有存档":"存档"+core.saves.saveIndex)+"同步成功!\n\n您的存档编号 "
+response.code+"\n您的存档密码 "+response.msg
+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。\n\r[yellow]另外请注意,存档同步只会保存一个月的时间。\r")
core.drawText((type=='all'?"所有存档":"存档"+core.saves.saveIndex)+"同步成功!\n\n您的存档编号+密码 \r[yellow]"
+response.code+response.msg
+"\r\n\n请牢记以上信息如截图等在从服务器\n同步存档时使用。\n\r[yellow]另外请注意,存档同步只会保存一个月的时间。\r")
}
}, function (e) {
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+e);
@ -1832,13 +1832,14 @@ control.prototype._syncSave_http = function (type, saves) {
////// 从服务器加载存档 //////
control.prototype.syncLoad = function () {
core.myprompt("请输入存档编号", null, function (id) {
if (!id) return core.ui.drawSyncSave();
core.myprompt("请输入存档密码:", null, function (password) {
if (!password) return core.ui.drawSyncSave();
core.ui.drawWaiting("正在同步,请稍后...");
core.control._syncLoad_http(id, password);
});
core.myprompt("请输入存档编号+密码", null, function (idpassword) {
if (!idpassword) return core.ui.drawSyncSave();
if (!/^\d{6}\w{4}$/.test(idpassword)) {
core.drawText("不合法的存档编号+密码应当为6位数字+4位数字字母的组合如\r[yellow]123456abcd\r。");
return;
}
core.ui.drawWaiting("正在同步,请稍后...");
core.control._syncLoad_http(idpassword.substring(0, 6), idpassword.substring(6));
});
}
@ -2695,6 +2696,12 @@ control.prototype.resize = function() {
}
control.prototype._resize_gameGroup = function (obj) {
var startBackground = core.domStyle.isVertical ? (main.styles.startVerticalBackground || main.styles.startBackground) : main.styles.startBackground;
if (main.dom.startBackground.getAttribute('__src__') != startBackground) {
main.dom.startBackground.setAttribute('__src__', startBackground);
main.dom.startBackground.src = startBackground;
}
var gameGroup = core.dom.gameGroup;
var totalWidth, totalHeight;
if (core.domStyle.isVertical) {

View File

@ -44,7 +44,6 @@ events.prototype.startGame = function (hard, seed, route, callback) {
events.prototype._startGame_start = function (hard, seed, route, callback) {
console.log('开始游戏');
core.resetGame(core.firstData.hero, hard, null, core.clone(core.initStatus.maps));
var nowLoc = core.clone(core.getHeroLoc());
core.setHeroLoc('x', -1);
core.setHeroLoc('y', -1);
@ -64,7 +63,7 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
core.push(todo, {"type": "function", "function": "function() { core.events._startGame_setHard(); }"})
core.push(todo, core.firstData.startText);
this.insertAction(todo, null, null, function () {
core.events._startGame_afterStart(nowLoc, callback);
core.events._startGame_afterStart(callback);
});
if (route != null) core.startReplay(route);
@ -86,11 +85,10 @@ events.prototype._startGame_setHard = function () {
core.setFlag('__hardColor__', hardColor);
}
events.prototype._startGame_afterStart = function (nowLoc, callback) {
events.prototype._startGame_afterStart = function (callback) {
core.ui.closePanel();
this._startGame_statusBar();
core.dom.musicBtn.style.display = 'none';
core.changeFloor(core.firstData.floorId, null, nowLoc, null, function () {
core.changeFloor(core.firstData.floorId, null, core.firstData.hero.loc, null, function () {
// 插入一个空事件避免直接回放录像出错
core.insertAction([]);
if (callback) callback();

View File

@ -207,7 +207,6 @@ main.prototype.init = function (mode, callback) {
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
for(var ii in mainData)main[ii]=mainData[ii];
main.dom.startBackground.src = main.styles.startBackground;
main.dom.startLogo.style=main.styles.startLogoStyle;
main.dom.startButtonGroup.style = main.styles.startButtonsStyle;
main.levelChoose = main.levelChoose || [];

View File

@ -138,6 +138,7 @@ function action_data(callback) {
// Step 2: 合并main.styles
if (!main.styles) main.styles = {
"startBackground": "project/images/bg.jpg",
"startVerticalBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
"statusLeftBackground": "url(project/materials/ground.png) repeat",
@ -150,7 +151,8 @@ function action_data(callback) {
};
["startLogoStyle", "startButtonsStyle", "statusLeftBackground", "statusTopBackground", "toolsBackground", "font"].forEach(function (one) {
if (main[one]) main.styles[one] = main[one];
})
});
if (main.styles.startVerticalBackground == null) main.styles.startVerticalBackground = main.styles.startBackground;
for (var key in main.styles) delete main[key];
delete main.floorChangingBackground; delete main.floorChangingTextColor;

View File

@ -73,6 +73,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"startBgm": null,
"styles": {
"startBackground": "project/images/bg.jpg",
"startVerticalBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
"statusLeftBackground": "url(project/materials/ground.png) repeat",

View File

@ -68,7 +68,9 @@
(不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画
(已完成!) 合并main中一些设置内容
(已完成!) \t[this], 勇士朝下flag:arg清理瞬移扣血
nowLoc同步存档合并右键反复弹出失去焦点右键地图编辑框无效
(OK) 同步存档合并;(OK) 失去焦点右键;地图编辑框无效;(OK) 竖屏标题界面背景
右键反复弹出;(OK) 画上下楼梯直接绑定楼传事件;(OK) 属性框出现0问题
-------------