mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-25 16:43:24 +08:00
refactor: 章节显示
This commit is contained in:
parent
5e4a8c1eb3
commit
2d3146758b
@ -35,7 +35,7 @@ main.floors.MT0=
|
|||||||
"\r[red]注意!!!\r[]该塔新增了很多新的功能,同时对样板的ui进行了大幅度的改动,操作也有改变,由于内容过多,这里不再一一描述,具体请在道具栏查看百科全书!!百科全书是在你面前的几个道具中的其中一个",
|
"\r[red]注意!!!\r[]该塔新增了很多新的功能,同时对样板的ui进行了大幅度的改动,操作也有改变,由于内容过多,这里不再一一描述,具体请在道具栏查看百科全书!!百科全书是在你面前的几个道具中的其中一个",
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"function": "function(){\ncore.plugin.gameUi.showChapter('序章 起源');\n}"
|
"function": "function(){\nmota.ui.fixed.open('chapter', { chapter: '序章 起源' });\n}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parallelDo": "",
|
"parallelDo": "",
|
||||||
|
@ -157,7 +157,7 @@ main.floors.MT21=
|
|||||||
"\t[低级智人]\b[up,hero]或许智慧结晶会告诉我答案吧。",
|
"\t[低级智人]\b[up,hero]或许智慧结晶会告诉我答案吧。",
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"function": "function(){\ncore.plugin.gameUi.showChapter('第二章 智慧');\ncore.plugin.removeMap.removeMaps('tower1', 'tower7', true);\ndelete flags.tower1;\ndelete flags.wordsTimeOut;\ndelete flags.boom;\ndelete flags.booming;\n}"
|
"function": "function(){\nmota.ui.fixed.open('chapter', { chapter: '第二章 智慧' });\ncore.plugin.removeMap.removeMaps('tower1', 'tower7', true);\ndelete flags.tower1;\ndelete flags.wordsTimeOut;\ndelete flags.boom;\ndelete flags.booming;\n}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "setValue",
|
"type": "setValue",
|
||||||
|
@ -63,7 +63,7 @@ main.floors.MT6=
|
|||||||
"\t[原始人]\b[down,hero]感觉好像可以学习一些简单的东西了。",
|
"\t[原始人]\b[down,hero]感觉好像可以学习一些简单的东西了。",
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"function": "function(){\ncore.plugin.gameUi.showChapter('第一章 勇气');\n}"
|
"function": "function(){\nmota.ui.fixed.open('chapter', { chapter: '第一章 勇气' });\n}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "setValue",
|
"type": "setValue",
|
||||||
|
@ -18,10 +18,8 @@ interface AncTePlugin {
|
|||||||
utils: ReturnType<typeof import('../plugin/utils').default>;
|
utils: ReturnType<typeof import('../plugin/utils').default>;
|
||||||
status: ReturnType<typeof import('../plugin/ui/statusBar').default>;
|
status: ReturnType<typeof import('../plugin/ui/statusBar').default>;
|
||||||
mark: ReturnType<typeof import('../plugin/mark').default>;
|
mark: ReturnType<typeof import('../plugin/mark').default>;
|
||||||
chapter: ReturnType<typeof import('../plugin/ui/chapter').default>;
|
|
||||||
fly: ReturnType<typeof import('../plugin/ui/fly').default>;
|
fly: ReturnType<typeof import('../plugin/ui/fly').default>;
|
||||||
chase: ReturnType<typeof import('../plugin/chase/chase').default>;
|
chase: ReturnType<typeof import('../plugin/chase/chase').default>;
|
||||||
fixed: ReturnType<typeof import('../plugin/ui/fixed').default>;
|
|
||||||
webglUtils: ReturnType<typeof import('../plugin/webgl/utils').default>;
|
webglUtils: ReturnType<typeof import('../plugin/webgl/utils').default>;
|
||||||
shadow: ReturnType<typeof import('../plugin/shadow/shadow').default>;
|
shadow: ReturnType<typeof import('../plugin/shadow/shadow').default>;
|
||||||
gameShadow: ReturnType<
|
gameShadow: ReturnType<
|
||||||
|
@ -5,7 +5,6 @@ import animate from '@/plugin/animateController';
|
|||||||
import utils from '@/plugin/utils';
|
import utils from '@/plugin/utils';
|
||||||
import status from '@/plugin/ui/statusBar';
|
import status from '@/plugin/ui/statusBar';
|
||||||
import mark from '@/plugin/mark';
|
import mark from '@/plugin/mark';
|
||||||
import chapter from '@/plugin/ui/chapter';
|
|
||||||
import fly from '@/plugin/ui/fly';
|
import fly from '@/plugin/ui/fly';
|
||||||
import chase from '@/plugin/chase/chase';
|
import chase from '@/plugin/chase/chase';
|
||||||
import webglUtils from '@/plugin/webgl/utils';
|
import webglUtils from '@/plugin/webgl/utils';
|
||||||
@ -29,7 +28,6 @@ export function resolvePlugin() {
|
|||||||
['utils', utils()],
|
['utils', utils()],
|
||||||
['status', status()],
|
['status', status()],
|
||||||
['mark', mark()],
|
['mark', mark()],
|
||||||
['chapter', chapter()],
|
|
||||||
['fly', fly()],
|
['fly', fly()],
|
||||||
['chase', chase()],
|
['chase', chase()],
|
||||||
['webglUtils', webglUtils()],
|
['webglUtils', webglUtils()],
|
||||||
|
@ -5,7 +5,6 @@ export {};
|
|||||||
if (main.replayChecking)
|
if (main.replayChecking)
|
||||||
return (core.plugin.gameUi = {
|
return (core.plugin.gameUi = {
|
||||||
openItemShop: () => 0,
|
openItemShop: () => 0,
|
||||||
showChapter: () => 0,
|
|
||||||
openSkill: () => 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() {
|
function openSkill() {
|
||||||
if (core.isReplaying()) return;
|
if (core.isReplaying()) return;
|
||||||
mota.ui.main.open('skill');
|
mota.ui.main.open('skill');
|
||||||
@ -99,7 +92,6 @@ export {};
|
|||||||
|
|
||||||
core.plugin.gameUi = {
|
core.plugin.gameUi = {
|
||||||
openItemShop,
|
openItemShop,
|
||||||
openSkill,
|
openSkill
|
||||||
showChapter
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
@ -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,51 +1,8 @@
|
|||||||
import { cloneDeep, debounce } from 'lodash-es';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { getDamageColor } from '../utils';
|
import { getDamageColor } from '../utils';
|
||||||
import { ToShowEnemy, detailInfo } from './book';
|
import { ToShowEnemy } from './book';
|
||||||
import { DamageEnemy } from '../game/enemy/damage';
|
import { DamageEnemy } from '../game/enemy/damage';
|
||||||
import { isMobile } from '../use';
|
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 {
|
export function getLocFromMouseLoc(x: number, y: number): LocArr {
|
||||||
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
||||||
const my = Math.round(y + core.bigmap.offsetY / 32);
|
const my = Math.round(y + core.bigmap.offsetY / 32);
|
||||||
|
6
src/types/plugin.d.ts
vendored
6
src/types/plugin.d.ts
vendored
@ -177,12 +177,6 @@ interface PluginUis {
|
|||||||
/** 是否展示标记的怪物 */
|
/** 是否展示标记的怪物 */
|
||||||
readonly showMarkedEnemy: Ref<boolean>;
|
readonly showMarkedEnemy: Ref<boolean>;
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示章节
|
|
||||||
* @param chapter 显示的文字
|
|
||||||
*/
|
|
||||||
showChapter(chapter: string): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开技能查看界面
|
* 打开技能查看界面
|
||||||
*/
|
*/
|
||||||
|
@ -6,12 +6,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Animation, hyper, power, sleep } from 'mutate-animate';
|
import { Animation, hyper, sleep } from 'mutate-animate';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import { has } from '../plugin/utils';
|
import { has } from '../plugin/utils';
|
||||||
import { chapterShowed } from '../plugin/ui/chapter';
|
import { GameUi } from '@/core/main/custom/ui';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
num: number;
|
||||||
|
ui: GameUi;
|
||||||
chapter: string;
|
chapter: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ onMounted(async () => {
|
|||||||
const ani = new Animation();
|
const ani = new Animation();
|
||||||
const w = window.innerWidth * devicePixelRatio;
|
const w = window.innerWidth * devicePixelRatio;
|
||||||
const h = window.innerHeight * devicePixelRatio;
|
const h = window.innerHeight * devicePixelRatio;
|
||||||
ctx.font = '5vh scroll';
|
ctx.font = '5vh normal';
|
||||||
const textWidth = ctx.measureText(props.chapter).width;
|
const textWidth = ctx.measureText(props.chapter).width;
|
||||||
const line = h * 0.05;
|
const line = h * 0.05;
|
||||||
ani.register('rect', 0);
|
ani.register('rect', 0);
|
||||||
@ -54,7 +56,7 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (time >= 4050) {
|
if (time >= 4050) {
|
||||||
chapterShowed.value = false;
|
mota.ui.fixed.close(props.num);
|
||||||
ani.ticker.destroy();
|
ani.ticker.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user