From 80ca28144c47413fb58251690a950a5cd077fa3f Mon Sep 17 00:00:00 2001 From: Nan Wang Date: Fri, 12 Aug 2016 19:29:25 +0800 Subject: [PATCH] update ccclass editor attributes --- cocos2d/core/platform/CCClass.js | 100 +++++++------------------------ extensions/ccpool/CCPool.js | 1 + 2 files changed, 22 insertions(+), 79 deletions(-) diff --git a/cocos2d/core/platform/CCClass.js b/cocos2d/core/platform/CCClass.js index 953be36160..b2721cad08 100644 --- a/cocos2d/core/platform/CCClass.js +++ b/cocos2d/core/platform/CCClass.js @@ -614,21 +614,21 @@ function _boundSuperCall (func, funcName, base) { var pd = JS.getPropertyDescriptor(base.prototype, funcName); if (pd) { superFunc = pd.value; - // ignore pd.get, assume that function defined by getter is just for warnings + // ignore pd.get, assume that function defined by getter is just for warnings if (typeof superFunc === 'function') { var hasSuperCall = SuperCallReg.test(func); if (hasSuperCall) { return function () { var tmp = this._super; - + // Add a new ._super() method that is the same method but on the super-Class this._super = superFunc; - + var ret = func.apply(this, arguments); - + // The method only need to be bound temporarily, so we remove it when we're done executing this._super = tmp; - + return ret; }; } @@ -689,72 +689,6 @@ function declareProperties (cls, className, properties, baseClass, mixins) { } } -/** - * @class _ComponentAttributes - * @constructor - */ -/** - * Automatically add required component as a dependency. - * - * @property requireComponent - * @type {Component} - * @default null - */ -/** - * If specified to a type, prevents Component of the same type (or subtype) to be added more than once to a Node. - * - * @property disallowMultiple - * @type {Component} - * @default null - */ -/** - * The menu path to register a component to the editors "Component" menu. Eg. "Rendering/Camera". - * - * @property menu - * @type {String} - * @default "" - */ -/** - * Makes a component execute in edit mode. - * By default, all components are only executed in play mode, - * which means they will not have their callback functions executed while the Editor is in edit mode. - * - * @property executeInEditMode - * @type {Boolean} - * @default false - */ -/** - * This property is only available if executeInEditMode is true. - * If specified, the editor's scene view will keep updating this node in 60 fps when it is selected, - * otherwise, it will update only if necessary. - * - * @property playOnFocus - * @type {Boolean} - * @default false - */ -/** - * Specifying the url of the custom html to draw the component in inspector. - * - * @property inspector - * @type {String} - * @default "" - */ -/** - * Specifying the url of the icon to display in inspector. - * - * @property icon - * @type {String} - * @default "" - */ - -/** - * The custom documentation URL - * - * @property help - * @type {String} - * @default "" - */ - /** * @module cc */ @@ -762,9 +696,9 @@ function declareProperties (cls, className, properties, baseClass, mixins) { /** * !#en Defines a CCClass using the given specification, please see [Class](/en/scripting/class/) for details. * !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/zh/scripting/class/)。 - * + * * @method Class - * + * * @param {Object} [options] * @param {String} [options.name] - The class name used for serialization. * @param {Function} [options.extends] - The base class. @@ -772,9 +706,17 @@ function declareProperties (cls, className, properties, baseClass, mixins) { * @param {Object} [options.properties] - The property definitions. * @param {Object} [options.statics] - The static members. * @param {Function[]} [options.mixins] - * - * @param {Object} [options.editor] - attributes for Component, see {{#crossLink "_ComponentAttributes"}}ComponentAttributes{{/crossLink}}. - * + * + * @param {Object} [options.editor] - attributes for Component listed below. + * @param {Component} [options.editor.requireComponent] - Automatically add required component as a dependency. + * @param {Component} [options.editor.disallowMultiple] - If specified to a type, prevents Component of the same type (or subtype) to be added more than once to a Node. + * @param {String} [options.editor.menu] - The menu path to register a component to the editors "Component" menu. Eg. "Rendering/Camera". + * @param {Boolean} [options.editor.executeInEditMode] - Makes a component execute in edit mode. By default, all components are only executed in play mode, which means they will not have their callback functions executed while the Editor is in edit mode. + * @param {Boolean} [options.editor.playOnFocus] - This property is only available if executeInEditMode is true. If specified, the editor's scene view will keep updating this node in 60 fps when it is selected, otherwise, it will update only if necessary. + * @param {String} [options.editor.inspector] - Specifying the url of the custom html to draw the component in inspector. + * @param {String} [options.editor.icon] - Specifying the url of the icon to display in inspector. + * @param {String} [options.editor.help] - The custom documentation UR + * * @param {Function} [options.update] - lifecycle method for Component, see {{#crossLink "Component/update:method"}}{{/crossLink}} * @param {Function} [options.lateUpdate] - lifecycle method for Component, see {{#crossLink "Component/lateUpdate:method"}}{{/crossLink}} * @param {Function} [options.onLoad] - lifecycle method for Component, see {{#crossLink "Component/onLoad:method"}}{{/crossLink}} @@ -786,9 +728,9 @@ function declareProperties (cls, className, properties, baseClass, mixins) { * @param {Function} [options.onLostFocusInEditor] - lifecycle method for Component, see {{#crossLink "Component/onLostFocusInEditor:method"}}{{/crossLink}} * @param {Function} [options.onRestore] - for Component only, see {{#crossLink "Component/onRestore:method"}}{{/crossLink}} * @param {Function} [options._getLocalBounds] - for Component only, see {{#crossLink "Component/_getLocalBounds:method"}}{{/crossLink}} - * + * * @return {Function} - the created class - * + * * @example // define base class var Node = cc.Class(); @@ -1142,5 +1084,5 @@ module.exports = { }; if (CC_EDITOR) { - module.exports.getDefault = getDefault; + module.exports.getDefault = getDefault; } diff --git a/extensions/ccpool/CCPool.js b/extensions/ccpool/CCPool.js index 384dac278e..a39b9f56db 100644 --- a/extensions/ccpool/CCPool.js +++ b/extensions/ccpool/CCPool.js @@ -38,6 +38,7 @@ * cc.pool 是一个单例对象,用作为对象缓存池。
* 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁
* @class pool + * @deprecated !#en Please use cc.NodePool instead !#zh 请使用 cc.NodePool 代替 */ cc.pool = /** @lends cc.pool# */{ _pool: {},