From 07eb9fdbe655791f30ad0acbc58fe4c0beeaba33 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sun, 24 May 2020 10:50:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4nowLoc,=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=AD=98=E6=A1=A3=E5=90=8C=E6=AD=A5,=E7=AB=96=E5=B1=8F?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=A1=B5=E9=9D=A2,=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 20 +++++++++++--------- _server/MotaActionParser.js | 4 ++-- _server/editor_config.js | 2 +- _server/editor_mappanel.js | 20 ++++++++++---------- _server/table/data.comment.js | 4 ++-- libs/control.js | 27 +++++++++++++++++---------- libs/events.js | 8 +++----- main.js | 1 - migration.html | 4 +++- project/data.js | 1 + v2.x-final更新.txt | 4 +++- 11 files changed, 53 insertions(+), 42 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 7497c0c3..6dfaeebe 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -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); */; diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index e60d61c7..a5779d8e 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -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 ]); diff --git a/_server/editor_config.js b/_server/editor_config.js index 016b316c..bf0dd074 100644 --- a/_server/editor_config.js +++ b/_server/editor_config.js @@ -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(); }) } diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index 160631bf..47524342 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -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); diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index 76256d83..7c3d4ea1 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -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(), diff --git a/libs/control.js b/libs/control.js index 9ccbbfe3..93d8f5fd 100644 --- a/libs/control.js +++ b/libs/control.js @@ -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) { diff --git a/libs/events.js b/libs/events.js index 96c4548b..bb455bc6 100644 --- a/libs/events.js +++ b/libs/events.js @@ -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(); diff --git a/main.js b/main.js index 90b360f0..b05c815c 100644 --- a/main.js +++ b/main.js @@ -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 || []; diff --git a/migration.html b/migration.html index 1cbc9670..4129e54b 100644 --- a/migration.html +++ b/migration.html @@ -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; diff --git a/project/data.js b/project/data.js index c77e5f3b..8149e0b7 100644 --- a/project/data.js +++ b/project/data.js @@ -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", diff --git a/v2.x-final更新.txt b/v2.x-final更新.txt index df7659ea..e0e13873 100644 --- a/v2.x-final更新.txt +++ b/v2.x-final更新.txt @@ -68,7 +68,9 @@ (不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画 (已完成!) 合并main中一些设置内容 (已完成!) \t[this], 勇士朝下,flag:arg清理,瞬移扣血 -nowLoc;同步存档合并;右键反复弹出;失去焦点右键;地图编辑框无效 +(OK) 同步存档合并;(OK) 失去焦点右键;地图编辑框无效;(OK) 竖屏标题界面背景 +右键反复弹出; + -------------