From d42ce084d68b1646692022630c5a2395da5a5fb6 Mon Sep 17 00:00:00 2001 From: oc Date: Thu, 11 Oct 2018 17:28:03 +0800 Subject: [PATCH] drawStatistics & flyTo --- _server/functions.comment.js | 12 +++++++++++ libs/actions.js | 13 ++---------- libs/control.js | 16 +++++++-------- libs/ui.js | 18 ++++++---------- project/functions.js | 40 ++++++++++++++++++++++++++++++++++++ 更新说明.txt | 5 +++-- 6 files changed, 71 insertions(+), 33 deletions(-) diff --git a/_server/functions.comment.js b/_server/functions.comment.js index acceed2f..f49f51d1 100644 --- a/_server/functions.comment.js +++ b/_server/functions.comment.js @@ -127,6 +127,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_leaf": false, "_type": "object", "_data": { + "flyTo": { + "_leaf": true, + "_type": "textarea", + "_lint": true, + "_data": "使用楼层传送器飞到某层" + }, "updateStatusBar": { "_leaf": true, "_type": "textarea", @@ -145,6 +151,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_leaf": false, "_type": "object", "_data": { + "drawStatistics": { + "_leaf": true, + "_type": "textarea", + "_lint": true, + "_data": "地图数据统计项的注册" + }, "drawAbout": { "_leaf": true, "_type": "textarea", diff --git a/libs/actions.js b/libs/actions.js index a42ea53c..46640f2f 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -969,17 +969,8 @@ actions.prototype.clickFly = function(x,y) { if ((x==10 || x==11) && y==10) core.ui.drawFly(core.status.event.data-10); if ((x==10 || x==11) && y==4) core.ui.drawFly(core.status.event.data+10); if (x>=5 && x<=7 && y==12) core.ui.closePanel(); - if (x>=0 && x<=9 && y>=3 && y<=11) { - var index=core.status.hero.flyRange.indexOf(core.status.floorId); - var stair=core.status.event.data=0 && x<=9 && y>=3 && y<=11) + core.control.flyTo(core.status.hero.flyRange[core.status.event.data]); return; } diff --git a/libs/control.js b/libs/control.js index d9233d8f..80a4e03e 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1901,14 +1901,10 @@ control.prototype.replay = function () { if (core.hasItem('fly') && toIndex>=0 && nowIndex>=0) { core.ui.drawFly(toIndex); setTimeout(function () { - core.ui.closePanel(); - var stair=toIndex0) { - var name=""; + var name=null; if (key=='yellowDoor') name="黄门"; else if (key=='blueDoor') name="蓝门"; else if (key=='redDoor') name="红门"; else if (key=='greenDoor') name="绿门"; else if (key=='steelDoor') name="铁门"; - else name=core.material.items[key].name; + else name=(core.material.items[key]||{}).name; if (core.isset(name)) { text+=name+value+"个;"; } diff --git a/project/functions.js b/project/functions.js index 384daad0..30d29e48 100644 --- a/project/functions.js +++ b/project/functions.js @@ -554,6 +554,31 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } }, "control": { + "flyTo": function (toId, callback) { + // 楼层传送器的使用,从当前楼层飞往toId + // 如果不能飞行请返回false + + var fromId = core.status.floorId; + + // 检查能否飞行 + if (!core.floors[fromId].canFlyTo || !core.floors[toId].canFlyTo) { + core.drawTip("无法飞往" + core.floors[toId].title +"!"); + return false; + } + + // 获得两个楼层的索引,以决定是上楼梯还是下楼梯 + var fromIndex = core.floorIds.indexOf(fromId), toIndex = core.floorIds.indexOf(toId); + var stair = fromIndex<=toIndex?"downFloor":"upFloor"; + // 地下层:同层传送至上楼梯 + if (fromIndex == toIndex && core.floorIds[fromId].underGround) stair = "upFloor"; + // 记录录像 + core.status.route.push("fly:"+toId); + // 传送 + core.ui.closePanel(); + core.changeFloor(toId, stair, null, null, callback); + + return true; +}, "updateStatusBar": function () { // 更新状态栏 @@ -759,6 +784,21 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } }, "ui": { + "drawStatistics": function () { + // 浏览地图时参与的统计项目 + + return [ + 'yellowDoor', 'blueDoor', 'redDoor', 'greenDoor', 'steelDoor', + 'yellowKey', 'blueKey', 'redKey', 'greenKey', 'steelKey', + 'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel', + 'redPotion', 'bluePotion', 'greenPotion', 'yellowPotion', 'superPotion', + 'pickaxe', 'bomb', 'centerFly', + 'poisonWine', 'weakWine', 'curseWine', 'superWine', + 'sword1', 'sword2', 'sword3', 'sword4', 'sword5', + 'shield1', 'shield2', 'shield3', 'shield4', 'shield5', + // 在这里可以增加新的ID来进行统计个数,只能增加道具ID + ]; +}, "drawAbout": function() { // 绘制“关于”界面 if (!core.isPlaying()) { diff --git a/更新说明.txt b/更新说明.txt index e25cb82f..64c7c121 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,8 +1,9 @@ HTML5魔塔样板V2.4.1 增加光环属性 -怪物属性获取独立到脚本编辑中 -楼层传送代码独立到脚本编辑中 +怪物属性获取移动到脚本编辑中 +楼层传送代码移动到脚本编辑中 +地图数据统计移动到脚本编辑中 状态栏可以显示角色名字 修复大地图的夹击Bug iOS设备默认关闭新版存档