mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-28 17:37:07 +08:00
fix: 怪物手册前后移动5个 & 编辑器大地图绘制
This commit is contained in:
parent
f8a1ea503c
commit
ec5381e2bb
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
@ -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();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user