diff --git a/API列表.txt b/API列表.txt index 9c8b2129..52e1a2b0 100644 --- a/API列表.txt +++ b/API列表.txt @@ -56,7 +56,6 @@ core.platform.isPC (是否是电脑端) core.platform.isAndroid (是否是安卓端) core.platform.isIOS (是否是iOS端) core.platform.useLocalForage (是否开启了新版存档) -core.platform.extendKeyBoard (是否开启了拓展键盘) core.domStyle diff --git a/README.md b/README.md index 4d83c518..7ccf34ca 100644 --- a/README.md +++ b/README.md @@ -55,17 +55,18 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! ## 更新说明 -### 2019.7.5 V2.6.3 +### 2019.7.24 V2.6.3 -* [x] 标题界面大幅美化,支持键盘开始游戏 +* [x] 标题界面大幅美化,增加闪烁光标,支持键盘开始游戏 * [x] 事件编辑器支持自动补全,能对flag和API列表等进行补全 * [x] 剧情文本中\\c修改字体大小,\\d和\\e切换粗体和斜体 -* [x] 可以指定每个选择项的出现条件,动态生成 +* [x] 事件:设置视角&移动视角 +* [x] 可以指定显示选择项的出现条件并动态生成 * [x] 楼层传送器的平面传送模式(哪里离开飞回到哪里) -* [x] UI绘制事件增添绘制圆(边框),且可直接双击预览 +* [x] UI绘制事件增添绘制圆和绘制圆边框 +* [x] 所有的UI绘制事件均可以双击预览 * [x] 播放BGM事件可以一直持续播放直到下次调用 * [x] \f立绘支持alpha值 -* [x] 只有一个全局商店时V键能直接打开 * [x] 支持在脚本编辑中直接flags.xxx调用自定义变量 * [x] 首次获得道具将给予提示 * [x] 等待用户操作支持滚轮,视为PgUp和PgDn diff --git a/_docs/api.md b/_docs/api.md index 5bcbe0ed..980c3b3a 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -57,7 +57,6 @@ core.platform.isPC (是否是电脑端) core.platform.isAndroid (是否是安卓端) core.platform.isIOS (是否是iOS端) core.platform.useLocalForage (是否开启了新版存档) -core.platform.extendKeyBoard (是否开启了拓展键盘) core.domStyle diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 27bacb0f..e7001609 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -293,6 +293,8 @@ action | changeFloor_s | changePos_0_s | changePos_1_s + | setViewport_s + | moveViewport_s | useItem_s | openShop_s | disableShop_s @@ -756,7 +758,7 @@ return code; */; setBlock_s - : '转变图块为' EvalString 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline + : '转变图块为' EvalString 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline /* setBlock_s @@ -765,8 +767,21 @@ helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E colour : this.mapColor default : ["yellowDoor","","",""] var floorstr = ''; -if (PosString_0 && PosString_1) { - floorstr = ', "loc": ['+PosString_0+','+PosString_1+']'; +if (EvalString_1 && EvalString_2) { + var pattern1 = MotaActionFunctions.pattern.id; + if(pattern1.test(EvalString_1) || pattern1.test(EvalString_2)){ + EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1); + EvalString_2=MotaActionFunctions.PosString_pre(EvalString_2); + EvalString_1=[EvalString_1,EvalString_2] + } else { + var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/; + if(!pattern2.test(EvalString_1) || !pattern2.test(EvalString_2))throw new Error('坐标格式错误,请右键点击帮助查看格式'); + EvalString_1=EvalString_1.split(','); + EvalString_2=EvalString_2.split(','); + if(EvalString_1.length!==EvalString_2.length)throw new Error('坐标格式错误,请右键点击帮助查看格式'); + for(var ii=0;ii 此浏览器不支持HTML5 +
diff --git a/libs/actions.js b/libs/actions.js index 51eefbab..648b8dd6 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -137,7 +137,7 @@ actions.prototype._sys_onkeyDown = function (e) { return; } } - e.preventDefault(); + if (e.preventDefault) e.preventDefault(); core.status.holdingKeys.push(e.keyCode); this.pressKey(e.keyCode); } else { @@ -199,7 +199,7 @@ actions.prototype._sys_onkeyUp = function (e) { break; } } - e.preventDefault(); + if (e.preventDefault) e.preventDefault(); this.keyUp(e.keyCode, e.altKey); } else { if (e.keyCode == 17) core.status.ctrlDown = false; @@ -1934,8 +1934,6 @@ actions.prototype._clickSwitchs = function (x, y) { case 7: return this._clickSwitchs_clickMove(); case 8: - return this._clickSwitchs_ExtendKeyboard(); - case 9: core.status.event.selection = 0; core.ui.drawSettings(); break; @@ -2000,13 +1998,6 @@ actions.prototype._clickSwitchs_clickMove = function () { core.ui.drawSwitchs(); } -actions.prototype._clickSwitchs_ExtendKeyboard = function () { - core.platform.extendKeyboard = !core.platform.extendKeyboard; - core.setLocalStorage('extendKeyboard', core.platform.extendKeyboard); - core.updateStatusBar(); - core.ui.drawSwitchs(); -} - ////// 系统设置界面时,放开某个键的操作 ////// actions.prototype._keyUpSwitchs = function (keycode) { if (keycode == 27 || keycode == 88) { diff --git a/libs/control.js b/libs/control.js index 50d25713..e6d297bc 100644 --- a/libs/control.js +++ b/libs/control.js @@ -19,7 +19,6 @@ control.prototype._init = function () { this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime); this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave); this.registerAnimationFrame("globalAnimate", true, this._animationFrame_globalAnimate); - this.registerAnimationFrame("selector", false, this._animationFrame_selector); this.registerAnimationFrame("animate", true, this._animationFrame_animate); this.registerAnimationFrame("heroMoving", true, this._animationFrame_heroMoving); this.registerAnimationFrame("weather", true, this._animationFrame_weather); @@ -151,23 +150,6 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { core.animateFrame.globalTime = timestamp; } -control.prototype._animationFrame_selector = function (timestamp) { - if (timestamp - core.animateFrame.selectorTime <= 20) return; - var opacity = null; - if (core.dymCanvas._selector) opacity = parseFloat(core.dymCanvas._selector.canvas.style.opacity); - else if (core.dymCanvas._uievent_selector) opacity = parseFloat(core.dymCanvas._uievent_selector.canvas.style.opacity); - if (!core.isset(opacity)) return; - if (core.animateFrame.selectorUp) - opacity += 0.02; - else - opacity -= 0.02; - if (opacity > 0.95 || opacity < 0.55) - core.animateFrame.selectorUp = !core.animateFrame.selectorUp; - core.setOpacity("_selector", opacity); - core.setOpacity("_uievent_selector", opacity); - core.animateFrame.selectorTime = timestamp; -} - control.prototype._animationFrame_animate = function (timestamp) { if (timestamp - core.animateFrame.animateTime < 50 || !core.status.animateObjs || core.status.animateObjs.length == 0) return; core.clearMap('animate'); @@ -797,6 +779,7 @@ control.prototype.drawHero = function (status, offset) { }); core.control.updateViewport(); + core.setGameCanvasTranslate('hero', 0, 0); } control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, offset) { @@ -870,6 +853,48 @@ control.prototype.updateViewport = function() { core.relocateCanvas('route', core.status.automaticRoute.offsetX - core.bigmap.offsetX, core.status.automaticRoute.offsetY - core.bigmap.offsetY); } +////// 设置视野范围 ////// +control.prototype.setViewport = function (x, y) { + core.bigmap.offsetX = core.clamp(x, 0, 32 * core.bigmap.width - core.__PIXELS__); + core.bigmap.offsetY = core.clamp(y, 0, 32 * core.bigmap.height - core.__PIXELS__); + this.updateViewport(); + // ------ hero层也需要! + var hero_x = core.clamp((core.getHeroLoc('x') - core.__HALF_SIZE__) * 32, 0, 32*core.bigmap.width-core.__PIXELS__); + var hero_y = core.clamp((core.getHeroLoc('y') - core.__HALF_SIZE__) * 32, 0, 32*core.bigmap.height-core.__PIXELS__); + core.control.setGameCanvasTranslate('hero', hero_x - core.bigmap.offsetX, hero_y - core.bigmap.offsetY); +} + +////// 移动视野范围 ////// +control.prototype.moveViewport = function (steps, time, callback) { + time = time || core.values.moveSpeed || 300; + var step = 0, moveSteps = (steps||[]).filter(function (t) { + return ['up','down','left','right'].indexOf(t)>=0; + }); + var animate=window.setInterval(function() { + if (moveSteps.length==0) { + delete core.animateFrame.asyncId[animate]; + clearInterval(animate); + if (callback) callback(); + } + else { + if (core.control._moveViewport_moving(++step, moveSteps)) + step = 0; + } + }, time / 16 / core.status.replay.speed); + + core.animateFrame.asyncId[animate] = true; +} + +control.prototype._moveViewport_moving = function (step, moveSteps) { + var direction = moveSteps[0], scan = core.utils.scan[direction]; + core.setViewport(core.bigmap.offsetX + 2 * scan.x, core.bigmap.offsetY + 2 * scan.y); + if (step == 16) { + moveSteps.shift(); + return true; + } + return false; +} + ////// 获得勇士面对位置的x坐标 ////// control.prototype.nextX = function(n) { if (n == null) n = 1; @@ -1211,7 +1236,7 @@ control.prototype.bookReplay = function () { // 从“浏览地图”页面打开 if (core.status.event.id=='viewMaps') - core.status.event.selection = core.status.event.data; + core.status.event.ui = core.status.event.data; core.lockControl(); core.status.event.id='book'; @@ -2343,6 +2368,7 @@ control.prototype._updateStatusBar_setToolboxIcon = function () { } control.prototype.showStatusBar = function () { + if (main.mode == 'editor') return; if (core.domStyle.showStatusBar) return; var statusItems = core.dom.status; core.domStyle.showStatusBar = true; @@ -2355,9 +2381,12 @@ control.prototype.showStatusBar = function () { } control.prototype.hideStatusBar = function (showToolbox) { + if (main.mode == 'editor') return; + // 如果原本就是隐藏的,则先显示 if (!core.domStyle.showStatusBar) this.showStatusBar(); + if (core.isReplaying()) showToolbox = true; var statusItems = core.dom.status, toolItems = core.dom.tools; core.domStyle.showStatusBar = false; @@ -2465,7 +2494,7 @@ control.prototype.setToolbarButton = function (useButton) { } if (useButton == null) useButton = core.domStyle.toolbarBtn; - if (!core.domStyle.isVertical || !core.platform.extendKeyboard) useButton = false; + if (!core.domStyle.isVertical || core.isReplaying()) useButton = false; core.domStyle.toolbarBtn = useButton; if (useButton) { @@ -2648,6 +2677,11 @@ control.prototype._resize_canvas = function (obj) { canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; } + // resize next + main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px"; + main.dom.next.style.borderBottomWidth = main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px"; + + } control.prototype._resize_statusBar = function (obj) { diff --git a/libs/core.js b/libs/core.js index be98ccfe..6cbe83cf 100644 --- a/libs/core.js +++ b/libs/core.js @@ -72,7 +72,6 @@ function core() { 'isChrome': false, // 是否是Chrome 'supportCopy': false, // 是否支持复制到剪切板 'useLocalForage': true, - 'extendKeyboard': false, 'fileInput': null, // FileInput 'fileReader': null, // 是否支持FileReader @@ -285,7 +284,6 @@ core.prototype._init_platform = function () { core.platform.isQQ = /QQ/i.test(navigator.userAgent); core.platform.isWeChat = /MicroMessenger/i.test(navigator.userAgent); this._init_checkLocalForage(); - core.platform.extendKeyboard = core.getLocalStorage("extendKeyboard", false); if (window.FileReader) { core.platform.fileReader = new FileReader(); core.platform.fileReader.onload = function () { diff --git a/libs/events.js b/libs/events.js index 4d61b05a..b5989364 100644 --- a/libs/events.js +++ b/libs/events.js @@ -462,7 +462,7 @@ events.prototype.getItem = function (id, num, x, y, callback) { // --- 首次获得道具的提示 if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []); var itemHint = core.getFlag("__itemHint__"); - if (itemHint.indexOf(id) < 0 && itemCls != 'items') { + if (core.flags.itemFirstText && itemHint.indexOf(id) < 0 && itemCls != 'items') { var hint = core.material.items[id].text || "该道具暂无描述"; try { hint = core.replaceText(hint); @@ -1030,8 +1030,10 @@ events.prototype._action_hide = function (data, x, y, prefix) { } events.prototype._action_setBlock = function (data, x, y, prefix) { - var loc = this.__action_getLoc(data.loc, x, y, prefix); - core.setBlock(data.number, loc[0], loc[1], data.floorId); + data.loc = this.__action_getLoc2D(data.loc, x, y, prefix); + data.loc.forEach(function (t) { + core.setBlock(data.number, t[0], t[1], data.floorId); + }); core.doAction(); } @@ -1052,8 +1054,10 @@ events.prototype._action_hideBgFgMap = function (data, x, y, prefix) { } events.prototype._action_setBgFgBlock = function (data, x, y, prefix) { - var loc = this.__action_getLoc(data.loc, x, y, prefix); - core.setBgFgBlock(data.name, data.number, loc[0], loc[1], data.floorId); + data.loc = this.__action_getLoc2D(data.loc, x, y, prefix); + data.loc.forEach(function (t) { + core.setBgFgBlock(data.name, data.number, t[0], t[1], data.floorId); + }); core.doAction(); } @@ -1073,6 +1077,21 @@ events.prototype._action_animate = function (data, x, y, prefix) { this.__action_doAsyncFunc(data.async, core.drawAnimate, data.name, data.loc[0], data.loc[1]); } +events.prototype._action_setViewport = function (data, x, y, prefix) { + if (data.loc == null) { + core.drawHero(); + } + else { + var loc = this.__action_getLoc(data.loc, x, y, prefix); + core.setViewport(32 * loc[0], 32 * loc[1]); + } + core.doAction(); +} + +events.prototype._action_moveViewport = function (data, x, y, prefix) { + this.__action_doAsyncFunc(data.async, core.moveViewport, data.steps, data.time); +} + events.prototype._action_move = function (data, x, y, prefix) { var loc = this.__action_getLoc(data.loc, x, y, prefix); this.__action_doAsyncFunc(data.async, core.moveBlock, loc[0], loc[1], data.steps, data.time, data.keep); diff --git a/libs/maps.js b/libs/maps.js index 3cda4b57..71f8cf36 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -939,24 +939,25 @@ maps.prototype._drawFloorImage = function (ctx, name, type, image, offsetX, widt ////// 绘制Autotile ////// maps.prototype._drawAutotile = function (ctx, mapArr, block, size, left, top, status) { - var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块 - // +----+----+----+----+----+----+ - [10, 9, 4, 3], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 | - [10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+ - [10, 9, 18, 3], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 | - [10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+ - [10, 43, 4, 3], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 | - [10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+ - [10, 7, 2, 3], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 | - [10, 31, 16, 5], //7 bin:0111 +----+----+----+----+----+----+ - [48, 9, 4, 3], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 | - [8, 9, 4, 1], //9 bin:1001 +----+----+----+----+----+----+ - [36, 9, 30, 3], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 | - [36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+ - [46, 45, 4, 3], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 | - [46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+ - [12, 45, 30, 3], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 | - [34, 33, 28, 27] //15 bin:1111 +----+----+----+----+----+----+ + var indexArrs = [ //16种组合的图块索引数组; + // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块 + // +----+----+----+----+----+----+ + [10, 9, 4, 3], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 | + [10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+ + [10, 9, 18, 3], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 | + [10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+ + [10, 43, 4, 3], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 | + [10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+ + [10, 43, 18, 3], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 | + [10, 31, 16, 5], //7 bin:0111 +----+----+----+----+----+----+ + [48, 9, 4, 3], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 | + [48, 9, 4, 13], //9 bin:1001 +----+----+----+----+----+----+ + [36, 9, 30, 3], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 | + [36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+ + [46, 45, 4, 3], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 | + [46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+ + [12, 45, 30, 3], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 | + [20, 23, 38, 41] //15 bin:1111 +----+----+----+----+----+----+ ]; // 开始绘制autotile diff --git a/libs/ui.js b/libs/ui.js index 2050669b..46738a4f 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -452,6 +452,7 @@ ui.prototype.closePanel = function () { ui.prototype.clearUI = function () { core.status.boxAnimateObjs = []; if (core.dymCanvas._selector) core.deleteCanvas("_selector"); + main.dom.next.style.display = 'none'; core.clearMap('ui'); core.setAlpha('ui', 1); } @@ -640,7 +641,6 @@ ui.prototype._getPosition = function (content) { ui.prototype.drawWindowSelector = function(background, x, y, w, h) { w = Math.round(w), h = Math.round(h); var ctx = core.ui.createCanvas("_selector", x, y, w, h, 165); - ctx.canvas.style.opacity = 0.8; this._drawSelector(ctx, background, w, h); } @@ -662,7 +662,6 @@ ui.prototype._uievent_drawSelector = function (data) { var z = 136; if (core.dymCanvas.uievent) z = (parseInt(core.dymCanvas.uievent.canvas.style.zIndex) || 135) + 1; var ctx = core.createCanvas('_uievent_selector', x, y, w, h, z); - ctx.canvas.style.opacity = 0.8; this._drawSelector(ctx, background, w, h); } @@ -1119,10 +1118,20 @@ ui.prototype.drawTextBox = function(content, showAll) { var content_top = this._drawTextBox_drawTitleAndIcon(titleInfo, hPos, vPos, alpha); // Step 5: 绘制正文 - return this.drawTextContent('ui', content, { + var config = this.drawTextContent('ui', content, { left: hPos.content_left, top: content_top, maxWidth: hPos.validWidth, lineHeight: vPos.lineHeight, time: (showAll || textAttribute.time<=0 || core.status.event.id!='action')?0:textAttribute.time }); + + // Step 6: 绘制光标 + main.dom.next.style.display = 'block'; + main.dom.next.style.borderRightColor = main.dom.next.style.borderBottomColor = core.arrayToRGB(textAttribute.text); + main.dom.next.style.top = (vPos.bottom - 20) * core.domStyle.scale + "px"; + var left = (hPos.left + hPos.right) / 2; + if (pInfo.position == 'up' && pInfo.px != null && Math.abs(pInfo.px * 32 + 16 - left) < 50) + left = hPos.right - 64; + main.dom.next.style.left = left * core.domStyle.scale + "px"; + return config; } ui.prototype._drawTextBox_drawImages = function (content) { @@ -1170,7 +1179,7 @@ ui.prototype._drawTextBox_getHorizontalPosition = function (content, titleInfo, ui.prototype._drawTextBox_getVerticalPosition = function (content, titleInfo, posInfo, validWidth) { var textAttribute = core.status.textAttribute || core.initStatus.textAttribute; var lineHeight = textAttribute.textfont + 6; - var height = 30 + this.getTextContentHeight(content, { + var height = 45 + this.getTextContentHeight(content, { lineHeight: lineHeight, maxWidth: validWidth }); if (titleInfo.title) height += textAttribute.titlefont + 5; @@ -1507,7 +1516,6 @@ ui.prototype.drawSwitchs = function() { "领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"), "新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"), "单击瞬移: "+(!core.hasFlag("__noClickMove__") ? "[ON]":"[OFF]"), - "拓展键盘: "+(core.platform.extendKeyboard ? "[ON]":"[OFF]"), "返回主菜单" ]; this.drawChoices(null, choices); diff --git a/main.js b/main.js index e19c4143..e2c8cf15 100644 --- a/main.js +++ b/main.js @@ -74,7 +74,8 @@ function main() { 'inputMessage': document.getElementById('inputMessage'), 'inputBox': document.getElementById('inputBox'), 'inputYes': document.getElementById('inputYes'), - 'inputNo': document.getElementById('inputNo') + 'inputNo': document.getElementById('inputNo'), + 'next': document.getElementById('next') }; this.mode = 'play'; this.loadList = [ @@ -216,6 +217,7 @@ main.prototype.init = function (mode, callback) { })(span,value[1]); main.dom.levelChooseButtons.appendChild(span); }); + main.createOnChoiceAnimation(); main.loadJs('libs', main.loadList, function () { main.core = core; @@ -328,14 +330,32 @@ main.prototype.log = function (e) { } } +main.prototype.createOnChoiceAnimation = function () { + var borderColor = main.dom.startButtonGroup.style.caretColor || "rgb(255, 215, 0)"; + // get rgb value + var rgb = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+\s*)?\)$/.exec(borderColor); + if (rgb != null) { + var value = rgb[1] + ", " + rgb[2] + ", " + rgb[3]; + var style = document.createElement("style"); + style.type = 'text/css'; + var keyFrames = "onChoice { " + + "0% { border-color: rgba("+value+", 0.9); } " + + "50% { border-color: rgba("+value+", 0.3); } " + + "100% { border-color: rgba("+value+", 0.9); } " + + "}"; + style.innerHTML = "@-webkit-keyframes " + keyFrames + " @keyframes " + keyFrames; + document.body.appendChild(style); + } +} + ////// 选项 ////// main.prototype.selectButton = function (index) { var select = function (children) { index = (index + children.length) % children.length; for (var i = 0;i < children.length; ++i) { - children[i].style.borderColor = 'transparent'; + children[i].classList.remove("onChoiceAnimate"); } - children[index].style.borderColor = main.dom.startButtonGroup.style.caretColor || '#FFD700'; + children[index].classList.add("onChoiceAnimate"); if (main.selectedButton == index) { children[index].click(); } @@ -383,6 +403,9 @@ main.dom.body.onkeyup = function(e) { main.selectButton((main.selectedButton||0) + 1); else if (e.keyCode == 67 || e.keyCode == 13 || e.keyCode == 32) // C/Enter/Space main.selectButton(main.selectedButton); + else if (e.keyCode == 27 && main.dom.levelChooseButtons.style.display == 'block') { // ESC + main.core.showStartAnimate(true); + } e.stopPropagation(); return; } @@ -642,7 +665,7 @@ main.statusBar.image.settings.onclick = function (e) { } ////// 点击工具栏时 ////// -main.dom.toolBar.onclick = function () { +main.dom.hard.onclick = function () { if (core.isReplaying()) return; main.core.control.setToolbarButton(!core.domStyle.toolbarBtn); diff --git a/project/data.js b/project/data.js index 29c59b80..f8ec9780 100644 --- a/project/data.js +++ b/project/data.js @@ -396,6 +396,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "snowFourDirections": false, "bigKeyIsBox": false, "steelDoorWithoutKey": false, + "itemFirstText": true, "equipment": false, "equipboxButton": false, "iconInEquipbox": false, diff --git a/styles.css b/styles.css index ccdb83cb..3a428992 100644 --- a/styles.css +++ b/styles.css @@ -159,6 +159,10 @@ border-radius: 6px; } +.onChoiceAnimate { + animation: onChoice 2s ease-in-out 0s infinite normal none running; +} + #floorMsgGroup { top: 3px; right: 3px; @@ -374,4 +378,49 @@ p#name { #inputNo { float:right; margin-right: 10%; +} + +#_selector, #_uievent_selector { + animation: selector 2s ease-in-out 0s infinite normal none running; +} + +@-webkit-keyframes selector { + 0% { opacity: 0.95; } + 50% { opacity: 0.55; } + 100% { opacity: 0.95; } +} + +@keyframes selector { + 0% { opacity: 0.95; } + 50% { opacity: 0.55; } + 100% { opacity: 0.95; } +} + +#next { + width: 5px; + height: 5px; + display: none; + position: absolute; + transform: rotate(45deg); + border-bottom-width: 4px; + border-bottom-style: solid; + border-right-width: 4px; + border-right-style: solid; + -webkit-animation: next .5s ease-in-out alternate infinite; + animation: next .5s ease-in-out alternate infinite; + left: 0; + top: 0; + opacity: 0.7; + z-index: 169; +} + +@-webkit-keyframes next { + 100% { + transform: rotate(45deg) translate(-3px, -3px); + } +} +@keyframes next { + 100% { + transform: rotate(45deg) translate(-3px, -3px); + } } \ No newline at end of file diff --git a/更新说明.txt b/更新说明.txt index 8e690e8e..8b3e2419 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,9 +1,10 @@ HTML5魔塔样板V2.6.3 -标题界面大幅美化,支持键盘开始游戏 +标题界面大幅美化,增加闪烁光标,支持键盘开始游戏 事件编辑器支持自动补全,能对flag和API列表等进行补全 剧情文本中\\c修改字体大小,\\d和\\e切换粗体和斜体 -可以指定每个选择项的出现条件,动态生成 +事件:设置视角&移动视角 +可以指定显示选择项的出现条件并动态生成 楼层传送器的平面传送模式(哪里离开飞回到哪里) UI绘制事件增添绘制圆和绘制圆边框 所有的UI绘制事件均可以双击预览