drawStatistics & flyTo

This commit is contained in:
oc 2018-10-11 17:28:03 +08:00
parent eff81904aa
commit d42ce084d6
6 changed files with 71 additions and 33 deletions

View File

@ -127,6 +127,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": false, "_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"flyTo": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "使用楼层传送器飞到某层"
},
"updateStatusBar": { "updateStatusBar": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
@ -145,6 +151,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": false, "_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"drawStatistics": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "地图数据统计项的注册"
},
"drawAbout": { "drawAbout": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",

View File

@ -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==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==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>=5 && x<=7 && y==12) core.ui.closePanel();
if (x>=0 && x<=9 && y>=3 && y<=11) { if (x>=0 && x<=9 && y>=3 && y<=11)
var index=core.status.hero.flyRange.indexOf(core.status.floorId); core.control.flyTo(core.status.hero.flyRange[core.status.event.data]);
var stair=core.status.event.data<index?"upFloor":"downFloor";
if (core.status.event.data==index && core.floors[core.status.floorId].underGround)
stair = "upFloor";
var floorId=core.status.event.data;
var toFloor = core.status.hero.flyRange[floorId];
core.status.route.push("fly:"+toFloor);
core.ui.closePanel();
core.changeFloor(toFloor, stair);
}
return; return;
} }

View File

@ -1901,14 +1901,10 @@ control.prototype.replay = function () {
if (core.hasItem('fly') && toIndex>=0 && nowIndex>=0) { if (core.hasItem('fly') && toIndex>=0 && nowIndex>=0) {
core.ui.drawFly(toIndex); core.ui.drawFly(toIndex);
setTimeout(function () { setTimeout(function () {
core.ui.closePanel(); if (!core.control.flyTo(floorId, function () {core.replay()})) {
var stair=toIndex<nowIndex?"upFloor":"downFloor"; core.stopReplay();
if (toIndex==nowIndex && core.floors[core.status.floorId].underGround) core.insertAction("录像文件出错");
stair = "upFloor"; }
core.status.route.push("fly:"+floorId);
core.changeFloor(floorId, stair, null, null, function () {
core.replay();
});
}, 750 / Math.max(1, core.status.replay.speed)); }, 750 / Math.max(1, core.status.replay.speed));
return; return;
} }
@ -2059,6 +2055,10 @@ control.prototype.useFly = function (need) {
return; return;
} }
control.prototype.flyTo = function (toId, callback) {
return this.controldata.flyTo(toId, callback);
}
////// 点击装备栏时的打开操作 ////// ////// 点击装备栏时的打开操作 //////
control.prototype.openEquipbox = function (need) { control.prototype.openEquipbox = function (need) {
if (core.isset(core.status.replay)&&core.status.replay.replaying) return; if (core.isset(core.status.replay)&&core.status.replay.replaying) return;

View File

@ -2159,21 +2159,15 @@ ui.prototype.drawStatistics = function () {
// 5. 当前已走的步数;瞬间移动的步数,瞬间移动的次数(和少走的步数);游戏时长 // 5. 当前已走的步数;瞬间移动的步数,瞬间移动的次数(和少走的步数);游戏时长
// 6. 当前已恢复的生命值;当前总伤害、战斗伤害、阻激夹域血网伤害、中毒伤害。 // 6. 当前已恢复的生命值;当前总伤害、战斗伤害、阻激夹域血网伤害、中毒伤害。
var ids = this.uidata.drawStatistics();
var obj = {};
ids.forEach(function (e) {obj[e] = 0;})
var total = { var total = {
'monster': { 'monster': {
'count': 0, 'money': 0, 'experience': 0, 'point': 0, 'count': 0, 'money': 0, 'experience': 0, 'point': 0,
}, },
'count': { 'count': obj,
'yellowDoor': 0, 'blueDoor': 0, 'redDoor': 0, 'greenDoor': 0, 'steelDoor': 0,
'yellowKey': 0, 'blueKey': 0, 'redKey': 0, 'greenKey': 0, 'steelKey': 0,
'redJewel': 0, 'blueJewel': 0, 'greenJewel': 0, 'yellowJewel': 0,
'redPotion': 0, 'bluePotion': 0, 'greenPotion': 0, 'yellowPotion': 0, 'superPotion': 0,
'pickaxe': 0, 'bomb': 0, 'centerFly': 0,
'poisonWine': 0, 'weakWine': 0, 'curseWine': 0, 'superWine': 0,
'sword1': 0, 'sword2': 0, 'sword3': 0, 'sword4': 0, 'sword5': 0,
'shield1': 0, 'shield2': 0, 'shield3': 0, 'shield4': 0, 'shield5': 0,
},
'add': { 'add': {
'hp': 0, 'atk': 0, 'def': 0, 'mdef': 0 'hp': 0, 'atk': 0, 'def': 0, 'mdef': 0
} }
@ -2265,13 +2259,13 @@ ui.prototype.drawStatistics = function () {
Object.keys(data.count).forEach(function (key) { Object.keys(data.count).forEach(function (key) {
var value=data.count[key]; var value=data.count[key];
if (value>0) { if (value>0) {
var name=""; var name=null;
if (key=='yellowDoor') name="黄门"; if (key=='yellowDoor') name="黄门";
else if (key=='blueDoor') name="蓝门"; else if (key=='blueDoor') name="蓝门";
else if (key=='redDoor') name="红门"; else if (key=='redDoor') name="红门";
else if (key=='greenDoor') name="绿门"; else if (key=='greenDoor') name="绿门";
else if (key=='steelDoor') name="铁门"; else if (key=='steelDoor') name="铁门";
else name=core.material.items[key].name; else name=(core.material.items[key]||{}).name;
if (core.isset(name)) { if (core.isset(name)) {
text+=name+value+"个;"; text+=name+value+"个;";
} }

View File

@ -554,6 +554,31 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
}, },
"control": { "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 () { "updateStatusBar": function () {
// 更新状态栏 // 更新状态栏
@ -759,6 +784,21 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
}, },
"ui": { "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() { "drawAbout": function() {
// 绘制“关于”界面 // 绘制“关于”界面
if (!core.isPlaying()) { if (!core.isPlaying()) {

View File

@ -1,8 +1,9 @@
HTML5魔塔样板V2.4.1 HTML5魔塔样板V2.4.1
增加光环属性 增加光环属性
怪物属性获取独立到脚本编辑中 怪物属性获取移动到脚本编辑中
楼层传送代码独立到脚本编辑中 楼层传送代码移动到脚本编辑中
地图数据统计移动到脚本编辑中
状态栏可以显示角色名字 状态栏可以显示角色名字
修复大地图的夹击Bug 修复大地图的夹击Bug
iOS设备默认关闭新版存档 iOS设备默认关闭新版存档