@cocos/cocos-cli-types 0.0.1-alpha.22.1 → 0.0.1-alpha.23.1
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/assets.d.ts +13 -1
- package/builder.d.ts +1 -0
- package/{service.d.ts → cli.d.ts} +337 -624
- package/configuration.d.ts +2 -0
- package/engine.d.ts +9 -0
- package/index.d.ts +994 -55
- package/package.json +1 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Scene } from 'cc';
|
|
6
|
-
import { TransformBit } from 'cc';
|
|
7
|
-
import { Vec3 as Vec3_2 } from 'cc';
|
|
1
|
+
import type { Component } from 'cc';
|
|
2
|
+
import type { Node as Node_2 } from 'cc';
|
|
3
|
+
import type { Scene } from 'cc';
|
|
4
|
+
import type { Vec3 as Vec3_2 } from 'cc';
|
|
8
5
|
|
|
9
6
|
/** 动画剪辑资源的 userData */
|
|
10
7
|
declare interface AnimationClipAssetUserData {
|
|
@@ -107,24 +104,6 @@ declare const ASSET_HANDLER_TYPES: string[];
|
|
|
107
104
|
/** 资源处理器类型(从常量数组派生) */
|
|
108
105
|
declare type AssetHandlerType = typeof ASSET_HANDLER_TYPES[number] | 'database';
|
|
109
106
|
|
|
110
|
-
export declare class AssetService extends BaseService<IAssetEvents> implements IAssetService {
|
|
111
|
-
/**
|
|
112
|
-
* 主进程监听 asset 事件,所触发事件
|
|
113
|
-
* @param uuid
|
|
114
|
-
*/
|
|
115
|
-
assetChanged(uuid: string): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* 主进程监听 asset 事件,所触发事件
|
|
118
|
-
* @param uuid
|
|
119
|
-
*/
|
|
120
|
-
assetDeleted(uuid: string): Promise<void>;
|
|
121
|
-
onEditorOpened(): void;
|
|
122
|
-
onNodeChanged(node: Node_2): void;
|
|
123
|
-
onComponentAdded(comp: Component): void;
|
|
124
|
-
onComponentRemoved(comp: Component): void;
|
|
125
|
-
releaseAsset(assetUUID: string): void;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
107
|
declare interface AssetUserDataMap {
|
|
129
108
|
'animation-clip': AnimationClipAssetUserData;
|
|
130
109
|
'auto-atlas': AutoAtlasAssetUserData;
|
|
@@ -193,43 +172,6 @@ declare interface AutoAtlasAssetUserData {
|
|
|
193
172
|
textureSetting: any;
|
|
194
173
|
}
|
|
195
174
|
|
|
196
|
-
declare class BaseService<TEvents extends Record<string, any>> {
|
|
197
|
-
protected isOpen: boolean;
|
|
198
|
-
/**
|
|
199
|
-
* 触发事件
|
|
200
|
-
* @param event 事件名称
|
|
201
|
-
* @param args 事件参数(根据事件类型自动推断)
|
|
202
|
-
*/
|
|
203
|
-
protected emit<K extends keyof TEvents>(event: K, ...args: TEvents[K]): void;
|
|
204
|
-
/**
|
|
205
|
-
* 跨进程广播事件
|
|
206
|
-
*/
|
|
207
|
-
broadcast<K extends keyof TEvents>(event: K, ...args: TEvents[K]): void;
|
|
208
|
-
/**
|
|
209
|
-
* 监听事件
|
|
210
|
-
* @param event 事件名称
|
|
211
|
-
* @param listener 事件监听器
|
|
212
|
-
*/
|
|
213
|
-
protected on<K extends keyof TEvents>(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void;
|
|
214
|
-
/**
|
|
215
|
-
* 一次性监听事件
|
|
216
|
-
* @param event 事件名称
|
|
217
|
-
* @param listener 事件监听器
|
|
218
|
-
*/
|
|
219
|
-
protected once<K extends keyof TEvents>(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void;
|
|
220
|
-
/**
|
|
221
|
-
* 移除事件监听器
|
|
222
|
-
* @param event 事件名称
|
|
223
|
-
* @param listener 事件监听器
|
|
224
|
-
*/
|
|
225
|
-
protected off<K extends keyof TEvents>(event: K, listener: TEvents[K] extends void ? () => void : (payload: TEvents[K]) => void): void;
|
|
226
|
-
/**
|
|
227
|
-
* 清除事件监听器
|
|
228
|
-
* @param event 事件名称,如果不提供则清除所有
|
|
229
|
-
*/
|
|
230
|
-
protected clear(event?: keyof TEvents): void;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
175
|
/** 位图字体资源的 userData */
|
|
234
176
|
declare interface BitmapFontAssetUserData {
|
|
235
177
|
/** 字体配置 */
|
|
@@ -240,78 +182,6 @@ declare interface BitmapFontAssetUserData {
|
|
|
240
182
|
textureUuid: string;
|
|
241
183
|
}
|
|
242
184
|
|
|
243
|
-
/**
|
|
244
|
-
* 子进程节点处理器
|
|
245
|
-
* 在子进程中处理所有节点相关操作
|
|
246
|
-
*/
|
|
247
|
-
export declare class ComponentService extends BaseService<IComponentEvents> implements IComponentService {
|
|
248
|
-
modeName: SceneModeType;
|
|
249
|
-
protected _sceneEventListener: ISceneEvents[];
|
|
250
|
-
protected _recycleComponent: Record<string, Component>;
|
|
251
|
-
constructor();
|
|
252
|
-
/**
|
|
253
|
-
* 查询当前正在编辑的模式名字
|
|
254
|
-
*/
|
|
255
|
-
queryMode(): SceneModeType;
|
|
256
|
-
onAddComponent(comp: Component, opts?: IOptionBase): void;
|
|
257
|
-
onRemoveComponent(comp: Component, opts?: IOptionBase): void;
|
|
258
|
-
onComponentAdded(comp: Component, opts?: IOptionBase): void;
|
|
259
|
-
onComponentRemoved(comp: Component, opts?: IOptionBase): void;
|
|
260
|
-
dispatchEvents(eventName: keyof ISceneEvents, ...args: any[any]): void;
|
|
261
|
-
private addComponentImpl;
|
|
262
|
-
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
263
|
-
/**
|
|
264
|
-
* 创建组件
|
|
265
|
-
* @param params
|
|
266
|
-
*/
|
|
267
|
-
private requireComponentList;
|
|
268
|
-
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
269
|
-
checkComponentsCollision(node: Node_2): Promise<void>;
|
|
270
|
-
checkDynamicBodyShape(ndoe: Node_2): void;
|
|
271
|
-
/**
|
|
272
|
-
* 通过 path、uuid 或 url 查找组件实例
|
|
273
|
-
*/
|
|
274
|
-
private findComponent;
|
|
275
|
-
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
276
|
-
queryComponent(params: IQueryComponentOptions): Promise<IComponent | IComponentForPinK | null>;
|
|
277
|
-
setProperty(options: ISetPropertyOptions): Promise<boolean>;
|
|
278
|
-
/**
|
|
279
|
-
* 查询一个节点的实例
|
|
280
|
-
* @param {*} uuid
|
|
281
|
-
* @return {cc.Node}
|
|
282
|
-
*/
|
|
283
|
-
query(uuid: string | undefined): Node_2 | null;
|
|
284
|
-
setPropertyForPink(uuid: string, path: string, dump: IProperty, record?: boolean): Promise<boolean>;
|
|
285
|
-
private setPropertyImp;
|
|
286
|
-
queryAllComponent(): Promise<string[]>;
|
|
287
|
-
init(): void;
|
|
288
|
-
private readonly CompMgrEventHandlers;
|
|
289
|
-
private compMgrEventHandlers;
|
|
290
|
-
/**
|
|
291
|
-
* 注册引擎 Node 管理相关事件的监听
|
|
292
|
-
*/
|
|
293
|
-
registerCompMgrEvents(): void;
|
|
294
|
-
unregisterCompMgrEvents(): void;
|
|
295
|
-
/**
|
|
296
|
-
* 添加到组件缓存
|
|
297
|
-
* @param {String} uuid
|
|
298
|
-
* @param {cc.Component} component
|
|
299
|
-
*/
|
|
300
|
-
add(uuid: string, component: Component): void;
|
|
301
|
-
/**
|
|
302
|
-
* 移除组件缓存
|
|
303
|
-
* @param {String} uuid
|
|
304
|
-
* @param {cc.Component} component
|
|
305
|
-
*/
|
|
306
|
-
remove(uuid: string, component: Component): void;
|
|
307
|
-
/**
|
|
308
|
-
* 重置组件
|
|
309
|
-
* @param uuid component 的 uuid
|
|
310
|
-
*/
|
|
311
|
-
resetComponent(params: IQueryComponentOptions): Promise<boolean>;
|
|
312
|
-
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
185
|
/**
|
|
316
186
|
* 创建类型
|
|
317
187
|
*/
|
|
@@ -329,45 +199,6 @@ declare interface DirectoryAssetUserData {
|
|
|
329
199
|
priority?: number;
|
|
330
200
|
}
|
|
331
201
|
|
|
332
|
-
/**
|
|
333
|
-
* EditorAsset - 统一的编辑器管理入口
|
|
334
|
-
* 作为调度器,根据资源类型动态创建和管理编辑器实例
|
|
335
|
-
*/
|
|
336
|
-
export declare class EditorService extends BaseService<IEditorEvents> implements IEditorService {
|
|
337
|
-
private needReloadAgain;
|
|
338
|
-
private lastSceneOrNode;
|
|
339
|
-
private reloadPromise;
|
|
340
|
-
private currentEditorUuid;
|
|
341
|
-
private editorMap;
|
|
342
|
-
private lockCount;
|
|
343
|
-
private lockPromise;
|
|
344
|
-
private lockResolve;
|
|
345
|
-
private _isReloading;
|
|
346
|
-
lock(): Promise<void>;
|
|
347
|
-
unlock(): void;
|
|
348
|
-
waitLocks(): Promise<void>;
|
|
349
|
-
/**
|
|
350
|
-
* 当前编辑的类型
|
|
351
|
-
*/
|
|
352
|
-
getCurrentEditorType(): 'scene' | 'prefab' | 'unknown';
|
|
353
|
-
/**
|
|
354
|
-
* 是否打开场景
|
|
355
|
-
*/
|
|
356
|
-
hasOpen(): Promise<boolean>;
|
|
357
|
-
/**
|
|
358
|
-
* 根据资源类型创建对应的编辑器
|
|
359
|
-
*/
|
|
360
|
-
private createEditor;
|
|
361
|
-
queryCurrent(): Promise<IScene | INode | null>;
|
|
362
|
-
getRootNode(): cc_2.Scene | cc_2.Node | null;
|
|
363
|
-
open(params: IOpenOptions): Promise<IScene | INode>;
|
|
364
|
-
close(params: ICloseOptions): Promise<boolean>;
|
|
365
|
-
save(params: ISaveOptions): Promise<IAssetInfo>;
|
|
366
|
-
reload(params: IReloadOptions): Promise<ReloadResult>;
|
|
367
|
-
create(params: ICreateOptions): Promise<IBaseIdentifier>;
|
|
368
|
-
onScriptExecutionFinished(): void;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
202
|
/** Effect 着色器资源的 userData */
|
|
372
203
|
declare interface EffectAssetUserData {
|
|
373
204
|
/** 预编译组合 */
|
|
@@ -376,46 +207,6 @@ declare interface EffectAssetUserData {
|
|
|
376
207
|
editor?: any;
|
|
377
208
|
}
|
|
378
209
|
|
|
379
|
-
/**
|
|
380
|
-
* 引擎管理器,用于引擎相关操作
|
|
381
|
-
*/
|
|
382
|
-
export declare class EngineService extends BaseService<IEngineEvents> implements IEngineService {
|
|
383
|
-
private _setTimeoutId;
|
|
384
|
-
private _rafId;
|
|
385
|
-
private _maxDeltaTimeInEM;
|
|
386
|
-
private _stateRecord;
|
|
387
|
-
private _shouldRepaintInEM;
|
|
388
|
-
private _tickInEM;
|
|
389
|
-
private _tickedFrameInEM;
|
|
390
|
-
private _paused;
|
|
391
|
-
private _capture;
|
|
392
|
-
private _bindTick;
|
|
393
|
-
private geometryRenderer;
|
|
394
|
-
private _sceneTick;
|
|
395
|
-
init(): Promise<void>;
|
|
396
|
-
setTimeout(callback: any, time: number): void;
|
|
397
|
-
clearTimeout(): void;
|
|
398
|
-
repaintInEditMode(): Promise<void>;
|
|
399
|
-
setFrameRate(fps: number): void;
|
|
400
|
-
startTick(): void;
|
|
401
|
-
stopTick(): void;
|
|
402
|
-
tickInEditMode(deltaTime: number): void;
|
|
403
|
-
getGeometryRenderer(): GeometryRenderer & Pick<GeometryRenderer_2, 'addDashedLine' | 'addTriangle' | 'addQuad' | 'addBoundingBox' | 'addCross' | 'addFrustum' | 'addCapsule' | 'addCylinder' | 'addCone' | 'addCircle' | 'addArc' | 'addPolygon' | 'addDisc' | 'addSector' | 'addSphere' | 'addTorus' | 'addOctahedron' | 'addBezier' | 'addMesh' | 'addIndexedMesh'>;
|
|
404
|
-
resume(): void;
|
|
405
|
-
pause(): void;
|
|
406
|
-
private _tick;
|
|
407
|
-
private _isTickAllowed;
|
|
408
|
-
get capture(): boolean;
|
|
409
|
-
set capture(b: boolean);
|
|
410
|
-
onEditorOpened(): void;
|
|
411
|
-
onEditorClosed(): void;
|
|
412
|
-
onEditorReload(): void;
|
|
413
|
-
onNodeChanged(): void;
|
|
414
|
-
onComponentAdded(): void;
|
|
415
|
-
onComponentRemoved(): void;
|
|
416
|
-
onSetPropertyComponent(): void;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
210
|
declare type Filter = 'none' | 'nearest' | 'linear';
|
|
420
211
|
|
|
421
212
|
declare interface FntData {
|
|
@@ -442,21 +233,72 @@ declare interface FontDefDictionary {
|
|
|
442
233
|
[charId: number]: FontDef;
|
|
443
234
|
}
|
|
444
235
|
|
|
445
|
-
declare class GeometryRenderer {
|
|
446
|
-
private _renderer;
|
|
447
|
-
private _dataMap;
|
|
448
|
-
constructor();
|
|
449
|
-
get renderer(): any;
|
|
450
|
-
set renderer(renderer: any);
|
|
451
|
-
flush(): void;
|
|
452
|
-
removeData(method: string): void;
|
|
453
|
-
removeDataAll(): void;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
236
|
/**
|
|
457
|
-
*
|
|
237
|
+
* 全局事件管理器
|
|
238
|
+
* 统一管理所有服务的事件监听,支持类型安全的事件订阅
|
|
458
239
|
*/
|
|
459
|
-
export declare
|
|
240
|
+
export declare class GlobalEventManager {
|
|
241
|
+
/**
|
|
242
|
+
* 监听指定类型的事件(类型安全版本)
|
|
243
|
+
* @param event 事件名称
|
|
244
|
+
* @param listener 事件监听器
|
|
245
|
+
*/
|
|
246
|
+
on<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
247
|
+
/**
|
|
248
|
+
* 监听指定类型的事件(通用版本)
|
|
249
|
+
* @param event 事件名称
|
|
250
|
+
* @param listener 事件监听器
|
|
251
|
+
*/
|
|
252
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
253
|
+
/**
|
|
254
|
+
* 监听指定类型的事件(一次性,类型安全版本)
|
|
255
|
+
* @param event 事件名称
|
|
256
|
+
* @param listener 事件监听器
|
|
257
|
+
*/
|
|
258
|
+
once<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
259
|
+
/**
|
|
260
|
+
* 监听指定类型的事件(一次性,通用版本)
|
|
261
|
+
* @param event 事件名称
|
|
262
|
+
* @param listener 事件监听器
|
|
263
|
+
*/
|
|
264
|
+
once(event: string, listener: (...args: any[]) => void): void;
|
|
265
|
+
/**
|
|
266
|
+
* 移除指定类型的事件监听器(类型安全版本)
|
|
267
|
+
* @param event 事件名称
|
|
268
|
+
* @param listener 事件监听器
|
|
269
|
+
*/
|
|
270
|
+
off<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
271
|
+
/**
|
|
272
|
+
* 移除事件监听器(通用版本)
|
|
273
|
+
* @param event 事件名称
|
|
274
|
+
* @param listener 事件监听器
|
|
275
|
+
*/
|
|
276
|
+
off(event: string, listener: (...args: any[]) => void): void;
|
|
277
|
+
/**
|
|
278
|
+
* 发射指定类型的事件(类型安全版本)
|
|
279
|
+
* @param event 事件名称
|
|
280
|
+
* @param args 事件参数
|
|
281
|
+
*/
|
|
282
|
+
emit<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
|
|
283
|
+
/**
|
|
284
|
+
* 触发事件(通用版本)
|
|
285
|
+
* @param event 事件名称
|
|
286
|
+
* @param args 事件参数
|
|
287
|
+
*/
|
|
288
|
+
emit(event: string, ...args: any[]): void;
|
|
289
|
+
/**
|
|
290
|
+
* 跨进程广播,传的参数需要能被序列化
|
|
291
|
+
* @param event 事件名称
|
|
292
|
+
* @param args 事件参数
|
|
293
|
+
*/
|
|
294
|
+
broadcast<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
|
|
295
|
+
broadcast(event: string, ...args: any[]): void;
|
|
296
|
+
/**
|
|
297
|
+
* 清除事件监听器
|
|
298
|
+
* @param event 事件名称,如果不提供则清除所有
|
|
299
|
+
*/
|
|
300
|
+
clear(event?: string): void;
|
|
301
|
+
}
|
|
460
302
|
|
|
461
303
|
/** glTF 动画资源的 userData */
|
|
462
304
|
declare interface GltfAnimationAssetUserData {
|
|
@@ -640,7 +482,7 @@ declare interface GlTFUserData {
|
|
|
640
482
|
}
|
|
641
483
|
|
|
642
484
|
/**
|
|
643
|
-
*
|
|
485
|
+
* 添加/创建组件的选项
|
|
644
486
|
*/
|
|
645
487
|
declare interface IAddComponentOptions {
|
|
646
488
|
nodePathOrUuid: string;
|
|
@@ -651,15 +493,6 @@ declare interface IApplyPrefabChangesParams {
|
|
|
651
493
|
nodePath: string;
|
|
652
494
|
}
|
|
653
495
|
|
|
654
|
-
/**
|
|
655
|
-
* 资源事件类型
|
|
656
|
-
*/
|
|
657
|
-
declare interface IAssetEvents {
|
|
658
|
-
'asset:change': [uuid: string];
|
|
659
|
-
'asset:deleted': [uuid: string];
|
|
660
|
-
'asset-refresh': [uuid: string];
|
|
661
|
-
}
|
|
662
|
-
|
|
663
496
|
declare interface IAssetInfo {
|
|
664
497
|
name: string; // 资源名字
|
|
665
498
|
source: string; // url 地址
|
|
@@ -693,6 +526,7 @@ declare interface IAssetInfo {
|
|
|
693
526
|
mtime?: number; // 资源文件的 mtime
|
|
694
527
|
depends?: string[]; // 依赖的资源 uuid 信息
|
|
695
528
|
dependeds?: string[]; // 被依赖的资源 uuid 信息
|
|
529
|
+
temp?: string; // 资源临时文件目录
|
|
696
530
|
}
|
|
697
531
|
|
|
698
532
|
declare interface IAssetMeta<T extends ISupportCreateType | 'unknown' = 'unknown'> {
|
|
@@ -771,6 +605,27 @@ declare interface IBaseIdentifier {
|
|
|
771
605
|
assetType: string;
|
|
772
606
|
}
|
|
773
607
|
|
|
608
|
+
declare interface ICameraService {
|
|
609
|
+
init(): void;
|
|
610
|
+
initFromConfig(): Promise<void>;
|
|
611
|
+
is2D: boolean;
|
|
612
|
+
focus(nodes?: string[] | null, editorCameraInfo?: any, immediate?: boolean): void;
|
|
613
|
+
defaultFocus(uuid: string): void;
|
|
614
|
+
rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
|
|
615
|
+
changeProjection(): void;
|
|
616
|
+
setGridVisible(value: boolean): void;
|
|
617
|
+
isGridVisible(): boolean;
|
|
618
|
+
setCameraProperty(options: any): void;
|
|
619
|
+
resetCameraProperty(): void;
|
|
620
|
+
getCameraFov(): number;
|
|
621
|
+
zoomUp(): void;
|
|
622
|
+
zoomDown(): void;
|
|
623
|
+
zoomReset(): void;
|
|
624
|
+
alignNodeToSceneView(nodes: string[]): void;
|
|
625
|
+
alignSceneViewToNode(nodes: string[]): void;
|
|
626
|
+
onUpdate(deltaTime: number): void;
|
|
627
|
+
}
|
|
628
|
+
|
|
774
629
|
declare interface IChangeNodeOptions {
|
|
775
630
|
source?: 'editor' | 'undo' | 'engine';
|
|
776
631
|
type?: NodeEventType;
|
|
@@ -780,6 +635,11 @@ declare interface IChangeNodeOptions {
|
|
|
780
635
|
dumpImmediately?: boolean;
|
|
781
636
|
}
|
|
782
637
|
|
|
638
|
+
export declare interface ICLI {
|
|
639
|
+
Scene: IServiceManager;
|
|
640
|
+
SceneEvents: GlobalEventManager;
|
|
641
|
+
}
|
|
642
|
+
|
|
783
643
|
/**
|
|
784
644
|
* 关闭场景/预制体选项
|
|
785
645
|
*/
|
|
@@ -788,7 +648,7 @@ declare interface ICloseOptions {
|
|
|
788
648
|
}
|
|
789
649
|
|
|
790
650
|
/**
|
|
791
|
-
*
|
|
651
|
+
* CLI 使用的组件信息,属性值以扁平的 key-value 形式呈现
|
|
792
652
|
*/
|
|
793
653
|
declare interface IComponent extends IComponentIdentifier {
|
|
794
654
|
properties: {
|
|
@@ -798,19 +658,10 @@ declare interface IComponent extends IComponentIdentifier {
|
|
|
798
658
|
}
|
|
799
659
|
|
|
800
660
|
/**
|
|
801
|
-
*
|
|
661
|
+
* 编辑器使用的组件详细信息,属性值以 IProperty 编码形式呈现,
|
|
662
|
+
* 包含 type、readonly、default 等元信息,用于编辑器 Inspector 面板渲染
|
|
802
663
|
*/
|
|
803
|
-
declare interface
|
|
804
|
-
'component:add': [Component];
|
|
805
|
-
'component:before-remove': [Component];
|
|
806
|
-
'component:remove': [Component];
|
|
807
|
-
'component:set-property': [Component, IChangeNodeOptions];
|
|
808
|
-
'component:added': [Component];
|
|
809
|
-
'component:removed': [Component];
|
|
810
|
-
'component:before-add-component': [string, Node_2];
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
declare interface IComponentForPinK extends IProperty {
|
|
664
|
+
declare interface IComponentForEditor extends IProperty {
|
|
814
665
|
value: {
|
|
815
666
|
enabled: IPropertyValueType;
|
|
816
667
|
uuid: IPropertyValueType;
|
|
@@ -820,7 +671,7 @@ declare interface IComponentForPinK extends IProperty {
|
|
|
820
671
|
}
|
|
821
672
|
|
|
822
673
|
/**
|
|
823
|
-
*
|
|
674
|
+
* 组件标识信息,包含组件的基本标识字段
|
|
824
675
|
*/
|
|
825
676
|
declare interface IComponentIdentifier {
|
|
826
677
|
cid: string;
|
|
@@ -832,50 +683,139 @@ declare interface IComponentIdentifier {
|
|
|
832
683
|
}
|
|
833
684
|
|
|
834
685
|
/**
|
|
835
|
-
*
|
|
686
|
+
* 组件服务接口,定义了所有组件相关的操作方法
|
|
836
687
|
*/
|
|
837
688
|
declare interface IComponentService extends IServiceEvents {
|
|
838
689
|
/**
|
|
839
|
-
*
|
|
840
|
-
* @param params
|
|
690
|
+
* 添加组件到指定节点,返回添加后的组件信息
|
|
691
|
+
* @param params - 添加组件选项
|
|
692
|
+
* @param params.nodePathOrUuid - 目标节点路径或 UUID
|
|
693
|
+
* @param params.component - 组件类名,支持精确匹配('cc.Label')和模糊匹配('label')
|
|
694
|
+
* @returns 添加成功后的组件信息
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```ts
|
|
698
|
+
* // 通过节点路径 + 精确组件名
|
|
699
|
+
* const comp = await addComponent({ nodePathOrUuid: 'Canvas/MyNode', component: 'cc.Label' });
|
|
700
|
+
*
|
|
701
|
+
* // 通过节点 UUID + 模糊组件名
|
|
702
|
+
* const comp = await addComponent({ nodePathOrUuid: 'abc-123-uuid', component: 'label' });
|
|
703
|
+
* ```
|
|
841
704
|
*/
|
|
842
705
|
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
843
706
|
/**
|
|
844
|
-
*
|
|
845
|
-
* @param params
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* 删除组件
|
|
850
|
-
* @param params
|
|
707
|
+
* 删除指定组件
|
|
708
|
+
* @param params - 删除组件选项
|
|
709
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
710
|
+
* @returns 删除成功返回 true,失败返回 false
|
|
851
711
|
*/
|
|
852
712
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
853
713
|
/**
|
|
854
714
|
* 设置组件属性
|
|
855
|
-
*
|
|
715
|
+
* - CLI 调用时传入 ISetPropertyOptions,通过 componentPath 定位,属性为扁平键值对
|
|
716
|
+
* - 编辑器调用时传入 ISetPropertyOptionsForEditor,通过节点 UUID + dump 路径定位,属性为 IProperty 格式
|
|
717
|
+
*
|
|
718
|
+
* @param params - 设置属性选项,根据调用方不同传入不同类型
|
|
719
|
+
* @returns 设置成功返回 true,失败返回 false
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```ts
|
|
723
|
+
* // CLI 方式:通过 componentPath 定位,直接传属性键值对
|
|
724
|
+
* await setProperty({
|
|
725
|
+
* componentPath: 'Canvas/cc.Label_1',
|
|
726
|
+
* properties: { string: 'Hello', fontSize: 32 },
|
|
727
|
+
* });
|
|
728
|
+
*
|
|
729
|
+
* // 编辑器方式:通过节点 UUID + dump 路径定位,传 IProperty 格式
|
|
730
|
+
* await setProperty({
|
|
731
|
+
* uuid: 'node-uuid',
|
|
732
|
+
* path: '__comps__.0.string',
|
|
733
|
+
* dump: { value: 'Hello', type: 'String' },
|
|
734
|
+
* });
|
|
735
|
+
* ```
|
|
736
|
+
*/
|
|
737
|
+
setProperty(params: ISetPropertyOptions | ISetPropertyOptionsForEditor): Promise<boolean>;
|
|
738
|
+
/**
|
|
739
|
+
* 查询组件信息
|
|
740
|
+
* - 传入 IQueryComponentOptions 时,返回 IComponent 或 IComponent
|
|
741
|
+
* - 传入 string 时,返回 IComponentForEditor
|
|
742
|
+
*
|
|
743
|
+
* @param params - 查询选项或组件路径字符串
|
|
744
|
+
* @returns 如果传入的是 IQueryComponentOptions 时返回 IComponent,如果传入是string时返回 IComponentForEditor,未找到返回 null
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```ts
|
|
748
|
+
* CLI 模式:返回 IComponent(扁平属性)
|
|
749
|
+
* const comp = await queryComponent({ path: 'Canvas/cc.Label_1' }) as IComponent;
|
|
750
|
+
*
|
|
751
|
+
* 编辑器模式:直接传 string,这里是uuid,因为与cli重复了,也支持 path 和 url
|
|
752
|
+
* const comp = await queryComponent('uuid') as IComponentForEditor;
|
|
753
|
+
* ```
|
|
856
754
|
*/
|
|
857
|
-
|
|
755
|
+
queryComponent(params: IQueryComponentOptions | string): Promise<IComponent | IComponentForEditor | null>;
|
|
858
756
|
/**
|
|
859
|
-
*
|
|
860
|
-
* @
|
|
757
|
+
* 获取所有已注册的组件类名,包含内置与自定义组件
|
|
758
|
+
* @returns 组件类名数组,如 ['cc.Label', 'cc.Sprite', 'MyCustomComponent']
|
|
861
759
|
*/
|
|
862
|
-
|
|
760
|
+
queryAllComponent(): Promise<string[]>;
|
|
863
761
|
/**
|
|
864
|
-
*
|
|
762
|
+
* 创建组件(编辑器使用),与 addComponent 不同的是仅返回是否成功
|
|
763
|
+
* @param params - 添加组件选项
|
|
764
|
+
* @param params.nodePathOrUuid - 目标节点路径或 UUID
|
|
765
|
+
* @param params.component - 组件类名
|
|
766
|
+
* @returns 创建成功返回 true,失败返回 false
|
|
865
767
|
*/
|
|
866
|
-
|
|
768
|
+
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
867
769
|
/**
|
|
868
|
-
*
|
|
770
|
+
* 复位组件,将组件所有属性恢复为默认值
|
|
771
|
+
* @param params - 查询组件选项,用于定位要复位的组件
|
|
772
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
773
|
+
* @returns 复位成功返回 true,失败返回 false
|
|
869
774
|
*/
|
|
870
|
-
|
|
775
|
+
resetComponent(params: IQueryComponentOptions): Promise<boolean>;
|
|
871
776
|
/**
|
|
872
|
-
*
|
|
777
|
+
* 获取所有注册类名,支持按继承关系过滤
|
|
778
|
+
* @param options - 过滤选项,不传则返回所有注册类
|
|
779
|
+
* @param options.extends - 父类名称,只返回继承自该类的子类,支持字符串或字符串数组
|
|
780
|
+
* @param options.excludeSelf - 是否排除父类自身,默认 false
|
|
781
|
+
* @returns 类名对象数组,如 [{ name: 'cc.Label' }, { name: 'cc.Sprite' }]
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* ```ts
|
|
785
|
+
* // 查询所有注册类
|
|
786
|
+
* const all = await queryClasses();
|
|
787
|
+
*
|
|
788
|
+
* // 查询 cc.Component 的所有子类(含自身)
|
|
789
|
+
* const comps = await queryClasses({ extends: 'cc.Component' });
|
|
790
|
+
*
|
|
791
|
+
* // 查询 cc.Component 的所有子类(排除自身)
|
|
792
|
+
* const subComps = await queryClasses({ extends: 'cc.Component', excludeSelf: true });
|
|
793
|
+
* ```
|
|
873
794
|
*/
|
|
874
|
-
|
|
795
|
+
queryClasses(options?: IQueryClassesOptions): Promise<{
|
|
796
|
+
name: string;
|
|
797
|
+
}[]>;
|
|
798
|
+
/**
|
|
799
|
+
* 查询指定节点上所有组件暴露的可调用函数
|
|
800
|
+
* @param uuid - 节点 UUID
|
|
801
|
+
* @returns 节点上组件的函数信息,节点不存在时返回空对象
|
|
802
|
+
*/
|
|
803
|
+
queryComponentFunctionOfNode(uuid: string): Promise<any>;
|
|
875
804
|
/**
|
|
876
|
-
*
|
|
805
|
+
* 执行组件上的指定方法
|
|
806
|
+
* @param options - 执行选项
|
|
807
|
+
* @param options.uuid - 组件实例的 UUID
|
|
808
|
+
* @param options.name - 要执行的方法名,如 'onLoad'、'start'
|
|
809
|
+
* @param options.args - 方法参数列表
|
|
810
|
+
* @returns 执行成功返回 true,失败返回 false
|
|
877
811
|
*/
|
|
878
812
|
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
813
|
+
/**
|
|
814
|
+
* 查询指定名称的组件是否已注册(是否存在对应脚本)
|
|
815
|
+
* @param name - 组件类名,如 'cc.Label'
|
|
816
|
+
* @returns 存在返回 true,不存在返回 false
|
|
817
|
+
*/
|
|
818
|
+
queryComponentHasScript(name: string): Promise<boolean>;
|
|
879
819
|
init(): void;
|
|
880
820
|
unregisterCompMgrEvents(): void;
|
|
881
821
|
}
|
|
@@ -922,16 +862,6 @@ declare interface IDeleteNodeResult {
|
|
|
922
862
|
path: string;
|
|
923
863
|
}
|
|
924
864
|
|
|
925
|
-
/**
|
|
926
|
-
* 事件类型
|
|
927
|
-
*/
|
|
928
|
-
declare interface IEditorEvents {
|
|
929
|
-
'editor:open': [];
|
|
930
|
-
'editor:close': [];
|
|
931
|
-
'editor:save': [];
|
|
932
|
-
'editor:reload': [];
|
|
933
|
-
}
|
|
934
|
-
|
|
935
865
|
declare interface IEditorService extends IServiceEvents {
|
|
936
866
|
/**
|
|
937
867
|
* 当前编辑器类型
|
|
@@ -976,11 +906,6 @@ declare interface IEditorService extends IServiceEvents {
|
|
|
976
906
|
unlock(): void;
|
|
977
907
|
}
|
|
978
908
|
|
|
979
|
-
declare interface IEngineEvents {
|
|
980
|
-
'engine:update': [];
|
|
981
|
-
'engine:ticked': [];
|
|
982
|
-
}
|
|
983
|
-
|
|
984
909
|
declare interface IEngineService extends IServiceEvents {
|
|
985
910
|
/**
|
|
986
911
|
* 初始化引擎服务,目前是暂时引擎 mainLoop
|
|
@@ -993,7 +918,7 @@ declare interface IEngineService extends IServiceEvents {
|
|
|
993
918
|
}
|
|
994
919
|
|
|
995
920
|
/**
|
|
996
|
-
*
|
|
921
|
+
* 执行组件方法的选项
|
|
997
922
|
*/
|
|
998
923
|
declare interface IExecuteComponentMethodOptions {
|
|
999
924
|
uuid: string;
|
|
@@ -1041,6 +966,28 @@ declare interface IGetPrefabInfoParams {
|
|
|
1041
966
|
nodePath: string;
|
|
1042
967
|
}
|
|
1043
968
|
|
|
969
|
+
declare interface IGizmoService {
|
|
970
|
+
gizmoRootNode: any;
|
|
971
|
+
foregroundNode: any;
|
|
972
|
+
backgroundNode: any;
|
|
973
|
+
transformToolData: any;
|
|
974
|
+
transformToolName: string;
|
|
975
|
+
isViewMode: boolean;
|
|
976
|
+
init(): void;
|
|
977
|
+
initFromConfig(): Promise<void>;
|
|
978
|
+
saveConfig(): Promise<void>;
|
|
979
|
+
changeTool(name: string): void;
|
|
980
|
+
setCoordinate(coord: 'local' | 'global'): void;
|
|
981
|
+
setPivot(pivot: 'pivot' | 'center'): void;
|
|
982
|
+
lockGizmoTool(locked: boolean): void;
|
|
983
|
+
setIconVisible(visible: boolean): void;
|
|
984
|
+
showAllGizmoOfNode(node: any, recursive?: boolean): void;
|
|
985
|
+
removeAllGizmoOfNode(node: any, recursive?: boolean): void;
|
|
986
|
+
clearAllGizmos(): void;
|
|
987
|
+
callAllGizmoFuncOfNode(node: any, funcName: string, ...params: any[]): boolean;
|
|
988
|
+
onUpdate(deltaTime: number): void;
|
|
989
|
+
}
|
|
990
|
+
|
|
1044
991
|
declare interface IIsPrefabInstanceParams {
|
|
1045
992
|
nodePath: string;
|
|
1046
993
|
}
|
|
@@ -1110,20 +1057,6 @@ declare interface INode extends INodeIdentifier {
|
|
|
1110
1057
|
prefab: IPrefabInfo | null;
|
|
1111
1058
|
}
|
|
1112
1059
|
|
|
1113
|
-
/**
|
|
1114
|
-
* 节点事件类型
|
|
1115
|
-
*/
|
|
1116
|
-
declare interface INodeEvents {
|
|
1117
|
-
'node:before-remove': [Node_2];
|
|
1118
|
-
'node:before-change': [Node_2];
|
|
1119
|
-
'node:change': [Node_2, IChangeNodeOptions];
|
|
1120
|
-
'node:before-add': [Node_2];
|
|
1121
|
-
'node:add': [Node_2];
|
|
1122
|
-
'node:added': [Node_2];
|
|
1123
|
-
'node:remove': [Node_2];
|
|
1124
|
-
'node:removed': [Node_2, IChangeNodeOptions];
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1060
|
declare interface INodeIdentifier {
|
|
1128
1061
|
nodeId: string;
|
|
1129
1062
|
path: string;
|
|
@@ -1186,6 +1119,7 @@ declare interface INodeTreeItem {
|
|
|
1186
1119
|
active: boolean;
|
|
1187
1120
|
locked: boolean;
|
|
1188
1121
|
type: string;
|
|
1122
|
+
uuid: string;
|
|
1189
1123
|
children: INodeTreeItem[];
|
|
1190
1124
|
prefab: IPrefabStateInfo;
|
|
1191
1125
|
parent: string;
|
|
@@ -1203,8 +1137,14 @@ declare interface IOpenOptions {
|
|
|
1203
1137
|
simpleNode?: boolean;
|
|
1204
1138
|
}
|
|
1205
1139
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1140
|
+
declare interface IOperationService {
|
|
1141
|
+
addListener(type: OperationEvent, listener: Function, priority?: number): void;
|
|
1142
|
+
removeListener(type: OperationEvent, listener: Function): void;
|
|
1143
|
+
dispatch(type: OperationEvent, ...args: any[]): void;
|
|
1144
|
+
emitMouseEvent(type: string, event: ISceneMouseEvent, dpr?: number): void;
|
|
1145
|
+
requestPointerLock(): void;
|
|
1146
|
+
exitPointerLock(): void;
|
|
1147
|
+
changePointer(type: string): void;
|
|
1208
1148
|
}
|
|
1209
1149
|
|
|
1210
1150
|
declare interface IPrefab {
|
|
@@ -1215,12 +1155,6 @@ declare interface IPrefab {
|
|
|
1215
1155
|
persistent: boolean;
|
|
1216
1156
|
}
|
|
1217
1157
|
|
|
1218
|
-
/**
|
|
1219
|
-
* 预制体事件类型
|
|
1220
|
-
*/
|
|
1221
|
-
declare interface IPrefabEvents {
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
1158
|
declare interface IPrefabInfo {
|
|
1225
1159
|
/** 关联的预制体资源信息 */
|
|
1226
1160
|
asset?: IPrefab;
|
|
@@ -1369,11 +1303,18 @@ declare interface IQuat {
|
|
|
1369
1303
|
}
|
|
1370
1304
|
|
|
1371
1305
|
/**
|
|
1372
|
-
*
|
|
1306
|
+
* 查询注册类的过滤选项
|
|
1307
|
+
*/
|
|
1308
|
+
declare interface IQueryClassesOptions {
|
|
1309
|
+
extends?: string | string[];
|
|
1310
|
+
excludeSelf?: boolean;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* 查询组件的选项
|
|
1373
1315
|
*/
|
|
1374
1316
|
declare interface IQueryComponentOptions {
|
|
1375
|
-
|
|
1376
|
-
isFull?: boolean;
|
|
1317
|
+
path: string;
|
|
1377
1318
|
}
|
|
1378
1319
|
|
|
1379
1320
|
declare interface IQueryNodeParams {
|
|
@@ -1401,10 +1342,10 @@ declare interface IReloadOptions {
|
|
|
1401
1342
|
}
|
|
1402
1343
|
|
|
1403
1344
|
/**
|
|
1404
|
-
*
|
|
1345
|
+
* 删除组件的选项
|
|
1405
1346
|
*/
|
|
1406
1347
|
declare interface IRemoveComponentOptions {
|
|
1407
|
-
|
|
1348
|
+
path: string;
|
|
1408
1349
|
}
|
|
1409
1350
|
|
|
1410
1351
|
declare interface IRevertToPrefabParams {
|
|
@@ -1428,18 +1369,41 @@ declare interface IScene extends IBaseIdentifier {
|
|
|
1428
1369
|
components: IComponentIdentifier[];
|
|
1429
1370
|
}
|
|
1430
1371
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1372
|
+
declare interface ISceneMouseEvent {
|
|
1373
|
+
x: number;
|
|
1374
|
+
y: number;
|
|
1375
|
+
clientX: number;
|
|
1376
|
+
clientY: number;
|
|
1377
|
+
deltaX: number;
|
|
1378
|
+
deltaY: number;
|
|
1379
|
+
wheelDeltaX: number;
|
|
1380
|
+
wheelDeltaY: number;
|
|
1381
|
+
moveDeltaX: number;
|
|
1382
|
+
moveDeltaY: number;
|
|
1383
|
+
leftButton: boolean;
|
|
1384
|
+
middleButton: boolean;
|
|
1385
|
+
rightButton: boolean;
|
|
1386
|
+
button: number;
|
|
1387
|
+
buttons: number;
|
|
1388
|
+
ctrlKey: boolean;
|
|
1389
|
+
shiftKey: boolean;
|
|
1390
|
+
altKey: boolean;
|
|
1391
|
+
metaKey: boolean;
|
|
1392
|
+
hitPoint?: any;
|
|
1393
|
+
type?: string;
|
|
1394
|
+
handleName?: string;
|
|
1436
1395
|
}
|
|
1437
1396
|
|
|
1438
|
-
declare interface
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1397
|
+
declare interface ISceneViewService {
|
|
1398
|
+
init(): void;
|
|
1399
|
+
initFromConfig(): Promise<void>;
|
|
1400
|
+
saveConfig(): Promise<void>;
|
|
1401
|
+
setSceneLightOn(enable: boolean): void;
|
|
1402
|
+
querySceneLightOn(): boolean;
|
|
1403
|
+
onSceneOpened(scene: any): void;
|
|
1404
|
+
onSceneClosed(): void;
|
|
1405
|
+
onComponentAdded(comp: Component): void;
|
|
1406
|
+
onComponentRemoved(comp: Component): void;
|
|
1443
1407
|
}
|
|
1444
1408
|
|
|
1445
1409
|
declare interface IScriptService extends IServiceEvents {
|
|
@@ -1453,6 +1417,15 @@ declare interface IScriptService extends IServiceEvents {
|
|
|
1453
1417
|
suspend(condition: Promise<any>): void;
|
|
1454
1418
|
}
|
|
1455
1419
|
|
|
1420
|
+
declare interface ISelectionService {
|
|
1421
|
+
select(uuid: string): void;
|
|
1422
|
+
unselect(uuid: string): void;
|
|
1423
|
+
clear(): void;
|
|
1424
|
+
query(): string[];
|
|
1425
|
+
isSelect(uuid: string): boolean;
|
|
1426
|
+
reset(): void;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1456
1429
|
declare interface IServiceEvents {
|
|
1457
1430
|
onEditorOpened?(): void;
|
|
1458
1431
|
onEditorReload?(): void;
|
|
@@ -1480,9 +1453,12 @@ declare interface IServiceEvents {
|
|
|
1480
1453
|
onAssetChanged?(uuid: string): void;
|
|
1481
1454
|
onAssetRefreshed?(uuid: string): void;
|
|
1482
1455
|
onScriptExecutionFinished?(): void;
|
|
1456
|
+
onSelectionSelect?(uuid: string, uuids: string[]): void;
|
|
1457
|
+
onSelectionUnselect?(uuid: string, uuids: string[]): void;
|
|
1458
|
+
onSelectionClear?(): void;
|
|
1483
1459
|
}
|
|
1484
1460
|
|
|
1485
|
-
declare interface IServiceManager {
|
|
1461
|
+
export declare interface IServiceManager {
|
|
1486
1462
|
Editor: IEditorService;
|
|
1487
1463
|
Node: INodeService;
|
|
1488
1464
|
Component: IComponentService;
|
|
@@ -1490,10 +1466,16 @@ declare interface IServiceManager {
|
|
|
1490
1466
|
Asset: IAssetService;
|
|
1491
1467
|
Engine: IEngineService;
|
|
1492
1468
|
Prefab: IPrefabService;
|
|
1469
|
+
Selection: ISelectionService;
|
|
1470
|
+
Operation: IOperationService;
|
|
1471
|
+
Undo: IUndoService;
|
|
1472
|
+
Camera: ICameraService;
|
|
1473
|
+
Gizmo: IGizmoService;
|
|
1474
|
+
SceneView: ISceneViewService;
|
|
1493
1475
|
}
|
|
1494
1476
|
|
|
1495
1477
|
/**
|
|
1496
|
-
*
|
|
1478
|
+
* CLI 设置组件属性的选项
|
|
1497
1479
|
*/
|
|
1498
1480
|
declare interface ISetPropertyOptions {
|
|
1499
1481
|
componentPath: string;
|
|
@@ -1503,6 +1485,16 @@ declare interface ISetPropertyOptions {
|
|
|
1503
1485
|
record?: boolean;
|
|
1504
1486
|
}
|
|
1505
1487
|
|
|
1488
|
+
/**
|
|
1489
|
+
* 编辑器设置组件属性的选项
|
|
1490
|
+
*/
|
|
1491
|
+
declare interface ISetPropertyOptionsForEditor {
|
|
1492
|
+
uuid: string;
|
|
1493
|
+
path: string;
|
|
1494
|
+
dump: IProperty;
|
|
1495
|
+
record?: boolean;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1506
1498
|
declare type ISupportCreateCCType =
|
|
1507
1499
|
| 'cc.AnimationClip' // 动画剪辑
|
|
1508
1500
|
| 'cc.Script' // 脚本(TypeScript/JavaScript)
|
|
@@ -1535,6 +1527,17 @@ declare interface ITargetOverrideInfo {
|
|
|
1535
1527
|
targetInfo: ITargetInfo | null;
|
|
1536
1528
|
}
|
|
1537
1529
|
|
|
1530
|
+
declare interface IUndoService {
|
|
1531
|
+
beginRecording(uuids: string[], options?: any): string;
|
|
1532
|
+
endRecording(commandId: string): void;
|
|
1533
|
+
cancelRecording(commandId: string): void;
|
|
1534
|
+
undo(): Promise<void>;
|
|
1535
|
+
redo(): Promise<void>;
|
|
1536
|
+
snapshot(): void;
|
|
1537
|
+
reset(): void;
|
|
1538
|
+
isDirty(): boolean;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1538
1541
|
declare interface IUnpackPrefabInstanceParams {
|
|
1539
1542
|
/** 要解耦的预制体实例节点 */
|
|
1540
1543
|
nodePath: string;
|
|
@@ -1701,87 +1704,6 @@ declare enum NodeEventType {
|
|
|
1701
1704
|
RESET_COMPONENT = 'reset-component'
|
|
1702
1705
|
}
|
|
1703
1706
|
|
|
1704
|
-
/**
|
|
1705
|
-
* 子进程节点处理器
|
|
1706
|
-
* 在子进程中处理所有节点相关操作
|
|
1707
|
-
*/
|
|
1708
|
-
export declare class NodeService extends BaseService<INodeEvents> implements INodeService {
|
|
1709
|
-
createNodeByType(params: ICreateByNodeTypeParams): Promise<INode | null>;
|
|
1710
|
-
createNodeByAsset(params: ICreateByAssetParams): Promise<INode | null>;
|
|
1711
|
-
_createNode(assetUuid: string | null, canvasNeeded: boolean, checkUITransform: boolean, params: ICreateByNodeTypeParams | ICreateByAssetParams): Promise<INode | null>;
|
|
1712
|
-
/**
|
|
1713
|
-
* 获取或创建路径节点
|
|
1714
|
-
*/
|
|
1715
|
-
private _getOrCreateNodeByPath;
|
|
1716
|
-
/**
|
|
1717
|
-
* 确保路径存在,如果不存在则创建空节点
|
|
1718
|
-
*/
|
|
1719
|
-
private _ensurePathExists;
|
|
1720
|
-
deleteNode(params: IDeleteNodeParams): Promise<IDeleteNodeResult | null>;
|
|
1721
|
-
private _walkNode;
|
|
1722
|
-
updateNode(params: IUpdateNodeParams): Promise<IUpdateNodeResult>;
|
|
1723
|
-
queryNode(params: IQueryNodeParams): Promise<INode | null>;
|
|
1724
|
-
queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
|
|
1725
|
-
/**
|
|
1726
|
-
* 确保节点有 UITransform 组件
|
|
1727
|
-
* 目前只需保障在创建空节点的时候检查任意上级是否为 canvas
|
|
1728
|
-
*/
|
|
1729
|
-
ensureUITransformComponent(node: Node_2): void;
|
|
1730
|
-
/**
|
|
1731
|
-
* 检查并根据需要创建 canvas节点或为父级添加UITransform组件,返回父级节点,如果需要canvas节点,则父级节点会是canvas节点
|
|
1732
|
-
* @param workMode
|
|
1733
|
-
* @param canvasRequiredParam
|
|
1734
|
-
* @param parent
|
|
1735
|
-
* @param position
|
|
1736
|
-
* @returns
|
|
1737
|
-
*/
|
|
1738
|
-
checkCanvasRequired(workMode: string, canvasRequiredParam: boolean | undefined, parent: Node_2 | null, position: Vec3_2 | undefined): Promise<Node_2 | null>;
|
|
1739
|
-
onEditorOpened(): void;
|
|
1740
|
-
onEditorClosed(): void;
|
|
1741
|
-
private readonly NodeHandlers;
|
|
1742
|
-
private nodeHandlers;
|
|
1743
|
-
/**
|
|
1744
|
-
* 监听引擎发出的 node 事件
|
|
1745
|
-
* @param {*} node
|
|
1746
|
-
*/
|
|
1747
|
-
registerEventListeners(node: Node_2): void;
|
|
1748
|
-
/**
|
|
1749
|
-
* 取消监听引擎发出的node事件
|
|
1750
|
-
* @param {*} node
|
|
1751
|
-
*/
|
|
1752
|
-
unregisterEventListeners(node: Node_2): void;
|
|
1753
|
-
private readonly NodeMgrEventHandlers;
|
|
1754
|
-
private nodeMgrEventHandlers;
|
|
1755
|
-
/**
|
|
1756
|
-
* 注册引擎 Node 管理相关事件的监听
|
|
1757
|
-
*/
|
|
1758
|
-
registerNodeMgrEvents(): void;
|
|
1759
|
-
unregisterNodeMgrEvents(): void;
|
|
1760
|
-
onNodeTransformChanged(node: Node_2, transformBit: TransformBit): void;
|
|
1761
|
-
onNodeSizeChanged(node: Node_2): void;
|
|
1762
|
-
onNodeAnchorChanged(node: Node_2): void;
|
|
1763
|
-
onNodeParentChanged(parent: Node_2, child: Node_2): void;
|
|
1764
|
-
onLightProbeChanged(node: Node_2): void;
|
|
1765
|
-
/**
|
|
1766
|
-
* 添加一个节点到管理器内
|
|
1767
|
-
* @param uuid
|
|
1768
|
-
* @param {*} node
|
|
1769
|
-
*/
|
|
1770
|
-
add(uuid: string, node: Node_2): void;
|
|
1771
|
-
/**
|
|
1772
|
-
* 一个节点被修改,由 EditorExtends.Node.emit('change') 触发
|
|
1773
|
-
* @param uuid
|
|
1774
|
-
* @param node
|
|
1775
|
-
*/
|
|
1776
|
-
change(uuid: string, node: Node_2): void;
|
|
1777
|
-
/**
|
|
1778
|
-
* 从管理器内移除一个指定的节点
|
|
1779
|
-
* @param uuid
|
|
1780
|
-
* @param {*} node
|
|
1781
|
-
*/
|
|
1782
|
-
remove(uuid: string, node: Node_2): void;
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
1707
|
declare enum NodeType {
|
|
1786
1708
|
EMPTY = 'Empty',// 空节点
|
|
1787
1709
|
TERRAIN = 'Terrain',// 地形节点
|
|
@@ -1841,6 +1763,8 @@ declare enum NormalImportSetting {
|
|
|
1841
1763
|
recalculate = 3
|
|
1842
1764
|
}
|
|
1843
1765
|
|
|
1766
|
+
declare type OperationEvent = SceneDragEvent | SceneKeyboardEvent | SceneMouseEvent | 'resize';
|
|
1767
|
+
|
|
1844
1768
|
declare enum OptimizationPolicy {
|
|
1845
1769
|
AUTO = 0,
|
|
1846
1770
|
SINGLE_INSTANCE = 1,
|
|
@@ -1917,122 +1841,6 @@ declare interface PrefabAssetUserData {
|
|
|
1917
1841
|
syncNodeName?: string;
|
|
1918
1842
|
}
|
|
1919
1843
|
|
|
1920
|
-
export declare class PrefabService extends BaseService<IPrefabEvents> implements IPrefabService {
|
|
1921
|
-
private _softReloadTimer;
|
|
1922
|
-
private _utils;
|
|
1923
|
-
init(): void;
|
|
1924
|
-
/**
|
|
1925
|
-
* 将节点转换为预制体资源
|
|
1926
|
-
*/
|
|
1927
|
-
createPrefabFromNode(params: ICreatePrefabFromNodeParams): Promise<INode>;
|
|
1928
|
-
/**
|
|
1929
|
-
* 将节点的修改应用回预制体资源
|
|
1930
|
-
*/
|
|
1931
|
-
applyPrefabChanges(params: IApplyPrefabChangesParams): Promise<boolean>;
|
|
1932
|
-
/**
|
|
1933
|
-
* 重置节点到预制体原始状态
|
|
1934
|
-
*/
|
|
1935
|
-
revertToPrefab(params: IRevertToPrefabParams): Promise<boolean>;
|
|
1936
|
-
/**
|
|
1937
|
-
* 解耦预制体实例,使其成为普通节点
|
|
1938
|
-
*/
|
|
1939
|
-
unpackPrefabInstance(params: IUnpackPrefabInstanceParams): Promise<INode>;
|
|
1940
|
-
/**
|
|
1941
|
-
* 检查节点是否为预制体实例
|
|
1942
|
-
*/
|
|
1943
|
-
isPrefabInstance(params: IIsPrefabInstanceParams): Promise<boolean>;
|
|
1944
|
-
/**
|
|
1945
|
-
* 获取节点的预制体信息
|
|
1946
|
-
*/
|
|
1947
|
-
getPrefabInfo(params: IGetPrefabInfoParams): Promise<IPrefabInfo | null>;
|
|
1948
|
-
onEditorOpened(): void;
|
|
1949
|
-
onNodeRemoved(node: Node_2): void;
|
|
1950
|
-
onNodeChangedInGeneralMode(node: Node_2, opts: IChangeNodeOptions, root: Node_2 | Scene | null): void;
|
|
1951
|
-
onAddNode(node: Node_2): void;
|
|
1952
|
-
onNodeAdded(node: Node_2): void;
|
|
1953
|
-
onNodeChanged(node: Node_2, opts?: IChangeNodeOptions): void;
|
|
1954
|
-
onSetPropertyComponent(comp: Component, opts?: IChangeNodeOptions): void;
|
|
1955
|
-
removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void;
|
|
1956
|
-
checkToRemoveTargetOverride(source: Node_2 | Component, root: Node_2 | Scene | null): void;
|
|
1957
|
-
/**
|
|
1958
|
-
* 从一个节点生成一个PrefabAsset
|
|
1959
|
-
* @param nodeUUID
|
|
1960
|
-
* @param url
|
|
1961
|
-
* @param options
|
|
1962
|
-
*/
|
|
1963
|
-
createPrefabAssetFromNode(nodeUUID: string, url: string, options?: {
|
|
1964
|
-
undo: boolean;
|
|
1965
|
-
overwrite: boolean;
|
|
1966
|
-
}): Promise<Node_2 | null>;
|
|
1967
|
-
/**
|
|
1968
|
-
* 将一个 node 与一个 prefab 关联到一起
|
|
1969
|
-
* @param nodeUUID
|
|
1970
|
-
* @param {*} assetUuid 关联的资源
|
|
1971
|
-
*/
|
|
1972
|
-
linkNodeWithPrefabAsset(nodeUUID: string | Node_2, assetUuid: string | any): Promise<void>;
|
|
1973
|
-
/**
|
|
1974
|
-
* 从一个节点生成 prefab数据
|
|
1975
|
-
* 返回序列化数据
|
|
1976
|
-
* @param {*} nodeUUID
|
|
1977
|
-
*/
|
|
1978
|
-
generatePrefabDataFromNode(nodeUUID: string | Node_2): {
|
|
1979
|
-
prefabData: string;
|
|
1980
|
-
clearedReference: any;
|
|
1981
|
-
} | null;
|
|
1982
|
-
/**
|
|
1983
|
-
* 还原一个PrefabInstance的数据为它所关联的PrefabAsset
|
|
1984
|
-
* @param nodeUUID node
|
|
1985
|
-
*/
|
|
1986
|
-
revertPrefab(nodeUUID: Node_2 | string): Promise<boolean>;
|
|
1987
|
-
getUnlinkNodeUuids(uuid: string, removeNested?: boolean): string[];
|
|
1988
|
-
/**
|
|
1989
|
-
* 解除PrefabInstance对PrefabAsset的关联
|
|
1990
|
-
* @param nodeUUID 节点或节点的UUID
|
|
1991
|
-
* @param removeNested 是否递归的解除子节点PrefabInstance
|
|
1992
|
-
*/
|
|
1993
|
-
unWrapPrefabInstance(nodeUUID: string, removeNested?: boolean): boolean;
|
|
1994
|
-
unWrapPrefabInstanceInPrefabMode(nodeUUID: string | Node_2, removeNested?: boolean): boolean;
|
|
1995
|
-
/**
|
|
1996
|
-
* 将一个PrefabInstance的数据应用到对应的Asset资源上
|
|
1997
|
-
* @param nodeUUID uuid
|
|
1998
|
-
*/
|
|
1999
|
-
applyPrefab(nodeUUID: string): Promise<boolean>;
|
|
2000
|
-
onAddComponent(comp: Component): void;
|
|
2001
|
-
onComponentAdded(comp: Component): void;
|
|
2002
|
-
onRemoveComponentInGeneralMode(comp: Component, rootNode: Node_2 | Scene | null): void;
|
|
2003
|
-
onComponentRemovedInGeneralMode(comp: Component, rootNode: Node_2 | Scene | null): void;
|
|
2004
|
-
revertRemovedComponent(nodeUUID: string, fileID: string): Promise<void>;
|
|
2005
|
-
applyRemovedComponent(nodeUUID: string, fileID: string): Promise<void>;
|
|
2006
|
-
onAssetChanged(uuid: string): Promise<void>;
|
|
2007
|
-
onAssetDeleted(uuid: string): Promise<void>;
|
|
2008
|
-
/**
|
|
2009
|
-
* 将一个节点恢复到关联的 prefab 的状态
|
|
2010
|
-
* @param {*} nodeUuid
|
|
2011
|
-
*/
|
|
2012
|
-
revert(nodeUuid: string): void;
|
|
2013
|
-
/**
|
|
2014
|
-
* 将一个节点的修改,应用到关联的 prefab 上
|
|
2015
|
-
* @param {*} nodeUuid
|
|
2016
|
-
*/
|
|
2017
|
-
sync(nodeUuid: string): void;
|
|
2018
|
-
createNodeFromPrefabAsset(asset: any): Node_2 | null;
|
|
2019
|
-
filterChildOfAssetOfPrefabInstance(uuids: string | string[], operationTips: string): string[];
|
|
2020
|
-
filterPartOfPrefabAsset(uuids: string | string[], operationTips: string): string[];
|
|
2021
|
-
filterChildOfPrefabAssetWhenRemoveNode(uuids: string | string[]): string[];
|
|
2022
|
-
filterChildOfPrefabAssetWhenSetParent(uuids: string | string[]): string[];
|
|
2023
|
-
canModifySibling(uuid: string, target: number, offset: number): boolean;
|
|
2024
|
-
filterPartOfPrefabAssetWhenCreateComponent(uuids: string | string[]): string[];
|
|
2025
|
-
filterPartOfPrefabAssetWhenRemoveComponent(uuids: string | string[]): string[];
|
|
2026
|
-
/**
|
|
2027
|
-
* 暴力遍历root所有属性,找到rule返回true的路径
|
|
2028
|
-
* 比如找Scene节点的路径,rule = (obj)=> return obj.globals
|
|
2029
|
-
* @param root 根节点
|
|
2030
|
-
* @param rule 判断函数
|
|
2031
|
-
* @returns
|
|
2032
|
-
*/
|
|
2033
|
-
findPathWithRule(root: Node_2, rule: Function): string[];
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
1844
|
declare enum PrefabState {
|
|
2037
1845
|
NotAPrefab = 0,// Normal node, not a Prefab
|
|
2038
1846
|
PrefabChild = 1,// Child node of a Prefab, without PrefabInstance
|
|
@@ -2040,9 +1848,6 @@ declare enum PrefabState {
|
|
|
2040
1848
|
PrefabLostAsset = 3
|
|
2041
1849
|
}
|
|
2042
1850
|
|
|
2043
|
-
/** 类装饰器:注册 Service 类,自动收集所有公有方法 */
|
|
2044
|
-
export declare function register(name?: string): ClassDecorator;
|
|
2045
|
-
|
|
2046
1851
|
/**
|
|
2047
1852
|
* 重载结果
|
|
2048
1853
|
*/
|
|
@@ -2076,81 +1881,17 @@ declare interface RtSpriteFrameAssetUserData {
|
|
|
2076
1881
|
*/
|
|
2077
1882
|
declare const SCENE_TEMPLATE_TYPE: readonly ['2d', '3d', 'quality'];
|
|
2078
1883
|
|
|
2079
|
-
declare
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
Unset = ''
|
|
2085
|
-
}
|
|
1884
|
+
declare type SceneDragEvent = 'onDragLeave' | 'onDragOver' | 'onDrop';
|
|
1885
|
+
|
|
1886
|
+
declare type SceneKeyboardEvent = 'keydown' | 'keyup';
|
|
1887
|
+
|
|
1888
|
+
declare type SceneMouseEvent = 'dblclick' | 'mousedown' | 'mousemove' | 'mouseup' | 'mousewheel';
|
|
2086
1889
|
|
|
2087
1890
|
/** JavaScript 脚本模块的 userData */
|
|
2088
1891
|
declare interface ScriptModuleUserData {
|
|
2089
1892
|
isPlugin: false;
|
|
2090
1893
|
}
|
|
2091
1894
|
|
|
2092
|
-
export declare class ScriptService extends BaseService<IScriptEvents> implements IScriptService {
|
|
2093
|
-
private _executor;
|
|
2094
|
-
private _suspendPromise;
|
|
2095
|
-
private _syncPluginScripts;
|
|
2096
|
-
private _reloadScripts;
|
|
2097
|
-
/**
|
|
2098
|
-
* 非引擎定义的组件
|
|
2099
|
-
* @private
|
|
2100
|
-
*/
|
|
2101
|
-
private customComponents;
|
|
2102
|
-
constructor();
|
|
2103
|
-
/**
|
|
2104
|
-
* 挂起脚本管理器直到 `condition` 结束,才会进行下一次执行。
|
|
2105
|
-
* @param condition
|
|
2106
|
-
*/
|
|
2107
|
-
suspend(condition: Promise<void>): void;
|
|
2108
|
-
init(): Promise<void>;
|
|
2109
|
-
investigatePackerDriver(): Promise<void>;
|
|
2110
|
-
/**
|
|
2111
|
-
* 传入一个 uuid 返回这个 uuid 对应的脚本组件名字
|
|
2112
|
-
* @param uuid
|
|
2113
|
-
*/
|
|
2114
|
-
queryScriptName(uuid: string): Promise<string | null>;
|
|
2115
|
-
/**
|
|
2116
|
-
* 传入一个 uuid 返回这个 uuid 对应的脚本的 cid
|
|
2117
|
-
* @param uuid
|
|
2118
|
-
*/
|
|
2119
|
-
queryScriptCid(uuid: string): Promise<string | null>;
|
|
2120
|
-
/**
|
|
2121
|
-
* 是否是自定义脚本(不是引擎定义的组件)
|
|
2122
|
-
* @param classConstructor
|
|
2123
|
-
*/
|
|
2124
|
-
isCustomComponent(classConstructor: Function): boolean;
|
|
2125
|
-
_loadScripts(): Promise<void>;
|
|
2126
|
-
/**
|
|
2127
|
-
* 加载脚本时触发
|
|
2128
|
-
*/
|
|
2129
|
-
loadScript(): Promise<void>;
|
|
2130
|
-
/**
|
|
2131
|
-
* 删除脚本时触发
|
|
2132
|
-
*/
|
|
2133
|
-
removeScript(): Promise<void>;
|
|
2134
|
-
/**
|
|
2135
|
-
* 脚本发生变化时触发
|
|
2136
|
-
*/
|
|
2137
|
-
scriptChange(): Promise<void>;
|
|
2138
|
-
private _executeAsync;
|
|
2139
|
-
private _execute;
|
|
2140
|
-
/**
|
|
2141
|
-
* 防止插件脚本切换到项目脚本或者反之时,没有同步插件脚本列表
|
|
2142
|
-
* 这里使用了 AsyncIterationConcurrency1 功能,为了防止被多次调用,进行了迭代合并
|
|
2143
|
-
* @private
|
|
2144
|
-
*/
|
|
2145
|
-
private _syncPluginScriptListAsync;
|
|
2146
|
-
/**
|
|
2147
|
-
* 同步插件脚本列表到 Executor
|
|
2148
|
-
* @private
|
|
2149
|
-
*/
|
|
2150
|
-
private _syncPluginScriptList;
|
|
2151
|
-
private _handleImportException;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
1895
|
declare interface SerializedAssetFinder {
|
|
2155
1896
|
meshes?: Array<string | null>;
|
|
2156
1897
|
animations?: Array<string | null>;
|
|
@@ -2160,34 +1901,6 @@ declare interface SerializedAssetFinder {
|
|
|
2160
1901
|
scenes?: Array<string | null>;
|
|
2161
1902
|
}
|
|
2162
1903
|
|
|
2163
|
-
/**
|
|
2164
|
-
* 全局代理:通过 Service.Editor.xxx() 访问
|
|
2165
|
-
*/
|
|
2166
|
-
export declare const Service: IServiceManager;
|
|
2167
|
-
|
|
2168
|
-
/**
|
|
2169
|
-
* 范例
|
|
2170
|
-
* @register('Scene')
|
|
2171
|
-
* class SceneManager {
|
|
2172
|
-
* loadScene(name: string) {
|
|
2173
|
-
* console.log(`loading scene: ${name}`);
|
|
2174
|
-
* }
|
|
2175
|
-
*
|
|
2176
|
-
* unloadScene(name: string) {
|
|
2177
|
-
* console.log(`unloading scene: ${name}`);
|
|
2178
|
-
* }
|
|
2179
|
-
*
|
|
2180
|
-
* private internal() {
|
|
2181
|
-
* console.log('private logic');
|
|
2182
|
-
* }
|
|
2183
|
-
* }
|
|
2184
|
-
*
|
|
2185
|
-
* // 使用
|
|
2186
|
-
* import { Service } from './service';
|
|
2187
|
-
* Service.Editor.loadScene('Main');
|
|
2188
|
-
*/
|
|
2189
|
-
export declare type ServiceName = keyof IServiceManager;
|
|
2190
|
-
|
|
2191
1904
|
declare interface SimplifyOptions {
|
|
2192
1905
|
// 压缩比例
|
|
2193
1906
|
targetRatio?: number;
|