mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
+66
-19
@@ -326,36 +326,65 @@ function _formatString (arg) {
|
||||
var Enum = require('./cocos2d/core/value-types/CCEnum');
|
||||
|
||||
/**
|
||||
* Enum for debug modes.
|
||||
* !#en Enum for debug modes.
|
||||
* !#zh 调试模式
|
||||
* @enum DebugMode
|
||||
*/
|
||||
cc.DebugMode = Enum({
|
||||
/**
|
||||
* @property {number} NONE - The debug mode none.
|
||||
* !#en The debug mode none.
|
||||
* !#zh 禁止模式,禁止显示任何日志信息。
|
||||
* @property NONE.
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
NONE: 0,
|
||||
/**
|
||||
* @property {number} INFO - The debug mode info.
|
||||
* !#en The debug mode info.
|
||||
* !#zh 信息模式,在 console 中显示所有日志。
|
||||
* @property INFO
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
INFO: 1,
|
||||
/**
|
||||
* @property {number} WARN - The debug mode warn.
|
||||
* !#en The debug mode warn.
|
||||
* !#zh 警告模式,在 console 中只显示 warn 级别以上的(包含 error)日志。
|
||||
* @property WARN
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
WARN: 2,
|
||||
/**
|
||||
* @property {number} ERROR - The debug mode error.
|
||||
* !#en The debug mode error.
|
||||
* !#zh 错误模式,在 console 中只显示 error 日志。
|
||||
* @property ERROR
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
ERROR: 3,
|
||||
/**
|
||||
* @property {number} INFO_FOR_WEB_PAGE - The debug mode info for web page.
|
||||
* !#en The debug mode info for web page.
|
||||
* !#zh 信息模式(仅 WEB 端有效),在画面上输出所有信息。
|
||||
* @property INFO_FOR_WEB_PAGE
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
INFO_FOR_WEB_PAGE: 4,
|
||||
/**
|
||||
* @property {number} WARN_FOR_WEB_PAGE - The debug mode warn for web page.
|
||||
* !#en The debug mode warn for web page.
|
||||
* !#zh 警告模式(仅 WEB 端有效),在画面上输出 warn 级别以上的(包含 error)信息。
|
||||
* @property WARN_FOR_WEB_PAGE
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
WARN_FOR_WEB_PAGE: 5,
|
||||
/**
|
||||
* @property {number} ERROR_FOR_WEB_PAGE - The debug mode error for web page.
|
||||
* !#en The debug mode error for web page.
|
||||
* !#zh 错误模式(仅 WEB 端有效),在画面上输出 error 信息。
|
||||
* @property ERROR_FOR_WEB_PAGE
|
||||
* @type {Number}
|
||||
* @static
|
||||
*/
|
||||
ERROR_FOR_WEB_PAGE: 6
|
||||
});
|
||||
@@ -367,7 +396,8 @@ cc.DebugMode = Enum({
|
||||
var jsbLog = cc.log || console.log;
|
||||
|
||||
/**
|
||||
* Init Debug setting.
|
||||
* !#en Init Debug setting.
|
||||
* !#zh 设置调试模式。
|
||||
* @method _initDebugSetting
|
||||
* @param {DebugMode} mode
|
||||
*/
|
||||
@@ -412,12 +442,18 @@ cc._initDebugSetting = function (mode) {
|
||||
if (!console.warn) console.warn = console.log;
|
||||
|
||||
/**
|
||||
* Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).
|
||||
* - In Cocos Creator, error is red.
|
||||
* - In Chrome, error have a red icon along with red message text.
|
||||
* !#en
|
||||
* Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
|
||||
* - In Cocos Creator, error is red.<br/>
|
||||
* - In Chrome, error have a red icon along with red message text.<br/>
|
||||
* !#zh
|
||||
* 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
|
||||
* - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
|
||||
* - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
|
||||
*
|
||||
* @method error
|
||||
* @param {any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
* @param {Any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {Any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
*/
|
||||
if (CC_EDITOR) {
|
||||
cc.error = Editor.error;
|
||||
@@ -440,12 +476,17 @@ cc._initDebugSetting = function (mode) {
|
||||
};
|
||||
if (mode !== cc.DebugMode.ERROR) {
|
||||
/**
|
||||
* !#en
|
||||
* Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).
|
||||
* - In Cocos Creator, warning is yellow.
|
||||
* - In Chrome, warning have a yellow warning icon with the message text.
|
||||
* !#zh
|
||||
* 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>
|
||||
* - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
|
||||
* - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
|
||||
* @method warn
|
||||
* @param {any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
* @param {Any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {Any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
*/
|
||||
if (CC_EDITOR) {
|
||||
cc.warn = Editor.warn;
|
||||
@@ -466,10 +507,11 @@ cc._initDebugSetting = function (mode) {
|
||||
}
|
||||
else if (mode === cc.DebugMode.INFO) {
|
||||
/**
|
||||
* Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
|
||||
* !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
|
||||
* !#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
|
||||
* @method log
|
||||
* @param {any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
* @param {Any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {Any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
*/
|
||||
if (CC_JSB) {
|
||||
cc.log = jsbLog;
|
||||
@@ -484,9 +526,14 @@ cc._initDebugSetting = function (mode) {
|
||||
};
|
||||
}
|
||||
/**
|
||||
* !#en
|
||||
* Outputs an informational message to the Cocos Creator Console (editor) or Web Console (runtime).
|
||||
* - In Cocos Creator, info is blue.
|
||||
* - In Firefox and Chrome, a small "i" icon is displayed next to these items in the Web Console's log.
|
||||
* !#zh
|
||||
* 输出一条信息消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
|
||||
* - 在 Cocos Creator 中,Info 信息显示是蓝色的。<br/>
|
||||
* - 在 Firefox 和 Chrome 中,Info 信息有着小 “i” 图标。
|
||||
* @method info
|
||||
* @param {any} obj - A JavaScript string containing zero or more substitution strings.
|
||||
* @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
|
||||
|
||||
@@ -55,6 +55,7 @@ var HashElement = cc._Class.extend(/** @lends cc.HashElement# */{
|
||||
});
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* cc.ActionManager is a class that can manage actions.<br/>
|
||||
* Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
|
||||
* which uses this class's singleton object.
|
||||
@@ -62,7 +63,13 @@ var HashElement = cc._Class.extend(/** @lends cc.HashElement# */{
|
||||
* Examples:<br/>
|
||||
* - When you want to run an action where the target is different from a CCNode.<br/>
|
||||
* - When you want to pause / resume the actions<br/>
|
||||
*
|
||||
* !#zh
|
||||
* cc.ActionManager 是可以管理动作的单例类。<br/>
|
||||
* 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
|
||||
* 但也有一些情况下,您可能需要使用这个类。 <br/>
|
||||
* 例如:
|
||||
* - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
|
||||
* - 当你想要暂停/恢复动作时。 <br/>
|
||||
* @class ActionManager
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/CCActionManager/ActionManager.js}
|
||||
*/
|
||||
@@ -87,10 +94,18 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
this._currentTargetSalvaged = false;
|
||||
},
|
||||
|
||||
/** Adds an action with a target.
|
||||
/**
|
||||
* !#en
|
||||
* Adds an action with a target.<br/>
|
||||
* If the target is already present, then the action will be added to the existing target.
|
||||
* If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
|
||||
* When the target is paused, the queued actions won't be 'ticked'.
|
||||
* !#zh
|
||||
* 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
|
||||
* 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
|
||||
* 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
|
||||
* 当目标状态的 paused 为 true,动作将不会被执行
|
||||
*
|
||||
* @method addAction
|
||||
* @param {Action} action
|
||||
* @param {Node} target
|
||||
@@ -120,7 +135,8 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all actions from all the targets.
|
||||
* !#en Removes all actions from all the targets.
|
||||
* !#zh 移除所有对象的所有动作。
|
||||
* @method removeAllActions
|
||||
*/
|
||||
removeAllActions:function () {
|
||||
@@ -131,11 +147,16 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
this.removeAllActionsFromTarget(element.target, true);
|
||||
}
|
||||
},
|
||||
/** Removes all actions from a certain target. <br/>
|
||||
/**
|
||||
* !#en
|
||||
* Removes all actions from a certain target. <br/>
|
||||
* All the actions that belongs to the target will be removed.
|
||||
* !#zh
|
||||
* 移除指定对象上的所有动作。<br/>
|
||||
* 属于该目标的所有的动作将被删除。
|
||||
* @method removeAllActionsFromTarget
|
||||
* @param {object} target
|
||||
* @param {boolean} forceDelete
|
||||
* @param {Object} target
|
||||
* @param {Boolean} forceDelete
|
||||
*/
|
||||
removeAllActionsFromTarget:function (target, forceDelete) {
|
||||
// explicit null handling
|
||||
@@ -154,7 +175,9 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
}
|
||||
}
|
||||
},
|
||||
/** Removes an action given an action reference.
|
||||
/**
|
||||
* !#en Removes an action given an action reference.
|
||||
* !#zh 移除指定的动作。
|
||||
* @method removeAction
|
||||
* @param {Action} action
|
||||
*/
|
||||
@@ -177,10 +200,12 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
}
|
||||
},
|
||||
|
||||
/** Removes an action given its tag and the target
|
||||
/**
|
||||
* !#en Removes an action given its tag and the target.
|
||||
* !#zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
|
||||
* @method removeActionByTag
|
||||
* @param {Number} tag
|
||||
* @param {object} target
|
||||
* @param {Object} target
|
||||
*/
|
||||
removeActionByTag:function (tag, target) {
|
||||
if(tag === cc.Action.TAG_INVALID)
|
||||
@@ -202,10 +227,12 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
}
|
||||
},
|
||||
|
||||
/** Gets an action given its tag an a target
|
||||
/**
|
||||
* !#en Gets an action given its tag an a target.
|
||||
* !#zh 通过目标对象和标签获取一个动作。
|
||||
* @method getActionByTag
|
||||
* @param {Number} tag
|
||||
* @param {object} target
|
||||
* @param {Object} target
|
||||
* @return {Action|Null} return the Action with the given tag on success
|
||||
*/
|
||||
getActionByTag:function (tag, target) {
|
||||
@@ -227,13 +254,22 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
|
||||
/** Returns the numbers of actions that are running in a certain target. <br/>
|
||||
/**
|
||||
* !#en
|
||||
* Returns the numbers of actions that are running in a certain target. <br/>
|
||||
* Composable actions are counted as 1 action. <br/>
|
||||
* Example: <br/>
|
||||
* - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
|
||||
* - If you are running 7 Sequences of 2 actions, it will return 7.
|
||||
* !#zh
|
||||
* 返回指定对象下所有正在运行的动作数量。 <br/>
|
||||
* 组合动作被算作一个动作。<br/>
|
||||
* 例如:<br/>
|
||||
* - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
|
||||
* - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
|
||||
*
|
||||
* @method numberOfRunningActionsInTarget
|
||||
* @param {object} target
|
||||
* @param {Object} target
|
||||
* @return {Number}
|
||||
*/
|
||||
numberOfRunningActionsInTarget:function (target) {
|
||||
@@ -243,18 +279,22 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
|
||||
return 0;
|
||||
},
|
||||
/** Pauses the target: all running actions and newly added actions will be paused.
|
||||
/**
|
||||
* !#en Pauses the target: all running actions and newly added actions will be paused.
|
||||
* !#zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
|
||||
* @method pauseTarget
|
||||
* @param {object} target
|
||||
* @param {Object} target
|
||||
*/
|
||||
pauseTarget:function (target) {
|
||||
var element = this._hashTargets[target.__instanceId];
|
||||
if (element)
|
||||
element.paused = true;
|
||||
},
|
||||
/** Resumes the target. All queued actions will be resumed.
|
||||
/**
|
||||
* !#en Resumes the target. All queued actions will be resumed.
|
||||
* !#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
|
||||
* @method resumeTarget
|
||||
* @param {object} target
|
||||
* @param {Object} target
|
||||
*/
|
||||
resumeTarget:function (target) {
|
||||
var element = this._hashTargets[target.__instanceId];
|
||||
@@ -263,7 +303,8 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all running actions, returning a list of targets whose actions were paused.
|
||||
* !#en Pauses all running actions, returning a list of targets whose actions were paused.
|
||||
* !#zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
|
||||
* @method pauseAllRunningActions
|
||||
* @return {Array} a list of targets whose actions were paused.
|
||||
*/
|
||||
@@ -281,7 +322,8 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call)
|
||||
* !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
|
||||
* !#zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
|
||||
* @method resumeTargets
|
||||
* @param {Array} targetsToResume
|
||||
*/
|
||||
@@ -296,7 +338,8 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Pause a set of targets
|
||||
* !#en Pause a set of targets.
|
||||
* !#zh 暂停一组指定对象。
|
||||
* @method pauseTargets
|
||||
* @param {Array} targetsToPause
|
||||
*/
|
||||
@@ -310,8 +353,13 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
}
|
||||
},
|
||||
|
||||
/** purges the shared action manager. It releases the retained instance. <br/>
|
||||
* because it uses this, so it can not be static
|
||||
/**
|
||||
* !#en
|
||||
* purges the shared action manager. It releases the retained instance. <br/>
|
||||
* because it uses this, so it can not be static.
|
||||
* !#zh
|
||||
* 清除共用的动作管理器。它释放了持有的实例。 <br/>
|
||||
* 因为它使用 this,因此它不能是静态的。
|
||||
* @method purgeSharedManager
|
||||
*/
|
||||
purgeSharedManager:function () {
|
||||
@@ -362,6 +410,8 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* !#en The ActionManager update。
|
||||
* !#zh ActionManager 主循环。
|
||||
* @method update
|
||||
* @param {Number} dt delta time in seconds
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,7 @@ cc.g_NumberOfDraws = 0;
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* <p>
|
||||
* ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
|
||||
* cc.director is a singleton object which manage your game's logic flow.<br/>
|
||||
@@ -63,6 +64,9 @@ cc.g_NumberOfDraws = 0;
|
||||
* - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
|
||||
* - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
|
||||
* </p>
|
||||
*
|
||||
* !#zh 导演类,负责创建和处理主窗口,以及管理场景执行。
|
||||
*
|
||||
* @class Director
|
||||
*/
|
||||
cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
|
||||
@@ -61,7 +61,8 @@ var Canvas = cc.Class({
|
||||
|
||||
statics: {
|
||||
/**
|
||||
* Current active canvas, the scene should only have one active canvas at the same time.
|
||||
* !#en Current active canvas, the scene should only have one active canvas at the same time.
|
||||
* !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。
|
||||
* @property {Canvas} instance
|
||||
* @static
|
||||
*/
|
||||
@@ -71,7 +72,8 @@ var Canvas = cc.Class({
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* The desigin resolution for current scene.
|
||||
* !#en The desigin resolution for current scene.
|
||||
* !#zh 当前场景设计分辨率。
|
||||
* @property {cc.Size} designResolution
|
||||
* @default new cc.Size(960, 640)
|
||||
*/
|
||||
@@ -92,8 +94,8 @@ var Canvas = cc.Class({
|
||||
_fitHeight: true,
|
||||
|
||||
/**
|
||||
* !#zh: 是否优先将设计分辨率高度撑满视图高度
|
||||
*
|
||||
* !#en TODO
|
||||
* !#zh: 是否优先将设计分辨率高度撑满视图高度。
|
||||
* @property {Boolean} fitHeight
|
||||
* @default false
|
||||
*/
|
||||
@@ -111,8 +113,8 @@ var Canvas = cc.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* !#zh: 是否优先将设计分辨率宽度撑满视图宽度
|
||||
*
|
||||
* !#en TODO
|
||||
* !#zh: 是否优先将设计分辨率宽度撑满视图宽度。
|
||||
* @property {Boolean} fitWidth
|
||||
* @default false
|
||||
*/
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
* @class Component.EventHandler
|
||||
* @example
|
||||
* // Create new EventHandler
|
||||
* 1. var eventHandler = cc.Component.EventHandler(target, "MainMenu", "OnClick");
|
||||
* 2. var eventHandler = cc.Component.EventHandler();
|
||||
* eventHandler.target = newTarget;
|
||||
* eventHandler.component = "MainMenu";
|
||||
* eventHandler.handler = "OnClick"
|
||||
* var eventHandler = cc.Component.EventHandler();
|
||||
* eventHandler.target = newTarget;
|
||||
* eventHandler.component = "MainMenu";
|
||||
* eventHandler.handler = "OnClick"
|
||||
*/
|
||||
cc.Component.EventHandler = cc.Class({
|
||||
name: 'cc.ClickEvent',
|
||||
|
||||
@@ -39,8 +39,9 @@ function normalizePath (path) {
|
||||
|
||||
var GLOB = '**/*';
|
||||
|
||||
/**
|
||||
* AssetTable is used to find asset's uuid by url
|
||||
/*
|
||||
* !#en AssetTable is used to find asset's uuid by url.
|
||||
* !#zh AssetTable 用于查找资源的 uuid 和 url。
|
||||
* @class AssetTable
|
||||
* @constructor
|
||||
*/
|
||||
@@ -91,7 +92,8 @@ cc.js.mixin(AssetTable.prototype, {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all asset paths in the table.
|
||||
* !#en Returns all asset paths in the table.
|
||||
* !#zh 返回表中的所有资源路径。
|
||||
* @method getAllPaths
|
||||
* @return {string[]}
|
||||
*/
|
||||
@@ -175,6 +177,8 @@ cc.js.mixin(AssetTable.prototype, {
|
||||
//},
|
||||
|
||||
/**
|
||||
* !#en TODO
|
||||
* !#zh 以路径为 key,uuid 为值添加到表中。
|
||||
* @method add
|
||||
* @param {string} path - the path to load, should NOT include filename extensions.
|
||||
* @param {string} uuid
|
||||
|
||||
@@ -176,8 +176,8 @@ CallbacksHandler.prototype.remove = function (key, callback, target) {
|
||||
|
||||
|
||||
/**
|
||||
* The callbacks invoker to handle and invoke callbacks by key
|
||||
*
|
||||
* !#en The callbacks invoker to handle and invoke callbacks by key.
|
||||
* !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。
|
||||
* @class CallbacksInvoker
|
||||
* @constructor
|
||||
* @extends _CallbacksHandler
|
||||
|
||||
@@ -170,25 +170,40 @@ cc.js.get(cc.BlendFunc, "ADDITIVE", cc.BlendFunc._additive);
|
||||
*/
|
||||
cc.blendFuncDisable = cc.BlendFunc._disable;
|
||||
|
||||
/**
|
||||
* Common usage:
|
||||
/*
|
||||
* !#en
|
||||
* Common usage:</br>
|
||||
*
|
||||
* var fontDef = new cc.FontDefinition();
|
||||
* fontDef.fontName = "Arial";
|
||||
* fontDef.fontSize = 12;
|
||||
* ...
|
||||
* var fontDef = new cc.FontDefinition();</br>
|
||||
* fontDef.fontName = "Arial";</br>
|
||||
* fontDef.fontSize = 12;</br>
|
||||
* ...</br>
|
||||
*
|
||||
* OR using inline definition usefull for constructor injection
|
||||
* OR using inline definition usefull for constructor injection</br>
|
||||
*
|
||||
* var fontDef = new cc.FontDefinition({
|
||||
* fontName: "Arial",
|
||||
* fontSize: 12
|
||||
* var fontDef = new cc.FontDefinition({ </br>
|
||||
* fontName: "Arial", </br>
|
||||
* fontSize: 12 </br>
|
||||
* });</br>
|
||||
*
|
||||
* !#zh
|
||||
* 常见用法:</br>
|
||||
* var fontDef = new cc.FontDefinition();</br>
|
||||
* fontDef.fontName = "Arial"; </br>
|
||||
* fontDef.fontSize = 12; </br>
|
||||
* ... </br>
|
||||
*
|
||||
* 或使用定义构造函数:</br>
|
||||
*
|
||||
* var fontDef = new cc.FontDefinition({ </br>
|
||||
* fontName: "Arial", </br>
|
||||
* fontSize: 12 </br>
|
||||
* });
|
||||
*
|
||||
* @class FontDefinition
|
||||
* @constructor
|
||||
*/
|
||||
/**
|
||||
/*
|
||||
* !#en TODO
|
||||
* !#zh 定义字体基本属性的结构体。
|
||||
* @method FontDefinition
|
||||
|
||||
@@ -25,15 +25,20 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* !#en
|
||||
* cc.pool is a singleton object serves as an object cache pool.<br/>
|
||||
* It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
|
||||
* Some common use case is :<br/>
|
||||
* 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
|
||||
* 2. Blocks in candy crash (massive creation and recreation)<br/>
|
||||
* etc...
|
||||
* </p>
|
||||
*
|
||||
* !#zh
|
||||
* cc.pool 是一个单例对象,用作为对象缓存池。<br/>
|
||||
* 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
|
||||
* 一些常见的用例是:<br/>
|
||||
* 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
|
||||
* 2.糖果粉碎传奇中的木块(频繁创建)。
|
||||
* 等等....
|
||||
* @class pool
|
||||
*/
|
||||
cc.pool = /** @lends cc.pool# */{
|
||||
@@ -49,7 +54,8 @@ cc.pool = /** @lends cc.pool# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Put the obj in pool.
|
||||
* !#en Put the obj in pool.
|
||||
* !#zh 加入对象到对象池中。
|
||||
* @method putInPool
|
||||
* @param {Object} obj - The need put in pool object.
|
||||
* @example {@link utils/api/engine/docs/extensions/ccpool/putInPool.js}
|
||||
@@ -70,7 +76,8 @@ cc.pool = /** @lends cc.pool# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if this kind of obj has already in pool.
|
||||
* !#en Check if this kind of obj has already in pool.
|
||||
* !#zh 检查对象池中是否有指定对象的存在。
|
||||
* @method hasObject
|
||||
* @param {Object} objClass - The check object class.
|
||||
* @returns {Boolean} If this kind of obj is already in pool return true,else return false.
|
||||
@@ -85,7 +92,8 @@ cc.pool = /** @lends cc.pool# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the obj if you want to delete it.
|
||||
* !#en Remove the obj if you want to delete it.
|
||||
* !#zh 移除在对象池中指定的对象。
|
||||
* @method removeObject
|
||||
*/
|
||||
removeObject: function (obj) {
|
||||
@@ -105,7 +113,8 @@ cc.pool = /** @lends cc.pool# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the obj from pool.
|
||||
* !#en Get the obj from pool.
|
||||
* !#zh 获取对象池中的指定对象。
|
||||
* @method getFromPool
|
||||
* @returns {*} Call the reuse function an return the obj.
|
||||
*/
|
||||
@@ -125,7 +134,8 @@ cc.pool = /** @lends cc.pool# */{
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove all objs in pool and reset the pool.
|
||||
* !#en Remove all objs in pool and reset the pool.
|
||||
* !#zh 移除对象池中的所有对象,并且重置对象池。
|
||||
* @method drainAllPools
|
||||
*/
|
||||
drainAllPools: function () {
|
||||
|
||||
+4
-1
@@ -24,7 +24,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace
|
||||
* !#en
|
||||
* The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.
|
||||
* !#zh
|
||||
* Cocos 引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。
|
||||
* @module cc
|
||||
* @main cc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user