mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-06-09 08:57:58 +08:00
fix: 构建
This commit is contained in:
parent
877a6644c8
commit
fb83588df5
@ -5,7 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node-esm script/dev.ts",
|
"dev": "ts-node-esm script/dev.ts",
|
||||||
"build": "vue-tsc --noEmit && ts-node-esm script/build.ts dist",
|
"build": "vue-tsc --noEmit && pnpm docs:build && ts-node-esm script/build.ts dist",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"update": "ts-node-esm script/update.ts",
|
"update": "ts-node-esm script/update.ts",
|
||||||
"declare": "ts-node-esm script/declare.ts",
|
"declare": "ts-node-esm script/declare.ts",
|
||||||
|
@ -114,16 +114,7 @@ const compress = type === 'dist';
|
|||||||
'./dist/types/plugin.d.ts',
|
'./dist/types/plugin.d.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
const rep = pluginDTS.replace(
|
const rep = pluginDTS.replaceAll(`../game/system`, `../index.d.ts`);
|
||||||
`declare const Mota: import('../game/system').IMota;
|
|
||||||
interface Window {
|
|
||||||
Mota: import('../game/system').IMota;
|
|
||||||
}`,
|
|
||||||
`declare const Mota: import('./index.d.ts').IMota;
|
|
||||||
interface Window {
|
|
||||||
Mota: import('./index.d.ts').IMota;
|
|
||||||
}`
|
|
||||||
);
|
|
||||||
await fs.writeFile('./dist/types/plugin.d.ts', rep);
|
await fs.writeFile('./dist/types/plugin.d.ts', rep);
|
||||||
|
|
||||||
const js = ['functions.js', 'plugins.js'];
|
const js = ['functions.js', 'plugins.js'];
|
||||||
@ -154,7 +145,15 @@ interface Window {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8. 压缩
|
// 8. 文档
|
||||||
|
try {
|
||||||
|
await fs.move('./docs/.vitepress/dist', './dist/_docs');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('移动文档失败');
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 9. 压缩
|
||||||
if (compress) {
|
if (compress) {
|
||||||
try {
|
try {
|
||||||
await fs.ensureDir('./out');
|
await fs.ensureDir('./out');
|
||||||
|
@ -47,14 +47,14 @@ import * as statusBarTools from '@/plugin/ui/statusBar';
|
|||||||
import * as toolboxTools from '@/plugin/ui/toolbox';
|
import * as toolboxTools from '@/plugin/ui/toolbox';
|
||||||
import * as UI from '@ui/index';
|
import * as UI from '@ui/index';
|
||||||
import Box from '@/components/box.vue';
|
import Box from '@/components/box.vue';
|
||||||
import BoxAnimate from '@/components/boxAnimate.vue.vue';
|
import BoxAnimate from '@/components/boxAnimate.vue';
|
||||||
import Colomn from '@/components/colomn.vue.vue';
|
import Colomn from '@/components/colomn.vue';
|
||||||
import EnemyOne from '@/components/enemyOne.vue.vue';
|
import EnemyOne from '@/components/enemyOne.vue';
|
||||||
import Scroll from '@/components/scroll.vue.vue';
|
import Scroll from '@/components/scroll.vue';
|
||||||
import EnemyCritical from '@/panel/enemyCritical.vue';
|
import EnemyCritical from '@/panel/enemyCritical.vue';
|
||||||
import EnemySpecial from '@/panel/enemySpecial.vue.vue';
|
import EnemySpecial from '@/panel/enemySpecial.vue';
|
||||||
import EnemyTarget from '@/panel/enemyTarget.vue.vue';
|
import EnemyTarget from '@/panel/enemyTarget.vue';
|
||||||
import KeyboardPanel from '@/panel/keyboard.vue.vue';
|
import KeyboardPanel from '@/panel/keyboard.vue';
|
||||||
import { MCGenerator } from './main/layout';
|
import { MCGenerator } from './main/layout';
|
||||||
|
|
||||||
// ----- 类注册
|
// ----- 类注册
|
||||||
|
@ -438,9 +438,6 @@ gameKey
|
|||||||
.realize('viewMap', () => {
|
.realize('viewMap', () => {
|
||||||
core.ui._drawViewMaps();
|
core.ui._drawViewMaps();
|
||||||
})
|
})
|
||||||
.realize('skillTree', () => {
|
|
||||||
core.useItem('skill1', true);
|
|
||||||
})
|
|
||||||
.realize('undo', () => {
|
.realize('undo', () => {
|
||||||
core.doSL('autoSave', 'load');
|
core.doSL('autoSave', 'load');
|
||||||
})
|
})
|
||||||
|
337
src/types/plugin.d.ts
vendored
337
src/types/plugin.d.ts
vendored
@ -14,342 +14,7 @@ type CanParseCss = keyof {
|
|||||||
: never]: CSSStyleDeclaration[P];
|
: never]: CSSStyleDeclaration[P];
|
||||||
};
|
};
|
||||||
|
|
||||||
interface PluginDeclaration
|
interface PluginDeclaration {}
|
||||||
extends PluginUtils,
|
|
||||||
PluginUis,
|
|
||||||
PluginUse,
|
|
||||||
MiniMap,
|
|
||||||
PluginAchievement {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
utils: GamePluginUtils;
|
|
||||||
loopMap: GamePluginLoopMap;
|
|
||||||
skillTree: GamePluginSkillTree;
|
|
||||||
study: GamePluginStudy;
|
|
||||||
hero: GamePluginHeroRealStatus;
|
|
||||||
replay: PluginReplay;
|
|
||||||
chase: PluginChase;
|
|
||||||
|
|
||||||
skills: Record<Chapter, Skill[]>;
|
|
||||||
skillEffects: SkillEffects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加函数 例:添加弹出文字,像这个就可以使用core.addPop或core.plugin.addPop调用
|
|
||||||
* @param px 弹出的横坐标
|
|
||||||
* @param py 弹出的纵坐标
|
|
||||||
* @param value 弹出的文字
|
|
||||||
*/
|
|
||||||
addPop(px: number, py: number, value: string): void;
|
|
||||||
|
|
||||||
/** 添加变量 例:所有的正在弹出的文字,像这个就可以使用core.plugin.pop获取 */
|
|
||||||
pop: any[];
|
|
||||||
|
|
||||||
/** 状态栏信息,取反后刷新状态栏 */
|
|
||||||
readonly statusBarStatus: Ref<boolean>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加一个动画
|
|
||||||
* @param fn 要添加的函数
|
|
||||||
*/
|
|
||||||
addAnimate(fn: (time: number) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除一个动画
|
|
||||||
* @param fn 要移除的函数
|
|
||||||
*/
|
|
||||||
removeAnimate(fn: (time: number) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判定一个值是否不是undefined或null
|
|
||||||
* @param value 要判断的值
|
|
||||||
*/
|
|
||||||
has<T>(value: T): value is NonNullable<T>;
|
|
||||||
|
|
||||||
applyFragWith(
|
|
||||||
canvas: HTMLCanvasElement,
|
|
||||||
length?: number,
|
|
||||||
time?: number
|
|
||||||
): {
|
|
||||||
canvas: HTMLCanvasElement;
|
|
||||||
onEnd: Promise<void>;
|
|
||||||
animation: import('mutate-animate').Animation;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GamePluginUtils {
|
|
||||||
/**
|
|
||||||
* 判定一个值是否不是undefined或null
|
|
||||||
* @param value 要判断的值
|
|
||||||
*/
|
|
||||||
has<T>(value: T): value is NonNullable<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 滑动数组
|
|
||||||
* @param arr 数组
|
|
||||||
* @param delta 偏移量,正数表示向右滑动,负数表示向左滑动
|
|
||||||
*/
|
|
||||||
slide<T>(arr: T[], delta: number): T[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取方向的反方向
|
|
||||||
* @param dir 方向
|
|
||||||
*/
|
|
||||||
backDir(dir: Dir): Dir;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最大化游戏缩放
|
|
||||||
* @param n 最大缩放再少多少个缩放
|
|
||||||
*/
|
|
||||||
maxGameScale(n?: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GamePluginLoopMap {
|
|
||||||
checkLoopMap(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginUtils {
|
|
||||||
/**
|
|
||||||
* 判定一个值是否不是undefined或null
|
|
||||||
* @param value 要判断的值
|
|
||||||
*/
|
|
||||||
has<T>(value: T): value is NonNullable<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据伤害大小获取颜色
|
|
||||||
* @param damage 伤害大小
|
|
||||||
*/
|
|
||||||
getDamageColor(damage: number): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析css字符串为CSSStyleDeclaration对象
|
|
||||||
* @param css 要解析的css字符串
|
|
||||||
*/
|
|
||||||
parseCss(css: string): Partial<Record<CanParseCss, string>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 弹出一段提示
|
|
||||||
* @param text 提示信息
|
|
||||||
*/
|
|
||||||
tip(
|
|
||||||
type: 'warn' | 'info' | 'success' | 'error' | 'warning' | 'loading',
|
|
||||||
text: string
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始一个追逐战
|
|
||||||
* @param index 追逐战索引
|
|
||||||
*/
|
|
||||||
startChase(index: number): Promise<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginUis {
|
|
||||||
/** 是否正在进行章节显示 */
|
|
||||||
readonly chapterShowed: Ref<boolean>;
|
|
||||||
|
|
||||||
/** 章节显示的内容 */
|
|
||||||
readonly chapterContent: Ref<boolean>;
|
|
||||||
|
|
||||||
/** 是否展示标记的怪物 */
|
|
||||||
readonly showMarkedEnemy: Ref<boolean>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开技能查看界面
|
|
||||||
*/
|
|
||||||
openSkill(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginUse {
|
|
||||||
/** 是否是移动设备 */
|
|
||||||
readonly isMobile: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向一个元素添加拖拽事件
|
|
||||||
* @param ele 目标元素
|
|
||||||
* @param fn 推拽时触发的函数,传入x y和鼠标事件或点击事件
|
|
||||||
* @param ondown 鼠标按下时执行的函数
|
|
||||||
* @param global 是否全局拖拽,即拖拽后鼠标或手指离开元素后是否依然视为正在拖拽
|
|
||||||
*/
|
|
||||||
useDrag(
|
|
||||||
ele: HTMLElement,
|
|
||||||
fn: DragFn,
|
|
||||||
ondown?: DragFn,
|
|
||||||
onUp?: (e: MouseEvent | TouchEvent) => void,
|
|
||||||
global?: boolean
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 去除一个全局拖拽函数
|
|
||||||
* @param fn 要去除的函数
|
|
||||||
*/
|
|
||||||
cancelGlobalDrag(fn: DragFn): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当触发滚轮时执行函数
|
|
||||||
* @param ele 目标元素
|
|
||||||
* @param fn 当滚轮触发时执行的函数
|
|
||||||
*/
|
|
||||||
useWheel(
|
|
||||||
ele: HTMLElement,
|
|
||||||
fn: (x: number, y: number, z: number, e: WheelEvent) => void
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当鼠标或手指松开时执行函数
|
|
||||||
* @param ele 目标元素
|
|
||||||
* @param fn 当鼠标或手指松开时执行的函数
|
|
||||||
*/
|
|
||||||
useUp(ele: HTMLElement, fn: DragFn): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GamePluginSkillTree {
|
|
||||||
/**
|
|
||||||
* 获取技能等级
|
|
||||||
* @param skill 技能索引
|
|
||||||
*/
|
|
||||||
getSkillLevel(skill: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引获取技能
|
|
||||||
* @param index 索引
|
|
||||||
*/
|
|
||||||
getSkillFromIndex(index: number): Skill;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取技能的消耗
|
|
||||||
* @param skill 技能
|
|
||||||
*/
|
|
||||||
getSkillConsume(skill: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 升级技能
|
|
||||||
* @param skill 技能索引
|
|
||||||
*/
|
|
||||||
upgradeSkill(skill: number): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存技能树等级
|
|
||||||
*/
|
|
||||||
saveSkillTree(): number[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载技能树等级
|
|
||||||
* @param data 等级信息
|
|
||||||
*/
|
|
||||||
loadSkillTree(data: number[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MiniMap {
|
|
||||||
/**
|
|
||||||
* 切分区域
|
|
||||||
*/
|
|
||||||
splitArea(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GamePluginStudy {
|
|
||||||
/**
|
|
||||||
* 学习一个怪物技能
|
|
||||||
* @param enemy 被学习的怪物
|
|
||||||
* @param num 技能的索引
|
|
||||||
*/
|
|
||||||
studySkill(enemy: Enemy, num: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GamePluginHeroRealStatus {
|
|
||||||
/**
|
|
||||||
* 获取勇士在某一点的属性
|
|
||||||
* @param name 要获取的勇士属性
|
|
||||||
* @param x 勇士所在横坐标
|
|
||||||
* @param y 勇士所在纵坐标
|
|
||||||
* @param floorId 勇士所在楼层
|
|
||||||
*/
|
|
||||||
getHeroStatusOn(name: 'all', floorId?: FloorIds): HeroStatus;
|
|
||||||
getHeroStatusOn(
|
|
||||||
name: (keyof HeroStatus)[],
|
|
||||||
floorId?: FloorIds
|
|
||||||
): Partial<HeroStatus>;
|
|
||||||
getHeroStatusOn<K extends keyof HeroStatus>(
|
|
||||||
name: K,
|
|
||||||
floorId?: FloorIds
|
|
||||||
): HeroStatus[K];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取一定状态下的勇士在某一点的属性
|
|
||||||
* @param status 勇士的状态
|
|
||||||
* @param name 要获取的勇士属性
|
|
||||||
* @param x 勇士所在横坐标
|
|
||||||
* @param y 勇士所在纵坐标
|
|
||||||
* @param floorId 勇士所在楼层
|
|
||||||
*/
|
|
||||||
getHeroStatusOf(
|
|
||||||
status: Partial<HeroStatus>,
|
|
||||||
name: 'all',
|
|
||||||
floorId?: FloorIds
|
|
||||||
): HeroStatus;
|
|
||||||
getHeroStatusOf(
|
|
||||||
status: Partial<HeroStatus>,
|
|
||||||
name: (keyof HeroStatus)[],
|
|
||||||
floorId?: FloorIds
|
|
||||||
): Partial<HeroStatus>;
|
|
||||||
getHeroStatusOf<K extends keyof HeroStatus>(
|
|
||||||
status: Partial<HeroStatus>,
|
|
||||||
name: K,
|
|
||||||
floorId?: FloorIds
|
|
||||||
): HeroStatus[K];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginAchievement {
|
|
||||||
/**
|
|
||||||
* 完成一个成就
|
|
||||||
* @param type 成就类型
|
|
||||||
* @param index 成就索引
|
|
||||||
*/
|
|
||||||
completeAchievement(type: AchievementType, index: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否完成了某个成就
|
|
||||||
* @param type 成就类型
|
|
||||||
* @param index 成就索引
|
|
||||||
*/
|
|
||||||
hasCompletedAchievement(type: AchievementType, index: number): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前成就点数
|
|
||||||
*/
|
|
||||||
getNowPoint(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查所有到达过的楼层,用于成就的计算
|
|
||||||
*/
|
|
||||||
checkVisitedFloor(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginReplay {
|
|
||||||
ready(): void;
|
|
||||||
readyClip(): number;
|
|
||||||
clip(...replace: string[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PluginChase {
|
|
||||||
chaseInit1(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SkillEffects {
|
|
||||||
jumpIgnoreFloor: FloorIds[];
|
|
||||||
}
|
|
||||||
|
|
||||||
type Chapter = 'chapter1' | 'chapter2';
|
|
||||||
|
|
||||||
interface Skill {
|
|
||||||
index: number;
|
|
||||||
title: string;
|
|
||||||
desc: string[];
|
|
||||||
consume: string;
|
|
||||||
front: LocArr[];
|
|
||||||
loc: LocArr;
|
|
||||||
max: number;
|
|
||||||
effect: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
type Forward<T> = {
|
type Forward<T> = {
|
||||||
[K in keyof T as T[K] extends Function
|
[K in keyof T as T[K] extends Function
|
||||||
|
Loading…
Reference in New Issue
Block a user