-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support @base/object
module
#16410
support @base/object
module
#16410
Conversation
import dependUtil from './depend-util'; | ||
import { DependUtil } from './depend-util'; | ||
import downloader from './downloader'; | ||
import { Downloader } from './downloader'; | ||
import dependUtil, { DependUtil } from './depend-util'; | ||
import downloader, { Downloader } from './downloader'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as it's discussed before #16247 (comment)
we prefer to separate the default import and named import, but currently we have no suitable eslint rule to supporting to do this.
so I revert this change to adapt to current eslint rules
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -7723,8 +7723,434 @@
*/
ERROR_FOR_WEB_PAGE = 7
}
/**
+ * @en
+ * Defines a BitMask type. The editor will display different inspector depending on this data type. It may define some properties to the object.
+ * The keys of new properties are the integer type values, and the values are corresponding keys. See the example below.
+ * keys.
+ * @zh
+ * 定义一个位掩码类型。编辑器会根据这个数据类型显示不同的显示界面。它可能会在对象添加新属性。新属性的 key 是原来的整型 value,value 是对应的 key。参考下面的例子。
+ * @param obj
+ * @en A JavaScript literal object containing BitMask names and values.
+ * @zh 包含 BitMask 名称和值的 JavaScript 文字对象。
+ * @returns @en The defined BitMask type @zh 定义的位掩码类型。
+ * @example
+ * ```ts
+ * // `type1` and `type2` are single-selected.
+ * let obj = {
+ * type1: 0,
+ * type2: 1 << 2,
+ * }
+ *
+ * // `type1` and `type2` are multiple-selected.
+ * // New properties are added to obj, obj now is
+ * // {
+ * // type1: 0,
+ * // type2: 1<< 2,
+ * // 0: type1,
+ * // 4: type2
+ * // }
+ * BitMask(obj);
+ * ```
+ */
+ export function BitMask<T extends object>(obj: T): T;
+ export namespace BitMask {
+ export var isBitMask: (BitMaskType: any) => any;
+ export var getList: (BitMaskDef: any) => any;
+ export var update: (BitMaskDef: any) => any;
+ }
+ /**
+ * @en
+ * Define an enum type. <br/>
+ * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
+ * Otherwise it will use the value specified by user who writes the enum definition.
+ *
+ * @zh
+ * 定义一个枚举类型。<br/>
+ * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
+ *
+ * @param obj
+ * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
+ * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
+ * @return @en The defined enum type. @zh 定义的枚举类型。
+ */
+ export function Enum<T extends object>(obj: T): T;
+ export namespace Enum {
+ export var update: <T extends object>(obj: T) => T;
+ export var isEnum: <EnumT extends object>(enumType: EnumT) => boolean;
+ export var getList: <EnumT extends object>(enumType: EnumT) => readonly __private._cocos_base_object_src_value_types_enum__Enum.Enumerator<EnumT>[];
+ export var sortList: <EnumT extends object>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
+ }
+ /**
+ * Make the enum type `enumType` as enumeration so that Creator may identify, operate on it.
+ * Formally, as a result of invocation on this function with enum type `enumType`:
+ * - `Enum.isEnum(enumType)` returns `true`;
+ * - `Enum.getList(enumType)` returns the enumerators of `enumType`.
+ * @param
+ * @en enumType An enum type, eg, a kind of type with similar semantic defined by TypeScript.
+ * @zh 枚举类型,例如 TypeScript 中定义的类型。
+ */
+ export function ccenum<EnumT extends object>(enumType: EnumT): void;
+ /**
+ * @en The base class of all value types.
+ * @zh 所有值类型的基类。
+ */
+ export class ValueType {
+ /**
+ * @en
+ * Clone the current object. The clone result of the object should be equal to the current object,
+ * i.e. satisfy `this.equals(this, value.clone())`.
+ * The base version of this method do nothing and returns `this'.
+ * The derived class **must** rewrite this method and the returned object should not be `this`, i.e. satisfy `this !== this.clone()`.
+ * @zh
+ * 克隆当前值。克隆的结果值应与当前值相等,即满足 `this.equals(this, value.clone())`。
+ * 本方法的基类版本简单地返回 `this`;
+ * 派生类**必须**重写本方法,并且返回的对象不应当为 `this`,即满足 `this !== this.clone()`。
+ * @returns @en The cloned object. @zh 克隆的对象。
+ */
+ clone(): ValueType;
+ /**
+ * @en
+ * Check whether the current object is equal to the specified object.
+ * This check should be interchangeable, i.e. satisfy `this.equals(other) === other.equals(this)`.
+ * The base version of this method will returns `false'.
+ * @zh
+ * 判断当前值是否与指定值相等。此判断应当具有交换性,即满足 `this.equals(other) === other.equals(this)`。
+ * 本方法的基类版本简单地返回 `false`。
+ * @param other @en The other object @zh 指定值。
+ * @returns @en `true` if equal, otherwise returns `false` @zh 如果相等,则返回 `true`,否则返回 `false`。
+ */
+ equals(other: this): boolean;
+ /**
+ * @en
+ * Set the property values of the current object with the given object.
+ * The base version of this method will returns `this' and the derived class **must** rewrite this method.
+ * @zh
+ * 赋值当前值使其与指定值相等。
+ * 本方法的基类版本简单地返回 `this`,派生类**必须**重写本方法。
+ * @param other @en The other object. @zh 指定值。
+ */
+ set(other: this): void;
+ /**
+ * @en
+ * Convert the current object to a string.
+ * The base version of this method will returns an empty string.
+ * @zh
+ * 返回当前值的字符串表示。
+ * 本方法的基类版本返回空字符串。
+ * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
+ */
+ toString(): string;
+ }
+ export function CCClass<TFunction>(options: {
+ name?: string;
+ extends: null | (__private.____packages_cc_ambient_types_src_globals__Constructor & {
+ __props__?: any;
+ _sealed?: boolean;
+ });
+ ctor: TFunction;
+ properties?: Record<string, __private._cocos_base_object_src_class_stash__PropertyStash>;
+ editor?: any;
+ }): any;
+ export namespace CCClass {
+ export var _isCCClass: (constructor: any) => boolean;
+ export var fastDefine: (className: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>, serializableFields: Record<string, unknown>) => void;
+ export var Attr: typeof __private._cocos_base_object_src_utils_attribute;
+ export var attr: typeof __private._cocos_base_object_src_utils_attribute.attr;
+ export var isCCClassOrFastDefined: typeof __private._cocos_base_object_src_class__isCCClassOrFastDefined;
+ export var getInheritanceChain: (constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>) => any[];
+ export var isArray: (defaultVal: any) => boolean;
+ export var getDefault: (defaultVal: any) => any;
+ export var escapeForJS: (s: any) => string;
+ export var IDENTIFIER_RE: RegExp;
+ export var getNewValueTypeCode: any;
+ }
+ /**
+ * @en
+ * The base class of most of all the objects in Fireball.
+ * @zh
+ * 大部分对象的基类。
+ * @private
+ */
+ export class CCObject implements __private._cocos_base_object_src_editor_extras_tag__EditorExtendableObject {
+ static _deferredDestroy(): void;
+ /**
+ * @internal
+ */
+ [editorExtrasTag]: unknown;
+ /**
+ * @internal
+ */
+ _objFlags: number;
+ protected _name: string;
+ constructor(name?: string);
+ /**
+ * @en The name of the object.
+ * @zh 该对象的名称。
+ * @default ""
+ * @example
+ * ```
+ * obj.name = "New Obj";
+ * ```
+ */
+ get name(): string;
+ set name(value: string);
+ /**
+ * @en After inheriting CCObject objects, control whether you need to hide, lock, serialize, and other functions.
+ * @zh 在继承 CCObject 对象后,控制是否需要隐藏,锁定,序列化等功能。
+ */
+ set hideFlags(hideFlags: CCObject.Flags);
+ get hideFlags(): CCObject.Flags;
+ /**
+ * @en
+ * Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
+ * When an object's `destroy` is called, it is actually destroyed after the end of this frame.
+ * So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
+ * If you want to determine whether the current frame has called `destroy`, use `isValid(obj, true)`,
+ * but this is often caused by a particular logical requirements, which is not normally required.
+ *
+ * @zh
+ * 表示该对象是否可用(被 destroy 后将不可用)。<br>
+ * 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。<br>
+ * 因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。<br>
+ * 如果希望判断当前帧是否调用过 `destroy`,请使用 `isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
+ * @default true
+ * @readOnly
+ * @example
+ * ```ts
+ * import { Node, log } from 'cc';
+ * const node = new Node();
+ * log(node.isValid); // true
+ * node.destroy();
+ * log(node.isValid); // true, still valid in this frame
+ * // after a frame...
+ * log(node.isValid); // false, destroyed in the end of last frame
+ * ```
+ */
+ get isValid(): boolean;
+ /**
+ * @en
+ * Destroy this Object, and release all its own references to other objects.<br/>
+ * Actual object destruction will delayed until before rendering.
+ * From the next frame, this object is not usable any more.
+ * You can use `isValid(obj)` to check whether the object is destroyed before accessing it.
+ * @zh
+ * 销毁该对象,并释放所有它对其它对象的引用。<br/>
+ * 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
+ * 您可以在访问对象之前使用 `isValid(obj)` 来检查对象是否已被销毁。
+ * @return whether it is the first time the destroy being called
+ * @example
+ * ```
+ * obj.destroy();
+ * ```
+ */
+ destroy(): boolean;
+ /**
+ * @en
+ * Clear all references in the instance.
+ *
+ * NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject.
+ *
+ * @zh
+ * 清理实例的所有引用
+ * 注意:此方法不会清理实例上的 getter 与 setter 方法。
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @example
+ * ```
+ * // You can override the _destruct method if you need, for example:
+ * _destruct: function () {
+ * for (var key in this) {
+ * if (this.hasOwnProperty(key)) {
+ * switch (typeof this[key]) {
+ * case 'string':
+ * this[key] = '';
+ * break;
+ * case 'object':
+ * case 'function':
+ * this[key] = null;
+ * break;
+ * }
+ * }
+ * }
+ * ```
+ */
+ _destruct(): void;
+ /**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
+ _destroyImmediate(): void;
+ }
+ export namespace CCObject {
+ export enum Flags {
+ Destroyed,
+ /**
+ * @en The object will not be saved.
+ * @zh 该对象将不会被保存。
+ */
+ DontSave,
+ /**
+ * @en The object will not be saved when building a player.
+ * @zh 构建项目时,该对象将不会被保存。
+ */
+ EditorOnly,
+ Dirty,
+ /**
+ * @en Dont destroy automatically when loading a new scene.
+ * @zh 加载一个新场景时,不自动删除该对象。
+ * @private
+ */
+ DontDestroy,
+ /**
+ * @en
+ * @zh
+ * @private
+ */
+ PersistentMask,
+ /**
+ * @en
+ * @zh
+ * @private
+ */
+ Destroying,
+ /**
+ * @en The node is deactivating.
+ * @zh 节点正在反激活的过程中。
+ * @private
+ */
+ Deactivating,
+ /**
+ * @en
+ * Hide in game and hierarchy.
+ * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
+ * @zh
+ * 在游戏和层级中隐藏该对象。<br/>
+ * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
+ */
+ /**
+ * @en The lock node, when the node is locked, cannot be clicked in the scene.
+ * @zh 锁定节点,锁定后场景内不能点击。
+ * @private
+ */
+ LockedInEditor,
+ /**
+ * @en Hide the object in editor.
+ * @zh 在编辑器中隐藏该对象。
+ */
+ HideInHierarchy,
+ /**
+ * @en The object will not be saved and hide the object in editor,and lock node, when the node is locked,
+ * cannot be clicked in the scene,and The object will not be saved when building a player.
+ * @zh 该对象将不会被保存,构建项目时,该对象将不会被保存, 锁定节点,锁定后场景内不能点击, 在编辑器中隐藏该对象。
+ */
+ AllHideMasks,
+ /**
+ * @en
+ * Hide in game view, hierarchy, and scene view... etc.
+ * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
+ * @zh
+ * 在游戏视图,层级,场景视图等等...中隐藏该对象。
+ * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
+ */
+ IsPreloadStarted,
+ IsOnLoadStarted,
+ IsOnLoadCalled,
+ IsOnEnableCalled,
+ IsStartCalled,
+ IsEditorOnEnableCalled,
+ IsPositionLocked,
+ IsRotationLocked,
+ IsScaleLocked,
+ IsAnchorLocked,
+ IsSizeLocked
+ }
+ export let __props__: string[];
+ export let __values__: string[];
+ }
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as an Integer value.
+ * @zh
+ * 指定编辑器以整数形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCInteger, _decorator } from "cc";
+ *
+ * // in the class definition:
+ *
+ * @_decorator.property({type: CCInteger})
+ * count = 0;
+ *
+ * @_decorator.property({type: [CCInteger]})
+ * array = [];
+ * ```
+ */
+ export const CCInteger: __private._cocos_base_object_src_utils_attribute__PrimitiveType<number>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a Float value.
+ * @zh
+ * 指定编辑器以浮点数形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCFloat, _decorator } from "cc";
+ *
+ * // in the class definition:
+ *
+ * @_decorator.property({type: CCFloat})
+ * x = 0;
+ *
+ * @_decorator.property({type: [CCFloat]})
+ * array = [];
+ * ```
+ */
+ export const CCFloat: __private._cocos_base_object_src_utils_attribute__PrimitiveType<number>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a Boolean value.
+ * @zh
+ * 指定编辑器以布尔值形式对待该属性或数组元素。
+ *
+ * @example
+ * ```ts
+ * import { CCBoolean, _decorator } from "cc";
+ * // in the class definition
+ * @_decorator.property({type: CCBoolean})
+ * isTrue = false;
+ *
+ * @_decorator.property({type: [CCBoolean]})
+ * array = [];
+ * ```
+ */
+ export const CCBoolean: __private._cocos_base_object_src_utils_attribute__PrimitiveType<boolean>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a String value.
+ * @zh
+ * 指定编辑器以字符串形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCString, _decorator } from "cc";
+ *
+ * // in the class definition
+ *
+ * @_decorator.property({type: CCString})
+ * name = '';
+ *
+ * @_decorator.property({type: [CCString]})
+ * array = [];
+ * ```
+ */
+ export const CCString: __private._cocos_base_object_src_utils_attribute__PrimitiveType<string>;
+ /**
+ * Tag to visit editor extras of an object. Never be concerned about its value, please.
+ */
+ export const editorExtrasTag = "__editorExtras__";
+ export function setPropertyEnumType(objectOrConstructor: object, propertyName: string, enumType: __private._cocos_base_object_src_value_types_enum__EnumType): void;
+ export function setPropertyEnumTypeOnAttrs(attrs: Record<string, unknown>, propertyName: string, enumType: __private._cocos_base_object_src_value_types_enum__EnumType): void;
+ export function isCCObject(object: any): object is CCObject;
+ export function isValid(value: any, strictMode?: boolean): boolean;
+ /**
* @en The root manager of the renderer which manages all device resources and the render pipeline.
* @zh 基础渲染器管理类,管理所有设备相关的资源创建以及渲染管线。
*/
export class Root {
@@ -19597,127 +20023,8 @@
export class frustum extends Frustum {
constructor();
}
}
- /**
- * @en
- * Defines a BitMask type. The editor will display different inspector depending on this data type. It may define some properties to the object.
- * The keys of new properties are the integer type values, and the values are corresponding keys. See the example below.
- * keys.
- * @zh
- * 定义一个位掩码类型。编辑器会根据这个数据类型显示不同的显示界面。它可能会在对象添加新属性。新属性的 key 是原来的整型 value,value 是对应的 key。参考下面的例子。
- * @param obj
- * @en A JavaScript literal object containing BitMask names and values.
- * @zh 包含 BitMask 名称和值的 JavaScript 文字对象。
- * @returns @en The defined BitMask type @zh 定义的位掩码类型。
- * @example
- * ```ts
- * // `type1` and `type2` are single-selected.
- * let obj = {
- * type1: 0,
- * type2: 1 << 2,
- * }
- *
- * // `type1` and `type2` are multiple-selected.
- * // New properties are added to obj, obj now is
- * // {
- * // type1: 0,
- * // type2: 1<< 2,
- * // 0: type1,
- * // 4: type2
- * // }
- * BitMask(obj);
- * ```
- */
- export function BitMask<T extends object>(obj: T): T;
- export namespace BitMask {
- export var isBitMask: (BitMaskType: any) => any;
- export var getList: (BitMaskDef: any) => any;
- export var update: (BitMaskDef: any) => any;
- }
- /**
- * @en
- * Define an enum type. <br/>
- * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
- * Otherwise it will use the value specified by user who writes the enum definition.
- *
- * @zh
- * 定义一个枚举类型。<br/>
- * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
- *
- * @param obj
- * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
- * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
- * @return @en The defined enum type. @zh 定义的枚举类型。
- */
- export function Enum<T extends object>(obj: T): T;
- export namespace Enum {
- export var update: <T extends object>(obj: T) => T;
- export var isEnum: <EnumT extends object>(enumType: EnumT) => boolean;
- export var getList: <EnumT extends object>(enumType: EnumT) => readonly __private._cocos_core_value_types_enum__Enum.Enumerator<EnumT>[];
- export var sortList: <EnumT extends object>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
- }
- /**
- * Make the enum type `enumType` as enumeration so that Creator may identify, operate on it.
- * Formally, as a result of invocation on this function with enum type `enumType`:
- * - `Enum.isEnum(enumType)` returns `true`;
- * - `Enum.getList(enumType)` returns the enumerators of `enumType`.
- * @param
- * @en enumType An enum type, eg, a kind of type with similar semantic defined by TypeScript.
- * @zh 枚举类型,例如 TypeScript 中定义的类型。
- */
- export function ccenum<EnumT extends object>(enumType: EnumT): void;
- /**
- * @en The base class of all value types.
- * @zh 所有值类型的基类。
- */
- export class ValueType {
- /**
- * @en
- * Clone the current object. The clone result of the object should be equal to the current object,
- * i.e. satisfy `this.equals(this, value.clone())`.
- * The base version of this method do nothing and returns `this'.
- * The derived class **must** rewrite this method and the returned object should not be `this`, i.e. satisfy `this !== this.clone()`.
- * @zh
- * 克隆当前值。克隆的结果值应与当前值相等,即满足 `this.equals(this, value.clone())`。
- * 本方法的基类版本简单地返回 `this`;
- * 派生类**必须**重写本方法,并且返回的对象不应当为 `this`,即满足 `this !== this.clone()`。
- * @returns @en The cloned object. @zh 克隆的对象。
- */
- clone(): ValueType;
- /**
- * @en
- * Check whether the current object is equal to the specified object.
- * This check should be interchangeable, i.e. satisfy `this.equals(other) === other.equals(this)`.
- * The base version of this method will returns `false'.
- * @zh
- * 判断当前值是否与指定值相等。此判断应当具有交换性,即满足 `this.equals(other) === other.equals(this)`。
- * 本方法的基类版本简单地返回 `false`。
- * @param other @en The other object @zh 指定值。
- * @returns @en `true` if equal, otherwise returns `false` @zh 如果相等,则返回 `true`,否则返回 `false`。
- */
- equals(other: this): boolean;
- /**
- * @en
- * Set the property values of the current object with the given object.
- * The base version of this method will returns `this' and the derived class **must** rewrite this method.
- * @zh
- * 赋值当前值使其与指定值相等。
- * 本方法的基类版本简单地返回 `this`,派生类**必须**重写本方法。
- * @param other @en The other object. @zh 指定值。
- */
- set(other: this): void;
- /**
- * @en
- * Convert the current object to a string.
- * The base version of this method will returns an empty string.
- * @zh
- * 返回当前值的字符串表示。
- * 本方法的基类版本返回空字符串。
- * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
- */
- toString(): string;
- }
export namespace misc {
/**
* @en Inserts a new element into a map. All values corresponding to the same key are stored in an array.
* @zh 往 map 插入一个元素。同一个关键字对应的所有值存储在一个数组里。
@@ -20031,8 +20338,9 @@
* @zh 标注属性为 cc 属性。<br/>
* 等价于`@property()`。
*/
export function property(...args: Parameters<__private._cocos_core_data_decorators_utils__LegacyPropertyDecorator>): void;
+ /// <reference types="cc-ambient-types" />
/**
* @en Declare that the current component relies on another type of component.
* If the required component doesn't exist, the engine will create a new empty instance of the required component and add it to the node.
* @zh 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
@@ -20048,9 +20356,9 @@
* // ...
* }
* ```
*/
- export const requireComponent: (requiredComponent: Function | Function[]) => ClassDecorator;
+ export const requireComponent: (requiredComponent: __private.____packages_cc_ambient_types_src_globals__AnyFunction | __private.____packages_cc_ambient_types_src_globals__AnyFunction[]) => ClassDecorator;
/**
* @en Set the component priority, it decides at which order the life cycle functions of components will be invoked. Smaller priority gets invoked before larger priority.
* This will affect `onLoad`, `onEnable`, `start`, `update` and `lateUpdate`, but `onDisable` and `onDestroy` won't be affected.
* @zh 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
@@ -20198,10 +20506,10 @@
*/
export function type(type: Function | [
Function
] | any): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
- export function type<T>(type: __private._cocos_core_data_utils_attribute__PrimitiveType<T> | [
- __private._cocos_core_data_utils_attribute__PrimitiveType<T>
+ export function type<T>(type: __private._cocos_base_object_src_utils_attribute__PrimitiveType<T> | [
+ __private._cocos_base_object_src_utils_attribute__PrimitiveType<T>
]): __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
/**
* @en Declare the property as integer
* @zh 将该属性标记为整数。
@@ -20222,308 +20530,9 @@
* @zh 将该属性标记为字符串。
*/
export const string: __private._cocos_core_data_decorators_utils__LegacyPropertyDecorator;
}
- export function CCClass<TFunction>(options: {
- name?: string;
- extends: null | (__private.____packages_cc_ambient_types_src_globals__Constructor & {
- __props__?: any;
- _sealed?: boolean;
- });
- ctor: TFunction;
- properties?: Record<string, __private._cocos_core_data_class_stash__PropertyStash>;
- editor?: any;
- }): any;
- export namespace CCClass {
- export var _isCCClass: (constructor: any) => boolean;
- export var fastDefine: (className: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>, serializableFields: Record<string, unknown>) => void;
- export var Attr: typeof __private._cocos_core_data_utils_attribute;
- export var attr: typeof __private._cocos_core_data_utils_attribute.attr;
- export var isCCClassOrFastDefined: typeof __private._cocos_core_data_class__isCCClassOrFastDefined;
- export var getInheritanceChain: (constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>) => any[];
- export var isArray: (defaultVal: any) => boolean;
- export var getDefault: (defaultVal: any) => any;
- export var escapeForJS: (s: any) => string;
- export var IDENTIFIER_RE: RegExp;
- export var getNewValueTypeCode: any;
- }
/**
- * @en
- * The base class of most of all the objects in Fireball.
- * @zh
- * 大部分对象的基类。
- * @private
- */
- export class CCObject implements __private._cocos_core_data_editor_extras_tag__EditorExtendableObject {
- static _deferredDestroy(): void;
- /**
- * @internal
- */
- [editorExtrasTag]: unknown;
- /**
- * @internal
- */
- _objFlags: number;
- protected _name: string;
- constructor(name?: string);
- /**
- * @en The name of the object.
- * @zh 该对象的名称。
- * @default ""
- * @example
- * ```
- * obj.name = "New Obj";
- * ```
- */
- get name(): string;
- set name(value: string);
- /**
- * @en After inheriting CCObject objects, control whether you need to hide, lock, serialize, and other functions.
- * @zh 在继承 CCObject 对象后,控制是否需要隐藏,锁定,序列化等功能。
- */
- set hideFlags(hideFlags: CCObject.Flags);
- get hideFlags(): CCObject.Flags;
- /**
- * @en
- * Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
- * When an object's `destroy` is called, it is actually destroyed after the end of this frame.
- * So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
- * If you want to determine whether the current frame has called `destroy`, use `isValid(obj, true)`,
- * but this is often caused by a particular logical requirements, which is not normally required.
- *
- * @zh
- * 表示该对象是否可用(被 destroy 后将不可用)。<br>
- * 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。<br>
- * 因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。<br>
- * 如果希望判断当前帧是否调用过 `destroy`,请使用 `isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
- * @default true
- * @readOnly
- * @example
- * ```ts
- * import { Node, log } from 'cc';
- * const node = new Node();
- * log(node.isValid); // true
- * node.destroy();
- * log(node.isValid); // true, still valid in this frame
- * // after a frame...
- * log(node.isValid); // false, destroyed in the end of last frame
- * ```
- */
- get isValid(): boolean;
- /**
- * @en
- * Destroy this Object, and release all its own references to other objects.<br/>
- * Actual object destruction will delayed until before rendering.
- * From the next frame, this object is not usable any more.
- * You can use `isValid(obj)` to check whether the object is destroyed before accessing it.
- * @zh
- * 销毁该对象,并释放所有它对其它对象的引用。<br/>
- * 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
- * 您可以在访问对象之前使用 `isValid(obj)` 来检查对象是否已被销毁。
- * @return whether it is the first time the destroy being called
- * @example
- * ```
- * obj.destroy();
- * ```
- */
- destroy(): boolean;
- /**
- * @en
- * Clear all references in the instance.
- *
- * NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject.
- *
- * @zh
- * 清理实例的所有引用
- * 注意:此方法不会清理实例上的 getter 与 setter 方法。
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- * @example
- * ```
- * // You can override the _destruct method if you need, for example:
- * _destruct: function () {
- * for (var key in this) {
- * if (this.hasOwnProperty(key)) {
- * switch (typeof this[key]) {
- * case 'string':
- * this[key] = '';
- * break;
- * case 'object':
- * case 'function':
- * this[key] = null;
- * break;
- * }
- * }
- * }
- * ```
- */
- _destruct(): void;
- /**
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- _destroyImmediate(): void;
- }
- export namespace CCObject {
- export enum Flags {
- Destroyed,
- /**
- * @en The object will not be saved.
- * @zh 该对象将不会被保存。
- */
- DontSave,
- /**
- * @en The object will not be saved when building a player.
- * @zh 构建项目时,该对象将不会被保存。
- */
- EditorOnly,
- Dirty,
- /**
- * @en Dont destroy automatically when loading a new scene.
- * @zh 加载一个新场景时,不自动删除该对象。
- * @private
- */
- DontDestroy,
- /**
- * @en
- * @zh
- * @private
- */
- PersistentMask,
- /**
- * @en
- * @zh
- * @private
- */
- Destroying,
- /**
- * @en The node is deactivating.
- * @zh 节点正在反激活的过程中。
- * @private
- */
- Deactivating,
- /**
- * @en
- * Hide in game and hierarchy.
- * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
- * @zh
- * 在游戏和层级中隐藏该对象。<br/>
- * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
- */
- /**
- * @en The lock node, when the node is locked, cannot be clicked in the scene.
- * @zh 锁定节点,锁定后场景内不能点击。
- * @private
- */
- LockedInEditor,
- /**
- * @en Hide the object in editor.
- * @zh 在编辑器中隐藏该对象。
- */
- HideInHierarchy,
- /**
- * @en The object will not be saved and hide the object in editor,and lock node, when the node is locked,
- * cannot be clicked in the scene,and The object will not be saved when building a player.
- * @zh 该对象将不会被保存,构建项目时,该对象将不会被保存, 锁定节点,锁定后场景内不能点击, 在编辑器中隐藏该对象。
- */
- AllHideMasks,
- /**
- * @en
- * Hide in game view, hierarchy, and scene view... etc.
- * This flag is readonly, it can only be used as an argument of scene.addEntity() or Entity.createWithFlags().
- * @zh
- * 在游戏视图,层级,场景视图等等...中隐藏该对象。
- * 该标记只读,它只能被用作 scene.addEntity()的一个参数。
- */
- IsPreloadStarted,
- IsOnLoadStarted,
- IsOnLoadCalled,
- IsOnEnableCalled,
- IsStartCalled,
- IsEditorOnEnableCalled,
- IsPositionLocked,
- IsRotationLocked,
- IsScaleLocked,
- IsAnchorLocked,
- IsSizeLocked
- }
- export let __props__: string[];
- export let __values__: string[];
- }
- /**
- * @en
- * Indicates that the editor should treat this property or array element as an Integer value.
- * @zh
- * 指定编辑器以整数形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCInteger, _decorator } from "cc";
- *
- * // in the class definition:
- *
- * @_decorator.property({type: CCInteger})
- * count = 0;
- *
- * @_decorator.property({type: [CCInteger]})
- * array = [];
- * ```
- */
- export const CCInteger: __private._cocos_core_data_utils_attribute__PrimitiveType<number>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a Float value.
- * @zh
- * 指定编辑器以浮点数形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCFloat, _decorator } from "cc";
- *
- * // in the class definition:
- *
- * @_decorator.property({type: CCFloat})
- * x = 0;
- *
- * @_decorator.property({type: [CCFloat]})
- * array = [];
- * ```
- */
- export const CCFloat: __private._cocos_core_data_utils_attribute__PrimitiveType<number>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a Boolean value.
- * @zh
- * 指定编辑器以布尔值形式对待该属性或数组元素。
- *
- * @example
- * ```ts
- * import { CCBoolean, _decorator } from "cc";
- * // in the class definition
- * @_decorator.property({type: CCBoolean})
- * isTrue = false;
- *
- * @_decorator.property({type: [CCBoolean]})
- * array = [];
- * ```
- */
- export const CCBoolean: __private._cocos_core_data_utils_attribute__PrimitiveType<boolean>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a String value.
- * @zh
- * 指定编辑器以字符串形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCString, _decorator } from "cc";
- *
- * // in the class definition
- *
- * @_decorator.property({type: CCString})
- * name = '';
- *
- * @_decorator.property({type: [CCString]})
- * array = [];
- * ```
- */
- export const CCString: __private._cocos_core_data_utils_attribute__PrimitiveType<string>;
- /**
* @deprecated Since V3.5.0.
*/
export class CompactValueTypeArray {
static StorageUnit: typeof __private._cocos_core_data_utils_compact_value_type_array__StorageUnit;
@@ -20548,12 +20557,8 @@
*/
decompress<T>(arrayBuffer: ArrayBuffer): T[];
}
/**
- * Tag to visit editor extras of an object. Never be concerned about its value, please.
- */
- export const editorExtrasTag = "__editorExtras__";
- /**
* Tag to define the custom deserialization method.
* @internal
*/
export const deserializeTag: unique symbol;
@@ -22247,12 +22252,8 @@
number,
number,
number
];
- export function setPropertyEnumType(objectOrConstructor: object, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
- export function setPropertyEnumTypeOnAttrs(attrs: Record<string, unknown>, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
- export function isCCObject(object: any): object is CCObject;
- export function isValid(value: any, strictMode?: boolean): boolean;
export namespace js {
/**
* @en Inserts a new element into a map. All values corresponding to the same key are stored in an array.
* @zh 往 map 插入一个元素。同一个关键字对应的所有值存储在一个数组里。
@@ -51992,10 +51993,10 @@
protected _materialCache: {
[key: string]: renderer.MaterialInstance;
};
paused: boolean;
- protected _enumSkins: __private._cocos_core_value_types_enum__EnumType;
- protected _enumAnimations: __private._cocos_core_value_types_enum__EnumType;
+ protected _enumSkins: __private._cocos_base_object_src_value_types_enum__EnumType;
+ protected _enumAnimations: __private._cocos_base_object_src_value_types_enum__EnumType;
protected attachUtil: __private._cocos_spine_attach_util__AttachUtil;
protected _socketNodes: Map<number, Node>;
protected _cachedSockets: Map<string, number>;
protected _paused: boolean;
@@ -57863,9 +57864,9 @@
/**
* Engine classes with this kind of signature are integrated with editor extendability.
* @internal
*/
- export interface _cocos_core_data_editor_extras_tag__EditorExtendableObject {
+ export interface _cocos_base_object_src_editor_extras_tag__EditorExtendableObject {
/**
* @en
* The editor extras on this object.
*
@@ -57909,9 +57910,9 @@
/**
* Class which implements the `EditorExtendableObject` interface.
* @engineInternal
*/
- export const _cocos_core_data_editor_extendable__EditorExtendable: new (...args: any[]) => _cocos_core_data_editor_extras_tag__EditorExtendableObject;
+ export const _cocos_core_data_editor_extendable__EditorExtendable: new (...args: any[]) => _cocos_base_object_src_editor_extras_tag__EditorExtendableObject;
export type _cocos_core_data_editor_extendable__EditorExtendable = InstanceType<typeof _cocos_core_data_editor_extendable__EditorExtendable>;
export abstract class _cocos_animation_embedded_player_embedded_player__EmbeddedPlayableState {
constructor(randomAccess: boolean);
/**
@@ -61224,8 +61225,306 @@
ENDED = "ended"
}
export type _pal_audio_type__AudioBufferView = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
export type _cocos_base_debug_src_index__StringSubstitution = number | string;
+ /**
+ * @en
+ * Define an enum type. <br/>
+ * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
+ * Otherwise it will use the value specified by user who writes the enum definition.
+ *
+ * @zh
+ * 定义一个枚举类型。<br/>
+ * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
+ *
+ * @param obj
+ * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
+ * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
+ * @return @en The defined enum type. @zh 定义的枚举类型。
+ */
+ export function _cocos_base_object_src_value_types_enum__Enum<T extends object>(obj: T): T;
+ export namespace _cocos_base_object_src_value_types_enum__Enum {
+ var update: <T extends object>(obj: T) => T;
+ var isEnum: <EnumT extends object>(enumType: EnumT) => boolean;
+ var getList: <EnumT extends object>(enumType: EnumT) => readonly _cocos_base_object_src_value_types_enum__Enum.Enumerator<EnumT>[];
+ var sortList: <EnumT extends object>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
+ }
+ export namespace _cocos_base_object_src_value_types_enum__Enum {
+ interface Enumerator<EnumT> {
+ /**
+ * The name of the enumerator.
+ */
+ name: keyof EnumT;
+ /**
+ * The value of the numerator.
+ */
+ value: EnumT[keyof EnumT];
+ }
+ }
+ export type _cocos_base_object_src_utils_attribute_defines__GroupOptions = {
+ name: string;
+ } & Partial<{
+ id: string;
+ name: string;
+ displayOrder: number;
+ style: string;
+ }>;
+ export interface _cocos_base_object_src_utils_attribute_defines__IExposedAttributes {
+ /**
+ * 指定属性的类型。
+ */
+ type?: any;
+ /**
+ * 控制是否在编辑器中显示该属性。
+ */
+ visible?: boolean | (() => boolean);
+ /**
+ * 该属性在编辑器中的显示名称。
+ */
+ displayName?: string;
+ /**
+ *
+ */
+ displayOrder?: number;
+ /**
+ * @en Editor tooltip of this property.
+ * @zh 该属性在编辑器中的工具提示内容。
+ */
+ tooltip?: string;
+ /**
+ * @en The group name where this property is organized into, on property inspector.
+ * @zh 在属性检查器上该属性所属的分类标签名。
+ */
+ group?: string | _cocos_base_object_src_utils_attribute_defines__GroupOptions;
+ /**
+ *
+ */
+ multiline?: boolean;
+ /**
+ * 指定该属性是否为可读的。
+ * 将 `readonly` 指定为 `true` 或选项对象时都将标记为该属性是可读的;
+ * 当指定为 `true` 时将应用所有默认的只读性质。
+ * @default false
+ */
+ readonly?: boolean | {
+ /**
+ * 如果该属性是对象或数组,指定该对象的属性或该数组的元素是否是只读的。
+ * 若为 `true`,递归的所有属性或元素都将是只读的。
+ * @default true
+ */
+ deep?: boolean;
+ };
+ /**
+ * 当该属性为数值类型时,指定了该属性允许的最小值。
+ */
+ min?: number;
+ /**
+ * 当该属性为数值类型时,指定了该属性允许的最大值。
+ */
+ max?: number;
+ /**
+ * 当该属性为数值类型时并在编辑器中提供了滑动条时,指定了滑动条的步长。
+ */
+ step?: number;
+ /**
+ * 当该属性为数值类型时,指定了该属性允许的范围。
+ */
+ range?: number[];
+ /**
+ * 当该属性为数值类型时,是否在编辑器中提供滑动条来调节值。
+ */
+ slide?: boolean;
+ /**
+ * 该属性是否参与序列化和反序列化。
+ */
+ serializable?: boolean;
+ /**
+ * 该属性的曾用名。
+ */
+ formerlySerializedAs?: string;
+ /**
+ * 该属性是否仅仅在编辑器环境中生效。
+ */
+ editorOnly?: boolean;
+ /**
+ * 是否覆盖基类中的同名属性。
+ */
+ override?: boolean;
+ /**
+ *
+ */
+ animatable?: boolean;
+ /**
+ *
+ */
+ unit?: string;
+ /**
+ * 转换为弧度
+ */
+ radian?: boolean;
+ /**
+ * @en User custom data, which can be obtained through the `CCClass.attr()` interface.
+ * @zh 用户自定义数据,可以通过 `CCClass.attr()` 接口获取自定义数据。
+ */
+ userData?: Record<string, any>;
+ /**
+ * 在允许的情况下,在编辑器中显示为一组单选按钮
+ */
+ radioGroup?: boolean;
+ }
+ export interface _cocos_base_object_src_class_stash__PropertyStash extends _cocos_base_object_src_utils_attribute_defines__IExposedAttributes {
+ /**
+ * The property's default value.
+ */
+ default?: unknown;
+ /**
+ * The property's getter, if it's an accessor.
+ */
+ get?: () => unknown;
+ /**
+ * The property's setter, if it's an accessor.
+ */
+ set?: (value: unknown) => void;
+ /**
+ * Reserved for deprecated usage.
+ */
+ _short?: unknown;
+ /**
+ * Some decorators may write this internal slot. See `PropertyStashInternalFlag`.
+ */
+ __internalFlags: number;
+ }
+ export class _cocos_base_object_src_utils_attribute__PrimitiveType<T> {
+ name: string;
+ default: T;
+ constructor(name: string, defaultValue: T);
+ toString(): string;
+ }
+ namespace _cocos_base_object_src_utils_attribute {
+ /// <reference types="cc-ambient-types" />
+ export const DELIMETER = "$_$";
+ export function createAttrsSingle(owner: Record<string | number, unknown>, superAttrs?: unknown): any;
+ /**
+ * @param subclass Should not have '__attrs__'.
+ */
+ export function createAttrs(subclass: any): any;
+ /**
+ * Tag the class with any meta attributes, then return all current attributes assigned to it.
+ * This function holds only the attributes, not their implementations.
+ * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
+ * @param propertyName The name of the property or function, used to retrieve the attributes.
+ * @private
+ */
+ export function attr(constructor: any, propertyName: string): {
+ [attributeName: string]: any;
+ };
+ /**
+ * Returns a read-only meta-object.
+ */
+ export function getClassAttrs(constructor: any): any;
+ export function setClassAttr(ctor: any, propName: any, key: any, value: any): void;
+ export class PrimitiveType<T> {
+ name: string;
+ default: T;
+ constructor(name: string, defaultValue: T);
+ toString(): string;
+ }
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as an Integer value.
+ * @zh
+ * 指定编辑器以整数形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCInteger, _decorator } from "cc";
+ *
+ * // in the class definition:
+ *
+ * @_decorator.property({type: CCInteger})
+ * count = 0;
+ *
+ * @_decorator.property({type: [CCInteger]})
+ * array = [];
+ * ```
+ */
+ export const CCInteger: _cocos_base_object_src_utils_attribute__PrimitiveType<number>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a Float value.
+ * @zh
+ * 指定编辑器以浮点数形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCFloat, _decorator } from "cc";
+ *
+ * // in the class definition:
+ *
+ * @_decorator.property({type: CCFloat})
+ * x = 0;
+ *
+ * @_decorator.property({type: [CCFloat]})
+ * array = [];
+ * ```
+ */
+ export const CCFloat: _cocos_base_object_src_utils_attribute__PrimitiveType<number>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a Boolean value.
+ * @zh
+ * 指定编辑器以布尔值形式对待该属性或数组元素。
+ *
+ * @example
+ * ```ts
+ * import { CCBoolean, _decorator } from "cc";
+ * // in the class definition
+ * @_decorator.property({type: CCBoolean})
+ * isTrue = false;
+ *
+ * @_decorator.property({type: [CCBoolean]})
+ * array = [];
+ * ```
+ */
+ export const CCBoolean: _cocos_base_object_src_utils_attribute__PrimitiveType<boolean>;
+ /**
+ * @en
+ * Indicates that the editor should treat this property or array element as a String value.
+ * @zh
+ * 指定编辑器以字符串形式对待该属性或数组元素。
+ * @example
+ * ```ts
+ * import { CCString, _decorator } from "cc";
+ *
+ * // in the class definition
+ *
+ * @_decorator.property({type: CCString})
+ * name = '';
+ *
+ * @_decorator.property({type: [CCString]})
+ * array = [];
+ * ```
+ */
+ export const CCString: _cocos_base_object_src_utils_attribute__PrimitiveType<string>;
+ export function getTypeChecker_ET(type: string, attributeName: string): (constructor: ____packages_cc_ambient_types_src_globals__Constructor, mainPropertyName: string) => void;
+ export function getObjTypeChecker_ET(typeCtor: any): (classCtor: ____packages_cc_ambient_types_src_globals__Constructor, mainPropName: string) => void;
+ }
+ /**
+ * Tag the class with any meta attributes, then return all current attributes assigned to it.
+ * This function holds only the attributes, not their implementations.
+ * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
+ * @param propertyName The name of the property or function, used to retrieve the attributes.
+ * @private
+ */
+ export function _cocos_base_object_src_utils_attribute__attr(constructor: any, propertyName: string): {
+ [attributeName: string]: any;
+ };
+ /**
+ * Returns if the class is a cc-class or is fast-defined.
+ * @param constructor The constructor of the class.
+ * @returns Judge result.
+ * @engineInternal
+ */
+ export function _cocos_base_object_src_class__isCCClassOrFastDefined<T>(constructor: ____packages_cc_ambient_types_src_globals__Constructor<T>): boolean;
+ export type _cocos_base_object_src_value_types_enum__EnumType = Record<string, string | number>;
export interface _cocos_render_scene_core_render_window__IRenderWindowInfo {
title?: string;
width: number;
height: number;
@@ -61761,163 +62060,18 @@
constructor();
evaluate(T: number): number;
}
/**
- * @en
- * Define an enum type. <br/>
- * If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
- * Otherwise it will use the value specified by user who writes the enum definition.
- *
- * @zh
- * 定义一个枚举类型。<br/>
- * 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
- *
- * @param obj
- * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
- * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
- * @return @en The defined enum type. @zh 定义的枚举类型。
- */
- export function _cocos_core_value_types_enum__Enum<T extends object>(obj: T): T;
- export namespace _cocos_core_value_types_enum__Enum {
- var update: <T extends object>(obj: T) => T;
- var isEnum: <EnumT extends object>(enumType: EnumT) => boolean;
- var getList: <EnumT extends object>(enumType: EnumT) => readonly _cocos_core_value_types_enum__Enum.Enumerator<EnumT>[];
- var sortList: <EnumT extends object>(enumType: EnumT, compareFn: (a: any, b: any) => number) => void;
- }
- export namespace _cocos_core_value_types_enum__Enum {
- interface Enumerator<EnumT> {
- /**
- * The name of the enumerator.
- */
- name: keyof EnumT;
- /**
- * The value of the numerator.
- */
- value: EnumT[keyof EnumT];
- }
- }
- /**
* Alias of `Function` but suppress eslint warning.
* Please avoid using it and explicitly specify function signatures as possible.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type ____packages_cc_ambient_types_src_globals__AnyFunction = Function;
- export type _cocos_core_data_utils_attribute_defines__GroupOptions = {
- name: string;
- } & Partial<{
- id: string;
- name: string;
- displayOrder: number;
- style: string;
- }>;
- export interface _cocos_core_data_utils_attribute_defines__IExposedAttributes {
- /**
- * 指定属性的类型。
- */
- type?: any;
- /**
- * 控制是否在编辑器中显示该属性。
- */
- visible?: boolean | (() => boolean);
- /**
- * 该属性在编辑器中的显示名称。
- */
- displayName?: string;
- /**
- *
- */
- displayOrder?: number;
- /**
- * @en Editor tooltip of this property.
- * @zh 该属性在编辑器中的工具提示内容。
- */
- tooltip?: string;
- /**
- * @en The group name where this property is organized into, on property inspector.
- * @zh 在属性检查器上该属性所属的分类标签名。
- */
- group?: string | _cocos_core_data_utils_attribute_defines__GroupOptions;
- /**
- *
- */
- multiline?: boolean;
- /**
- * 指定该属性是否为可读的。
- * 将 `readonly` 指定为 `true` 或选项对象时都将标记为该属性是可读的;
- * 当指定为 `true` 时将应用所有默认的只读性质。
- * @default false
- */
- readonly?: boolean | {
- /**
- * 如果该属性是对象或数组,指定该对象的属性或该数组的元素是否是只读的。
- * 若为 `true`,递归的所有属性或元素都将是只读的。
- * @default true
- */
- deep?: boolean;
- };
- /**
- * 当该属性为数值类型时,指定了该属性允许的最小值。
- */
- min?: number;
- /**
- * 当该属性为数值类型时,指定了该属性允许的最大值。
- */
- max?: number;
- /**
- * 当该属性为数值类型时并在编辑器中提供了滑动条时,指定了滑动条的步长。
- */
- step?: number;
- /**
- * 当该属性为数值类型时,指定了该属性允许的范围。
- */
- range?: number[];
- /**
- * 当该属性为数值类型时,是否在编辑器中提供滑动条来调节值。
- */
- slide?: boolean;
- /**
- * 该属性是否参与序列化和反序列化。
- */
- serializable?: boolean;
- /**
- * 该属性的曾用名。
- */
- formerlySerializedAs?: string;
- /**
- * 该属性是否仅仅在编辑器环境中生效。
- */
- editorOnly?: boolean;
- /**
- * 是否覆盖基类中的同名属性。
- */
- override?: boolean;
- /**
- *
- */
- animatable?: boolean;
- /**
- *
- */
- unit?: string;
- /**
- * 转换为弧度
- */
- radian?: boolean;
- /**
- * @en User custom data, which can be obtained through the `CCClass.attr()` interface.
- * @zh 用户自定义数据,可以通过 `CCClass.attr()` 接口获取自定义数据。
- */
- userData?: Record<string, any>;
- /**
- * 在允许的情况下,在编辑器中显示为一组单选按钮
- */
- radioGroup?: boolean;
- }
/**
* @zh CCClass 属性选项。
* @en CCClass property options
*/
- export type _cocos_core_data_decorators_property__IPropertyOptions = _cocos_core_data_utils_attribute_defines__IExposedAttributes;
+ export type _cocos_core_data_decorators_property__IPropertyOptions = _cocos_base_object_src_utils_attribute_defines__IExposedAttributes;
export type _cocos_core_data_decorators_utils__Initializer = () => unknown;
export type _cocos_core_data_decorators_utils__BabelPropertyDecoratorDescriptor = PropertyDescriptor & {
initializer?: _cocos_core_data_decorators_utils__Initializer;
};
@@ -61932,160 +62086,8 @@
*/
export type _cocos_core_data_decorators_utils__LegacyPropertyDecorator = (target: Record<string, any>, propertyKey: string | symbol, descriptorOrInitializer?: _cocos_core_data_decorators_utils__BabelPropertyDecoratorDescriptor | _cocos_core_data_decorators_utils__Initializer | null) => void;
export type _cocos_core_data_decorators_property__SimplePropertyType = Function | string | typeof CCString | typeof CCInteger | typeof CCBoolean;
export type _cocos_core_data_decorators_property__PropertyType = _cocos_core_data_decorators_property__SimplePropertyType | _cocos_core_data_decorators_property__SimplePropertyType[];
- export class _cocos_core_data_utils_attribute__PrimitiveType<T> {
- name: string;
- default: T;
- constructor(name: string, defaultValue: T);
- toString(): string;
- }
- export interface _cocos_core_data_class_stash__PropertyStash extends _cocos_core_data_utils_attribute_defines__IExposedAttributes {
- /**
- * The property's default value.
- */
- default?: unknown;
- /**
- * The property's getter, if it's an accessor.
- */
- get?: () => unknown;
- /**
- * The property's setter, if it's an accessor.
- */
- set?: (value: unknown) => void;
- /**
- * Reserved for deprecated usage.
- */
- _short?: unknown;
- /**
- * Some decorators may write this internal slot. See `PropertyStashInternalFlag`.
- */
- __internalFlags: number;
- }
- namespace _cocos_core_data_utils_attribute {
- /// <reference types="cc-ambient-types" />
- export const DELIMETER = "$_$";
- export function createAttrsSingle(owner: Record<string | number, unknown>, superAttrs?: unknown): any;
- /**
- * @param subclass Should not have '__attrs__'.
- */
- export function createAttrs(subclass: any): any;
- /**
- * Tag the class with any meta attributes, then return all current attributes assigned to it.
- * This function holds only the attributes, not their implementations.
- * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
- * @param propertyName The name of the property or function, used to retrieve the attributes.
- * @private
- */
- export function attr(constructor: any, propertyName: string): {
- [attributeName: string]: any;
- };
- /**
- * Returns a read-only meta-object.
- */
- export function getClassAttrs(constructor: any): any;
- export function setClassAttr(ctor: any, propName: any, key: any, value: any): void;
- export class PrimitiveType<T> {
- name: string;
- default: T;
- constructor(name: string, defaultValue: T);
- toString(): string;
- }
- /**
- * @en
- * Indicates that the editor should treat this property or array element as an Integer value.
- * @zh
- * 指定编辑器以整数形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCInteger, _decorator } from "cc";
- *
- * // in the class definition:
- *
- * @_decorator.property({type: CCInteger})
- * count = 0;
- *
- * @_decorator.property({type: [CCInteger]})
- * array = [];
- * ```
- */
- export const CCInteger: _cocos_core_data_utils_attribute__PrimitiveType<number>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a Float value.
- * @zh
- * 指定编辑器以浮点数形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCFloat, _decorator } from "cc";
- *
- * // in the class definition:
- *
- * @_decorator.property({type: CCFloat})
- * x = 0;
- *
- * @_decorator.property({type: [CCFloat]})
- * array = [];
- * ```
- */
- export const CCFloat: _cocos_core_data_utils_attribute__PrimitiveType<number>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a Boolean value.
- * @zh
- * 指定编辑器以布尔值形式对待该属性或数组元素。
- *
- * @example
- * ```ts
- * import { CCBoolean, _decorator } from "cc";
- * // in the class definition
- * @_decorator.property({type: CCBoolean})
- * isTrue = false;
- *
- * @_decorator.property({type: [CCBoolean]})
- * array = [];
- * ```
- */
- export const CCBoolean: _cocos_core_data_utils_attribute__PrimitiveType<boolean>;
- /**
- * @en
- * Indicates that the editor should treat this property or array element as a String value.
- * @zh
- * 指定编辑器以字符串形式对待该属性或数组元素。
- * @example
- * ```ts
- * import { CCString, _decorator } from "cc";
- *
- * // in the class definition
- *
- * @_decorator.property({type: CCString})
- * name = '';
- *
- * @_decorator.property({type: [CCString]})
- * array = [];
- * ```
- */
- export const CCString: _cocos_core_data_utils_attribute__PrimitiveType<string>;
- export function getTypeChecker_ET(type: string, attributeName: string): (constructor: ____packages_cc_ambient_types_src_globals__Constructor, mainPropertyName: string) => void;
- export function getObjTypeChecker_ET(typeCtor: any): (classCtor: ____packages_cc_ambient_types_src_globals__Constructor, mainPropName: string) => void;
- }
- /**
- * Tag the class with any meta attributes, then return all current attributes assigned to it.
- * This function holds only the attributes, not their implementations.
- * @param constructor The class or instance. If instance, the attribute will be dynamic and only available for the specified instance.
- * @param propertyName The name of the property or function, used to retrieve the attributes.
- * @private
- */
- export function _cocos_core_data_utils_attribute__attr(constructor: any, propertyName: string): {
- [attributeName: string]: any;
- };
- /**
- * Returns if the class is a cc-class or is fast-defined.
- * @param constructor The constructor of the class.
- * @returns Judge result.
- * @engineInternal
- */
- export function _cocos_core_data_class__isCCClassOrFastDefined<T>(constructor: ____packages_cc_ambient_types_src_globals__Constructor<T>): boolean;
export enum _cocos_core_data_utils_compact_value_type_array__StorageUnit {
Uint8 = 0,
Uint16 = 1,
Uint32 = 2,
@@ -62773,9 +62775,8 @@
PROFILING = "profiling",
PLUGINS = "plugins",
XR = "xr"
}
- export type _cocos_core_value_types_enum__EnumType = Record<string, string | number>;
export type _cocos_base_utils_src_pool__CleanUpFunction<T> = (value: T) => boolean | void;
export type ____packages_cc_ambient_types_src_globals__Getter = () => any;
export type ____packages_cc_ambient_types_src_globals__Setter = (value: any) => void;
export interface _cocos_base_utils_src_x_deprecated__IReplacement {
@@ -65207,63 +65208,12 @@
z: number;
w: number;
}
/**
- * @en The base class of all value types.
- * @zh 所有值类型的基类。
- */
- export class ____cocos_core_value_types_value_type__ValueType {
- /**
- * @en
- * Clone the current object. The clone result of the object should be equal to the current object,
- * i.e. satisfy `this.equals(this, value.clone())`.
- * The base version of this method do nothing and returns `this'.
- * The derived class **must** rewrite this method and the returned object should not be `this`, i.e. satisfy `this !== this.clone()`.
- * @zh
- * 克隆当前值。克隆的结果值应与当前值相等,即满足 `this.equals(this, value.clone())`。
- * 本方法的基类版本简单地返回 `this`;
- * 派生类**必须**重写本方法,并且返回的对象不应当为 `this`,即满足 `this !== this.clone()`。
- * @returns @en The cloned object. @zh 克隆的对象。
- */
- public clone(): ____cocos_core_value_types_value_type__ValueType;
- /**
- * @en
- * Check whether the current object is equal to the specified object.
- * This check should be interchangeable, i.e. satisfy `this.equals(other) === other.equals(this)`.
- * The base version of this method will returns `false'.
- * @zh
- * 判断当前值是否与指定值相等。此判断应当具有交换性,即满足 `this.equals(other) === other.equals(this)`。
- * 本方法的基类版本简单地返回 `false`。
- * @param other @en The other object @zh 指定值。
- * @returns @en `true` if equal, otherwise returns `false` @zh 如果相等,则返回 `true`,否则返回 `false`。
- */
- public equals(other: this): boolean;
- /**
- * @en
- * Set the property values of the current object with the given object.
- * The base version of this method will returns `this' and the derived class **must** rewrite this method.
- * @zh
- * 赋值当前值使其与指定值相等。
- * 本方法的基类版本简单地返回 `this`,派生类**必须**重写本方法。
- * @param other @en The other object. @zh 指定值。
- */
- public set(other: this): void;
- /**
- * @en
- * Convert the current object to a string.
- * The base version of this method will returns an empty string.
- * @zh
- * 返回当前值的字符串表示。
- * 本方法的基类版本返回空字符串。
- * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
- */
- public toString(): string;
- }
- /**
* @en Mathematical 3x3 matrix.
* @zh 表示三维(3x3)矩阵。
*/
- export class ____cocos_core_math_mat3__Mat3 extends ____cocos_core_value_types_value_type__ValueType {
+ export class ____cocos_core_math_mat3__Mat3 extends ValueType {
public static IDENTITY = "Bad expression <Object.freeze(new Mat3())>";
/**
* @en Clone a matrix and save the results to out matrix
* @zh 获得指定矩阵的拷贝
@@ -65584,9 +65534,9 @@
/**
* @en quaternion
* @zh 四元数
*/
- export class ____cocos_core_math_quat__Quat extends ____cocos_core_value_types_value_type__ValueType {
+ export class ____cocos_core_math_quat__Quat extends ValueType {
public static IDENTITY = "Bad expression <Object.freeze(new Quat())>";
/**
* @en Obtain a copy of the given quaternion
* @zh 获得指定四元数的拷贝
@@ -65917,9 +65867,9 @@
/**
* @en Mathematical 4x4 matrix.
* @zh 表示四维(4x4)矩阵。
*/
- export class ____cocos_core_math_mat4__Mat4 extends ____cocos_core_value_types_value_type__ValueType {
+ export class ____cocos_core_math_mat4__Mat4 extends ValueType {
public static IDENTITY = "Bad expression <Object.freeze(new Mat4())>";
/**
* @en Clone a matrix and save the results to out matrix
* @zh 获得指定矩阵的拷贝
@@ -66531,9 +66481,9 @@
/**
* @en Representation of 3D vectors and points.
* @zh 三维向量。
*/
- export class ____cocos_core_math_vec3__Vec3 extends ____cocos_core_value_types_value_type__ValueType {
+ export class ____cocos_core_math_vec3__Vec3 extends ValueType {
public static UNIT_X = "Bad expression <Object.freeze(new Vec3(1, 0, 0))>";
public static UNIT_Y = "Bad expression <Object.freeze(new Vec3(0, 1, 0))>";
public static UNIT_Z = "Bad expression <Object.freeze(new Vec3(0, 0, 1))>";
public static RIGHT = "Bad expression <Object.freeze(new Vec3(1, 0, 0))>";
@@ -67037,9 +66987,9 @@
/**
* @en Representation of 2D vectors and points.
* @zh 二维向量。
*/
- export class ____cocos_core_math_vec2__Vec2 extends ____cocos_core_value_types_value_type__ValueType {
+ export class ____cocos_core_math_vec2__Vec2 extends ValueType {
public static ZERO = "Bad expression <Object.freeze(new Vec2(0, 0))>";
public static ONE = "Bad expression <Object.freeze(new Vec2(1, 1))>";
public static NEG_ONE = "Bad expression <Object.freeze(new Vec2(-1, -1))>";
public static UNIT_X = "Bad expression <Object.freeze(new Vec2(1, 0))>";
|
import { js, memop } from '@base/utils'; | ||
import { isCCObject, isValid } from '../data/object'; | ||
import { isCCObject, isValid } from '@base/object'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this to support @base/event
module
export { _decorator }; | ||
export { CCClass, isCCClassOrFastDefined } from './class'; | ||
export { CCObject } from './object'; | ||
export { CCInteger, CCFloat, CCBoolean, CCString } from './utils/attribute'; | ||
export { CompactValueTypeArray } from './utils/compact-value-type-array'; | ||
export { editorExtrasTag } from './editor-extras-tag'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a module cannot re-export another module's interfaces
@@ -26,11 +26,10 @@ | |||
import { EDITOR, SUPPORT_JIT } from 'internal:constants'; | |||
import { cclegacy } from '@base/global'; | |||
import { errorID, warn } from '@base/debug'; | |||
import { editorExtrasTag } from '../../core'; | |||
import { editorExtrasTag, ValueType } from '@base/object'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's editorExtrasTag
? Why it belongs to object module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a private symbol or string, and this is a js trick to implement firend
property in js class, for example
// 'A' module
export const editorExtrasTag = symbol();
export class A {
// we use compute property to implement friend property in js
[editorExtrasTag] = 1;
}
that is, if any js class can access editorExtrasTag
, they can access the [editorExtrasTag]
property in class A
import { editorExtrasTag } from 'A'
class B {
a: A = new A();
accessAFriendProperty () {
this.a[editorExtrasTag] // <--
}
}
Why it belongs to object module?
because CCObject
implements EditorExtendableObject
, and editorExtrasTag
is part of EditorExtendableObject
@@ -28,7 +28,8 @@ import { getError, warn } from '@base/debug'; | |||
import { cclegacy } from '@base/global'; | |||
import { js } from '@base/utils'; | |||
import { isDomNode } from '@pal/utils'; | |||
import { CCObject, isCCObject, ValueType, jsbUtils, isCCClassOrFastDefined } from '../core'; | |||
import { CCObject, isCCClassOrFastDefined, ValueType, isCCObject } from '@base/object'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As isCCClassOrFastDefined
is something related with class, not object. It is better to implement in core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it should be, but the implementation of CCObject
rely on CCClass
, and isCCClassOrFastDefined
is part of CCClass
Re: #16375
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: