@cocos/cocos-cli-types 0.0.1-alpha.21.2 → 0.0.1-alpha.22.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/configuration.d.ts +13 -10
- package/index.d.ts +239 -10
- package/package.json +1 -1
- package/service.d.ts +217 -12
package/configuration.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare interface IBaseConfiguration extends EventEmitterMethods {
|
|
|
23
23
|
* 默认配置数据
|
|
24
24
|
*/
|
|
25
25
|
getDefaultConfig(): Record<string, any> | undefined;
|
|
26
|
+
mergeDefaultConfig(defaultConfig?: Record<string, any>): void;
|
|
26
27
|
/**
|
|
27
28
|
* 获取配置值
|
|
28
29
|
* @param key 配置键名,支持点号分隔的嵌套路径
|
|
@@ -61,26 +62,21 @@ export declare interface ICocosConfigurationNode {
|
|
|
61
62
|
properties: Record<string, ICocosConfigurationPropertySchema>;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
/**
|
|
65
|
-
* Cocos 配置元数据定义。
|
|
66
|
-
*
|
|
67
|
-
* 基于 COCOS_CONFIG 类型(@types/cocos.config.d.ts)展开,
|
|
68
|
-
* 按 group(顶级模块) → node(二级字段) 组织。
|
|
69
|
-
*
|
|
70
|
-
* 供 Pink 配置面板渲染使用,通过 CocosHostConfiguration.getMetadata() 返回。
|
|
71
|
-
*/
|
|
72
65
|
export declare interface ICocosConfigurationPropertySchema {
|
|
73
66
|
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
74
67
|
default?: unknown;
|
|
75
68
|
title?: string;
|
|
76
69
|
description?: string;
|
|
77
|
-
|
|
78
|
-
enum?: any[];
|
|
70
|
+
enum?: Array<string | number | boolean>;
|
|
79
71
|
enumDescriptions?: string[];
|
|
80
72
|
minimum?: number;
|
|
81
73
|
maximum?: number;
|
|
82
74
|
step?: number;
|
|
83
75
|
order?: number;
|
|
76
|
+
properties?: Record<string, ICocosConfigurationPropertySchema>;
|
|
77
|
+
items?: ICocosConfigurationPropertySchema | ICocosConfigurationPropertySchema[];
|
|
78
|
+
additionalProperties?: boolean | ICocosConfigurationPropertySchema;
|
|
79
|
+
required?: string[];
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
/**
|
|
@@ -99,6 +95,13 @@ export declare function migrate(): Promise<void>;
|
|
|
99
95
|
|
|
100
96
|
export declare function migrateFromProject(): Promise<IConfiguration>;
|
|
101
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 注册 configurationManager 保存事件的监听器
|
|
100
|
+
* 每次 cocos.config.json 被写入磁盘时触发
|
|
101
|
+
* @returns 取消监听的函数
|
|
102
|
+
*/
|
|
103
|
+
export declare function onDidSave(callback: () => void): () => void;
|
|
104
|
+
|
|
102
105
|
export declare function reload(): Promise<void>;
|
|
103
106
|
|
|
104
107
|
export declare function remove(key: string, scope?: ConfigurationScope): Promise<boolean>;
|
package/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import { NextFunction } from 'express';
|
|
|
6
6
|
import { Request as Request_2 } from 'express';
|
|
7
7
|
import { Response as Response_2 } from 'express';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Add component to node // 添加组件到节点
|
|
11
|
+
*/
|
|
12
|
+
declare function addComponent(options: IAddComponentOptions): Promise<IComponent>;
|
|
13
|
+
|
|
9
14
|
/** 动画剪辑资源的 userData */
|
|
10
15
|
declare interface AnimationClipAssetUserData {
|
|
11
16
|
/** 动画名称 */
|
|
@@ -446,6 +451,19 @@ declare type CCEModuleMap = {
|
|
|
446
451
|
|
|
447
452
|
declare function close_2(): Promise<void>;
|
|
448
453
|
|
|
454
|
+
export declare namespace Component {
|
|
455
|
+
export {
|
|
456
|
+
addComponent,
|
|
457
|
+
createComponent,
|
|
458
|
+
removeComponent,
|
|
459
|
+
queryComponent,
|
|
460
|
+
resetComponent,
|
|
461
|
+
setProperty,
|
|
462
|
+
executeComponentMethod,
|
|
463
|
+
queryAllComponent
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
|
|
449
467
|
export declare namespace Configuration {
|
|
450
468
|
export {
|
|
451
469
|
init_3 as init,
|
|
@@ -456,6 +474,7 @@ export declare namespace Configuration {
|
|
|
456
474
|
set,
|
|
457
475
|
remove,
|
|
458
476
|
save,
|
|
477
|
+
onDidSave,
|
|
459
478
|
getMetadata,
|
|
460
479
|
IConfiguration,
|
|
461
480
|
ConfigurationScope,
|
|
@@ -517,6 +536,11 @@ declare interface CreateAssetOptions {
|
|
|
517
536
|
customOptions?: Record<string, any>;
|
|
518
537
|
}
|
|
519
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Add component to node // 添加组件到节点
|
|
541
|
+
*/
|
|
542
|
+
declare function createComponent(options: IAddComponentOptions): Promise<boolean>;
|
|
543
|
+
|
|
520
544
|
/**
|
|
521
545
|
* Delete Asset // 删除资源
|
|
522
546
|
*/
|
|
@@ -611,6 +635,8 @@ declare interface ExecuteAssetDBScriptMethodOptions {
|
|
|
611
635
|
args?: any[];
|
|
612
636
|
}
|
|
613
637
|
|
|
638
|
+
declare function executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
639
|
+
|
|
614
640
|
declare interface Features {
|
|
615
641
|
[feature: string]: IModuleItem;
|
|
616
642
|
}
|
|
@@ -874,6 +900,14 @@ declare interface GlTFUserData {
|
|
|
874
900
|
};
|
|
875
901
|
}
|
|
876
902
|
|
|
903
|
+
/**
|
|
904
|
+
* 创建/添加组件
|
|
905
|
+
*/
|
|
906
|
+
declare interface IAddComponentOptions {
|
|
907
|
+
nodePathOrUuid: string;
|
|
908
|
+
component: string;
|
|
909
|
+
}
|
|
910
|
+
|
|
877
911
|
declare interface IAssetConfig {
|
|
878
912
|
displayName?: string;
|
|
879
913
|
description?: string;
|
|
@@ -981,6 +1015,7 @@ declare interface IBaseConfiguration extends EventEmitterMethods {
|
|
|
981
1015
|
* 默认配置数据
|
|
982
1016
|
*/
|
|
983
1017
|
getDefaultConfig(): Record<string, any> | undefined;
|
|
1018
|
+
mergeDefaultConfig(defaultConfig?: Record<string, any>): void;
|
|
984
1019
|
/**
|
|
985
1020
|
* 获取配置值
|
|
986
1021
|
* @param key 配置键名,支持点号分隔的嵌套路径
|
|
@@ -1024,32 +1059,62 @@ declare interface ICocosConfigurationNode {
|
|
|
1024
1059
|
properties: Record<string, ICocosConfigurationPropertySchema>;
|
|
1025
1060
|
}
|
|
1026
1061
|
|
|
1027
|
-
/**
|
|
1028
|
-
* Cocos 配置元数据定义。
|
|
1029
|
-
*
|
|
1030
|
-
* 基于 COCOS_CONFIG 类型(@types/cocos.config.d.ts)展开,
|
|
1031
|
-
* 按 group(顶级模块) → node(二级字段) 组织。
|
|
1032
|
-
*
|
|
1033
|
-
* 供 Pink 配置面板渲染使用,通过 CocosHostConfiguration.getMetadata() 返回。
|
|
1034
|
-
*/
|
|
1035
1062
|
declare interface ICocosConfigurationPropertySchema {
|
|
1036
1063
|
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
1037
1064
|
default?: unknown;
|
|
1038
1065
|
title?: string;
|
|
1039
1066
|
description?: string;
|
|
1040
|
-
|
|
1041
|
-
enum?: any[];
|
|
1067
|
+
enum?: Array<string | number | boolean>;
|
|
1042
1068
|
enumDescriptions?: string[];
|
|
1043
1069
|
minimum?: number;
|
|
1044
1070
|
maximum?: number;
|
|
1045
1071
|
step?: number;
|
|
1046
1072
|
order?: number;
|
|
1073
|
+
properties?: Record<string, ICocosConfigurationPropertySchema>;
|
|
1074
|
+
items?: ICocosConfigurationPropertySchema | ICocosConfigurationPropertySchema[];
|
|
1075
|
+
additionalProperties?: boolean | ICocosConfigurationPropertySchema;
|
|
1076
|
+
required?: string[];
|
|
1047
1077
|
}
|
|
1048
1078
|
|
|
1049
1079
|
declare interface ICollisionMatrix {
|
|
1050
1080
|
[x: string]: number;
|
|
1051
1081
|
}
|
|
1052
1082
|
|
|
1083
|
+
/**
|
|
1084
|
+
* 代表组件属性信息
|
|
1085
|
+
*/
|
|
1086
|
+
declare interface IComponent extends IComponentIdentifier {
|
|
1087
|
+
properties: {
|
|
1088
|
+
[key: string]: IPropertyValueType;
|
|
1089
|
+
};
|
|
1090
|
+
prefab: ICompPrefabInfo | null;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
declare interface IComponentForPinK extends IProperty {
|
|
1094
|
+
value: {
|
|
1095
|
+
enabled: IPropertyValueType;
|
|
1096
|
+
uuid: IPropertyValueType;
|
|
1097
|
+
name: IPropertyValueType;
|
|
1098
|
+
} & Record<string, IPropertyValueType>;
|
|
1099
|
+
mountedRoot?: string;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* 代表一个组件
|
|
1104
|
+
*/
|
|
1105
|
+
declare interface IComponentIdentifier {
|
|
1106
|
+
cid: string;
|
|
1107
|
+
path: string;
|
|
1108
|
+
uuid: string;
|
|
1109
|
+
name: string;
|
|
1110
|
+
type: string;
|
|
1111
|
+
enabled: boolean;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
declare interface ICompPrefabInfo {
|
|
1115
|
+
fileId: string;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1053
1118
|
/**
|
|
1054
1119
|
* 配置的格式
|
|
1055
1120
|
*/
|
|
@@ -1182,6 +1247,15 @@ declare interface IEngineProjectConfig extends Exclude<IEngineConfig, 'includeMo
|
|
|
1182
1247
|
globalConfigKey?: string;
|
|
1183
1248
|
}
|
|
1184
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* 执行组件方法选项
|
|
1252
|
+
*/
|
|
1253
|
+
declare interface IExecuteComponentMethodOptions {
|
|
1254
|
+
uuid: string;
|
|
1255
|
+
name: string;
|
|
1256
|
+
args: any[];
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1185
1259
|
declare interface IFbxSetting {
|
|
1186
1260
|
/**
|
|
1187
1261
|
* https://github.com/cocos-creator/FBX-glTF-conv/pull/26
|
|
@@ -1487,6 +1561,78 @@ declare interface IProject {
|
|
|
1487
1561
|
updateInfo<T>(keyOrValue: string | ProjectInfo, value?: T): Promise<boolean>;
|
|
1488
1562
|
}
|
|
1489
1563
|
|
|
1564
|
+
/**
|
|
1565
|
+
* 组件的 dump 数据,以 IProperty 格式编码组件信息
|
|
1566
|
+
* 与 IComponent 不同,所有属性(包括 uuid, name, enabled)都通过 encodeObject 编码为 IProperty
|
|
1567
|
+
*/
|
|
1568
|
+
declare interface IProperty {
|
|
1569
|
+
value: { [key: string]: IPropertyValueType } | IPropertyValueType;
|
|
1570
|
+
default?: any; // 默认值
|
|
1571
|
+
|
|
1572
|
+
// 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
|
|
1573
|
+
values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
|
|
1574
|
+
|
|
1575
|
+
lock?: { [key in keyof Vec4]?: IPropertyLock };
|
|
1576
|
+
|
|
1577
|
+
cid?: string;
|
|
1578
|
+
type?: string;
|
|
1579
|
+
ui?: { name: string; data?: any }; // 是否用指定的 UI 组件,name 是组件的名称
|
|
1580
|
+
readonly?: boolean;
|
|
1581
|
+
visible?: boolean;
|
|
1582
|
+
name?: string;
|
|
1583
|
+
|
|
1584
|
+
elementTypeData?: IProperty; // 数组里的数据的默认值 dump
|
|
1585
|
+
|
|
1586
|
+
path?: string; // 数据的搜索路径,这个是由使用方填充的
|
|
1587
|
+
|
|
1588
|
+
isArray?: boolean;
|
|
1589
|
+
invalid?: boolean;
|
|
1590
|
+
extends?: string[]; // 继承链
|
|
1591
|
+
displayName?: string; // 显示到界面上的名字
|
|
1592
|
+
displayOrder?: number; // 显示排序
|
|
1593
|
+
help?: string; // 帮助文档的 url 地址
|
|
1594
|
+
group?: IPropertyGroupOptions; // tab
|
|
1595
|
+
tooltip?: string; // 提示文本
|
|
1596
|
+
editor?: any; // 组件上定义的编辑器数据
|
|
1597
|
+
animatable?: boolean; // 是否可以在动画中编辑
|
|
1598
|
+
radioGroup?: boolean; // 是否渲染为 RadioGroup
|
|
1599
|
+
|
|
1600
|
+
// Enum
|
|
1601
|
+
enumList?: any[]; // enum 类型的 list 选项数组
|
|
1602
|
+
|
|
1603
|
+
bitmaskList?: any[];
|
|
1604
|
+
|
|
1605
|
+
// Number
|
|
1606
|
+
min?: number; // 数值类型的最小值
|
|
1607
|
+
max?: number; // 数值类型的最大值
|
|
1608
|
+
step?: number; // 数值类型的步进值
|
|
1609
|
+
slide?: boolean; // 数组是否显示为滑块
|
|
1610
|
+
unit?: string; // 显示的单位
|
|
1611
|
+
radian?: boolean; // 标识是否为角度
|
|
1612
|
+
|
|
1613
|
+
// Label
|
|
1614
|
+
multiline?: boolean; // 字符串是否允许换行
|
|
1615
|
+
// nullable?: boolean; 属性是否允许为空
|
|
1616
|
+
|
|
1617
|
+
optionalTypes?: string[]; // 对属性是 object 且是可变类型的数据的支持,比如 render-pipeline
|
|
1618
|
+
|
|
1619
|
+
userData?: { [key: string]: any }; // 用户透传的数据
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
declare interface IPropertyGroupOptions {
|
|
1623
|
+
id: string // 默认 'default'
|
|
1624
|
+
name: string,
|
|
1625
|
+
displayOrder: number, // 默认 Infinity, 排在最后面
|
|
1626
|
+
style: string // 默认为 'tab'
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
declare type IPropertyLock = {
|
|
1630
|
+
default: number;
|
|
1631
|
+
message: string
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
declare type IPropertyValueType = IProperty | IProperty[] | null | undefined | number | boolean | string | Vec4 | Vec3 | Vec2 | Mat4 | any | Array<unknown>
|
|
1635
|
+
|
|
1490
1636
|
declare interface IRedirectInfo {
|
|
1491
1637
|
// 跳转资源的类型
|
|
1492
1638
|
type: string;
|
|
@@ -1494,6 +1640,20 @@ declare interface IRedirectInfo {
|
|
|
1494
1640
|
uuid: string;
|
|
1495
1641
|
}
|
|
1496
1642
|
|
|
1643
|
+
/**
|
|
1644
|
+
* 删除组件
|
|
1645
|
+
*/
|
|
1646
|
+
declare interface IRemoveComponentOptions {
|
|
1647
|
+
pathOrUuidOrUrl: string;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
declare interface ISetPropertyOptionsForPink {
|
|
1651
|
+
uuid: string;
|
|
1652
|
+
path: string;
|
|
1653
|
+
dump: IProperty;
|
|
1654
|
+
record?: boolean;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1497
1657
|
declare interface ISocketConfig {
|
|
1498
1658
|
connection: (socket: any) => void;
|
|
1499
1659
|
disconnect: (socket: any) => void;
|
|
@@ -1639,6 +1799,28 @@ declare type MacroItem = {
|
|
|
1639
1799
|
|
|
1640
1800
|
declare type MakeRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
1641
1801
|
|
|
1802
|
+
declare interface Mat4 {
|
|
1803
|
+
m00: number;
|
|
1804
|
+
m01: number;
|
|
1805
|
+
m02: number;
|
|
1806
|
+
m03: number;
|
|
1807
|
+
|
|
1808
|
+
m04: number;
|
|
1809
|
+
m05: number;
|
|
1810
|
+
m06: number;
|
|
1811
|
+
m07: number;
|
|
1812
|
+
|
|
1813
|
+
m08: number;
|
|
1814
|
+
m09: number;
|
|
1815
|
+
m10: number;
|
|
1816
|
+
m11: number;
|
|
1817
|
+
|
|
1818
|
+
m12: number;
|
|
1819
|
+
m13: number;
|
|
1820
|
+
m14: number;
|
|
1821
|
+
m15: number;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1642
1824
|
export declare namespace Mcp {
|
|
1643
1825
|
export {
|
|
1644
1826
|
register,
|
|
@@ -1802,6 +1984,13 @@ declare function onAssetRemoved(listener: (info: IAssetInfo) => void): () => voi
|
|
|
1802
1984
|
*/
|
|
1803
1985
|
declare function onDBReady(listener: (dbInfo: IAssetDBInfo) => void): () => void;
|
|
1804
1986
|
|
|
1987
|
+
/**
|
|
1988
|
+
* 注册 configurationManager 保存事件的监听器
|
|
1989
|
+
* 每次 cocos.config.json 被写入磁盘时触发
|
|
1990
|
+
* @returns 取消监听的函数
|
|
1991
|
+
*/
|
|
1992
|
+
declare function onDidSave(callback: () => void): () => void;
|
|
1993
|
+
|
|
1805
1994
|
/**
|
|
1806
1995
|
* Register listener for initialization progress.
|
|
1807
1996
|
*
|
|
@@ -2069,6 +2258,11 @@ declare interface ProjectInfo {
|
|
|
2069
2258
|
*/
|
|
2070
2259
|
declare type ProjectType = '2d' | '3d';
|
|
2071
2260
|
|
|
2261
|
+
/**
|
|
2262
|
+
* Query all component names // 查询所有组件名称
|
|
2263
|
+
*/
|
|
2264
|
+
declare function queryAllComponent(): Promise<string[]>;
|
|
2265
|
+
|
|
2072
2266
|
/**
|
|
2073
2267
|
* Query Asset Config Map // 查询资源配置映射表
|
|
2074
2268
|
*/
|
|
@@ -2127,6 +2321,11 @@ declare function queryAssetUserDataConfig(urlOrUuidOrPath: string): Promise<fals
|
|
|
2127
2321
|
*/
|
|
2128
2322
|
declare function queryAssetUsers(uuidOrUrl: string, type?: QueryAssetType): Promise<string[]>;
|
|
2129
2323
|
|
|
2324
|
+
/**
|
|
2325
|
+
* Query component info // 查询组件信息
|
|
2326
|
+
*/
|
|
2327
|
+
declare function queryComponent(uuid: string): Promise<IComponentForPinK | null>;
|
|
2328
|
+
|
|
2130
2329
|
/**
|
|
2131
2330
|
* Query Creatable Asset Map // 查询可创建资源映射表
|
|
2132
2331
|
*/
|
|
@@ -2196,6 +2395,11 @@ declare function reload(): Promise<void>;
|
|
|
2196
2395
|
|
|
2197
2396
|
declare function remove(key: string, scope?: ConfigurationScope): Promise<boolean>;
|
|
2198
2397
|
|
|
2398
|
+
/**
|
|
2399
|
+
* Remove component from node // 移除节点上的组件
|
|
2400
|
+
*/
|
|
2401
|
+
declare function removeComponent(options: IRemoveComponentOptions): Promise<boolean>;
|
|
2402
|
+
|
|
2199
2403
|
/**
|
|
2200
2404
|
* Rename Asset // 重命名资源
|
|
2201
2405
|
*/
|
|
@@ -2207,6 +2411,8 @@ declare interface RenderTextureAssetUserData extends TextureBaseAssetUserData {
|
|
|
2207
2411
|
height: number;
|
|
2208
2412
|
}
|
|
2209
2413
|
|
|
2414
|
+
declare function resetComponent(uuid: string): Promise<void>;
|
|
2415
|
+
|
|
2210
2416
|
/** 渲染纹理精灵帧的 userData */
|
|
2211
2417
|
declare interface RtSpriteFrameAssetUserData {
|
|
2212
2418
|
/** 图片 UUID 或数据库 URI */
|
|
@@ -2269,6 +2475,11 @@ export declare namespace Server {
|
|
|
2269
2475
|
|
|
2270
2476
|
declare function set<T>(key: string, value: T, scope?: ConfigurationScope): Promise<boolean>;
|
|
2271
2477
|
|
|
2478
|
+
/**
|
|
2479
|
+
* Set component property // 设置组件属性
|
|
2480
|
+
*/
|
|
2481
|
+
declare function setProperty(options: ISetPropertyOptionsForPink): Promise<boolean>;
|
|
2482
|
+
|
|
2272
2483
|
declare interface SharedSettings {
|
|
2273
2484
|
useDefineForClassFields: boolean;
|
|
2274
2485
|
allowDeclareFields: boolean;
|
|
@@ -2472,6 +2683,24 @@ declare function updateAssetUserData(urlOrUuidOrPath: string, path: string, valu
|
|
|
2472
2683
|
*/
|
|
2473
2684
|
declare function updateDefaultUserData(handler: string, path: string, value: any): Promise<void>;
|
|
2474
2685
|
|
|
2686
|
+
declare interface Vec2 {
|
|
2687
|
+
x: number;
|
|
2688
|
+
y: number;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
declare interface Vec3 {
|
|
2692
|
+
x: number;
|
|
2693
|
+
y: number;
|
|
2694
|
+
z: number;
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
declare interface Vec4 {
|
|
2698
|
+
x: number;
|
|
2699
|
+
y: number;
|
|
2700
|
+
z: number;
|
|
2701
|
+
w: number;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2475
2704
|
declare type WrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat';
|
|
2476
2705
|
|
|
2477
2706
|
export { };
|
package/package.json
CHANGED
package/service.d.ts
CHANGED
|
@@ -245,11 +245,43 @@ declare interface BitmapFontAssetUserData {
|
|
|
245
245
|
* 在子进程中处理所有节点相关操作
|
|
246
246
|
*/
|
|
247
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;
|
|
248
261
|
private addComponentImpl;
|
|
249
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;
|
|
250
275
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
251
|
-
queryComponent(params: IQueryComponentOptions): Promise<IComponent | null>;
|
|
276
|
+
queryComponent(params: IQueryComponentOptions): Promise<IComponent | IComponentForPinK | null>;
|
|
252
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>;
|
|
253
285
|
private setPropertyImp;
|
|
254
286
|
queryAllComponent(): Promise<string[]>;
|
|
255
287
|
init(): void;
|
|
@@ -272,6 +304,12 @@ export declare class ComponentService extends BaseService<IComponentEvents> impl
|
|
|
272
304
|
* @param {cc.Component} component
|
|
273
305
|
*/
|
|
274
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>;
|
|
275
313
|
}
|
|
276
314
|
|
|
277
315
|
/**
|
|
@@ -602,10 +640,10 @@ declare interface GlTFUserData {
|
|
|
602
640
|
}
|
|
603
641
|
|
|
604
642
|
/**
|
|
605
|
-
*
|
|
643
|
+
* 创建/添加组件
|
|
606
644
|
*/
|
|
607
645
|
declare interface IAddComponentOptions {
|
|
608
|
-
|
|
646
|
+
nodePathOrUuid: string;
|
|
609
647
|
component: string;
|
|
610
648
|
}
|
|
611
649
|
|
|
@@ -762,13 +800,23 @@ declare interface IComponent extends IComponentIdentifier {
|
|
|
762
800
|
/**
|
|
763
801
|
* 场景事件类型
|
|
764
802
|
*/
|
|
765
|
-
declare interface IComponentEvents {
|
|
803
|
+
declare interface IComponentEvents extends INodeEvents {
|
|
766
804
|
'component:add': [Component];
|
|
767
805
|
'component:before-remove': [Component];
|
|
768
806
|
'component:remove': [Component];
|
|
769
807
|
'component:set-property': [Component, IChangeNodeOptions];
|
|
770
808
|
'component:added': [Component];
|
|
771
809
|
'component:removed': [Component];
|
|
810
|
+
'component:before-add-component': [string, Node_2];
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare interface IComponentForPinK extends IProperty {
|
|
814
|
+
value: {
|
|
815
|
+
enabled: IPropertyValueType;
|
|
816
|
+
uuid: IPropertyValueType;
|
|
817
|
+
name: IPropertyValueType;
|
|
818
|
+
} & Record<string, IPropertyValueType>;
|
|
819
|
+
mountedRoot?: string;
|
|
772
820
|
}
|
|
773
821
|
|
|
774
822
|
/**
|
|
@@ -788,10 +836,15 @@ declare interface IComponentIdentifier {
|
|
|
788
836
|
*/
|
|
789
837
|
declare interface IComponentService extends IServiceEvents {
|
|
790
838
|
/**
|
|
791
|
-
*
|
|
839
|
+
* 添加组件
|
|
792
840
|
* @param params
|
|
793
841
|
*/
|
|
794
842
|
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
843
|
+
/**
|
|
844
|
+
* 创建组件
|
|
845
|
+
* @param params
|
|
846
|
+
*/
|
|
847
|
+
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
795
848
|
/**
|
|
796
849
|
* 删除组件
|
|
797
850
|
* @param params
|
|
@@ -802,14 +855,27 @@ declare interface IComponentService extends IServiceEvents {
|
|
|
802
855
|
* @param params
|
|
803
856
|
*/
|
|
804
857
|
setProperty(params: ISetPropertyOptions): Promise<boolean>;
|
|
858
|
+
/**
|
|
859
|
+
* 设置组件属性,pink专属接口,因为结构与ISetPropertyOptions是不同的
|
|
860
|
+
* @param params
|
|
861
|
+
*/
|
|
862
|
+
setPropertyForPink(uuid: string, path: string, dump: IProperty, record?: boolean): Promise<boolean>;
|
|
805
863
|
/**
|
|
806
864
|
* 查询组件
|
|
807
865
|
*/
|
|
808
|
-
queryComponent(params: IQueryComponentOptions): Promise<IComponent | null>;
|
|
866
|
+
queryComponent(params: IQueryComponentOptions): Promise<IComponent | IComponentForPinK | null>;
|
|
809
867
|
/**
|
|
810
868
|
* 获取所有组件名,包含内置与自定义组件
|
|
811
869
|
*/
|
|
812
870
|
queryAllComponent(): Promise<string[]>;
|
|
871
|
+
/**
|
|
872
|
+
* 复位组件
|
|
873
|
+
*/
|
|
874
|
+
resetComponent(params: IQueryComponentOptions): Promise<boolean>;
|
|
875
|
+
/**
|
|
876
|
+
* 执行组件方法
|
|
877
|
+
*/
|
|
878
|
+
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
813
879
|
init(): void;
|
|
814
880
|
unregisterCompMgrEvents(): void;
|
|
815
881
|
}
|
|
@@ -926,6 +992,15 @@ declare interface IEngineService extends IServiceEvents {
|
|
|
926
992
|
repaintInEditMode(): Promise<void>;
|
|
927
993
|
}
|
|
928
994
|
|
|
995
|
+
/**
|
|
996
|
+
* 执行组件方法选项
|
|
997
|
+
*/
|
|
998
|
+
declare interface IExecuteComponentMethodOptions {
|
|
999
|
+
uuid: string;
|
|
1000
|
+
name: string;
|
|
1001
|
+
args: any[];
|
|
1002
|
+
}
|
|
1003
|
+
|
|
929
1004
|
declare interface IFbxSetting {
|
|
930
1005
|
/**
|
|
931
1006
|
* https://github.com/cocos-creator/FBX-glTF-conv/pull/26
|
|
@@ -1093,6 +1168,31 @@ declare interface INodeService extends IServiceEvents {
|
|
|
1093
1168
|
* 查询节点
|
|
1094
1169
|
*/
|
|
1095
1170
|
queryNode(params: IQueryNodeParams): Promise<INode | null>;
|
|
1171
|
+
/**
|
|
1172
|
+
* 查询节点树(层级管理器格式)
|
|
1173
|
+
*/
|
|
1174
|
+
queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
declare interface INodeTreeComponent {
|
|
1178
|
+
isCustom: boolean;
|
|
1179
|
+
type: string;
|
|
1180
|
+
value: string;
|
|
1181
|
+
extends: string[];
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
declare interface INodeTreeItem {
|
|
1185
|
+
name: string;
|
|
1186
|
+
active: boolean;
|
|
1187
|
+
locked: boolean;
|
|
1188
|
+
type: string;
|
|
1189
|
+
children: INodeTreeItem[];
|
|
1190
|
+
prefab: IPrefabStateInfo;
|
|
1191
|
+
parent: string;
|
|
1192
|
+
path: string;
|
|
1193
|
+
isScene: boolean;
|
|
1194
|
+
readonly: boolean;
|
|
1195
|
+
components: INodeTreeComponent[];
|
|
1096
1196
|
}
|
|
1097
1197
|
|
|
1098
1198
|
/**
|
|
@@ -1103,6 +1203,10 @@ declare interface IOpenOptions {
|
|
|
1103
1203
|
simpleNode?: boolean;
|
|
1104
1204
|
}
|
|
1105
1205
|
|
|
1206
|
+
export declare interface IOptionBase {
|
|
1207
|
+
modeName?: string;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1106
1210
|
declare interface IPrefab {
|
|
1107
1211
|
name: string;
|
|
1108
1212
|
uuid: string;
|
|
@@ -1169,16 +1273,86 @@ declare interface IPrefabService extends IServiceEvents {
|
|
|
1169
1273
|
removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void;
|
|
1170
1274
|
}
|
|
1171
1275
|
|
|
1276
|
+
declare interface IPrefabStateInfo {
|
|
1277
|
+
state: PrefabState;
|
|
1278
|
+
isUnwrappable: boolean;
|
|
1279
|
+
isRevertable: boolean;
|
|
1280
|
+
isApplicable: boolean;
|
|
1281
|
+
isAddedChild: boolean;
|
|
1282
|
+
isNested: boolean;
|
|
1283
|
+
assetUuid: string;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* 组件的 dump 数据,以 IProperty 格式编码组件信息
|
|
1288
|
+
* 与 IComponent 不同,所有属性(包括 uuid, name, enabled)都通过 encodeObject 编码为 IProperty
|
|
1289
|
+
*/
|
|
1172
1290
|
declare interface IProperty {
|
|
1173
1291
|
value: { [key: string]: IPropertyValueType } | IPropertyValueType;
|
|
1292
|
+
default?: any; // 默认值
|
|
1293
|
+
|
|
1294
|
+
// 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
|
|
1295
|
+
values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
|
|
1296
|
+
|
|
1297
|
+
lock?: { [key in keyof Vec4]?: IPropertyLock };
|
|
1298
|
+
|
|
1299
|
+
cid?: string;
|
|
1174
1300
|
type?: string;
|
|
1301
|
+
ui?: { name: string; data?: any }; // 是否用指定的 UI 组件,name 是组件的名称
|
|
1175
1302
|
readonly?: boolean;
|
|
1303
|
+
visible?: boolean;
|
|
1176
1304
|
name?: string;
|
|
1305
|
+
|
|
1306
|
+
elementTypeData?: IProperty; // 数组里的数据的默认值 dump
|
|
1307
|
+
|
|
1177
1308
|
path?: string; // 数据的搜索路径,这个是由使用方填充的
|
|
1309
|
+
|
|
1178
1310
|
isArray?: boolean;
|
|
1311
|
+
invalid?: boolean;
|
|
1312
|
+
extends?: string[]; // 继承链
|
|
1313
|
+
displayName?: string; // 显示到界面上的名字
|
|
1314
|
+
displayOrder?: number; // 显示排序
|
|
1315
|
+
help?: string; // 帮助文档的 url 地址
|
|
1316
|
+
group?: IPropertyGroupOptions; // tab
|
|
1317
|
+
tooltip?: string; // 提示文本
|
|
1318
|
+
editor?: any; // 组件上定义的编辑器数据
|
|
1319
|
+
animatable?: boolean; // 是否可以在动画中编辑
|
|
1320
|
+
radioGroup?: boolean; // 是否渲染为 RadioGroup
|
|
1321
|
+
|
|
1322
|
+
// Enum
|
|
1323
|
+
enumList?: any[]; // enum 类型的 list 选项数组
|
|
1324
|
+
|
|
1325
|
+
bitmaskList?: any[];
|
|
1326
|
+
|
|
1327
|
+
// Number
|
|
1328
|
+
min?: number; // 数值类型的最小值
|
|
1329
|
+
max?: number; // 数值类型的最大值
|
|
1330
|
+
step?: number; // 数值类型的步进值
|
|
1331
|
+
slide?: boolean; // 数组是否显示为滑块
|
|
1332
|
+
unit?: string; // 显示的单位
|
|
1333
|
+
radian?: boolean; // 标识是否为角度
|
|
1334
|
+
|
|
1335
|
+
// Label
|
|
1336
|
+
multiline?: boolean; // 字符串是否允许换行
|
|
1337
|
+
// nullable?: boolean; 属性是否允许为空
|
|
1338
|
+
|
|
1339
|
+
optionalTypes?: string[]; // 对属性是 object 且是可变类型的数据的支持,比如 render-pipeline
|
|
1340
|
+
|
|
1179
1341
|
userData?: { [key: string]: any }; // 用户透传的数据
|
|
1180
1342
|
}
|
|
1181
1343
|
|
|
1344
|
+
declare interface IPropertyGroupOptions {
|
|
1345
|
+
id: string // 默认 'default'
|
|
1346
|
+
name: string,
|
|
1347
|
+
displayOrder: number, // 默认 Infinity, 排在最后面
|
|
1348
|
+
style: string // 默认为 'tab'
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
declare type IPropertyLock = {
|
|
1352
|
+
default: number;
|
|
1353
|
+
message: string
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1182
1356
|
declare interface IPropertyOverrideInfo {
|
|
1183
1357
|
targetInfo: ITargetInfo | null;
|
|
1184
1358
|
propertyPath: string[];
|
|
@@ -1198,7 +1372,8 @@ declare interface IQuat {
|
|
|
1198
1372
|
* 查询组件
|
|
1199
1373
|
*/
|
|
1200
1374
|
declare interface IQueryComponentOptions {
|
|
1201
|
-
|
|
1375
|
+
pathOrUuidOrUrl: string;
|
|
1376
|
+
isFull?: boolean;
|
|
1202
1377
|
}
|
|
1203
1378
|
|
|
1204
1379
|
declare interface IQueryNodeParams {
|
|
@@ -1207,6 +1382,10 @@ declare interface IQueryNodeParams {
|
|
|
1207
1382
|
queryComponent: boolean;
|
|
1208
1383
|
}
|
|
1209
1384
|
|
|
1385
|
+
declare interface IQueryNodeTreeParams {
|
|
1386
|
+
path?: string;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1210
1389
|
declare interface IRedirectInfo {
|
|
1211
1390
|
// 跳转资源的类型
|
|
1212
1391
|
type: string;
|
|
@@ -1225,7 +1404,7 @@ declare interface IReloadOptions {
|
|
|
1225
1404
|
* 删除组件
|
|
1226
1405
|
*/
|
|
1227
1406
|
declare interface IRemoveComponentOptions {
|
|
1228
|
-
|
|
1407
|
+
pathOrUuidOrUrl: string;
|
|
1229
1408
|
}
|
|
1230
1409
|
|
|
1231
1410
|
declare interface IRevertToPrefabParams {
|
|
@@ -1249,6 +1428,13 @@ declare interface IScene extends IBaseIdentifier {
|
|
|
1249
1428
|
components: IComponentIdentifier[];
|
|
1250
1429
|
}
|
|
1251
1430
|
|
|
1431
|
+
export declare interface ISceneEvents {
|
|
1432
|
+
onAddComponent?(comp: Component): void;
|
|
1433
|
+
onRemoveComponent?(comp: Component): void;
|
|
1434
|
+
onComponentAdded?(comp: Component, opts?: IOptionBase): void;
|
|
1435
|
+
onComponentRemoved?(comp: Component, opts?: IOptionBase): void;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1252
1438
|
declare interface IScriptEvents {
|
|
1253
1439
|
/**
|
|
1254
1440
|
* 当脚本刷新并执行完成时触发
|
|
@@ -1263,7 +1449,7 @@ declare interface IScriptService extends IServiceEvents {
|
|
|
1263
1449
|
scriptChange(): Promise<void>;
|
|
1264
1450
|
queryScriptCid(uuid: string): Promise<string | null>;
|
|
1265
1451
|
queryScriptName(uuid: string): Promise<string | null>;
|
|
1266
|
-
isCustomComponent(classConstructor: Function):
|
|
1452
|
+
isCustomComponent(classConstructor: Function): boolean;
|
|
1267
1453
|
suspend(condition: Promise<any>): void;
|
|
1268
1454
|
}
|
|
1269
1455
|
|
|
@@ -1287,6 +1473,9 @@ declare interface IServiceEvents {
|
|
|
1287
1473
|
onComponentAdded?(comp: Component): void;
|
|
1288
1474
|
onComponentRemoved?(comp: Component): void;
|
|
1289
1475
|
onBeforeRemoveComponent?(comp: Component): void;
|
|
1476
|
+
onComponentBeforeChanged?(node: Node_2): void;
|
|
1477
|
+
onBeforeComponentAdded?(name: string, node: Node_2): void;
|
|
1478
|
+
onComponentChanged?(name: string, opts: IChangeNodeOptions): void;
|
|
1290
1479
|
onAssetDeleted?(uuid: string): void;
|
|
1291
1480
|
onAssetChanged?(uuid: string): void;
|
|
1292
1481
|
onAssetRefreshed?(uuid: string): void;
|
|
@@ -1532,6 +1721,7 @@ export declare class NodeService extends BaseService<INodeEvents> implements INo
|
|
|
1532
1721
|
private _walkNode;
|
|
1533
1722
|
updateNode(params: IUpdateNodeParams): Promise<IUpdateNodeResult>;
|
|
1534
1723
|
queryNode(params: IQueryNodeParams): Promise<INode | null>;
|
|
1724
|
+
queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
|
|
1535
1725
|
/**
|
|
1536
1726
|
* 确保节点有 UITransform 组件
|
|
1537
1727
|
* 目前只需保障在创建空节点的时候检查任意上级是否为 canvas
|
|
@@ -1653,8 +1843,8 @@ declare enum NormalImportSetting {
|
|
|
1653
1843
|
|
|
1654
1844
|
declare enum OptimizationPolicy {
|
|
1655
1845
|
AUTO = 0,
|
|
1656
|
-
SINGLE_INSTANCE =
|
|
1657
|
-
MULTI_INSTANCE =
|
|
1846
|
+
SINGLE_INSTANCE = 1,
|
|
1847
|
+
MULTI_INSTANCE = 2
|
|
1658
1848
|
}
|
|
1659
1849
|
|
|
1660
1850
|
/** 粒子资源的 userData */
|
|
@@ -1843,6 +2033,13 @@ export declare class PrefabService extends BaseService<IPrefabEvents> implements
|
|
|
1843
2033
|
findPathWithRule(root: Node_2, rule: Function): string[];
|
|
1844
2034
|
}
|
|
1845
2035
|
|
|
2036
|
+
declare enum PrefabState {
|
|
2037
|
+
NotAPrefab = 0,// Normal node, not a Prefab
|
|
2038
|
+
PrefabChild = 1,// Child node of a Prefab, without PrefabInstance
|
|
2039
|
+
PrefabInstance = 2,// Root node of a Prefab that contains a PrefabInstance
|
|
2040
|
+
PrefabLostAsset = 3
|
|
2041
|
+
}
|
|
2042
|
+
|
|
1846
2043
|
/** 类装饰器:注册 Service 类,自动收集所有公有方法 */
|
|
1847
2044
|
export declare function register(name?: string): ClassDecorator;
|
|
1848
2045
|
|
|
@@ -1879,6 +2076,14 @@ declare interface RtSpriteFrameAssetUserData {
|
|
|
1879
2076
|
*/
|
|
1880
2077
|
declare const SCENE_TEMPLATE_TYPE: readonly ['2d', '3d', 'quality'];
|
|
1881
2078
|
|
|
2079
|
+
declare enum SceneModeType {
|
|
2080
|
+
General = 'general',
|
|
2081
|
+
Prefab = 'prefab',
|
|
2082
|
+
Animation = 'animation',
|
|
2083
|
+
Preview = 'preview',
|
|
2084
|
+
Unset = ''
|
|
2085
|
+
}
|
|
2086
|
+
|
|
1882
2087
|
/** JavaScript 脚本模块的 userData */
|
|
1883
2088
|
declare interface ScriptModuleUserData {
|
|
1884
2089
|
isPlugin: false;
|
|
@@ -1916,7 +2121,7 @@ export declare class ScriptService extends BaseService<IScriptEvents> implements
|
|
|
1916
2121
|
* 是否是自定义脚本(不是引擎定义的组件)
|
|
1917
2122
|
* @param classConstructor
|
|
1918
2123
|
*/
|
|
1919
|
-
isCustomComponent(classConstructor: Function):
|
|
2124
|
+
isCustomComponent(classConstructor: Function): boolean;
|
|
1920
2125
|
_loadScripts(): Promise<void>;
|
|
1921
2126
|
/**
|
|
1922
2127
|
* 加载脚本时触发
|