@gongxh/bit-ui 0.0.1 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +159 -241
- package/dist/bit-ui.cjs +1657 -1218
- package/dist/bit-ui.d.ts +273 -301
- package/dist/bit-ui.min.cjs +1 -1
- package/dist/bit-ui.min.mjs +1 -1
- package/dist/bit-ui.mjs +1657 -1218
- package/package.json +38 -54
package/dist/bit-ui.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GComponent } from 'fairygui-cc';
|
|
2
|
-
import {
|
|
2
|
+
import { JsonAsset } from 'cc';
|
|
3
|
+
import { Module } from '@gongxh/bit-core';
|
|
3
4
|
|
|
4
5
|
/** 窗口显示时,对其他窗口的隐藏处理类型 */
|
|
5
6
|
declare enum WindowType {
|
|
@@ -23,17 +24,46 @@ declare enum AdapterType {
|
|
|
23
24
|
/** 固定的 不适配 */
|
|
24
25
|
Fixed = 2
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* 窗口属性基类
|
|
29
|
+
*/
|
|
30
|
+
interface IDecoratorInfo {
|
|
31
|
+
/** 构造函数 */
|
|
32
|
+
ctor: any;
|
|
33
|
+
/** 属性 */
|
|
34
|
+
props: Record<string, 1>;
|
|
35
|
+
/** 方法 */
|
|
36
|
+
callbacks: Record<string, Function>;
|
|
37
|
+
/** 控制器 */
|
|
38
|
+
controls: Record<string, 1>;
|
|
39
|
+
/** 动画 */
|
|
40
|
+
transitions: Record<string, 1>;
|
|
41
|
+
res: {
|
|
42
|
+
/** fgui包名 */
|
|
43
|
+
pkg: string;
|
|
44
|
+
/** 组件名 */
|
|
45
|
+
name: string;
|
|
46
|
+
/** 窗口组名称 可选(只有窗口才会设置) */
|
|
47
|
+
group?: string;
|
|
48
|
+
/** 内联的包名 当前界面需要引用其他包中的资源时使用 (只有窗口才会设置) */
|
|
49
|
+
inlinePkgs?: string[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
26
52
|
|
|
27
53
|
/**
|
|
28
54
|
* @Author: Gongxh
|
|
29
55
|
* @Date: 2024-12-08
|
|
30
56
|
* @Description: 窗口顶边资源栏
|
|
31
57
|
*/
|
|
32
|
-
interface IHeader {
|
|
58
|
+
interface IHeader<T = any> {
|
|
33
59
|
/** 资源栏名称 */
|
|
34
60
|
name: string;
|
|
35
61
|
/** 窗口适配类型 */
|
|
36
62
|
adapterType: AdapterType;
|
|
63
|
+
/**
|
|
64
|
+
* 是否显示中
|
|
65
|
+
*/
|
|
66
|
+
isShowing(): boolean;
|
|
37
67
|
}
|
|
38
68
|
|
|
39
69
|
/**
|
|
@@ -41,16 +71,17 @@ interface IHeader {
|
|
|
41
71
|
* @Date: 2025-01-10
|
|
42
72
|
* @Description: 窗口顶部资源栏信息
|
|
43
73
|
*/
|
|
44
|
-
|
|
74
|
+
|
|
75
|
+
declare class HeaderInfo<T> {
|
|
45
76
|
/** header名字 */
|
|
46
77
|
name: string;
|
|
47
78
|
/**
|
|
48
79
|
* 创建 WindowHeaderInfo
|
|
49
80
|
* @param {string} name header窗口名
|
|
50
81
|
* @param {*} [userdata] 自定义数据
|
|
51
|
-
* @returns {
|
|
82
|
+
* @returns {HeaderInfo}
|
|
52
83
|
*/
|
|
53
|
-
static create(
|
|
84
|
+
static create<T extends new () => IHeader, U>(ctor: T, userdata?: U): HeaderInfo<U>;
|
|
54
85
|
}
|
|
55
86
|
|
|
56
87
|
/**
|
|
@@ -59,7 +90,9 @@ declare class WindowHeaderInfo {
|
|
|
59
90
|
* @Description:
|
|
60
91
|
*/
|
|
61
92
|
|
|
62
|
-
interface IWindow {
|
|
93
|
+
interface IWindow<TUserData = any, THeaderData = any> {
|
|
94
|
+
/** 窗口名称 */
|
|
95
|
+
name: string;
|
|
63
96
|
/** 窗口类型 */
|
|
64
97
|
type: WindowType;
|
|
65
98
|
/** 窗口适配类型 */
|
|
@@ -71,394 +104,332 @@ interface IWindow {
|
|
|
71
104
|
*/
|
|
72
105
|
isShowing(): boolean;
|
|
73
106
|
/**
|
|
74
|
-
*
|
|
107
|
+
* 窗口是否在最上层
|
|
108
|
+
*
|
|
75
109
|
*/
|
|
76
|
-
|
|
110
|
+
isTop(): boolean;
|
|
77
111
|
/** 获取资源栏数据 */
|
|
78
|
-
getHeaderInfo():
|
|
112
|
+
getHeaderInfo<THeaderData>(): HeaderInfo<THeaderData>;
|
|
113
|
+
/** 刷新资源栏 */
|
|
114
|
+
refreshHeader(): void;
|
|
79
115
|
}
|
|
80
116
|
|
|
81
117
|
/**
|
|
82
118
|
* @Author: Gongxh
|
|
83
|
-
* @Date:
|
|
84
|
-
* @Description:
|
|
85
|
-
* 窗口顶边资源栏 同组中只会有一个显示
|
|
119
|
+
* @Date: 2024-12-08
|
|
120
|
+
* @Description: 窗口组 (在同一个窗口容器的上的窗口)
|
|
86
121
|
*/
|
|
87
122
|
|
|
88
|
-
declare
|
|
89
|
-
/** 窗口适配类型 */
|
|
90
|
-
adapterType: AdapterType;
|
|
91
|
-
protected abstract onInit(): void;
|
|
92
|
-
protected abstract onShow(window: IWindow, userdata?: any): void;
|
|
93
|
-
protected abstract onClose(): void;
|
|
94
|
-
protected onHide(): void;
|
|
95
|
-
protected onAdapted(): void;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @Author: Gongxh
|
|
100
|
-
* @Date: 2024-12-11
|
|
101
|
-
* @Description: UI 装饰器
|
|
102
|
-
*/
|
|
103
|
-
declare namespace _uidecorator {
|
|
104
|
-
interface IUIInfoBase {
|
|
105
|
-
/** 构造函数 */
|
|
106
|
-
ctor: any;
|
|
107
|
-
/** 属性 */
|
|
108
|
-
props: Record<string, 1>;
|
|
109
|
-
/** 方法 */
|
|
110
|
-
callbacks: Record<string, Function>;
|
|
111
|
-
/** 控制器 */
|
|
112
|
-
controls: Record<string, 1>;
|
|
113
|
-
/** 动画 */
|
|
114
|
-
transitions: Record<string, 1>;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* 窗口属性注册数据结构
|
|
118
|
-
*/
|
|
119
|
-
interface UIWindowInfo extends IUIInfoBase {
|
|
120
|
-
/** 配置信息 */
|
|
121
|
-
res: {
|
|
122
|
-
/** 窗口组名称 */
|
|
123
|
-
group: string;
|
|
124
|
-
/** fgui包名 */
|
|
125
|
-
pkg: string;
|
|
126
|
-
/** 窗口名 */
|
|
127
|
-
name: string;
|
|
128
|
-
/** 窗口bundle名 */
|
|
129
|
-
bundle: string;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/** 获取窗口注册信息 */
|
|
133
|
-
export function getWindowMaps(): Map<any, UIWindowInfo>;
|
|
123
|
+
declare class WindowGroup {
|
|
134
124
|
/**
|
|
135
|
-
*
|
|
136
|
-
* @
|
|
137
|
-
* @param {string} pkgName fgui包名
|
|
138
|
-
* @param {string} name 窗口名 (与fgui中的组件名一一对应)
|
|
125
|
+
* 获取窗口组的名称。
|
|
126
|
+
* @returns {string} 窗口组的名称。
|
|
139
127
|
*/
|
|
140
|
-
|
|
128
|
+
get name(): string;
|
|
129
|
+
/** 获取窗口组的根节点 */
|
|
130
|
+
get root(): GComponent;
|
|
141
131
|
/**
|
|
142
|
-
*
|
|
132
|
+
* 获取当前窗口组中窗口的数量。
|
|
133
|
+
* @returns 窗口数量
|
|
143
134
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/** fgui包名 */
|
|
148
|
-
pkg: string;
|
|
149
|
-
/** 组件名 */
|
|
150
|
-
name: string;
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/** 获取组件注册信息 */
|
|
154
|
-
export function getComponentMaps(): Map<any, IUIComInfo>;
|
|
135
|
+
get size(): number;
|
|
136
|
+
/** 获取窗口组中窗口的名称列表 */
|
|
137
|
+
get windowNames(): string[];
|
|
155
138
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @
|
|
158
|
-
* @param {string} name 组件名
|
|
139
|
+
* 获取是否忽略查询的状态。
|
|
140
|
+
* @returns {boolean} 如果忽略查询,则返回 true,否则返回 false。
|
|
159
141
|
*/
|
|
160
|
-
|
|
161
|
-
/** header属性注册数据结构 */
|
|
162
|
-
interface IUIHeaderInfo extends IUIInfoBase {
|
|
163
|
-
/** 配置信息 */
|
|
164
|
-
res: {
|
|
165
|
-
/** fgui包名 */
|
|
166
|
-
pkg: string;
|
|
167
|
-
/** 组件名 */
|
|
168
|
-
name: string;
|
|
169
|
-
/** headerbundle名 */
|
|
170
|
-
bundle: string;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
/** 获取header注册信息 */
|
|
174
|
-
export function getHeaderMaps(): Map<any, IUIHeaderInfo>;
|
|
142
|
+
get isIgnore(): boolean;
|
|
175
143
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param
|
|
178
|
-
* @param {string} name 组件名
|
|
144
|
+
* 处理index下层窗口的隐藏状态的私有方法。递归调用
|
|
145
|
+
* @param index - 窗口索引
|
|
179
146
|
*/
|
|
180
|
-
|
|
147
|
+
private processWindowHideStatus;
|
|
148
|
+
hasWindow(name: string): boolean;
|
|
181
149
|
/**
|
|
182
|
-
*
|
|
183
|
-
* @
|
|
184
|
-
* @param {string} name 属性名
|
|
185
|
-
*
|
|
186
|
-
* example: @uiprop node: GObject
|
|
150
|
+
* 获取窗口组顶部窗口实例
|
|
151
|
+
* @returns {IWindow} 顶部窗口实例
|
|
187
152
|
*/
|
|
188
|
-
|
|
153
|
+
getTopWindow<T extends IWindow>(): T;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @Author: Gongxh
|
|
158
|
+
* @Date: 2024-12-14
|
|
159
|
+
* @Description: 窗口基类和fgui组件对接
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
declare abstract class WindowBase<T = any, U = any> extends GComponent implements IWindow<T, U> {
|
|
163
|
+
/** 窗口类型 */
|
|
164
|
+
type: WindowType;
|
|
165
|
+
/** 窗口适配类型 */
|
|
166
|
+
adapterType: AdapterType;
|
|
167
|
+
/** 底部遮罩的透明度 */
|
|
168
|
+
bgAlpha: number;
|
|
169
|
+
isShowing(): boolean;
|
|
170
|
+
/** 是否在最上层显示 (除忽略的窗口组外, 显示到最上层时) */
|
|
171
|
+
isTop(): boolean;
|
|
189
172
|
/**
|
|
190
|
-
*
|
|
191
|
-
* @
|
|
192
|
-
* @param {string} name 属性名
|
|
193
|
-
*
|
|
194
|
-
* example: @uicontrol node: GObject
|
|
173
|
+
* 获取窗口顶部资源栏数据 默认返回空数组
|
|
174
|
+
* @returns {HeaderInfo}
|
|
195
175
|
*/
|
|
196
|
-
|
|
176
|
+
abstract getHeaderInfo<U>(): HeaderInfo<U>;
|
|
197
177
|
/**
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* example: @uitransition node: GObject
|
|
178
|
+
* 刷新顶部资源栏
|
|
179
|
+
* 调用这个方法会重新创建 或者 刷新header
|
|
180
|
+
* 用来在同一个界面显示不同的header
|
|
203
181
|
*/
|
|
204
|
-
|
|
182
|
+
refreshHeader(): void;
|
|
205
183
|
/**
|
|
206
|
-
*
|
|
207
|
-
* @param {Object} target 实例成员的类的原型
|
|
208
|
-
* @param {string} name 方法名
|
|
184
|
+
* 用于在界面中关闭自己
|
|
209
185
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
186
|
+
protected removeSelf(): void;
|
|
187
|
+
protected abstract onAdapted(): void;
|
|
188
|
+
protected abstract onInit(): void;
|
|
189
|
+
protected abstract onClose(): void;
|
|
190
|
+
protected abstract onShow(userdata?: T): void;
|
|
191
|
+
protected abstract onShowFromHide(): void;
|
|
192
|
+
protected abstract onHide(): void;
|
|
193
|
+
protected abstract onToTop(): void;
|
|
194
|
+
protected abstract onToBottom(): void;
|
|
195
|
+
protected abstract onEmptyAreaClick(): void;
|
|
214
196
|
}
|
|
215
197
|
|
|
216
198
|
/**
|
|
217
199
|
* @Author: Gongxh
|
|
218
|
-
* @Date:
|
|
219
|
-
* @Description:
|
|
200
|
+
* @Date: 2024-12-14
|
|
201
|
+
* @Description:
|
|
220
202
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
* 2. 资源header所在的包
|
|
232
|
-
* 3. 用于一些特殊场景, 比如需要和其他资源一起加载, 并且显示进度条的包
|
|
233
|
-
*/
|
|
234
|
-
manualPackages: string[];
|
|
203
|
+
|
|
204
|
+
declare abstract class Window<T = any, U = any> extends WindowBase<T, U> {
|
|
205
|
+
protected onAdapted(): void;
|
|
206
|
+
protected abstract onInit(): void;
|
|
207
|
+
protected abstract onClose(): void;
|
|
208
|
+
protected abstract onShow(userdata?: T): void;
|
|
209
|
+
protected onHide(): void;
|
|
210
|
+
protected onShowFromHide(): void;
|
|
211
|
+
protected onToTop(): void;
|
|
212
|
+
protected onToBottom(): void;
|
|
235
213
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
214
|
+
* 空白区域点击事件处理函数。
|
|
215
|
+
* 当用户点击窗口的空白区域时触发此方法。
|
|
238
216
|
*/
|
|
239
|
-
|
|
240
|
-
[windowName: string]: string[];
|
|
241
|
-
};
|
|
217
|
+
protected onEmptyAreaClick(): void;
|
|
242
218
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* 不包括手动管理的包
|
|
219
|
+
* 获取窗口顶部资源栏数据 默认返回空数组
|
|
220
|
+
* @returns {HeaderInfo}
|
|
246
221
|
*/
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
interface IPackageConfigRes {
|
|
250
|
-
/** 配置信息 */
|
|
251
|
-
config: IPackageConfig;
|
|
252
|
-
/** 显示加载等待窗 */
|
|
253
|
-
showWaitWindow: () => void;
|
|
254
|
-
/** 隐藏加载等待窗 */
|
|
255
|
-
hideWaitWindow: () => void;
|
|
256
|
-
/** 打开窗口时UI包加载失败 */
|
|
257
|
-
fail: (windowName: string, errmsg: string, pkgs: string[]) => void;
|
|
222
|
+
getHeaderInfo<U>(): HeaderInfo<U>;
|
|
258
223
|
}
|
|
259
224
|
|
|
260
225
|
/**
|
|
261
226
|
* @Author: Gongxh
|
|
262
|
-
* @Date:
|
|
263
|
-
* @Description:
|
|
227
|
+
* @Date: 2025-01-09
|
|
228
|
+
* @Description: 属性辅助类
|
|
264
229
|
*/
|
|
265
|
-
interface
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
bundle: string;
|
|
230
|
+
interface IPropsConfig {
|
|
231
|
+
[packageName: string]: {
|
|
232
|
+
[componentName: string]: IPropsInfo;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
interface IPropsInfo {
|
|
236
|
+
props: (string | number)[];
|
|
237
|
+
callbacks: (string | number)[];
|
|
238
|
+
controls: string[];
|
|
239
|
+
transitions: string[];
|
|
276
240
|
}
|
|
277
241
|
|
|
278
242
|
/**
|
|
279
243
|
* @Author: Gongxh
|
|
280
|
-
* @Date: 2024-12-
|
|
281
|
-
* @Description:
|
|
244
|
+
* @Date: 2024-12-07
|
|
245
|
+
* @Description: 窗口管理类
|
|
282
246
|
*/
|
|
283
247
|
|
|
284
|
-
|
|
248
|
+
/**
|
|
249
|
+
* 从窗口类型中提取 UserData 类型
|
|
250
|
+
*/
|
|
251
|
+
type ExtractUserData<T> = T extends Window<infer U, any> ? U : any;
|
|
252
|
+
/**
|
|
253
|
+
* 从窗口构造函数中提取窗口实例类型
|
|
254
|
+
*/
|
|
255
|
+
type ExtractWindowInstance<T> = T extends new () => infer R ? R : never;
|
|
256
|
+
declare class WindowManager {
|
|
257
|
+
private static _bgAlpha;
|
|
258
|
+
private static _bgColor;
|
|
285
259
|
/**
|
|
286
|
-
*
|
|
287
|
-
* @
|
|
260
|
+
* 添加手动管理资源加载 和 卸载的包名
|
|
261
|
+
* @param pkgName 包名
|
|
288
262
|
*/
|
|
289
|
-
|
|
263
|
+
static addManualPackage(pkgName: string): void;
|
|
290
264
|
/**
|
|
291
|
-
*
|
|
292
|
-
* @
|
|
265
|
+
* 提供一种特殊需求 用来手动设置包所在的 bundle名 以及包在bundle中的路径
|
|
266
|
+
* @param name 窗口名称
|
|
267
|
+
* @param bundleName bundle名 默认: resources
|
|
268
|
+
* @param path 包在bundle中的路径 默认: ui目录
|
|
293
269
|
*/
|
|
294
|
-
|
|
270
|
+
static setPackageInfo(pkgName: string, bundleName?: string, path?: string): void;
|
|
295
271
|
/**
|
|
296
|
-
*
|
|
297
|
-
* @
|
|
272
|
+
* 用于手动设置UI导出数据
|
|
273
|
+
* @param config UI导出数据
|
|
298
274
|
*/
|
|
299
|
-
|
|
300
|
-
showWindow(info: WindowInfo, userdata?: any): void;
|
|
301
|
-
hasWindow(name: string): boolean;
|
|
275
|
+
static setUIConfig(config: IPropsConfig): void;
|
|
302
276
|
/**
|
|
303
|
-
*
|
|
304
|
-
* @
|
|
277
|
+
* 设置UI包加载相关回调函数
|
|
278
|
+
* @param callbacks 包含加载回调的对象
|
|
279
|
+
* @param callbacks.showWaitWindow 显示加载等待窗的回调
|
|
280
|
+
* @param callbacks.hideWaitWindow 隐藏加载等待窗的回调
|
|
281
|
+
* @param callbacks.fail 打开窗口时资源加载失败的回调 code( 1:bundle加载失败 2:包加载失败 )
|
|
305
282
|
*/
|
|
306
|
-
|
|
283
|
+
static setPackageCallbacks(callbacks: {
|
|
284
|
+
showWaitWindow: () => void;
|
|
285
|
+
hideWaitWindow: () => void;
|
|
286
|
+
fail: (windowName: string, code: 1 | 2, message: string) => void;
|
|
287
|
+
}): void;
|
|
307
288
|
/**
|
|
308
|
-
*
|
|
309
|
-
|
|
310
|
-
closeAllWindow(): void;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @Author: Gongxh
|
|
315
|
-
* @Date: 2024-12-07
|
|
316
|
-
* @Description: 窗口管理类
|
|
317
|
-
*/
|
|
318
|
-
|
|
319
|
-
declare class UIManager {
|
|
320
|
-
/** 配置UI包的一些信息 (可以不配置 完全手动管理) */
|
|
321
|
-
static initPackageConfig(res: IPackageConfigRes): void;
|
|
322
|
-
/**
|
|
323
|
-
* 异步打开一个窗口 (如果UI包的资源未加载, 会自动加载 配合 UIManager.initPackageConfig一起使用)
|
|
324
|
-
* @param windowName 窗口名
|
|
289
|
+
* 异步打开一个窗口 (如果UI包的资源未加载, 会自动加载 可以配合 WindowManager.setPackageCallbacks一起使用)
|
|
290
|
+
* @param 窗口类
|
|
325
291
|
* @param userdata 用户数据
|
|
326
292
|
*/
|
|
327
|
-
static showWindow(
|
|
293
|
+
static showWindow<T extends new () => Window<any, any>>(window: T, userdata?: ExtractUserData<ExtractWindowInstance<T>>): Promise<ExtractWindowInstance<T>>;
|
|
328
294
|
/**
|
|
329
|
-
*
|
|
330
|
-
* @param
|
|
331
|
-
* @param userdata - 可选参数,用于传递给窗口的用户数据。
|
|
295
|
+
* 关闭一个窗口
|
|
296
|
+
* @param ctor 窗口类
|
|
332
297
|
*/
|
|
333
|
-
static
|
|
298
|
+
static closeWindow<T extends new () => IWindow>(window: T): void;
|
|
334
299
|
/**
|
|
335
|
-
*
|
|
336
|
-
* @param
|
|
300
|
+
* 通过窗口名称关闭一个窗口
|
|
301
|
+
* @param name 窗口名称
|
|
337
302
|
*/
|
|
338
|
-
static
|
|
303
|
+
static closeWindowByName(name: string): void;
|
|
339
304
|
/**
|
|
340
|
-
*
|
|
341
|
-
* @param
|
|
305
|
+
* 是否存在窗口
|
|
306
|
+
* @param name 窗口名称
|
|
342
307
|
*/
|
|
343
|
-
static
|
|
344
|
-
/**
|
|
345
|
-
* 获取当前最顶层的窗口实例。
|
|
346
|
-
* @template T - 窗口实例的类型,必须继承自 IWindow 接口。
|
|
347
|
-
* @returns {T | null} - 返回最顶层的窗口实例,如果没有找到则返回 null。
|
|
348
|
-
* @description 该方法会遍历所有窗口组,找到最顶层的窗口并返回其实例。
|
|
349
|
-
*/
|
|
350
|
-
static getTopWindow<T extends IWindow>(): T | null;
|
|
308
|
+
static hasWindow(name: string): boolean;
|
|
351
309
|
/**
|
|
352
310
|
* 根据窗口名称获取窗口实例。
|
|
353
311
|
* @template T 窗口类型,必须继承自IWindow接口。
|
|
354
|
-
* @param name
|
|
312
|
+
* @param name 窗口名称
|
|
355
313
|
* @returns 如果找到窗口,则返回对应类型的窗口实例;否则返回null。
|
|
356
314
|
*/
|
|
357
|
-
static getWindow<T extends IWindow>(name: string): T |
|
|
315
|
+
static getWindow<T extends IWindow>(name: string): T | undefined;
|
|
358
316
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* @returns
|
|
317
|
+
* 获取当前最顶层的窗口实例。
|
|
318
|
+
* 默认会忽略掉忽略查询的窗口组
|
|
319
|
+
* @returns {T | null} - 返回最顶层的窗口实例,如果没有找到则返回 null。
|
|
362
320
|
*/
|
|
363
|
-
static
|
|
321
|
+
static getTopWindow<T extends IWindow, U>(isAll?: boolean): T | null;
|
|
322
|
+
/**
|
|
323
|
+
* 获取所有窗口组的名称列表(按层级顺序)
|
|
324
|
+
* @returns 窗口组的名称列表
|
|
325
|
+
*/
|
|
326
|
+
static getGroupNames(): string[];
|
|
364
327
|
/**
|
|
365
328
|
* 根据给定的组名获取窗口组。如果组不存在,则抛出错误。
|
|
366
|
-
* @param
|
|
329
|
+
* @param name 窗口组名称
|
|
367
330
|
* @returns 返回找到的窗口组。
|
|
368
331
|
*/
|
|
369
|
-
static getWindowGroup(
|
|
332
|
+
static getWindowGroup(name: string): WindowGroup;
|
|
370
333
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* 如果没有找到任何包含窗口的组,则返回空字符串。
|
|
334
|
+
* 关闭所有窗口
|
|
335
|
+
* @param ignores 不关闭的窗口
|
|
374
336
|
*/
|
|
375
|
-
static
|
|
376
|
-
/** 动态注册窗口到资源池中 */
|
|
377
|
-
static dynamicRegisterWindow(ctor: any, group: string, pkg: string, name: string, bundle: string): void;
|
|
378
|
-
/** 动态注册窗口header到资源池中 */
|
|
379
|
-
static dynamicRegisterHeader(ctor: any, pkg: string, name: string, bundle: string): void;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* @Author: Gongxh
|
|
384
|
-
* @Date: 2024-12-14
|
|
385
|
-
* @Description: 窗口基类和fgui组件对接
|
|
386
|
-
*/
|
|
387
|
-
|
|
388
|
-
declare abstract class UIWindow extends GComponent implements IWindow {
|
|
389
|
-
/** 窗口类型 */
|
|
390
|
-
type: WindowType;
|
|
391
|
-
/** 窗口适配类型 */
|
|
392
|
-
adapterType: AdapterType;
|
|
393
|
-
/** 底部遮罩的透明度 */
|
|
394
|
-
bgAlpha: number;
|
|
395
|
-
isShowing(): boolean;
|
|
396
|
-
isCover(): boolean;
|
|
337
|
+
static closeAllWindow(ignores?: IWindow[]): void;
|
|
397
338
|
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
339
|
+
* 释放不再使用中的自动加载的UI资源
|
|
340
|
+
* 针对在 UIModule 中设置了不自动释放资源的场景
|
|
400
341
|
*/
|
|
401
|
-
|
|
402
|
-
getHeader<T extends UIHeader>(): T | null;
|
|
403
|
-
protected abstract onAdapted(): void;
|
|
404
|
-
protected abstract onInit(): void;
|
|
405
|
-
protected abstract onClose(): void;
|
|
406
|
-
protected abstract onShow(userdata?: any): void;
|
|
407
|
-
protected abstract onShowFromHide(): void;
|
|
408
|
-
protected abstract onHide(): void;
|
|
409
|
-
protected abstract onCover(): void;
|
|
410
|
-
protected abstract onRecover(): void;
|
|
411
|
-
protected abstract onEmptyAreaClick(): void;
|
|
342
|
+
static releaseUnusedRes(): void;
|
|
412
343
|
}
|
|
413
344
|
|
|
414
345
|
/**
|
|
415
346
|
* @Author: Gongxh
|
|
416
|
-
* @Date: 2024-12-
|
|
417
|
-
* @Description:
|
|
347
|
+
* @Date: 2024-12-11
|
|
348
|
+
* @Description: UI 装饰器
|
|
418
349
|
*/
|
|
419
350
|
|
|
420
|
-
declare
|
|
421
|
-
|
|
351
|
+
declare namespace _uidecorator {
|
|
352
|
+
/** 获取窗口注册信息 */
|
|
353
|
+
function getWindowMaps(): Map<any, IDecoratorInfo>;
|
|
354
|
+
/** 获取组件注册信息 */
|
|
355
|
+
function getComponentMaps(): Map<any, IDecoratorInfo>;
|
|
356
|
+
/** 获取header注册信息 */
|
|
357
|
+
function getHeaderMaps(): Map<any, IDecoratorInfo>;
|
|
422
358
|
/**
|
|
423
|
-
*
|
|
424
|
-
*
|
|
359
|
+
* 窗口装饰器
|
|
360
|
+
* @param {string} groupName 窗口组名称
|
|
361
|
+
* @param {string} pkgName fgui包名
|
|
362
|
+
* @param {string} name 窗口名 (与fgui中的组件名一一对应)
|
|
363
|
+
* @param {string[] | string} inlinePkgs 内联的包名 当前界面需要引用其他包中的资源时使用 引用多个包用数组 引用单个包用字符串
|
|
364
|
+
*
|
|
365
|
+
* @example @uiclass("窗口组", "UI包名", "MyWindow", ["包名1", "包名2"])
|
|
366
|
+
* @example @uiclass("窗口组", "UI包名", "MyWindow", "包名1")
|
|
425
367
|
*/
|
|
426
|
-
|
|
368
|
+
function uiclass(groupName: string, pkgName: string, name: string, inlinePkgs?: string[] | string): Function;
|
|
427
369
|
/**
|
|
428
|
-
*
|
|
429
|
-
*
|
|
370
|
+
* UI组件装饰器
|
|
371
|
+
* @param {string} pkg 包名
|
|
372
|
+
* @param {string} name 组件名
|
|
430
373
|
*/
|
|
431
|
-
|
|
374
|
+
function uicom(pkg: string, name: string): Function;
|
|
432
375
|
/**
|
|
433
|
-
*
|
|
434
|
-
* @param
|
|
376
|
+
* UI header装饰器
|
|
377
|
+
* @param {string} pkg 包名
|
|
378
|
+
* @param {string} name 组件名
|
|
435
379
|
*/
|
|
436
|
-
|
|
380
|
+
function uiheader(pkg: string, name: string): Function;
|
|
437
381
|
/**
|
|
438
|
-
*
|
|
439
|
-
*
|
|
382
|
+
* UI属性装饰器
|
|
383
|
+
* @param {Object} target 实例成员的类的原型
|
|
384
|
+
* @param {string} name 属性名
|
|
385
|
+
*
|
|
386
|
+
* example: @uiprop node: GObject
|
|
440
387
|
*/
|
|
441
|
-
|
|
388
|
+
function uiprop(target: Object, name: string): any;
|
|
442
389
|
/**
|
|
443
|
-
*
|
|
444
|
-
*
|
|
390
|
+
* UI控制器装饰器
|
|
391
|
+
* @param {Object} target 实例成员的类的原型
|
|
392
|
+
* @param {string} name 属性名
|
|
393
|
+
*
|
|
394
|
+
* example: @uicontrol node: GObject
|
|
445
395
|
*/
|
|
446
|
-
|
|
396
|
+
function uicontrol(target: Object, name: string): any;
|
|
447
397
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
398
|
+
* UI动画装饰器
|
|
399
|
+
* @param {Object} target 实例成员的类的原型
|
|
400
|
+
* @param {string} name 属性名
|
|
401
|
+
*
|
|
402
|
+
* example: @uitransition node: GObject
|
|
450
403
|
*/
|
|
451
|
-
|
|
404
|
+
function uitransition(target: Object, name: string): any;
|
|
452
405
|
/**
|
|
453
|
-
*
|
|
454
|
-
*
|
|
406
|
+
* 方法装饰器 (给点击事件用)
|
|
407
|
+
* @param {Object} target 实例成员的类的原型
|
|
408
|
+
* @param {string} name 方法名
|
|
455
409
|
*/
|
|
456
|
-
|
|
410
|
+
function uiclick(target: Object, name: string, descriptor: PropertyDescriptor): void;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @Author: Gongxh
|
|
415
|
+
* @Date: 2025-01-11
|
|
416
|
+
* @Description: 窗口顶边栏
|
|
417
|
+
* 窗口顶边资源栏 同组中只会有一个显示
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
declare abstract class Header<T = any> extends GComponent implements IHeader<T> {
|
|
421
|
+
/** 窗口适配类型 */
|
|
422
|
+
adapterType: AdapterType;
|
|
423
|
+
protected abstract onInit(): void;
|
|
424
|
+
protected abstract onShow(userdata?: T): void;
|
|
425
|
+
protected onAdapted(): void;
|
|
426
|
+
protected onClose(): void;
|
|
427
|
+
protected onHide(): void;
|
|
428
|
+
protected onShowFromHide(): void;
|
|
457
429
|
/**
|
|
458
|
-
*
|
|
459
|
-
* 当用户点击窗口的空白区域时触发此方法。
|
|
430
|
+
* 是否显示中
|
|
460
431
|
*/
|
|
461
|
-
|
|
432
|
+
isShowing(): boolean;
|
|
462
433
|
}
|
|
463
434
|
|
|
464
435
|
/**
|
|
@@ -467,12 +438,13 @@ declare abstract class Window extends UIWindow {
|
|
|
467
438
|
* @Description: cocos UI模块
|
|
468
439
|
*/
|
|
469
440
|
|
|
470
|
-
declare class UIModule extends
|
|
441
|
+
declare class UIModule extends Module {
|
|
442
|
+
ui_config: JsonAsset;
|
|
443
|
+
bgAlpha: number;
|
|
444
|
+
autoReleaseUIRes: boolean;
|
|
471
445
|
/** 模块名称 */
|
|
472
446
|
moduleName: string;
|
|
473
|
-
|
|
474
|
-
protected onInit(): void;
|
|
447
|
+
onInit(): void;
|
|
475
448
|
}
|
|
476
449
|
|
|
477
|
-
export { AdapterType,
|
|
478
|
-
export type { IPackageConfigRes };
|
|
450
|
+
export { AdapterType, Header, HeaderInfo, UIModule, Window, WindowGroup, WindowManager, WindowType, _uidecorator };
|