diff --git a/public/libs/maps.js b/public/libs/maps.js index 2b47928..ddf6620 100644 --- a/public/libs/maps.js +++ b/public/libs/maps.js @@ -1485,28 +1485,32 @@ maps.prototype.drawMap = function (floorId) { core.extractBlocks(floorId); core.status.thisMap = core.status.maps[floorId]; - // this._drawMap_drawAll(); - // if (core.status.curtainColor) { - // core.fillRect( - // 'curtain', - // 0, - // 0, - // core._PX_, - // core._PY_, - // core.arrayToRGBA(core.status.curtainColor) - // ); - // } - // core.drawHero(); + if (main.mode === 'editor') { + this._drawMap_drawAll(); + if (core.status.curtainColor) { + core.fillRect( + 'curtain', + 0, + 0, + core._PX_, + core._PY_, + core.arrayToRGBA(core.status.curtainColor) + ); + } + core.drawHero(); + } core.updateStatusBar(); }; ////// 重绘某张地图 ////// maps.prototype.redrawMap = function () { - // core.bigmap.canvas.forEach(function (one) { - // core.clearMap(one); - // }); - // this._drawMap_drawAll(null, { redraw: true }); - // core.drawDamage(); + if (main.mode === 'editor') { + core.bigmap.canvas.forEach(function (one) { + core.clearMap(one); + }); + this._drawMap_drawAll(null, { redraw: true }); + core.drawDamage(); + } }; maps.prototype._drawMap_drawAll = function (floorId, config) { diff --git a/src/core/plugin.ts b/src/core/plugin.ts index 4e54ee9..75b09f8 100644 --- a/src/core/plugin.ts +++ b/src/core/plugin.ts @@ -24,7 +24,6 @@ import * as pop from '@/plugin/pop'; import * as frag from '@/plugin/fx/frag'; import * as use from '@/plugin/use'; import * as gameCanvas from '@/plugin/fx/gameCanvas'; -import * as smooth from '@/plugin/fx/smoothView'; import * as animateController from '@/plugin/animateController'; Mota.Plugin.register('fly_r', fly); @@ -34,7 +33,6 @@ Mota.Plugin.register('pop_r', pop, pop.init); Mota.Plugin.register('frag_r', frag, frag.init); Mota.Plugin.register('use_r', use); Mota.Plugin.register('gameCanvas_r', gameCanvas); -Mota.Plugin.register('smooth_r', smooth, smooth.init); Mota.Plugin.register( 'animateController_r', animateController, diff --git a/src/plugin/fx/smoothView.ts b/src/plugin/fx/smoothView.ts deleted file mode 100644 index 75d95cc..0000000 --- a/src/plugin/fx/smoothView.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { debounce } from 'lodash-es'; -import { Transition, hyper } from 'mutate-animate'; - -const tran = new Transition(); -tran.value.x = 0; -tran.value.y = 0; - -let needSmooth = false; - -export function init() { - const setting = Mota.require('var', 'mainSetting'); - - tran.ticker.add(() => { - if (core.isPlaying() && needSmooth && !core.isReplaying()) { - core.setViewport(tran.value.x, tran.value.y); - } - }); - - const func = debounce(() => { - needSmooth = false; - }, 700); - - Mota.rewrite( - core.control, - '_drawHero_updateViewport', - 'full', - (x, y, offset) => { - const ox = core.clamp( - (x - core._HALF_WIDTH_) * 32 + offset.x, - 0, - Math.max(32 * core.bigmap.width - core._PX_, 0) - ); - const oy = core.clamp( - (y - core._HALF_HEIGHT_) * 32 + offset.y, - 0, - Math.max(32 * core.bigmap.height - core._PY_, 0) - ); - - tran.transition('x', ox).transition('y', oy); - - const t = setting.getValue('screen.smoothView', false); - if (!t || core.isReplaying()) { - core.bigmap.offsetX = ox; - core.bigmap.offsetY = oy; - core.control.updateViewport(); - return; - } - if (tran.easeTime > 0) { - needSmooth = true; - func(); - } else { - core.setViewport(tran.value.x, tran.value.y); - } - } - ); - - const hso = hyper('sin', 'out'); - let time2 = Date.now(); - Mota.rewrite(core.control, '_moveAction_moving', 'front', () => { - const f = core.status.floorId === 'tower6'; - const t = setting.getValue('screen.smoothView', false) && !f ? 200 : 0; - if (Date.now() - time2 > 20) tran.mode(hso).time(t).absolute(); - }); - Mota.rewrite(core.control, 'moveDirectly', 'front', () => { - const f = core.status.floorId === 'tower6'; - const t = setting.getValue('screen.smoothView', false) && !f ? 600 : 0; - time2 = Date.now(); - tran.mode(hso).time(t).absolute(); - }); - Mota.rewrite(core.events, '_changeFloor_beforeChange', 'front', () => { - tran.time(0).absolute(); - }); -} diff --git a/src/ui/book.vue b/src/ui/book.vue index d4b70c1..0dfad8a 100644 --- a/src/ui/book.vue +++ b/src/ui/book.vue @@ -174,10 +174,10 @@ setTimeout(() => { .realize( '@book_pageDown', () => { - if (selected.value <= 4) { - selected.value = 0; + if (selected.value >= enemy.length - 5) { + selected.value = enemy.length - 1; } else { - selected.value -= 5; + selected.value += 5; } checkScroll(); }, @@ -186,10 +186,10 @@ setTimeout(() => { .realize( '@book_pageUp', () => { - if (selected.value >= enemy.length - 5) { - selected.value = enemy.length - 1; + if (selected.value <= 4) { + selected.value = 0; } else { - selected.value += 5; + selected.value -= 5; } checkScroll(); },