refactor: 章节显示

This commit is contained in:
AncTe committed 2023-11-13 12:53:22 +08:00
1 parent 5e4a8c1eb3
commit 2d3146758b
10 files changed
+12 -79

No files matched your search

+1 -9
View File
@@ -5,7 +5,6 @@ export {};
if (main.replayChecking)
return (core.plugin.gameUi = {
openItemShop: () => 0,
showChapter: () => 0,
openSkill: () => 0
});
@@ -86,12 +85,6 @@ export {};
}
};
function showChapter(chapter) {
if (core.isReplaying()) return;
mota.plugin.chapter.chapterContent.value = chapter;
mota.plugin.chapter.chapterShowed.value = true;
}
function openSkill() {
if (core.isReplaying()) return;
mota.ui.main.open('skill');
@@ -99,7 +92,6 @@ export {};
core.plugin.gameUi = {
openItemShop,
openSkill,
showChapter
openSkill
};
})();
-8
View File
@@ -1,8 +0,0 @@
import { ref } from 'vue';
export const chapterShowed = ref(false);
export const chapterContent = ref('');
export default function init() {
return { chapterShowed, chapterContent };
}
+1 -44
View File
@@ -1,51 +1,8 @@
import { cloneDeep, debounce } from 'lodash-es';
import { ref } from 'vue';
import { getDamageColor } from '../utils';
import { ToShowEnemy, detailInfo } from './book';
import { ToShowEnemy } from './book';
import { DamageEnemy } from '../game/enemy/damage';
import { isMobile } from '../use';
// export const showFixed = ref(false);
// let lastId: EnemyIds;
// const show = debounce((ev: MouseEvent) => {
// if (!window.flags) return;
// if (!flags.mouseLoc) return;
// flags.clientLoc = [ev.clientX, ev.clientY];
// const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
// const e = core.status.thisMap.enemy.list.find(v => {
// return v.x === mx && v.y === my;
// });
// if (!e) return;
// lastId = e.id;
// const detail = getDetailedEnemy(e);
// detailInfo.enemy = detail;
// showFixed.value = true;
// }, 200);
// export default function init() {
// const data = core.canvas.data.canvas;
// data.addEventListener('mousemove', ev => {
// if (!core.isPlaying() || core.status.lockControl) return;
// const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
// const e = core.getBlockId(mx, my);
// if (e !== lastId) showFixed.value = false;
// if (!e) return;
// show(ev);
// });
// data.addEventListener('mousedown', ev => {
// showFixed.value = false;
// });
// return {
// showFixed
// };
// }
export function getLocFromMouseLoc(x: number, y: number): LocArr {
const mx = Math.round(x + core.bigmap.offsetX / 32);
const my = Math.round(y + core.bigmap.offsetY / 32);