diff --git a/libs/actions.js b/libs/actions.js index ce47a2d0..d97acaaa 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -910,10 +910,12 @@ actions.prototype._selectChoices = function (length, keycode, callback) { actions.prototype._keyDownChoices = function (keycode) { if (keycode == 38) { core.status.event.selection--; + core.playSound('光标移动'); core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices); } if (keycode == 40) { core.status.event.selection++; + core.playSound('光标移动'); core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices); } } @@ -929,6 +931,7 @@ actions.prototype._onMoveChoices = function (x, y) { var selection = y - topIndex; if (selection == core.status.event.selection) return; core.status.event.selection = selection; + core.playSound('光标移动'); core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices); } } @@ -942,6 +945,7 @@ actions.prototype._clickCenterFly = function (x, y) { core.useItem('centerFly'); } else { + core.playSound('操作失败'); core.drawTip('当前不能使用' + core.material.items['centerFly'].name); } } @@ -954,6 +958,7 @@ actions.prototype._keyUpCenterFly = function (keycode) { core.useItem('centerFly'); } else { + core.playSound('操作失败'); core.drawTip('当前不能使用' + core.material.items['centerFly'].name); } } @@ -969,18 +974,12 @@ actions.prototype._clickConfirmBox = function (x, y) { ////// 键盘操作确认框时 ////// actions.prototype._keyUpConfirmBox = function (keycode) { - if (keycode == 37) { - core.status.event.selection = 0; + if (keycode == 37 || keycode == 39) { + core.status.event.selection = 1 - core.status.event.selection; + core.playSound('光标移动'); core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); return; } - - if (keycode == 39) { - core.status.event.selection = 1; - core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); - return; - } - if (keycode == 13 || keycode == 32 || keycode == 67) { if (core.status.event.selection == 0 && core.status.event.data.yes) { core.status.event.selection = null; @@ -999,13 +998,19 @@ actions.prototype._keyUpConfirmBox = function (keycode) { actions.prototype._onMoveConfirmBox = function (x, y) { if (y == this.HSIZE + 1) { if (x == this.HSIZE - 2 || x == this.HSIZE - 1) { - core.status.event.selection = 0; - core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); + if (core.status.event.selection != 0) { + core.status.event.selection = 0; + core.playSound('光标移动'); + core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); + } return; } if (x == this.HSIZE + 2 || x == this.HSIZE + 1) { - core.status.event.selection = 1; - core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); + if (core.status.event.selection != 1) { + core.status.event.selection = 1; + core.playSound('光标移动'); + core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no); + } return; } } @@ -1039,6 +1044,7 @@ actions.prototype._clickAction = function (x, y) { if (y >= topIndex && y < topIndex + choices.length) { var choice = choices[y - topIndex]; if (choice.need != null && choice.need != '' && !core.calValue(choice.need)) { + core.playSound('操作失败'); core.drawTip("无法选择此项"); return; } @@ -1085,6 +1091,7 @@ actions.prototype._keyDownAction = function (keycode) { } if (core.status.event.data.type == 'confirm' && (keycode == 37 || keycode == 39)) { core.status.event.selection = 1 - core.status.event.selection; + core.playSound('光标移动'); core.drawConfirmBox(core.status.event.ui.text); return; } @@ -1143,16 +1150,19 @@ actions.prototype._clickBook = function (x, y) { var pageinfo = core.ui._drawBook_pageinfo(); // 上一页 if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) { + core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - pageinfo.per_page); return; } // 下一页 if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) { + core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + pageinfo.per_page); return; } // 返回 if (x >= this.LAST-2 && y == this.LAST) { + core.playSound('取消'); if (core.events.recoverEvents(core.status.event.interval)) { return; } @@ -1184,18 +1194,19 @@ actions.prototype._clickBook = function (x, y) { ////// 怪物手册界面时,按下某个键的操作 ////// actions.prototype._keyDownBook = function (keycode) { var pageinfo = core.ui._drawBook_pageinfo(); - if (keycode == 37) core.ui.drawBook(core.status.event.data - pageinfo.per_page); - if (keycode == 38) core.ui.drawBook(core.status.event.data - 1); - if (keycode == 39) core.ui.drawBook(core.status.event.data + pageinfo.per_page); - if (keycode == 40) core.ui.drawBook(core.status.event.data + 1); - if (keycode == 33) core.ui.drawBook(core.status.event.data - pageinfo.per_page); - if (keycode == 34) core.ui.drawBook(core.status.event.data + pageinfo.per_page); + if (keycode == 37) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - pageinfo.per_page); } + if (keycode == 38) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - 1); } + if (keycode == 39) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + pageinfo.per_page); } + if (keycode == 40) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + 1); } + if (keycode == 33) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - pageinfo.per_page); } + if (keycode == 34) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + pageinfo.per_page); } return; } ////// 怪物手册界面时,放开某个键的操作 ////// actions.prototype._keyUpBook = function (keycode) { if (keycode == 27 || keycode == 88) { + core.playSound('取消'); if (core.events.recoverEvents(core.status.event.interval)) { return; } @@ -1218,16 +1229,17 @@ actions.prototype._keyUpBook = function (keycode) { ////// 怪物手册属性显示界面时的点击操作 ////// actions.prototype._clickBookDetail = function () { core.clearMap('data'); + core.playSound('取消'); core.status.event.id = 'book'; } ////// 楼层传送器界面时的点击操作 ////// actions.prototype._clickFly = function (x, y) { - if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+3) core.ui.drawFly(this._getNextFlyFloor(-1)); - if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-1) core.ui.drawFly(this._getNextFlyFloor(1)); - if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+4) core.ui.drawFly(this._getNextFlyFloor(-10)); - if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-2) core.ui.drawFly(this._getNextFlyFloor(10)); - if (x >= this.HSIZE-1 && x <= this.HSIZE+1 && y == this.LAST) core.ui.closePanel(); + if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+3) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-1)); } + if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-1) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(1)); } + if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+4) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-10)); } + if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-2) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(10)); } + if (x >= this.HSIZE-1 && x <= this.HSIZE+1 && y == this.LAST) { core.playSound('取消'); core.ui.closePanel(); } if (x >= 0 && x <= this.HSIZE+3 && y >= 3 && y <= this.LAST - 1) core.flyTo(core.floorIds[core.status.event.data]); return; @@ -1235,10 +1247,10 @@ actions.prototype._clickFly = function (x, y) { ////// 楼层传送器界面时,按下某个键的操作 ////// actions.prototype._keyDownFly = function (keycode) { - 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)); + if (keycode == 37) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-10)); } + else if (keycode == 38) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(1)); } + else if (keycode == 39) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(10)); } + else if (keycode == 40) { core.playSound('光标移动'); core.ui.drawFly(this._getNextFlyFloor(-1)); } return; } @@ -1263,8 +1275,10 @@ actions.prototype._getNextFlyFloor = function (delta, index) { ////// 楼层传送器界面时,放开某个键的操作 ////// actions.prototype._keyUpFly = function (keycode) { - if (keycode == 71 || keycode == 27 || keycode == 88) + if (keycode == 71 || keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); + } if (keycode == 13 || keycode == 32 || keycode == 67) this._clickFly(this.HSIZE-1, this.HSIZE-1); return; @@ -1284,39 +1298,47 @@ actions.prototype._clickViewMaps = function (x, y) { if (x <= per - 2 && y <= per - 2) { core.status.event.data.damage = !core.status.event.data.damage; + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx, cy); return; } if (x <= per - 2 && y >= this.SIZE + 1 - per) { if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId]; else core.markedFloorIds[floorId] = true; + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx, cy); return; } if (x >= this.SIZE + 1 - per && y <= per - 2) { core.status.event.data.all = !core.status.event.data.all; + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx, cy); return; } if (x >= per && x <= this.LAST - per && y <= per - 1 && (!core.status.event.data.all && mh > this.SIZE)) { + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx, cy - 1); return; } if (x >= per && x <= this.LAST - per && y >= this.SIZE - per && (!core.status.event.data.all && mh > this.SIZE)) { + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx, cy + 1); return; } if (x <= per - 1 && y >= per && y <= this.LAST - per) { + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx - 1, cy); return; } if (x >= this.SIZE - per && y >= per && y <= this.LAST - per) { + core.playSound('光标移动'); core.ui._drawViewMaps(index, cx + 1, cy); return; } if (y <= this.HSIZE - 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) { + core.playSound('光标移动'); index++; while (index < core.floorIds.length && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) index++; @@ -1325,6 +1347,7 @@ actions.prototype._clickViewMaps = function (x, y) { return; } if (y >= this.HSIZE + 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) { + core.playSound('光标移动'); index--; while (index >= 0 && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) index--; @@ -1334,6 +1357,7 @@ actions.prototype._clickViewMaps = function (x, y) { } if (x >= per && x <= this.LAST - per && y >= this.HSIZE - 1 && y <= this.HSIZE + 1) { core.clearMap('data'); + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1364,22 +1388,26 @@ actions.prototype._keyUpViewMaps = function (keycode) { if (keycode == 27 || keycode == 13 || keycode == 32 || (!core.isReplaying() && keycode == 67)) { core.clearMap('data'); + core.playSound('取消'); core.ui.closePanel(); return; } if (keycode == 86) { core.status.event.data.damage = !core.status.event.data.damage; + core.playSound('光标移动'); core.ui._drawViewMaps(core.status.event.data); return; } if (keycode == 90) { core.status.event.data.all = !core.status.event.data.all; + core.playSound('光标移动'); core.ui._drawViewMaps(core.status.event.data); return; } if (keycode == 66) { if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId]; else core.markedFloorIds[floorId] = true; + core.playSound('光标移动'); core.ui._drawViewMaps(core.status.event.data); return; } @@ -1403,6 +1431,7 @@ actions.prototype._clickQuickShop = function (x, y) { if (y >= topIndex && y < topIndex + shopIds.length) { var shopId = shopIds[y - topIndex]; if (!core.canOpenShop(shopId)) { + core.playSound('操作失败'); core.drawTip('当前项尚未开启'); return; } @@ -1411,12 +1440,15 @@ actions.prototype._clickQuickShop = function (x, y) { // core.ui.closePanel(); core.openShop(shopIds[y - topIndex], false); } else { + core.playSound('操作失败'); core.drawTip(message); } } // 离开 - else if (y == topIndex + shopIds.length) + else if (y == topIndex + shopIds.length) { + core.playSound('取消'); core.ui.closePanel(); + } return; } return; @@ -1425,6 +1457,7 @@ actions.prototype._clickQuickShop = function (x, y) { ////// 快捷商店界面时,放开某个键的操作 ////// actions.prototype._keyUpQuickShop = function (keycode) { if (keycode == 27 || keycode == 75 || keycode == 88 || keycode == 86) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1447,6 +1480,7 @@ actions.prototype._clickToolbox = function (x, y) { return; } if (x >= this.LAST - 2 && y == this.LAST) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1457,10 +1491,12 @@ actions.prototype._clickToolbox = function (x, y) { if (x == this.HSIZE-2 || x == this.HSIZE-3) { if (y == this.LAST - 5 && toolsPage > 1) { core.status.event.data.toolsPage--; + core.playSound('光标移动'); core.ui._drawToolbox(core.status.event.selection); } if (y == this.LAST && constantsPage > 1) { core.status.event.data.constantsPage--; + core.playSound('光标移动'); core.ui._drawToolbox(core.status.event.selection); } } @@ -1468,10 +1504,12 @@ actions.prototype._clickToolbox = function (x, y) { if (x == this.HSIZE+2 || x == this.HSIZE+3) { if (y == this.LAST - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) { core.status.event.data.toolsPage++; + core.playSound('光标移动'); core.ui._drawToolbox(core.status.event.selection); } if (y == this.LAST && constantsPage < Math.ceil(constants.length / this.LAST)) { core.status.event.data.constantsPage++; + core.playSound('光标移动'); core.ui._drawToolbox(core.status.event.selection); } } @@ -1533,6 +1571,7 @@ actions.prototype._keyDownToolbox = function (keycode) { if (index == 0) { // 处理向前翻页 if (toolsPage > 1) { core.status.event.data.toolsPage--; + core.playSound('光标移动'); index = last_index; } else return; // 第一页不向前翻 @@ -1545,6 +1584,7 @@ actions.prototype._keyDownToolbox = function (keycode) { } else { core.status.event.data.constantsPage--; + core.playSound('光标移动'); index = 2 * this.LAST - 1; } } @@ -1566,10 +1606,12 @@ actions.prototype._keyDownToolbox = function (keycode) { if (keycode == 39) { // right if (toolsPage < toolsTotalPage && index == last_index) { core.status.event.data.toolsPage++; + core.playSound('光标移动'); index = 0; } else if (constantsPage < constantsTotalPage && index == 2 * this.LAST - 1) { core.status.event.data.constantsPage++; + core.playSound('光标移动'); index = this.LAST; } else if (index == toolsLastIndex) { @@ -1615,6 +1657,7 @@ actions.prototype._keyUpToolbox = function (keycode) { return; } if (keycode == 84 || keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1639,6 +1682,7 @@ actions.prototype._clickEquipbox = function (x, y) { } // 返回 if (x >= this.LAST - 2 && y == this.LAST) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1647,6 +1691,7 @@ actions.prototype._clickEquipbox = function (x, y) { if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) { if (core.status.event.data.page > 1) { core.status.event.data.page--; + core.playSound('光标移动'); core.ui._drawEquipbox(core.status.event.selection); } return; @@ -1656,6 +1701,7 @@ actions.prototype._clickEquipbox = function (x, y) { var lastPage = Math.ceil(core.getToolboxItems('equips').length / this.LAST); if (core.status.event.data.page < lastPage) { core.status.event.data.page++; + core.playSound('光标移动'); core.ui._drawEquipbox(core.status.event.selection); } return; @@ -1718,6 +1764,7 @@ actions.prototype._keyDownEquipbox = function (keycode) { if (index == this.LAST) { if (page > 1) { core.status.event.data.page--; + core.playSound('光标移动'); index = this.LAST + last_index; } else if (page == 1) @@ -1743,6 +1790,7 @@ actions.prototype._keyDownEquipbox = function (keycode) { if (keycode == 39) { // right if (page < totalPage && index == this.LAST + last_index) { core.status.event.data.page++; + core.playSound('光标移动'); index = this.LAST; } else if (index == equipCapacity - 1) { @@ -1790,6 +1838,7 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) { return; } if (keycode == 81 || keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -1808,16 +1857,19 @@ actions.prototype._clickSL = function (x, y) { // 上一页 if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) { + core.playSound('光标移动'); core.ui._drawSLPanel(10 * (page - 1) + offset); return; } // 下一页 if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) { + core.playSound('光标移动'); core.ui._drawSLPanel(10 * (page + 1) + offset); return; } // 返回 if (x >= this.LAST-2 && y == this.LAST) { + core.playSound('取消'); if (core.events.recoverEvents(core.status.event.interval)) return; core.ui.closePanel(); @@ -1870,9 +1922,10 @@ actions.prototype._clickSL = function (x, y) { } if (id != null) { if (core.status.event.selection) { - if (id == 'autoSave') + if (id == 'autoSave') { + core.playSound('操作失败'); core.drawTip("无法删除自动存档!"); - else { + } else { core.removeSave(id, function () { core.ui._drawSLPanel(index, true); }); @@ -1909,6 +1962,7 @@ actions.prototype._clickSL_favorite = function (page, offset) { else if (core.hasSave(index)) { // 存在存档则进行收藏 core.saves.favorite.push(index); core.saves.favorite = core.saves.favorite.sort(function (a,b) {return a-b;}); // 保证有序 + core.playSound('确定'); core.drawTip("收藏成功!"); } core.control._updateFavoriteSaves(); @@ -1924,6 +1978,7 @@ actions.prototype._keyDownSL = function (keycode) { var index = page*10 + offset; if (keycode == 37) { // left + core.playSound('光标移动'); if (offset == 0) { core.ui._drawSLPanel(10 * (page - 1) + 5); } @@ -1933,6 +1988,7 @@ actions.prototype._keyDownSL = function (keycode) { return; } if (keycode == 38) { // up + core.playSound('光标移动'); if (offset < 3) { core.ui._drawSLPanel(10 * (page - 1) + offset + 3); } @@ -1942,6 +1998,7 @@ actions.prototype._keyDownSL = function (keycode) { return; } if (keycode == 39) { // right + core.playSound('光标移动'); if (offset == 5) { core.ui._drawSLPanel(10 * (page + 1) + 1); } @@ -1951,6 +2008,7 @@ actions.prototype._keyDownSL = function (keycode) { return; } if (keycode == 40) { // down + core.playSound('光标移动'); if (offset >= 3) { core.ui._drawSLPanel(10 * (page + 1) + offset - 3); } @@ -1960,10 +2018,12 @@ actions.prototype._keyDownSL = function (keycode) { return; } if (keycode == 33) { // PAGEUP + core.playSound('光标移动'); core.ui._drawSLPanel(10 * (page - 1) + offset); return; } if (keycode == 34) { // PAGEDOWN + core.playSound('光标移动'); core.ui._drawSLPanel(10 * (page + 1) + offset); return; } @@ -2000,6 +2060,7 @@ actions.prototype._keyUpSL = function (keycode) { } if (keycode == 46) { if (offset == 0) { + core.playSound('操作失败'); core.drawTip("无法删除自动存档!"); } else { @@ -2027,15 +2088,19 @@ actions.prototype._clickSwitchs = function (x, y) { switch (selection) { case 0: core.status.event.selection = 0; + core.playSound('确定'); return core.ui._drawSwitchs_sounds(); case 1: core.status.event.selection = 0; + core.playSound('确定'); return core.ui._drawSwitchs_display(); case 2: core.status.event.selection = 0; + core.playSound('确定'); return core.ui._drawSwitchs_action(); case 3: core.status.event.selection = 0; + core.playSound('取消'); return core.ui._drawSettings(); } } @@ -2045,6 +2110,7 @@ actions.prototype._clickSwitchs = function (x, y) { actions.prototype._keyUpSwitchs = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSettings(); return; } @@ -2074,6 +2140,7 @@ actions.prototype._clickSwitchs_sounds = function (x, y) { return; case 3: core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSwitchs(); return; } @@ -2082,12 +2149,14 @@ actions.prototype._clickSwitchs_sounds = function (x, y) { actions.prototype._clickSwitchs_sounds_bgm = function () { core.triggerBgm(); + core.playSound('确定'); core.ui._drawSwitchs_sounds(); } actions.prototype._clickSwitchs_sounds_se = function () { core.musicStatus.soundStatus = !core.musicStatus.soundStatus; core.setLocalStorage('soundStatus', core.musicStatus.soundStatus); + core.playSound('确定'); core.ui._drawSwitchs_sounds(); } @@ -2099,22 +2168,24 @@ actions.prototype._clickSwitchs_sounds_userVolume = function (delta) { if (core.musicStatus.gainNode != null) core.musicStatus.gainNode.gain.value = core.musicStatus.userVolume; if (core.musicStatus.playingBgm) core.material.bgms[core.musicStatus.playingBgm].volume = core.musicStatus.userVolume * core.musicStatus.designVolume; core.setLocalStorage('userVolume', core.musicStatus.userVolume); + core.playSound('确定'); core.ui._drawSwitchs_sounds(); } actions.prototype._keyUpSwitchs_sounds = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSwitchs(); return; } if (keycode == 37) { switch (core.status.event.selection) { - case 2: return this._clickSwitchs_sounds_userVolume(-1); + case 2: core.playSound('确定'); return this._clickSwitchs_sounds_userVolume(-1); } } else if (keycode == 39) { switch (core.status.event.selection) { - case 2: return this._clickSwitchs_sounds_userVolume(1); + case 2: core.playSound('确定'); return this._clickSwitchs_sounds_userVolume(1); } } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs_sounds); @@ -2138,17 +2209,23 @@ actions.prototype._clickSwitchs_display = function (x, y) { if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_display_setSize(1); return; case 1: + core.playSound('确定'); return this._clickSwitchs_display_enableHDCanvas(); case 2: + core.playSound('确定'); return this._clickSwitchs_display_enemyDamage(); case 3: + core.playSound('确定'); return this._clickSwitchs_display_critical(); case 4: + core.playSound('确定'); return this._clickSwitchs_display_extraDamage(); case 5: + core.playSound('确定'); return this._clickSwitchs_display_extraDamageType(); case 6: core.status.event.selection = 1; + core.playSound('取消'); core.ui._drawSwitchs(); return; } @@ -2208,16 +2285,17 @@ actions.prototype._clickSwitchs_display_extraDamageType = function () { actions.prototype._keyUpSwitchs_display = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSwitchs(); return; } if (keycode == 37) { switch (core.status.event.selection) { - case 0: return this._clickSwitchs_display_setSize(-1); + case 0: core.playSound('确定'); return this._clickSwitchs_display_setSize(-1); } } else if (keycode == 39) { switch (core.status.event.selection) { - case 0: return this._clickSwitchs_display_setSize(1); + case 0: core.playSound('确定'); return this._clickSwitchs_display_setSize(1); } } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs_display); @@ -2237,20 +2315,24 @@ actions.prototype._clickSwitchs_action = function (x, y) { core.status.event.selection = selection; switch (selection) { case 0: - if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_action_moveSpeed(-10); - if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_action_moveSpeed(10); + if (x == leftGrid || x == leftGrid + 1) { core.playSound('确定'); return this._clickSwitchs_action_moveSpeed(-10); } + if (x == rightGrid || x == rightGrid + 1) { core.playSound('确定'); return this._clickSwitchs_action_moveSpeed(10); } return; case 1: - if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_action_floorChangeTime(-100); - if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_action_floorChangeTime(100); + if (x == leftGrid || x == leftGrid + 1) { core.playSound('确定'); return this._clickSwitchs_action_floorChangeTime(-100); } + if (x == rightGrid || x == rightGrid + 1) { core.playSound('确定'); return this._clickSwitchs_action_floorChangeTime(100); } case 2: + core.playSound('确定'); return this._clickSwitchs_action_potionNoRouting(); case 3: + core.playSound('确定'); return this._clickSwitchs_action_clickMove(); case 4: + core.playSound('确定'); return this._clickSwitchs_action_leftHandPrefer(); case 5: core.status.event.selection = 2; + core.playSound('取消'); core.ui._drawSwitchs(); return; } @@ -2293,18 +2375,19 @@ actions.prototype._clickSwitchs_action_leftHandPrefer = function () { actions.prototype._keyUpSwitchs_action = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSwitchs(); return; } if (keycode == 37) { switch (core.status.event.selection) { - case 0: return this._clickSwitchs_action_moveSpeed(-10); - case 1: return this._clickSwitchs_action_floorChangeTime(-100); + case 0: core.playSound('确定'); return this._clickSwitchs_action_moveSpeed(-10); + case 1: core.playSound('确定'); return this._clickSwitchs_action_floorChangeTime(-100); } } else if (keycode == 39) { switch (core.status.event.selection) { - case 0: return this._clickSwitchs_action_moveSpeed(10); - case 1: return this._clickSwitchs_action_floorChangeTime(100); + case 0: core.playSound('确定'); return this._clickSwitchs_action_moveSpeed(10); + case 1: core.playSound('确定'); return this._clickSwitchs_action_floorChangeTime(100); } } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs_action); @@ -2321,30 +2404,37 @@ actions.prototype._clickSettings = function (x, y) { switch (selection) { case 0: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawSwitchs(); break; case 1: + core.playSound('确定'); core.ui._drawKeyBoard(); break; case 2: + core.playSound('确定'); core.clearUI(); core.ui._drawViewMaps(); break; case 3: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawNotes(); break; case 4: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawSyncSave(); break; case 5: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawGameInfo(); break; case 6: return core.confirmRestart(); case 7: + core.playSound('取消'); core.ui.closePanel(); break; } @@ -2355,6 +2445,7 @@ actions.prototype._clickSettings = function (x, y) { ////// 系统菜单栏界面时,放开某个键的操作 ////// actions.prototype._keyUpSettings = function (keycode) { if (keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -2372,12 +2463,15 @@ actions.prototype._clickNotes = function (x, y) { core.status.event.selection = selection; switch (selection) { case 0: + core.playSound('确定'); this._clickNotes_new(); break; case 1: + core.playSound('确定'); this._clickNotes_show(); break; case 2: + core.playSound('确定'); this._clickNotes_edit(); break; case 3: @@ -2385,6 +2479,7 @@ actions.prototype._clickNotes = function (x, y) { break; case 4: core.status.event.selection = 3; + core.playSound('取消'); core.ui._drawSettings(); break; } @@ -2456,6 +2551,7 @@ actions.prototype._clickNotes_edit = function () { actions.prototype._clickNotes_delete = function () { core.status.hero.notes = core.status.hero.notes || []; if (core.status.hero.notes.length == 0) { + core.playSound('操作失败'); core.drawText("当前没有存档笔记,无法删除!"); } else { core.myprompt("请输入要删除的所有存档笔记编号,以逗号分隔。不填则代表删除全部笔记。", null, function (data) { @@ -2487,6 +2583,7 @@ actions.prototype._clickNotes_delete = function () { actions.prototype._keyUpNotes = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 3; + core.playSound('取消'); core.ui._drawSettings(); return; } @@ -2504,25 +2601,32 @@ actions.prototype._clickSyncSave = function (x, y) { switch (selection) { case 0: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawSyncSelect(); break; case 1: + core.playSound('确定'); core.syncLoad(); break; case 2: + core.playSound('确定'); core.status.event.selection = 0; core.ui._drawLocalSaveSelect(); break; case 3: + core.playSound('确定'); return this._clickSyncSave_readFile(); case 4: + core.playSound('确定'); return this._clickSyncSave_replay(); case 5: core.status.event.selection = 0; + core.playSound('确定'); core.ui._drawStorageRemove(); break; case 6: core.status.event.selection = 4; + core.playSound('取消'); core.ui._drawSettings(); break; @@ -2547,7 +2651,8 @@ actions.prototype._clickSyncSave_replay = function () { ////// 同步存档界面时,放开某个键的操作 ////// actions.prototype._keyUpSyncSave = function (keycode) { if (keycode == 27 || keycode == 88) { - core.status.event.selection = 2; + core.status.event.selection = 4; + core.playSound('取消'); core.ui._drawSettings(); return; } @@ -2565,15 +2670,18 @@ actions.prototype._clickSyncSelect = function (x, y) { core.status.event.selection = selection; switch (selection) { case 0: + core.playSound('确定'); core.myconfirm('你确定要同步全部存档么?\n这可能在存档较多的时候比较慢。', function () { core.syncSave('all'); }); break; case 1: + core.playSound('确定'); core.syncSave(); break; case 2: core.status.event.selection = 0; + core.playSound('取消'); core.ui._drawSyncSave(); break; } @@ -2584,7 +2692,8 @@ actions.prototype._clickSyncSelect = function (x, y) { actions.prototype._keyUpSyncSelect = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 0; - core.ui._drawSettings(); + core.playSound('取消'); + core.ui._drawSyncSave(); return; } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSyncSelect); @@ -2616,6 +2725,7 @@ actions.prototype._clickLocalSaveSelect = function (x, y) { } core.status.event.selection = 2; + core.playSound('取消'); core.ui._drawSyncSave(); } } @@ -2623,8 +2733,9 @@ actions.prototype._clickLocalSaveSelect = function (x, y) { ////// 存档下载界面时,放开某个键的操作 ////// actions.prototype._keyUpLocalSaveSelect = function (keycode) { if (keycode == 27 || keycode == 88) { - core.status.event.selection = 0; - core.ui._drawSettings(); + core.status.event.selection = 2; + core.playSound('取消'); + core.ui._drawSyncSave(); return; } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickLocalSaveSelect); @@ -2647,6 +2758,7 @@ actions.prototype._clickStorageRemove = function (x, y) { return this._clickStorageRemove_current(); case 2: core.status.event.selection = 6; + core.playSound('取消'); core.ui._drawSyncSave(); break; } @@ -2654,7 +2766,7 @@ actions.prototype._clickStorageRemove = function (x, y) { } actions.prototype._clickStorageRemove_all = function () { - core.myconfirm("你确定要清除【全部塔】的所有本地存档?\n此行为不可逆!!!", function () { + core.myconfirm("你确定要清除【全部游戏】的所有本地存档?\n此行为不可逆!!!", function () { var done = function () { core.saves.ids = {}; core.saves.autosave.data = null; @@ -2680,7 +2792,7 @@ actions.prototype._clickStorageRemove_all = function () { } actions.prototype._clickStorageRemove_current = function () { - core.myconfirm("你确定要清除本塔的所有本地存档?\n此行为不可逆!!!", function () { + core.myconfirm("你确定要清除本游戏的所有本地存档?\n此行为不可逆!!!", function () { var done = function () { core.saves.ids = {}; core.saves.autosave.data = null; @@ -2715,6 +2827,7 @@ actions.prototype._clickStorageRemove_current = function () { actions.prototype._keyUpStorageRemove = function (keycode) { if (keycode == 27 || keycode == 88) { core.status.event.selection = 5; + core.playSound('取消'); core.ui._drawSyncSave(); return; } @@ -2732,12 +2845,12 @@ actions.prototype._clickReplay = function (x, y) { var selection = y - topIndex; core.status.event.selection = selection; switch (selection) { - case 0: return this._clickReplay_fromBeginning(); - case 1: return this._clickReplay_fromLoad(); - case 2: return this._clickReplay_replayRemain(); - case 3: return core.chooseReplayFile(); - case 4: return this._clickReplay_download(); - case 5: return core.ui.closePanel(); + case 0: core.playSound('确定'); return this._clickReplay_fromBeginning(); + case 1: core.playSound('确定'); return this._clickReplay_fromLoad(); + case 2: core.playSound('确定'); return this._clickReplay_replayRemain(); + case 3: core.playSound('确定'); return core.chooseReplayFile(); + case 4: core.playSound('确定'); return this._clickReplay_download(); + case 5: core.playSound('取消'); return core.ui.closePanel(); } } } @@ -2786,6 +2899,7 @@ actions.prototype._clickReplay_download = function () { ////// 回放选择界面时,放开某个键的操作 ////// actions.prototype._keyUpReplay = function (keycode) { if (keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); return; } @@ -2811,6 +2925,7 @@ actions.prototype._clickGameInfo = function (x, y) { case 5: return this._clickGameInfo_download(); case 6: core.status.event.selection = 5; + core.playSound('取消'); core.ui._drawSettings(); break; } @@ -2821,7 +2936,7 @@ actions.prototype._clickGameInfo_openProject = function () { if (core.platform.isPC) window.open("editor.html", "_blank"); else { - core.myconfirm("即将离开本塔,跳转至本塔工程页面,确认?", function () { + core.myconfirm("即将离开本游戏,跳转至工程页面,确认?", function () { window.location.href = "editor-mobile.html"; }); } @@ -2829,11 +2944,11 @@ actions.prototype._clickGameInfo_openProject = function () { actions.prototype._clickGameInfo_openComments = function () { if (core.platform.isPC) { - window.open("/score.php?name=" + core.firstData.name + "&num=10", "_blank"); + window.open("/score.php?name=" + core.firstData.name, "_blank"); } else { - core.myconfirm("即将离开本塔,跳转至本塔评论页面,确认?", function () { - window.location.href = "/score.php?name=" + core.firstData.name + "&num=10"; + core.myconfirm("即将离开本游戏,跳转至评论页面,确认?", function () { + window.location.href = "/score.php?name=" + core.firstData.name; }); } } @@ -2848,8 +2963,9 @@ actions.prototype._clickGameInfo_download = function () { ////// 游戏信息界面时,放开某个键的操作 ////// actions.prototype._keyUpGameInfo = function (keycode) { if (keycode == 27 || keycode == 88) { - core.ui.closePanel(); - return; + core.status.event.selection = 5; + core.playSound('取消'); + return core.ui._drawSettings(); } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickGameInfo); } @@ -2861,6 +2977,7 @@ actions.prototype._clickKeyBoard = function (x, y) { core.ui.closePanel(); core.keyUp(112 + x + 5 - m); } + /* if (y == m - 3 && x == m + 6) { var val = prompt(); if (val != null) { @@ -2871,6 +2988,7 @@ actions.prototype._clickKeyBoard = function (x, y) { } } } + */ if (y == m - 2 && x >= m - 5 && x <= m + 4) { core.ui.closePanel(); core.keyUp(x == m + 4 ? 48 : 49 + x + 5 - m); // 1-9: 49-57; 0: 48 @@ -2940,21 +3058,25 @@ actions.prototype._clickCursor = function (x, y) { actions.prototype._keyDownCursor = function (keycode) { if (keycode == 37) { // left core.status.automaticRoute.cursorX--; + core.playSound('确定'); core.ui._drawCursor(); return; } if (keycode == 38) { // up core.status.automaticRoute.cursorY--; + core.playSound('确定'); core.ui._drawCursor(); return; } if (keycode == 39) { // right core.status.automaticRoute.cursorX++; + core.playSound('确定'); core.ui._drawCursor(); return; } if (keycode == 40) { // down core.status.automaticRoute.cursorY++; + core.playSound('确定'); core.ui._drawCursor(); return; } @@ -2963,10 +3085,12 @@ actions.prototype._keyDownCursor = function (keycode) { ////// 光标界面时,放开某个键的操作 ////// actions.prototype._keyUpCursor = function (keycode) { if (keycode == 27 || keycode == 88) { + core.playSound('取消'); core.ui.closePanel(); return; } if (keycode == 13 || keycode == 32 || keycode == 67 || keycode == 69) { + core.playSound('确定'); core.ui.closePanel(); core.onclick(core.status.automaticRoute.cursorX, core.status.automaticRoute.cursorY, []); return; diff --git a/libs/control.js b/libs/control.js index 7c2db1a5..8d25ef3b 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1310,8 +1310,10 @@ control.prototype.pauseReplay = function () { ////// 恢复播放 ////// control.prototype.resumeReplay = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); + } core.status.replay.pausing = false; core.updateStatusBar(); core.drawTip("恢复播放"); @@ -1321,9 +1323,14 @@ control.prototype.resumeReplay = function () { ////// 单步播放 ////// control.prototype.stepReplay = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); + } core.replay(true); } @@ -1379,11 +1386,18 @@ control.prototype.stopReplay = function (force) { ////// 回退 ////// control.prototype.rewindReplay = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); - if (core.status.replay.save.length==0) + } + if (core.status.replay.save.length==0) { + core.playSound('操作失败'); return core.drawTip("无法再回到上一个节点"); + } var save = core.status.replay.save, data = save.pop(); core.loadData(data.data, function () { core.removeFlag('__fromLoad__'); @@ -1408,10 +1422,18 @@ control.prototype.rewindReplay = function () { ////// 回放时存档 ////// control.prototype._replay_SL = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); - if (core.hasFlag('__forbidSave__')) return core.drawTip('当前禁止存档'); + } + if (core.hasFlag('__forbidSave__')) { + core.playSound('操作失败'); + return core.drawTip('当前禁止存档'); + } this._replay_hideProgress(); core.lockControl(); @@ -1425,11 +1447,18 @@ control.prototype._replay_SL = function () { ////// 回放时查看怪物手册 ////// control.prototype._replay_book = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate - || (core.status.event.id && core.status.event.id != 'viewMaps')) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || (core.status.event.id && core.status.event.id != 'viewMaps')) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); - if (!core.hasItem('book')) return core.drawTip('你没有'+core.material.items['book'].name); + } + if (!core.hasItem('book')) { + core.playSound('操作失败'); + return core.drawTip('你没有'+core.material.items['book'].name, 'book'); + } this._replay_hideProgress(); // 从“浏览地图”页面打开 @@ -1444,9 +1473,14 @@ control.prototype._replay_book = function () { ////// 回放录像时浏览地图 ////// control.prototype._replay_viewMap = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); + } this._replay_hideProgress(); core.lockControl(); @@ -1456,9 +1490,14 @@ control.prototype._replay_viewMap = function () { control.prototype._replay_toolbox = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); + } this._replay_hideProgress(); core.lockControl(); @@ -1468,9 +1507,14 @@ control.prototype._replay_toolbox = function () { control.prototype._replay_equipbox = function () { if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) + if (!core.status.replay.pausing) { + core.playSound('操作失败'); + return core.drawTip("请先暂停录像"); + } + if (core.isMoving() || core.status.replay.animate || core.status.event.id) { + core.playSound('操作失败'); return core.drawTip("请等待当前事件的处理结束"); + } this._replay_hideProgress(); core.lockControl(); @@ -1574,6 +1618,7 @@ control.prototype._replay_error = function (action) { core.rewindReplay(); } else { + core.playSound('操作失败'); core.drawTip("无法回到上一个节点"); core.stopReplay(true); } @@ -1841,7 +1886,10 @@ control.prototype.doSL = function (id, type) { } control.prototype._doSL_save = function (id) { - if (id=='autoSave') return core.drawTip('不能覆盖自动存档!'); + if (id=='autoSave') { + core.playSound('操作失败'); + return core.drawTip('不能覆盖自动存档!'); + } // 在事件中的存档 if (core.status.event.interval != null) core.setFlag("__events__", core.status.event.interval); @@ -1851,6 +1899,7 @@ control.prototype._doSL_save = function (id) { // 恢复事件 if (!core.events.recoverEvents(core.status.event.interval)) core.ui.closePanel(); + core.playSound('存档'); core.drawTip('存档成功!'); }, function(err) { main.log(err); @@ -1932,14 +1981,27 @@ control.prototype._doSL_load_afterGet = function (id, data) { } control.prototype._doSL_replayLoad_afterGet = function (id, data) { - if (!data) return core.drawTip("无效的存档"); - if (data.version != core.firstData.version) return core.drawTip("存档版本不匹配"); - if (data.hard != core.status.hard) return core.drawTip("游戏难度不匹配!"); - if (data.hero.flags.__events__ && data.guid != core.getGuid()) + if (!data) { + core.playSound('操作失败'); + return core.drawTip("无效的存档"); + } + if (data.version != core.firstData.version) { + core.playSound('操作失败'); + return core.drawTip("存档版本不匹配"); + } + if (data.hard != core.status.hard) { + core.playSound('操作失败'); + return core.drawTip("游戏难度不匹配!"); + } + if (data.hero.flags.__events__ && data.guid != core.getGuid()) { + core.playSound('操作失败'); return core.drawTip("此存档可能存在风险,无法读档"); + } var route = core.subarray(core.status.route, core.decodeRoute(data.route)); - if (route == null || data.hero.flags.__seed__ != core.getFlag('__seed__')) - return core.drawTip("无法从此存档回放录像"); + if (route == null || data.hero.flags.__seed__ != core.getFlag('__seed__')) { + core.playSound('操作失败'); + return core.drawTip("种子不一致,无法从此存档回放录像"); + } core.loadData(data, function () { core.removeFlag('__fromLoad__'); core.startReplay(route); @@ -1949,8 +2011,10 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) { } control.prototype._doSL_replayRemain_afterGet = function (id, data) { - if (!data) return core.drawTip("无效的存档"); - + if (!data) { + core.playSound('操作失败'); + return core.drawTip("无效的存档"); + } var route = core.decodeRoute(data.route); if (core.status.tempRoute) { var remainRoute = core.subarray(route, core.status.tempRoute); @@ -2185,6 +2249,7 @@ control.prototype.removeSave = function (index, callback) { core.control._updateFavoriteSaves(); if (callback) callback(); }, function () { + core.playSound('操作失败'); core.drawTip("无法删除存档!"); if (callback) callback(); }); diff --git a/libs/events.js b/libs/events.js index 808e14bb..c0dc4a76 100644 --- a/libs/events.js +++ b/libs/events.js @@ -252,13 +252,13 @@ events.prototype._gameOver_askRate = function (ending) { return; } - core.ui.drawConfirmBox("恭喜通关本塔,你想进行评分吗?", function () { + core.ui.drawConfirmBox("恭喜通关!你想进行评分吗?", function () { if (core.platform.isPC) { - window.open("/score.php?name=" + core.firstData.name + "&num=10", "_blank"); + window.open("/score.php?name=" + core.firstData.name, "_blank"); core.restart(); } else { - window.location.href = "/score.php?name=" + core.firstData.name + "&num=10"; + window.location.href = "/score.php?name=" + core.firstData.name; } }, function () { core.restart(); @@ -273,11 +273,14 @@ events.prototype.restart = function() { ////// 询问是否需要重新开始 ////// events.prototype.confirmRestart = function () { + core.playSound('打开界面'); core.status.event.selection = 1; core.ui.drawConfirmBox("你确定要返回标题页面吗?", function () { + core.playSound('确定'); core.ui.closePanel(); core.restart(); }, function () { + core.playSound('取消'); core.ui.closePanel(); }); } @@ -410,7 +413,8 @@ events.prototype.battle = function (id, x, y, force, callback) { if (!id) return core.clearContinueAutomaticRoute(callback); // 非强制战斗 if (!core.enemys.canBattle(id, x, y) && !force && !core.status.event.id) { - core.drawTip("你打不过此怪物!"); + core.playSound('操作失败'); + core.drawTip("你打不过此怪物!", id); return core.clearContinueAutomaticRoute(callback); } // 自动存档 @@ -491,10 +495,14 @@ events.prototype._openDoor_check = function (id, x, y, needKey) { // --- 如果是一个不存在的道具,则直接认为无法开启 if (!core.material.items[keyName]) { + core.stopSound(); + core.playSound('操作失败'); core.drawTip("无法开启此门"); return clearAndReturn(); } if (core.itemCount(keyName) < keyValue) { + core.stopSound(); + core.playSound('操作失败'); core.drawTip("你的" + ((core.material.items[keyName] || {}).name || "钥匙") + "不足!", null, true); return false; } @@ -1616,6 +1624,7 @@ events.prototype._action_useItem = function (data, x, y, prefix) { core.useItem(data.id, true, core.doAction); } else { + core.playSound('操作失败'); core.drawTip("当前无法使用" + ((core.material.items[data.id] || {}).name || "未知道具")); core.doAction(); } @@ -1901,18 +1910,20 @@ events.prototype._action_choices = function (data, x, y, prefix) { } else { // 容错录像 if (main.replayChecking) { - core.control._replay_error(action); - return; - } - core.myprompt('录像回放出错!当前需要执行选择项但录像中未记录。\n如需修复请输入您要选的项(从0起),点击取消将不会修复。', 0, function (value) { - if (value == null) { - core.control._replay_error(action); - return; - } + // 录像验证系统中选择第一项 core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作 - value = core.clamp(parseInt(value), 0, data.choices.length - 1); - core.events.__action_choices_replaying(data, core.clamp(value, 0, data.choices.length - 1)) - }); + core.events.__action_choices_replaying(data, 0) + } else { + // 正常游戏中弹窗选择 + core.myprompt('录像回放出错!当前需要执行选择项但录像中未记录。\n如需修复请输入您要选的项(从0起),点击取消将不会修复。', 0, function (value) { + if (value == null) { + core.control._replay_error(action); + return; + } + core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作 + core.events.__action_choices_replaying(data, core.clamp(parseInt(value), 0, data.choices.length - 1)) + }); + } } } else { if (data.timeout) { @@ -2517,10 +2528,12 @@ events.prototype._checkStatus = function (name, fromUserAction, checkItem) { } if (fromUserAction && core.status.lockControl) return false; if (checkItem && !core.hasItem(name)) { - core.drawTip("你没有" + core.material.items[name].name); + core.playSound('操作失败'); + core.drawTip("你没有" + core.material.items[name].name, name); return false; } if (core.isMoving()) { + core.playSound('操作失败'); core.drawTip("请先停止勇士行动"); return false; } @@ -2547,6 +2560,7 @@ events.prototype.openBook = function (fromUserAction) { core.status.event.ui = core.status.event.data; } if (!this._checkStatus('book', fromUserAction, true)) return; + core.playSound('打开界面'); core.useItem('book', true); } @@ -2555,19 +2569,22 @@ events.prototype.useFly = function (fromUserAction) { if (core.isReplaying()) return; if (!this._checkStatus('fly', fromUserAction, true)) return; if (core.flags.flyNearStair && !core.nearStair()) { - core.drawTip("只有在楼梯边才能使用" + core.material.items['fly'].name); + core.playSound('操作失败'); + core.drawTip("只有在楼梯边才能使用" + core.material.items['fly'].name, 'fly'); core.unlockControl(); core.status.event.data = null; core.status.event.id = null; return; } if (!core.canUseItem('fly')) { - core.drawTip(core.material.items['fly'].name + "好像失效了"); + core.playSound('操作失败'); + core.drawTip(core.material.items['fly'].name + "好像失效了", 'fly'); core.unlockControl(); core.status.event.data = null; core.status.event.id = null; return; } + core.playSound('打开界面'); core.useItem('fly', true); return; } @@ -2580,6 +2597,7 @@ events.prototype.flyTo = function (toId, callback) { events.prototype.openEquipbox = function (fromUserAction) { if (core.isReplaying()) return; if (!this._checkStatus('equipbox', fromUserAction)) return; + core.playSound('打开界面'); core.ui._drawEquipbox(); } @@ -2587,6 +2605,7 @@ events.prototype.openEquipbox = function (fromUserAction) { events.prototype.openToolbox = function (fromUserAction) { if (core.isReplaying()) return; if (!this._checkStatus('toolbox', fromUserAction)) return; + core.playSound('打开界面'); core.ui._drawToolbox(); } @@ -2595,7 +2614,8 @@ events.prototype.openQuickShop = function (fromUserAction) { if (core.isReplaying()) return; if (Object.keys(core.status.shops).length == 0) { - core.drawTip("本塔没有快捷商店!"); + core.playSound('操作失败'); + core.drawTip("本游戏没有快捷商店!"); return; } @@ -2604,11 +2624,13 @@ events.prototype.openQuickShop = function (fromUserAction) { var shopId = Object.keys(core.status.shops)[0]; if (core.status.event.id != null) return; if (!core.canOpenShop(shopId)) { + core.playSound('操作失败'); core.drawTip("当前无法打开快捷商店!"); return; } var message = core.canUseQuickShop(shopId); if (message != null) { + core.playSound('操作失败'); core.drawTip(message); return; } @@ -2630,6 +2652,7 @@ events.prototype.openKeyBoard = function (fromUserAction) { events.prototype.save = function (fromUserAction) { if (core.isReplaying()) return; if (core.hasFlag('__forbidSave__')) { + core.playSound('操作失败'); core.drawTip('当前禁止存档'); return; } @@ -2638,6 +2661,7 @@ events.prototype.save = function (fromUserAction) { if (!this._checkStatus('save', fromUserAction)) return; var saveIndex = core.saves.saveIndex; var page=parseInt((saveIndex-1)/5), offset=saveIndex-5*page; + core.playSound('打开界面'); core.ui._drawSLPanel(10*page+offset); } @@ -2653,12 +2677,14 @@ events.prototype.load = function (fromUserAction) { core.clearMap('all'); core.status.event = {'id': 'load', 'data': null}; core.status.lockControl = true; + core.playSound('打开界面'); core.ui._drawSLPanel(10*page+offset); return; } if (core.status.event.id == 'load' && core.events.recoverEvents(core.status.event.interval)) return; if (!this._checkStatus('load', fromUserAction)) return; + core.playSound('打开界面'); core.ui._drawSLPanel(10*page+offset); } @@ -2667,6 +2693,7 @@ events.prototype.openSettings = function (fromUserAction) { if (core.isReplaying()) return; if (!this._checkStatus('settings', fromUserAction)) return; + core.playSound('打开界面'); core.ui._drawSettings(); } @@ -3264,6 +3291,7 @@ events.prototype.tryUseItem = function (itemId) { core.ui.closePanel(); core.useItem(itemId); } else { + core.playSound('操作失败'); core.drawTip("当前无法使用" + core.material.items[itemId].name); } } diff --git a/libs/items.js b/libs/items.js index 39c171ed..0eb64da1 100644 --- a/libs/items.js +++ b/libs/items.js @@ -233,13 +233,19 @@ items.prototype.canEquip = function (equipId, hint) { // 装备是否合法 var equip = core.material.items[equipId] || {}; if (!equip.equip) { - if (hint) core.drawTip("不合法的装备!"); + if (hint) { + core.playSound('操作失败'); + core.drawTip("不合法的装备!"); + } return false; } // 是否拥有该装备 if (!core.hasItem(equipId) && !core.hasEquip(equipId)) { - if (hint) core.drawTip("你当前没有" + equip.name + ",无法换装"); + if (hint) { + core.playSound('操作失败'); + core.drawTip("你当前没有" + equip.name + ",无法换装"); + } return false; } @@ -248,7 +254,10 @@ items.prototype.canEquip = function (equipId, hint) { if (canUseItemEffect) { try { if (!eval(canUseItemEffect)) { - if (hint) core.drawTip("当前不可换上" + equip.name); + if (hint) { + core.playSound('操作失败'); + core.drawTip("当前不可换上" + equip.name); + } return false; } } @@ -270,6 +279,7 @@ items.prototype.loadEquip = function (equipId, callback) { var loadEquip = core.material.items[equipId] || {}; var type = this.getEquipTypeById(equipId); if (type < 0) { + core.playSound('操作失败'); core.drawTip("当前没有" + loadEquip.equip.type + "的空位!"); if (callback) callback(); return; @@ -341,7 +351,7 @@ items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) { items.prototype._realLoadEquip_playSound = function () { if (core.hasFlag("__quickLoadEquip__")) return; core.stopSound(); - core.playSound('equip.mp3'); + core.playSound('穿脱装备'); } ////// 保存装备 ////// @@ -357,6 +367,7 @@ items.prototype.quickSaveEquip = function (index) { items.prototype.quickLoadEquip = function (index) { var current = core.getFlag("saveEquips", [])[index]; if (!current) { + core.playSound('操作失败'); core.drawTip(index + "号套装不存在"); return; } diff --git a/libs/ui.js b/libs/ui.js index 8f3db199..17ab6718 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1928,7 +1928,7 @@ ui.prototype._drawReplay = function () { ui.prototype._drawGameInfo = function () { core.status.event.id = 'gameInfo'; this.drawChoices(null, [ - "数据统计", "查看工程", "游戏主页", "操作帮助", "关于本塔","下载离线版本", "返回主菜单" + "数据统计", "查看工程", "游戏主页", "操作帮助", "关于游戏","下载离线版本", "返回主菜单" ]); } @@ -2226,7 +2226,7 @@ ui.prototype._drawBookDetail = function (index) { core.setAlpha('data', 1); core.strokeRect('data', left - 1, top - 1, width + 1, height + 1, core.arrayToRGBA(core.status.globalAttribute.borderColor), 2); - + core.playSound('确定'); this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth}); } @@ -2428,6 +2428,7 @@ ui.prototype._drawCenterFly = function () { offsetY = core.clamp(toY - core.__HALF_SIZE__, 0, core.bigmap.height - core.__SIZE__); core.fillRect('ui', (toX - offsetX) * 32, (toY - offsetY) * 32, 32, 32, fillstyle); core.status.event.data = {"x": toX, "y": toY, "posX": toX - offsetX, "posY": toY - offsetY}; + core.playSound('打开界面'); core.drawTip("请确认当前"+core.material.items['centerFly'].name+"的位置"); return; } @@ -3015,6 +3016,7 @@ ui.prototype.drawStatusBar = function () { ////// 绘制“数据统计”界面 ////// ui.prototype._drawStatistics = function (floorIds) { + core.playSound('打开界面'); var obj = this._drawStatistics_buildObj(); if (typeof floorIds == 'string') floorIds = [floorIds]; (floorIds || core.floorIds).forEach(function (floorId) { @@ -3189,6 +3191,7 @@ ui.prototype._drawAbout = function () { ////// 绘制帮助页面 ////// ui.prototype._drawHelp = function () { + core.playSound('打开界面'); core.clearUI(); if (core.material.images.keyboard) { core.status.event.id = 'help'; diff --git a/project/data.js b/project/data.js index c0774f03..64c0e047 100644 --- a/project/data.js +++ b/project/data.js @@ -35,12 +35,36 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "jump.mp3", "pickaxe.mp3", "bomb.mp3", - "centerFly.mp3" + "centerFly.mp3", + "error.mp3", + "cancel.mp3", + "cursor.mp3", + "confirm.mp3", + "open_ui.mp3", + "load.mp3", + "recovery.mp3", + "save.mp3" ], "fonts": [], "nameMap": { - "背景图.jpg": "bg.jpg", - "背景音乐.mp3": "bgm.mp3" + "普攻": "attack.mp3", + "炸弹": "bomb.mp3", + "飞行器": "centerFly.mp3", + "开关门": "door.mp3", + "上下楼": "floor.mp3", + "获得道具": "item.mp3", + "跳跃": "jump.mp3", + "破墙镐": "pickaxe.mp3", + "阻激夹域": "zone.mp3", + "操作失败": "error.mp3", + "取消": "cancel.mp3", + "光标移动": "cursor.mp3", + "确定": "confirm.mp3", + "穿脱装备": "equip.mp3", + "打开界面": "open_ui.mp3", + "读档": "load.mp3", + "回血": "recovery.mp3", + "存档": "save.mp3" }, "levelChoose": [ { diff --git a/project/functions.js b/project/functions.js index dd94a714..d16d2f37 100644 --- a/project/functions.js +++ b/project/functions.js @@ -100,7 +100,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // ---------- 此时还没有进行切换,当前floorId还是原来的 ---------- // var currentId = core.status.floorId || null; // 获得当前的floorId,可能为null var fromLoad = core.hasFlag('__fromLoad__'); // 是否是读档造成的切换 - if (!fromLoad) { + var isFlying = core.hasFlag('__isFlying__'); // 是否是楼传造成的切换 + if (!fromLoad && !(isFlying && currentId == floorId)) { if (!core.hasFlag("__leaveLoc__")) core.setFlag("__leaveLoc__", {}); if (currentId != null) core.getFlag("__leaveLoc__")[currentId] = core.clone(core.status.hero.loc); } @@ -111,7 +112,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // } // 播放换层音效 - core.playSound('floor.mp3'); + if (fromLoad) + core.playSound('读档'); + else if (isFlying) + core.playSound('飞行器'); + else if (currentId) + core.playSound('上下楼'); // 根据分区信息自动砍层与恢复 if (core.autoRemoveMaps) core.autoRemoveMaps(floorId); @@ -140,7 +146,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 切换楼层BGM if (core.status.maps[floorId].bgm) { var bgm = core.status.maps[floorId].bgm; - if (bgm instanceof Array) bgm = bgm[0]; + if (bgm instanceof Array) bgm = bgm[Math.floor(Math.random() * bgm.length)]; // 多个bgm则随机播放一个 if (!core.hasFlag("__bgm__")) core.playBgm(bgm); } // 更改画面色调 @@ -188,6 +194,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 检查能否飞行 if (!core.status.maps[fromId].canFlyFrom || !core.status.maps[toId].canFlyTo || !core.hasVisitedFloor(toId)) { + core.playSound('操作失败'); core.drawTip("无法飞往" + core.status.maps[toId].title + "!"); return false; } @@ -199,9 +206,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = loc = core.getFlag("__leaveLoc__", {})[toId] || null; } if (core.status.maps[toId].flyPoint != null && core.status.maps[toId].flyPoint.length == 2) { - loc = { x: core.status.maps[toId].flyPoint[0], y: core.status.maps[toId].flyPoint[1] }; + stair = 'flyPoint'; } - if (loc == null) { + if (stair == null && loc == null) { // 获得两个楼层的索引,以决定是上楼梯还是下楼梯 var fromIndex = core.floorIds.indexOf(fromId), toIndex = core.floorIds.indexOf(toId); @@ -236,7 +243,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (guards.length > 0) { // 记录flag,当前要参与支援的怪物 core.setFlag("__guards__" + x + "_" + y, guards); - var actions = [{ "type": "playSound", "name": "jump.mp3" }]; + var actions = [{ "type": "playSound", "name": "跳跃" }]; // 增加支援的特效动画(图块跳跃) guards.forEach(function (g) { core.push(actions, { "type": "jump", "from": [g[0], g[1]], "to": [x, y], "time": 300, "keep": false, "async": true }); @@ -322,8 +329,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.status.hero.statistics.exp += exp; var hint = "打败 " + enemy.name; - if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) hint += ",金币+" + money; - if (core.flags.statusBarItems.indexOf('enableExp') >= 0) hint += ",经验+" + exp; + if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) + hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money; + if (core.flags.statusBarItems.indexOf('enableExp') >= 0) + hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp; core.drawTip(hint, enemy.id); // 中毒 @@ -441,7 +450,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 获得一个道具后触发的事件 // itemId:获得的道具ID;x和y是该道具所在的坐标 // isGentleClick:是否是轻按触发的 - core.playSound('item.mp3'); + if (itemId.endsWith('Potion') && core.material.items[itemId].cls == 'items') + core.playSound('回血'); + else + core.playSound('获得道具'); var todo = []; // 检查该点的获得道具后事件。 @@ -1259,7 +1271,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 如需调用当前楼层的ratio可使用 core.status.maps[floorId].ratio if (id == 'lavaNet' && !core.hasItem('amulet')) { damage[loc] = (damage[loc] || 0) + core.values.lavaDamage; - type[loc]["血网伤害"] = true; + type[loc][(block.event.name || "血网") + "伤害"] = true; } // 领域 @@ -1703,6 +1715,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.fillText('ui', "作者: 艾之葵", text_start, top + 112); core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top + 112 + 32); // TODO: 写自己的“关于”页面,每次增加32像素即可 + core.playSound('打开界面'); } } } \ No newline at end of file diff --git a/project/items.js b/project/items.js index d125902f..b8f75f88 100644 --- a/project/items.js +++ b/project/items.js @@ -297,7 +297,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "name": "圣水", "itemEffect": "core.status.hero.hp *= 2", "itemEffectTip": ",生命值翻倍", - "useItemEffect": "core.status.hero.hp *= 2;", + "useItemEffect": "core.status.hero.hp *= 2; core.playSound('回血');", "canUseItemEffect": "true", "text": "生命值翻倍" }, @@ -333,7 +333,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "constants", "name": "冰冻徽章", "text": "可以将面前的熔岩变成平地", - "useItemEffect": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", + "useItemEffect": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('打开界面');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", "canUseItemEffect": "true" }, "cross": { @@ -374,21 +374,21 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "破墙镐", "text": "可以破坏勇士面前的墙", - "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", + "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('破墙镐');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", "canUseItemEffect": "true" }, "icePickaxe": { "cls": "tools", "name": "破冰镐", "text": "可以破坏勇士面前的一堵冰墙", - "useItemEffect": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", - "canUseItemEffect": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();" + "useItemEffect": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.playSound('打开界面');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", + "canUseItemEffect": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice' || core.getBlockId(core.nextX(), core.nextY()) == 'iceDoor';\n})();" }, "bomb": { "cls": "tools", "name": "炸弹", "text": "可以炸掉勇士面前的怪物", - "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", + "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('炸弹');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", "canUseItemEffect": "true" }, "centerFly": { @@ -416,7 +416,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "地震卷轴", "text": "可以破坏当前层的所有墙", - "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap();\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", + "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap();\n\tcore.playSound('打开界面');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", "canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();" }, "poisonWine": { @@ -465,6 +465,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "type": "function", "function": "function(){\ncore.addItem('lifeWand', 1);\n}" }, + { + "type": "playSound", + "name": "打开界面" + }, { "type": "input", "text": "请输入生命魔杖使用次数:(0-${item:lifeWand})" @@ -485,9 +489,17 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "operator": "+=", "value": "flag:input*100" }, + { + "type": "playSound", + "name": "回血" + }, "成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。" ], "false": [ + { + "type": "playSound", + "name": "操作失败" + }, "输入不合法!" ] } @@ -498,7 +510,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "跳跃靴", "text": "能跳跃到前方两格处", - "useItemEffect": "core.playSound(\"jump.mp3\"); core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });", + "useItemEffect": "core.playSound(\"跳跃\");\ncore.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });", "canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();" }, "skill1": { @@ -506,7 +518,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "name": "技能:二倍斩", "text": "可以打开或关闭主动技能二倍斩", "hideInReplay": true, - "useItemEffect": "(function () {\n\tvar skillValue = 1; // 技能的flag:skill值,可用于当前开启技能的判定;对于新技能可以依次改成2,3等等\n\tvar skillNeed = 5; // 技能的需求\n\tvar skillName = '二倍斩'; // 技能的名称\n\n\tif (core.getFlag('skill', 0) != skillValue) { // 判断当前是否已经开了技能\n\t\tif (core.getStatus('mana') >= skillNeed) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\t\tcore.setFlag('skill', skillValue); // 开技能1\n\t\t\tcore.setFlag('skillName', skillName); // 设置技能名\n\t\t} else {\n\t\t\tcore.drawTip('魔力不足,无法开启技能');\n\t\t}\n\t} else { // 关闭技能\n\t\tcore.setFlag('skill', 0); // 关闭技能状态\n\t\tcore.setFlag('skillName', '无');\n\t}\n})();", + "useItemEffect": "(function () {\n\tvar skillValue = 1; // 技能的flag:skill值,可用于当前开启技能的判定;对于新技能可以依次改成2,3等等\n\tvar skillNeed = 5; // 技能的需求\n\tvar skillName = '二倍斩'; // 技能的名称\n\n\tif (core.getFlag('skill', 0) != skillValue) { // 判断当前是否已经开了技能\n\t\tif (core.getStatus('mana') >= skillNeed) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\t\tcore.playSound('打开界面');\n\t\t\tcore.setFlag('skill', skillValue); // 开技能1\n\t\t\tcore.setFlag('skillName', skillName); // 设置技能名\n\t\t} else {\n\t\t\tcore.playSound('操作失败');\n\t\t\tcore.drawTip('魔力不足,无法开启技能');\n\t\t}\n\t} else { // 关闭技能\n\t\tcore.setFlag('skill', 0); // 关闭技能状态\n\t\tcore.setFlag('skillName', '无');\n\t}\n})();", "canUseItemEffect": "true" }, "wand": { diff --git a/project/plugins.js b/project/plugins.js index 68c610bc..db0e75c2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -108,6 +108,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.openItemShop) { core.openItemShop(shopId); } else { + core.playSound('操作失败'); core.insertAction("道具商店插件不存在!请检查是否存在该插件!"); } return; @@ -145,6 +146,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "condition": shop.disablePreview, "true": [ // 不可预览,提示并退出 + { "type": "playSound", "name": "操作失败" }, "当前无法访问该商店!", { "type": "break" }, ], @@ -173,7 +175,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "text": choice.text, "icon": choice.icon, "color": ableToBuy && !previewMode ? choice.color : [153, 153, 153, 1], - "action": ableToBuy && !previewMode ? choice.action : [ + "action": ableToBuy && !previewMode ? [{ "type": "playSound", "name": "确定" }].concat(choice.action) : [ + { "type": "playSound", "name": "操作失败" }, { "type": "tip", "text": previewMode ? "预览模式下不可购买" : "购买条件不足" } ] }; @@ -636,11 +639,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (type == 0) { core.status.hero[use] -= totalMoney; core.getItem(item.id, selectCount); + core.stopSound(); + core.playSound('确定'); if (item.number != null) item.number -= selectCount; item.money_count = (item.money_count || 0) + selectCount; } else { core.status.hero[use] += totalMoney; core.removeItem(item.id, selectCount); + core.playSound('确定'); core.drawTip("成功卖出" + selectCount + "个" + core.material.items[item.id].name, item.id); if (item.number != null) item.number += selectCount; item.sell_count = (item.sell_count || 0) + selectCount; diff --git a/project/sounds/cancel.mp3 b/project/sounds/cancel.mp3 new file mode 100644 index 00000000..f08449ed Binary files /dev/null and b/project/sounds/cancel.mp3 differ diff --git a/project/sounds/confirm.mp3 b/project/sounds/confirm.mp3 new file mode 100644 index 00000000..138beeb7 Binary files /dev/null and b/project/sounds/confirm.mp3 differ diff --git a/project/sounds/cursor.mp3 b/project/sounds/cursor.mp3 new file mode 100644 index 00000000..dc3a7219 Binary files /dev/null and b/project/sounds/cursor.mp3 differ diff --git a/project/sounds/equip.mp3 b/project/sounds/equip.mp3 index 5d821780..36bbd027 100644 Binary files a/project/sounds/equip.mp3 and b/project/sounds/equip.mp3 differ diff --git a/project/sounds/error.mp3 b/project/sounds/error.mp3 new file mode 100644 index 00000000..329cca45 Binary files /dev/null and b/project/sounds/error.mp3 differ diff --git a/project/sounds/load.mp3 b/project/sounds/load.mp3 new file mode 100644 index 00000000..e680f4d3 Binary files /dev/null and b/project/sounds/load.mp3 differ diff --git a/project/sounds/open_ui.mp3 b/project/sounds/open_ui.mp3 new file mode 100644 index 00000000..c648d526 Binary files /dev/null and b/project/sounds/open_ui.mp3 differ diff --git a/project/sounds/recovery.mp3 b/project/sounds/recovery.mp3 new file mode 100644 index 00000000..a4bb6176 Binary files /dev/null and b/project/sounds/recovery.mp3 differ diff --git a/project/sounds/save.mp3 b/project/sounds/save.mp3 new file mode 100644 index 00000000..295dbf2c Binary files /dev/null and b/project/sounds/save.mp3 differ diff --git a/project/sounds/shop.mp3 b/project/sounds/shop.mp3 new file mode 100644 index 00000000..905ae3df Binary files /dev/null and b/project/sounds/shop.mp3 differ