diff --git a/project/functions.js b/project/functions.js index 60c34b9..2504a10 100644 --- a/project/functions.js +++ b/project/functions.js @@ -326,12 +326,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.status.hero.exp += exp; core.status.hero.statistics.exp += exp; - var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y); - 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); + var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y); + 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; + if (!core.getFlag("isNoTip")) core.drawTip(hint, enemy.id); // 中毒 if (core.enemys.hasSpecial(special, 12)) { @@ -849,7 +849,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.load(true); break; case 69: // E:上 //打开光标 - if ((core.flags.flyNearStair && !core.nearStair())) + if (!core.hasItem('fly')) + core.drawTip("你没有" + core.material.items['fly'].name, 'fly'); + else if ((core.flags.flyNearStair && !core.nearStair())) core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); else if (!core.canUseItem('fly')) core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); @@ -870,7 +872,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.openToolbox(true); break; case 81: // Q:下 //打开装备栏 - if ((core.flags.flyNearStair && !core.nearStair())) + if (!core.hasItem('fly')) + core.drawTip("你没有" + core.material.items['fly'].name, 'fly'); + else if ((core.flags.flyNearStair && !core.nearStair())) core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); else if (!core.canUseItem('fly')) core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); diff --git a/project/plugins.js b/project/plugins.js index 2977663..b6ac27c 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -426,7 +426,95 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = - + core.ui._drawSettings = function () { + core.status.event.id = 'settings'; + this.drawChoices(null, [ + "系统设置", "虚拟键盘", "浏览地图", "存档笔记", "同步存档", "游戏信息", "返回标题", "返回游戏", "爽塔相关", "RM相关" + ]); + } + core.actions._clickSettings = function (x, y) { + if (this._out(x)) return; + var choices = core.status.event.ui.choices; + var topIndex = this._getChoicesTopIndex(choices.length); + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + core.status.event.selection = selection; + 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; + case 8: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawShuangta(); + /*core.playSound('确定'); + core.setFlag("itemDetail", !core.getFlag("itemDetail")); + core.getItemDetail(); + core.ui.closePanel();*/ + break; + case 9: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawRM(); + /*core.playSound('确定'); + core.setFlag("isRmFly", !core.getFlag("isRmFly")); + core.ui.closePanel();*/ + break; + } + } + return; + } + core.ui._drawShuangta = function () { + core.status.event.id = 'shuangta'; + this.drawChoices(null, [ + "数值显示: " + (core.getFlag("itemDetail") ? "[ON]" : "[OFF]"), + "自动拾取: " + (core.getFlag("__autoGetItem__") ? "[ON]" : "[OFF]"), + "自动清怪: " + (core.getFlag("__autoBattle__") ? "[ON]" : "[OFF]"), "返回主菜单" + ]); + } + core.ui._drawRM = function () { + core.status.event.id = 'rm'; + this.drawChoices(null, [ + "RM楼传: " + (core.getFlag("isRmFly") ? "[ON]" : "[OFF]"), + "显伤靠右: " + (core.getFlag("isDamageRight") ? "[ON]" : "[OFF]"), + "零伤白色: " + (core.getFlag("isZeroWhite") ? "[ON]" : "[OFF]"), + "道具打怪不提示: " + (core.getFlag("isNoTip") ? "[ON]" : "[OFF]"), + "手册显示普通: " + (core.getFlag("isCommon") ? "[ON]" : "[OFF]"), + "返回主菜单" + ]); + } ////// 获得某个物品 ////// core.events.getItem = function (id, num, x, y, isGentleClick, callback) { if (num == null) num = 1; @@ -436,7 +524,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var text = '获得 ' + core.material.items[id].name; if (num > 1) text += "x" + num; if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id); - //core.drawTip(text, id); + if (!core.getFlag("isNoTip")) core.drawTip(text, id); // --- 首次获得道具的提示 if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []); @@ -478,7 +566,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933'; else if (damage < core.status.hero.hp) color = '#FF9933'; else color = '#FF2222'; - + if (!core.getFlag('isZeroWhite')) { + if (damage <= 0) color = '#11FF11'; + else if (damage < core.status.hero.hp / 3) color = '#FFFFFF'; + else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00'; + else if (damage < core.status.hero.hp) color = '#FF9933'; + else color = '#FF2222'; + } damage = core.formatBigNumber(damage, true); if (core.enemys.hasSpecial(enemy, 19)) damage += "+"; @@ -500,6 +594,411 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.createCanvas('bookBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制手册bg core.drawWindowSkin('winskin.png', 'bookBg', 0, 0, core._PX_, core._PY_); } + core.actions._sys_keyDown_lockControl = function (keyCode) { + if (!core.status.lockControl) return false; + // Ctrl跳过对话 + if (keyCode == 17) { + this.keyDownCtrl(); + return true; + } + switch (core.status.event.id) { + case 'action': + this._keyDownAction(keyCode); + break; + case 'book': + this._keyDownBook(keyCode); + break; + case 'fly': + this._keyDownFly(keyCode); + break; + case 'viewMaps': + this._keyDownViewMaps(keyCode); + break; + case 'equipbox': + this._keyDownEquipbox(keyCode); + break; + case 'toolbox': + this._keyDownToolbox(keyCode); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._keyDownSL(keyCode); + break; + case 'selectShop': + case 'switchs': + case 'switchs-sounds': + case 'switchs-display': + case 'switchs-action': + case 'notes': + case 'settings': + case 'syncSave': + case 'syncSelect': + case 'localSaveSelect': + case 'storageRemove': + case 'replay': + case 'gameInfo': + case 'shuangta': + case 'rm': + this._keyDownChoices(keyCode); + break; + case 'cursor': + this._keyDownCursor(keyCode); + break; + } + return true; + } + core.actions._sys_keyUp_lockControl = function (keyCode, altKey) { + if (!core.status.lockControl) return false; + + var ok = function () { + return keyCode == 27 || keyCode == 88 || keyCode == 13 || keyCode == 32 || keyCode == 67; + } + + core.status.holdingKeys = []; + switch (core.status.event.id) { + case 'text': + ok() && core.drawText(); + break; + case 'confirmBox': + this._keyUpConfirmBox(keyCode); + break; + case 'action': + this._keyUpAction(keyCode); + break; + case 'about': + ok() && core.closePanel(); + break; + case 'help': + ok() && core.closePanel(); + break; + case 'book': + this._keyUpBook(keyCode); + break; + case 'book-detail': + ok() && this._clickBookDetail(); + break; + case 'fly': + this._keyUpFly(keyCode); + break; + case 'viewMaps': + this._keyUpViewMaps(keyCode); + break; + case 'selectShop': + this._keyUpQuickShop(keyCode); + break; + case 'toolbox': + this._keyUpToolbox(keyCode); + break; + case 'equipbox': + this._keyUpEquipbox(keyCode, altKey); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._keyUpSL(keyCode); + break; + case 'keyBoard': + ok() && core.closePanel(); + break; + case 'switchs': + this._keyUpSwitchs(keyCode); + break; + case 'switchs-sounds': + this._keyUpSwitchs_sounds(keyCode); + break; + case 'switchs-display': + this._keyUpSwitchs_display(keyCode); + break; + case 'switchs-action': + this._keyUpSwitchs_action(keyCode); + break; + case 'settings': + this._keyUpSettings(keyCode); + break; + case 'notes': + this._keyUpNotes(keyCode); + break; + case 'syncSave': + this._keyUpSyncSave(keyCode); + break; + case 'syncSelect': + this._keyUpSyncSelect(keyCode); + break; + case 'localSaveSelect': + this._keyUpLocalSaveSelect(keyCode); + break; + case 'storageRemove': + this._keyUpStorageRemove(keyCode); + break; + case 'cursor': + this._keyUpCursor(keyCode); + break; + case 'replay': + this._keyUpReplay(keyCode); + break; + case 'gameInfo': + this._keyUpGameInfo(keyCode); + break; + case 'shuangta': + this._keyUpShuangta(keyCode); + break; + case 'rm': + this._keyUpRM(keyCode); + break; + case 'centerFly': + this._keyUpCenterFly(keyCode); + break; + } + return true; + } + core.actions._sys_ondown_lockControl = function (x, y, px, py) { + if (core.status.played && !core.status.lockControl) return false; + + switch (core.status.event.id) { + case 'centerFly': + this._clickCenterFly(x, y, px, py); + break; + case 'book': + this._clickBook(x, y, px, py); + break; + case 'book-detail': + this._clickBookDetail(x, y, px, py); + break; + case 'fly': + this._clickFly(x, y, px, py); + break; + case 'viewMaps': + this._clickViewMaps(x, y, px, py); + break; + case 'switchs': + this._clickSwitchs(x, y, px, py); + break; + case 'switchs-sounds': + this._clickSwitchs_sounds(x, y, px, py); + break; + case 'switchs-display': + this._clickSwitchs_display(x, y, px, py); + break; + case 'switchs-action': + this._clickSwitchs_action(x, y, px, py); + break; + case 'settings': + this._clickSettings(x, y, px, py); + break; + case 'selectShop': + this._clickQuickShop(x, y, px, py); + break; + case 'equipbox': + this._clickEquipbox(x, y, px, py); + break; + case 'toolbox': + this._clickToolbox(x, y, px, py); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._clickSL(x, y, px, py); + break; + case 'confirmBox': + this._clickConfirmBox(x, y, px, py); + break; + case 'keyBoard': + this._clickKeyBoard(x, y, px, py); + break; + case 'action': + this._clickAction(x, y, px, py); + break; + case 'text': + core.drawText(); + break; + case 'notes': + this._clickNotes(x, y, px, py); + break; + case 'syncSave': + this._clickSyncSave(x, y, px, py); + break; + case 'syncSelect': + this._clickSyncSelect(x, y, px, py); + break; + case 'localSaveSelect': + this._clickLocalSaveSelect(x, y, px, py); + break; + case 'storageRemove': + this._clickStorageRemove(x, y, px, py); + break; + case 'cursor': + this._clickCursor(x, y, px, py); + break; + case 'replay': + this._clickReplay(x, y, px, py); + break; + case 'gameInfo': + this._clickGameInfo(x, y, px, py); + break; + case 'shuangta': + this._clickShuangta(x, y, px, py); + break; + case 'rm': + this._clickRM(x, y, px, py); + break; + case 'about': + case 'help': + core.ui.closePanel(); + break; + } + + // --- 长按判定 + if (core.timeout.onDownTimeout == null) { + core.timeout.onDownTimeout = setTimeout(function () { + if (core.interval.onDownInterval == null) { + core.interval.onDownInterval = setInterval(function () { + if (!core.actions.longClick(x, y, px, py)) { + clearInterval(core.interval.onDownInterval); + core.interval.onDownInterval = null; + } + }, 40) + } + }, 500); + } + return true; + } + core.actions._sys_onmove_choices = function (x, y, px, py) { + if (!core.status.lockControl) return false; + + switch (core.status.event.id) { + case 'action': + if (core.status.event.data.type == 'choices') { + this._onMoveChoices(x, y); + return true; + } + if (core.status.event.data.type == 'confirm') { + this._onMoveConfirmBox(x, y, px, py); + return true; + } + break; + case 'selectShop': + case 'switchs': + case 'switchs-sounds': + case 'switchs-display': + case 'switchs-action': + case 'notes': + case 'settings': + case 'syncSave': + case 'syncSelect': + case 'localSaveSelect': + case 'storageRemove': + case 'replay': + case 'gameInfo': + case 'shuangta': + case 'rm': + this._onMoveChoices(x, y); + return true; + case 'confirmBox': + this._onMoveConfirmBox(x, y, px, py); + return true; + default: + break; + } + return false; + } + core.actions._keyUpShuangta = function (keycode) { + if (keycode == 27 || keycode == 88) { + core.status.event.selection = 8; + core.playSound('取消'); + return core.ui._drawSettings(); + } + this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickShuangta); + } + core.actions._clickShuangta = function (x, y) { + if (this._out(x)) return; + var choices = core.status.event.ui.choices; + + var topIndex = this._getChoicesTopIndex(choices.length); + + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + core.status.event.selection = selection; + switch (selection) { + case 0: + core.setFlag("itemDetail", !core.getFlag("itemDetail")); + core.ui._drawShuangta(); + break; + case 1: + core.setFlag("__autoGetItem__", !core.getFlag("__autoGetItem__")); + core.ui._drawShuangta(); + break; + case 2: + core.setFlag("__autoBattle__", !core.getFlag("__autoBattle__")); + core.ui._drawShuangta(); + break; + case 3: + core.status.event.selection = 8; + core.playSound('取消'); + core.ui._drawSettings(); + break; + } + } + } + core.actions._keyUpRM = function (keycode) { + if (keycode == 27 || keycode == 88) { + core.status.event.selection = 9; + core.playSound('取消'); + return core.ui._drawSettings(); + } + this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickRM); + } + core.actions._clickRM = function (x, y) { + if (this._out(x)) return; + var choices = core.status.event.ui.choices; + + var topIndex = this._getChoicesTopIndex(choices.length); + + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + core.status.event.selection = selection; + switch (selection) { + case 0: + core.setFlag("isRmFly", !core.getFlag("isRmFly")); + core.ui._drawRM(); + break; + case 1: + core.setFlag("isDamageRight", !core.getFlag("isDamageRight")); + core.updateStatusBar(); + core.ui._drawRM(); + break; + case 2: + core.setFlag("isZeroWhite", !core.getFlag("isZeroWhite")); + core.updateStatusBar(); + core.ui._drawRM(); + break; + case 3: + core.setFlag("isNoTip", !core.getFlag("isNoTip")); + core.ui._drawRM(); + break; + case 4: + core.setFlag("isCommon", !core.getFlag("isCommon")); + core.ui._drawRM(); + break; + case 5: + core.status.event.selection = 9; + core.playSound('取消'); + core.ui._drawSettings(); + break; + } + } + } + core.actions.registerAction('keyDown', '_sys_keyDown_lockControl', core.actions._sys_keyDown_lockControl, 50); + core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50); + core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30); + core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30); + @@ -545,7 +1044,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗 switch (enemy.specialText.length) { case 1: - core.fillText('ui', enemy.specialText[0][0] + ' ' + enemy.specialText[0][1], left + width / 2, ////单属性两个字中间空一格 + core.fillText('ui', ((!core.getFlag('isCommon') || (2 != enemy.specialText[0].length)) ? + enemy.specialText[0] : enemy.specialText[0][0] + ' ' + enemy.specialText[0][1]), + left + width / 2, ////单属性两个字中间空一格 top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'), this._buildFont(20, false), width); ////调大怪物字号,取消加粗 break; @@ -2943,10 +3444,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // *** 下一句话可以更改你想要的显示字体 core.setFont(ctx, "bold 11px Arial"); // *** - if (core.getFlag('isRmDamage')) - core.setTextAlign(ctx, "right"); - else - core.setTextAlign(ctx, "left"); + core.setTextAlign(ctx, core.getFlag("isDamageRight") ? "right" : "left"); core.status.damage.data.forEach(function (one) { var px = one.px, py = one.py; @@ -2956,10 +3454,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (px < -32 * 2 || px > core.__PX__ + 32 || py < -32 || py > core.__PY__ + 32) return; } - if (core.getFlag('isRmDamage')) - core.fillBoldText(ctx, one.text, px + 32, py, one.color); - else - core.fillBoldText(ctx, one.text, px, py, one.color); + core.fillBoldText(ctx, one.text, px + (core.getFlag("isDamageRight") ? 32 : 0), py, one.color); }); core.setTextAlign(ctx, 'center'); core.status.damage.extraData.forEach(function (one) { @@ -3352,7 +3847,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } if (special === 0) { - text.push('普通'); ///////无特殊属性时增加“普通”属性显示 + if (core.getFlag('isCommon')) text.push('普通'); ///////无特殊属性时增加“普通”属性显示 } return text; } @@ -3974,480 +4469,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.relocateCanvas('ui', 0, 0); _doa.call(core.events); } -}, - "游戏设置": function () { - - - - // 在此增加新插件 - // - // - ////游戏设置选项 - ////// 绘制系统设置界面 ////// - ui.prototype._drawSwitchs = function () { - core.status.event.id = 'switchs'; - var choices = [ - "音效设置", - "显示设置", - "操作设置", - "游戏设置", //////新增 - "返回主菜单" - ]; - this.drawChoices(null, choices); - } - ////// 系统设置界面时的点击操作 ////// - actions.prototype._clickSwitchs = function (x, y) { - var choices = core.status.event.ui.choices; - var topIndex = this._getChoicesTopIndex(choices.length); - var selection = y - topIndex; - if (this._out(x)) return; - if (selection >= 0 && selection < choices.length) { - core.status.event.selection = selection; - 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._drawSwitchs_game(); - case 4: - core.status.event.selection = 0; - core.playSound('取消'); - return core.ui._drawSettings(); - } - } - } - - - - - ui.prototype._drawSwitchs_game = function () { - core.status.event.id = 'switchs-game'; - var choices = [ - "血瓶显示: " + (core.hasFlag('itemDetail') ? "[ON]" : "[OFF]"), - "RM楼传: " + (core.hasFlag('isRmFly') ? "[ON]" : "[OFF]"), - "RM显伤: " + (core.hasFlag('isRmDamage') ? "[ON]" : "[OFF]"), - "返回上一级" - ]; - this.drawChoices(null, choices); - } - - - ////游戏设置 - actions.prototype._clickSwitchs_game = function (x, y) { - var choices = core.status.event.ui.choices; - var topIndex = this._getChoicesTopIndex(choices.length); - var selection = y - topIndex; - if (this._out(x)) { - if (selection != 0 && selection != 1) return; - } - if (selection >= 0 && selection < choices.length) { - var width = choices[selection].width; - var leftPos = (core._PX_ - width) / 2, - rightPos = (core._PX_ + width) / 2; - var leftGrid = parseInt(leftPos / 32), - rightGrid = parseInt(rightPos / 32) - 1; - core.status.event.selection = selection; - switch (selection) { - case 0: - core.playSound('确定'); - return this._clickSwitchs_game_itemDetail(); - case 1: - core.playSound('确定'); - return this._clickSwitchs_game_isRmFly(); - case 2: - core.playSound('确定'); - return this._clickSwitchs_game_isRmDamage(); - case 3: - core.status.event.selection = 2; - core.playSound('取消'); - core.ui._drawSwitchs(); - return; - } - } - } - ///游戏设置 - actions.prototype._keyUpSwitchs_game = function (keycode) { - if (keycode == 27 || keycode == 88) { - core.status.event.selection = 3; - core.playSound('取消'); - core.ui._drawSwitchs(); - return; - } - - this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs_game); - } - - - actions.prototype._clickSwitchs_game_itemDetail = function () { - if (core.hasFlag('itemDetail')) core.removeFlag('itemDetail'); - else core.setFlag('itemDetail', true); - core.ui._drawSwitchs_game(); - } - actions.prototype._clickSwitchs_game_isRmFly = function () { - if (core.hasFlag('isRmFly')) core.removeFlag('isRmFly'); - else core.setFlag('isRmFly', true); - core.ui._drawSwitchs_game(); - } - actions.prototype._clickSwitchs_game_isRmDamage = function () { - if (core.hasFlag('isRmDamage')) core.removeFlag('isRmDamage'); - else core.setFlag('isRmDamage', true); - core.ui._drawSwitchs_game(); - } - - - - - - /////////////////////////////// - // - // - //////////// - /// - /// - ///注册同名函数 - /// - /// - ///但是,对于register系列函数是无效的,例如直接复写core.control._animationFrame_globalAnimate函数是没有效果的。对于这种情况引入的函数,需要注册同名函数,可参见最下面的样例。 - /// - // - // - - /* - this.myGlobalAnimate = function (timestamp) { - // ...... 实际复写的函数内容 - } - - // 注册同名(globalAnimate)函数来覆盖系统原始内容 - core.registerAnimationFrame("globalAnimate", true, "myGlobalAnimate"); - */ - - this.mykeyDown = function (keyCode) { - if (!core.status.lockControl) return false; - // Ctrl跳过对话 - if (keyCode == 17) { - this.keyDownCtrl(); - return true; - } - switch (core.status.event.id) { - case 'action': - this._keyDownAction(keyCode); - break; - case 'book': - this._keyDownBook(keyCode); - break; - case 'fly': - this._keyDownFly(keyCode); - break; - case 'viewMaps': - this._keyDownViewMaps(keyCode); - break; - case 'equipbox': - this._keyDownEquipbox(keyCode); - break; - case 'toolbox': - this._keyDownToolbox(keyCode); - break; - case 'save': - case 'load': - case 'replayLoad': - case 'replayRemain': - case 'replaySince': - this._keyDownSL(keyCode); - break; - case 'selectShop': - case 'switchs': - case 'switchs-sounds': - case 'switchs-display': - case 'switchs-action': - case 'switchs-game': - case 'notes': - case 'settings': - case 'syncSave': - case 'syncSelect': - case 'localSaveSelect': - case 'storageRemove': - case 'replay': - case 'gameInfo': - this._keyDownChoices(keyCode); - break; - case 'cursor': - this._keyDownCursor(keyCode); - break; - } - return true; - } - core.registerAction('keyDown', '_sys_keyDown_lockControl', this.mykeyDown, 50); - - - this.mykeyUp = function (keyCode, altKey) { - if (!core.status.lockControl) return false; - - var ok = function () { - return keyCode == 27 || keyCode == 88 || keyCode == 13 || keyCode == 32 || keyCode == 67; - } - - core.status.holdingKeys = []; - switch (core.status.event.id) { - case 'text': - ok() && core.drawText(); - break; - case 'confirmBox': - this._keyUpConfirmBox(keyCode); - break; - case 'action': - this._keyUpAction(keyCode); - break; - case 'about': - ok() && core.closePanel(); - break; - case 'help': - ok() && core.closePanel(); - break; - case 'book': - this._keyUpBook(keyCode); - break; - case 'book-detail': - ok() && this._clickBookDetail(); - break; - case 'fly': - this._keyUpFly(keyCode); - break; - case 'viewMaps': - this._keyUpViewMaps(keyCode); - break; - case 'selectShop': - this._keyUpQuickShop(keyCode); - break; - case 'toolbox': - this._keyUpToolbox(keyCode); - break; - case 'equipbox': - this._keyUpEquipbox(keyCode, altKey); - break; - case 'save': - case 'load': - case 'replayLoad': - case 'replayRemain': - case 'replaySince': - this._keyUpSL(keyCode); - break; - case 'keyBoard': - ok() && core.closePanel(); - break; - case 'switchs': - this._keyUpSwitchs(keyCode); - break; - case 'switchs-sounds': - this._keyUpSwitchs_sounds(keyCode); - break; - case 'switchs-display': - this._keyUpSwitchs_display(keyCode); - break; - case 'switchs-action': - this._keyUpSwitchs_action(keyCode); - break; - case 'switchs-game': - this._keyUpSwitchs_game(keyCode); - break; - case 'settings': - this._keyUpSettings(keyCode); - break; - case 'notes': - this._keyUpNotes(keyCode); - break; - case 'syncSave': - this._keyUpSyncSave(keyCode); - break; - case 'syncSelect': - this._keyUpSyncSelect(keyCode); - break; - case 'localSaveSelect': - this._keyUpLocalSaveSelect(keyCode); - break; - case 'storageRemove': - this._keyUpStorageRemove(keyCode); - break; - case 'cursor': - this._keyUpCursor(keyCode); - break; - case 'replay': - this._keyUpReplay(keyCode); - break; - case 'gameInfo': - this._keyUpGameInfo(keyCode); - break; - case 'centerFly': - this._keyUpCenterFly(keyCode); - break; - } - return true; - } - core.registerAction('keyUp', '_sys_keyUp_lockControl', this.mykeyUp, 50); - - - this.myondown = function (x, y, px, py) { - if (core.status.played && !core.status.lockControl) return false; - - switch (core.status.event.id) { - case 'centerFly': - this._clickCenterFly(x, y, px, py); - break; - case 'book': - this._clickBook(x, y, px, py); - break; - case 'book-detail': - this._clickBookDetail(x, y, px, py); - break; - case 'fly': - this._clickFly(x, y, px, py); - break; - case 'viewMaps': - this._clickViewMaps(x, y, px, py); - break; - case 'switchs': - this._clickSwitchs(x, y, px, py); - break; - case 'switchs-sounds': - this._clickSwitchs_sounds(x, y, px, py); - break; - case 'switchs-display': - this._clickSwitchs_display(x, y, px, py); - break; - case 'switchs-action': - this._clickSwitchs_action(x, y, px, py); - break; - case 'switchs-game': - this._clickSwitchs_game(x, y, px, py); - break; - case 'settings': - this._clickSettings(x, y, px, py); - break; - case 'selectShop': - this._clickQuickShop(x, y, px, py); - break; - case 'equipbox': - this._clickEquipbox(x, y, px, py); - break; - case 'toolbox': - this._clickToolbox(x, y, px, py); - break; - case 'save': - case 'load': - case 'replayLoad': - case 'replayRemain': - case 'replaySince': - this._clickSL(x, y, px, py); - break; - case 'confirmBox': - this._clickConfirmBox(x, y, px, py); - break; - case 'keyBoard': - this._clickKeyBoard(x, y, px, py); - break; - case 'action': - this._clickAction(x, y, px, py); - break; - case 'text': - core.drawText(); - break; - case 'notes': - this._clickNotes(x, y, px, py); - break; - case 'syncSave': - this._clickSyncSave(x, y, px, py); - break; - case 'syncSelect': - this._clickSyncSelect(x, y, px, py); - break; - case 'localSaveSelect': - this._clickLocalSaveSelect(x, y, px, py); - break; - case 'storageRemove': - this._clickStorageRemove(x, y, px, py); - break; - case 'cursor': - this._clickCursor(x, y, px, py); - break; - case 'replay': - this._clickReplay(x, y, px, py); - break; - case 'gameInfo': - this._clickGameInfo(x, y, px, py); - break; - case 'about': - case 'help': - core.ui.closePanel(); - break; - } - - // --- 长按判定 - if (core.timeout.onDownTimeout == null) { - core.timeout.onDownTimeout = setTimeout(function () { - if (core.interval.onDownInterval == null) { - core.interval.onDownInterval = setInterval(function () { - if (!core.actions.longClick(x, y, px, py)) { - clearInterval(core.interval.onDownInterval); - core.interval.onDownInterval = null; - } - }, 40) - } - }, 500); - } - return true; - } - core.registerAction('ondown', '_sys_ondown_lockControl', this.myondown, 30); - - this.myonmove = function (x, y, px, py) { - if (!core.status.lockControl) return false; - - switch (core.status.event.id) { - case 'action': - if (core.status.event.data.type == 'choices') { - this._onMoveChoices(x, y); - return true; - } - if (core.status.event.data.type == 'confirm') { - this._onMoveConfirmBox(x, y, px, py); - return true; - } - break; - case 'selectShop': - case 'switchs': - case 'switchs-sounds': - case 'switchs-display': - case 'switchs-action': - case 'switchs-game': - case 'notes': - case 'settings': - case 'syncSave': - case 'syncSelect': - case 'localSaveSelect': - case 'storageRemove': - case 'replay': - case 'gameInfo': - this._onMoveChoices(x, y); - return true; - case 'confirmBox': - this._onMoveConfirmBox(x, y, px, py); - return true; - default: - break; - } - return false; - } - core.registerAction('onmove', '_sys_onmove_choices', this.myonmove, 30); - }, "怪物受击发亮": function () { // 在此增加新插件