remove flyRange

This commit is contained in:
oc 2019-03-16 03:03:02 +08:00
parent 51f813e3a9
commit 32e760e9e6
9 changed files with 40 additions and 36 deletions

View File

@ -253,12 +253,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
}
}
},
"flyRange": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Array",
"_data": "初始可飞的楼层;一般留空数组即可"
},
"loc": {
"_type": "object",

View File

@ -339,7 +339,6 @@ editor_mode = function (editor) {
editor_mode.prototype.indent = function (field) {
var num = '\t';
if (field.indexOf("['main']") === 0) return 0;
if (field.indexOf("['flyRange']") !== -1) return 0;
if (field === "['special']") return 0;
return num;
}

View File

@ -660,8 +660,8 @@ actions.prototype._sys_onmousewheel = function (direct) {
// 楼层飞行器
if (core.status.lockControl && core.status.event.id == 'fly') {
if (direct==1) core.ui.drawFly(core.status.event.data+1);
if (direct==-1) core.ui.drawFly(core.status.event.data-1);
if (direct==1) core.ui.drawFly(this._getNextFlyFloor(1));
if (direct==-1) core.ui.drawFly(this._getNextFlyFloor(-1));
return;
}
@ -990,25 +990,44 @@ actions.prototype._clickBookDetail = function () {
////// 楼层传送器界面时的点击操作 //////
actions.prototype._clickFly = function(x,y) {
if ((x==10 || x==11) && y==9) core.ui.drawFly(core.status.event.data-1);
if ((x==10 || x==11) && y==5) core.ui.drawFly(core.status.event.data+1);
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==9) core.ui.drawFly(this._getNextFlyFloor(-1));
if ((x==10 || x==11) && y==5) core.ui.drawFly(this._getNextFlyFloor(1));
if ((x==10 || x==11) && y==10) core.ui.drawFly(this._getNextFlyFloor(-10));
if ((x==10 || x==11) && y==4) core.ui.drawFly(this._getNextFlyFloor(10));
if (x>=5 && x<=7 && y==12) core.ui.closePanel();
if (x>=0 && x<=9 && y>=3 && y<=11)
core.control.flyTo(core.status.hero.flyRange[core.status.event.data]);
core.control.flyTo(core.floorIds[core.status.event.data]);
return;
}
////// 楼层传送器界面时,按下某个键的操作 //////
actions.prototype._keyDownFly = function (keycode) {
if (keycode==37) core.ui.drawFly(core.status.event.data-10);
else if (keycode==38) core.ui.drawFly(core.status.event.data+1);
else if (keycode==39) core.ui.drawFly(core.status.event.data+10);
else if (keycode==40) core.ui.drawFly(core.status.event.data-1);
if (keycode==37) core.ui.drawFly(this._getNextFlyFloor(-10));
else if (keycode==38) core.ui.drawFly(this._getNextFlyFloor(1));
else if (keycode==39) core.ui.drawFly(this._getNextFlyFloor(10));
else if (keycode==40) core.ui.drawFly(this._getNextFlyFloor(-1));
return;
}
actions.prototype._getNextFlyFloor = function (delta, index) {
if (!core.isset(index)) index = core.status.event.data;
if (delta == 0) return index;
var sign = Math.sign(delta);
delta = Math.abs(delta);
var ans = index;
while (true) {
index += sign;
if (index < 0 || index >= core.floorIds.length) break;
var floorId = core.floorIds[index];
if (core.status.maps[floorId].canFlyTo && core.hasVisitedFloor(floorId)) {
delta--;
ans = index;
}
if (delta == 0) break;
}
return ans;
}
////// 楼层传送器界面时,放开某个键的操作 //////
actions.prototype._keyUpFly = function (keycode) {
if (keycode==71 || keycode==27 || keycode==88)

View File

@ -1912,9 +1912,8 @@ control.prototype.replay = function () {
}
else if (action.indexOf("fly:")==0) {
var floorId=action.substring(4);
var toIndex=core.status.hero.flyRange.indexOf(floorId);
var nowIndex=core.status.hero.flyRange.indexOf(core.status.floorId);
if (core.hasItem('fly') && toIndex>=0 && nowIndex>=0) {
var toIndex=core.floorIds.indexOf(floorId);
if (core.hasItem('fly')) {
core.ui.drawFly(toIndex);
setTimeout(function () {
if (!core.control.flyTo(floorId, function () {core.replay()})) {

View File

@ -452,12 +452,6 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
core.clearContinueAutomaticRoute();
core.status.replay.animate=true;
if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) {
core.status.hero.flyRange.push(floorId);
core.status.hero.flyRange.sort(function (a, b) {
return core.floorIds.indexOf(a) - core.floorIds.indexOf(b);
})
}
this._changeFloor_beforeChange(info, callback);
}

View File

@ -51,7 +51,9 @@ maps.prototype._mapIntoBlocks = function (map,floor,floorId){
var mh = core.floors[floorId].height;
for (var i = 0; i < mh; i++) {
for (var j = 0; j < mw; j++) {
blocks.push(this.initBlock(j, i, (map[i]||[])[j], true, floor));
var block = this.initBlock(j, i, (map[i]||[])[j], true, floor);
if (block.id != 0 || block.event.trigger)
blocks.push(block);
}
}
return blocks;

View File

@ -1575,11 +1575,9 @@ ui.prototype.drawBookDetail = function (index) {
////// 绘制楼层传送器 //////
ui.prototype.drawFly = function(page) {
if (page<0) page=0;
if (page>=core.status.hero.flyRange.length) page=core.status.hero.flyRange.length-1;
core.status.event.data = page;
var floorId = core.status.hero.flyRange[page];
var floorId = core.floorIds[page];
var title = core.status.maps[floorId].title;
core.clearMap('ui');
@ -1591,12 +1589,12 @@ ui.prototype.drawFly = function(page) {
core.fillText('ui', '楼层跳跃', 208, 60, '#FFFFFF', "bold 28px "+globalFont);
core.fillText('ui', '返回游戏', 208, 403, '#FFFFFF', "bold 15px "+globalFont)
core.fillText('ui', title, 356, 247, '#FFFFFF', "bold 19px "+globalFont);
if (page<core.status.hero.flyRange.length-1) {
if (core.actions._getNextFlyFloor(1) != page) {
core.fillText('ui', '▲', 356, 247 - 64, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▲', 356, 247 - 96, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▲', 356, 247 - 96 - 7, '#FFFFFF', "17px "+globalFont);
}
if (page>0) {
if (core.actions._getNextFlyFloor(-1) != page) {
core.fillText('ui', '▼', 356, 247 + 64, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▼', 356, 247 + 96, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▼', 356, 247 + 96 + 7, '#FFFFFF', "17px "+globalFont);

View File

@ -95,7 +95,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"tools": {},
"equips": {}
},
"flyRange": [],
"loc": {
"direction": "up",
"x": 6,

View File

@ -360,7 +360,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
},
"useItemEffect": {
"book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
"fly": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
@ -389,7 +389,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
},
"canUseItemEffect": {
"book": "true",
"fly": "(function () {\n\treturn core.status.hero.flyRange.indexOf(core.status.floorId)>=0 && (core.status.maps[core.status.floorId]||{}).canFlyTo;\n})();",
"fly": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();",
"pickaxe": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && core.nearHero(block.x, block.y) && \n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t\t// 四个方向\n\t\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"icePickaxe": "(function() {\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\t\tcore.status.event.ui = [i];\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"bomb": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",