mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-10 15:34:30 +08:00
ui控制系统
This commit is contained in:
1 parent
f3c96f7a07
commit
da771dae91
23 files changed
+6559
-3014
No files matched your search
Vendored
+7
-7
@@ -1,4 +1,4 @@
|
||||
type core = {
|
||||
type Core = {
|
||||
/** 地图的格子宽度 */
|
||||
readonly _WIDTH_: number;
|
||||
/** 地图的格子高度 */
|
||||
@@ -186,10 +186,10 @@ type core = {
|
||||
actions &
|
||||
Forward<PluginDeclaration>;
|
||||
|
||||
type main = {
|
||||
type Main = {
|
||||
/** 是否在录像验证中 */
|
||||
readonly replayChecking: boolean;
|
||||
readonly core: core;
|
||||
readonly core: Core;
|
||||
readonly dom: { [key: string]: HTMLElement };
|
||||
/** 游戏版本,发布后会被随机,请勿使用该属性 */
|
||||
readonly version: string;
|
||||
@@ -313,7 +313,7 @@ declare class Sprite {
|
||||
removeEventListenr: HTMLCanvasElement['addEventListener'];
|
||||
}
|
||||
|
||||
declare let main: main;
|
||||
declare let core: core;
|
||||
declare let flags: { [x: string]: any };
|
||||
declare let hero: HeroStatus;
|
||||
declare const main: main;
|
||||
declare const core: Core;
|
||||
declare const flags: { [x: string]: any };
|
||||
declare const hero: HeroStatus;
|
||||
Vendored
+37
@@ -1,5 +1,9 @@
|
||||
// 这里包含所有插件导出的函数及变量声明,声明的函数会在类型标注中标注到core上
|
||||
|
||||
type Ref<T> = {
|
||||
value: T;
|
||||
};
|
||||
|
||||
interface PluginDeclaration {
|
||||
/**
|
||||
* 添加函数 例:添加弹出文字,像这个就可以使用core.addPop或core.plugin.addPop调用
|
||||
@@ -11,6 +15,39 @@ interface PluginDeclaration {
|
||||
|
||||
/** 添加变量 例:所有的正在弹出的文字,像这个就可以使用core.plugin.pop获取 */
|
||||
pop: any[];
|
||||
|
||||
/** 手册是否打开 */
|
||||
readonly bookOpened: Ref<boolean>;
|
||||
|
||||
/** 手册详细信息 */
|
||||
readonly bookDetail: Ref<boolean>;
|
||||
|
||||
/** ui栈 */
|
||||
readonly uiStack: Ref<Component[]>;
|
||||
|
||||
/**
|
||||
* 向一个元素添加拖拽事件
|
||||
* @param ele 目标元素
|
||||
* @param fn 推拽时触发的函数,传入x y和鼠标事件或点击事件
|
||||
* @param ondown 鼠标按下时执行的函数
|
||||
* @param global 是否全局拖拽,即拖拽后鼠标或手指离开元素后是否依然视为正在拖拽
|
||||
*/
|
||||
useDrag(
|
||||
ele: HTMLElement,
|
||||
fn: (x: number, y: number, e: MouseEvent | TouchEvent) => void,
|
||||
ondown?: (x: number, y: number, e: MouseEvent | TouchEvent) => void,
|
||||
global: boolean = false
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 当触发滚轮时执行函数
|
||||
* @param ele 目标元素
|
||||
* @param fn 当滚轮触发时执行的函数
|
||||
*/
|
||||
useWheel(
|
||||
ele: HTMLElement,
|
||||
fn: (x: number, y: number, z: number, e: WheelEvent) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
type Forward<T> = {
|
||||
|
||||
Reference in new issue
Block a user