From 1632908fccdc4f7b007c16f9d7a3390b9728ee11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=AE=B6=E8=BE=89?= <35832931+ColinCollins@users.noreply.github.com> Date: Mon, 11 Jun 2018 19:02:14 +0800 Subject: [PATCH] correct the api docs template (#2852) --- cocos2d/core/CCScheduler.js | 10 +-- cocos2d/core/components/CCButton.js | 62 +++++++-------- cocos2d/core/components/CCToggleContainer.js | 8 +- cocos2d/core/load-pipeline/loading-items.js | 52 ++++++------ cocos2d/core/load-pipeline/pipeline.js | 84 ++++++++++---------- cocos2d/core/utils/base-node.js | 8 +- 6 files changed, 112 insertions(+), 112 deletions(-) diff --git a/cocos2d/core/CCScheduler.js b/cocos2d/core/CCScheduler.js index 2e9b24f5cf..6cabb9a428 100644 --- a/cocos2d/core/CCScheduler.js +++ b/cocos2d/core/CCScheduler.js @@ -483,7 +483,7 @@ cc.Scheduler.prototype = { /** * !#en *

- * The scheduled method will be called every 'interval' seconds.
+ * The scheduled method will be called every 'interval' seconds.
* If paused is YES, then it won't be called until it is resumed.
* If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.
* If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
@@ -491,11 +491,11 @@ cc.Scheduler.prototype = { * delay is the amount of time the action will wait before it'll start
*

* !#zh - * 指定回调函数,调用对象等信息来添加一个新的定时器。
- * 如果 paused 值为 true,那么直到 resume 被调用才开始计时。
- * 当时间间隔达到指定值时,设置的回调函数将会被调用。
+ * 指定回调函数,调用对象等信息来添加一个新的定时器。
+ * 如果 paused 值为 true,那么直到 resume 被调用才开始计时。
+ * 当时间间隔达到指定值时,设置的回调函数将会被调用。
* 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样, - * 建议使用 scheduleUpdateForTarget 代替。
+ * 建议使用 scheduleUpdateForTarget 代替。
* 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。
* repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER * 可以让定时器一直循环触发。
diff --git a/cocos2d/core/components/CCButton.js b/cocos2d/core/components/CCButton.js index eb75e77051..76ab33fdee 100644 --- a/cocos2d/core/components/CCButton.js +++ b/cocos2d/core/components/CCButton.js @@ -63,42 +63,42 @@ var Transition = cc.Enum({ /** * !#en - * Button has 4 Transition types - * When Button state changed: - * If Transition type is Button.Transition.NONE, Button will do nothing - * If Transition type is Button.Transition.COLOR, Button will change target's color - * If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite - * If Transition type is Button.Transition.SCALE, Button will change target node's scale + * Button has 4 Transition types
+ * When Button state changed:
+ * If Transition type is Button.Transition.NONE, Button will do nothing
+ * If Transition type is Button.Transition.COLOR, Button will change target's color
+ * If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
+ * If Transition type is Button.Transition.SCALE, Button will change target node's scale
* - * Button will trigger 5 events: - * Button.EVENT_TOUCH_DOWN - * Button.EVENT_TOUCH_UP - * Button.EVENT_HOVER_IN - * Button.EVENT_HOVER_MOVE - * Button.EVENT_HOVER_OUT + * Button will trigger 5 events:
+ * Button.EVENT_TOUCH_DOWN
+ * Button.EVENT_TOUCH_UP
+ * Button.EVENT_HOVER_IN
+ * Button.EVENT_HOVER_MOVE
+ * Button.EVENT_HOVER_OUT
* * !#zh - * 按钮组件。可以被按下,或者点击。
+ * 按钮组件。可以被按下,或者点击。
* - * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
- * -Button.Transition.NONE // 不做任何过渡
- * -Button.Transition.COLOR // 进行颜色之间过渡
- * -Button.Transition.SPRITE // 进行精灵之间过渡
- * -Button.Transition.SCALE // 进行缩放过渡
+ * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
+ * -Button.Transition.NONE // 不做任何过渡
+ * -Button.Transition.COLOR // 进行颜色之间过渡
+ * -Button.Transition.SPRITE // 进行精灵之间过渡
+ * -Button.Transition.SCALE // 进行缩放过渡
* - * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):
- * // 以下事件可以在全平台上都触发
- * -cc.Node.EventType.TOUCH_START // 按下时事件
- * -cc.Node.EventType.TOUCH_Move // 按住移动后事件
- * -cc.Node.EventType.TOUCH_END // 按下后松开后事件
- * -cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
- * // 以下事件只在 PC 平台上触发
- * -cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
- * -cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
- * -cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
- * -cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
- * -cc.Node.EventType.MOUSE_UP // 鼠标松开事件
- * -cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
+ * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):
+ * // 以下事件可以在全平台上都触发
+ * -cc.Node.EventType.TOUCH_START // 按下时事件
+ * -cc.Node.EventType.TOUCH_Move // 按住移动后事件
+ * -cc.Node.EventType.TOUCH_END // 按下后松开后事件
+ * -cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
+ * // 以下事件只在 PC 平台上触发
+ * -cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
+ * -cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
+ * -cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
+ * -cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
+ * -cc.Node.EventType.MOUSE_UP // 鼠标松开事件
+ * -cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
* * @class Button * @extends Component diff --git a/cocos2d/core/components/CCToggleContainer.js b/cocos2d/core/components/CCToggleContainer.js index c12894ff82..3d5801ba21 100644 --- a/cocos2d/core/components/CCToggleContainer.js +++ b/cocos2d/core/components/CCToggleContainer.js @@ -25,11 +25,11 @@ ****************************************************************************/ /** - * !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles.
- * Toggles that belong to the same group could only have one of them to be switched on at a time.
+ * !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles.
+ * Toggles that belong to the same group could only have one of them to be switched on at a time.
* Note: All the first layer child node containing the toggle component will auto be added to the container - * !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。
- * 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。
+ * !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。
+ * 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。
* 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 * @class ToggleContainer * @extends Component diff --git a/cocos2d/core/load-pipeline/loading-items.js b/cocos2d/core/load-pipeline/loading-items.js index a2c0c11a71..d003cadde7 100644 --- a/cocos2d/core/load-pipeline/loading-items.js +++ b/cocos2d/core/load-pipeline/loading-items.js @@ -124,35 +124,35 @@ function checkCircleReference(owner, item, recursiveCall) { /** * !#en - * LoadingItems is the queue of items which can flow them into the loading pipeline.
- * Please don't construct it directly, use {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} instead, because we use an internal pool to recycle the queues.
- * It hold a map of items, each entry in the map is a url to object key value pair.
- * Each item always contains the following property:
- * - id: The identification of the item, usually it's identical to url
- * - url: The url
- * - type: The type, it's the extension name of the url by default, could be specified manually too.
- * - error: The error happened in pipeline will be stored in this property.
- * - content: The content processed by the pipeline, the final result will also be stored in this property.
- * - complete: The flag indicate whether the item is completed by the pipeline.
- * - states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
- *
- * Item can hold other custom properties.
- * Each LoadingItems object will be destroyed for recycle after onComplete callback
+ * LoadingItems is the queue of items which can flow them into the loading pipeline.
+ * Please don't construct it directly, use {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} instead, because we use an internal pool to recycle the queues.
+ * It hold a map of items, each entry in the map is a url to object key value pair.
+ * Each item always contains the following property:
+ * - id: The identification of the item, usually it's identical to url
+ * - url: The url
+ * - type: The type, it's the extension name of the url by default, could be specified manually too.
+ * - error: The error happened in pipeline will be stored in this property.
+ * - content: The content processed by the pipeline, the final result will also be stored in this property.
+ * - complete: The flag indicate whether the item is completed by the pipeline.
+ * - states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
+ *
+ * Item can hold other custom properties.
+ * Each LoadingItems object will be destroyed for recycle after onComplete callback
* So please don't hold its reference for later usage, you can copy properties in it though. * !#zh - * LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。
+ * LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。
* 请不要直接使用 new 构造这个类的对象,你可以使用 {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} 来创建一个新的加载队列,这样可以允许我们的内部对象池回收并重利用加载队列。 - * 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。
- * 每个对象都会包含下列属性:
- * - id:该对象的标识,通常与 url 相同。
- * - url:路径
- * - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。
- * - error:pipeline 中发生的错误将被保存在这个属性中。
- * - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。
- * - complete:该标志表明该对象是否通过 pipeline 完成。
- * - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
- *
- * 对象可容纳其他自定义属性。
+ * 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。
+ * 每个对象都会包含下列属性:
+ * - id:该对象的标识,通常与 url 相同。
+ * - url:路径
+ * - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。
+ * - error:pipeline 中发生的错误将被保存在这个属性中。
+ * - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。
+ * - complete:该标志表明该对象是否通过 pipeline 完成。
+ * - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
+ *
+ * 对象可容纳其他自定义属性。
* 每个 LoadingItems 对象都会在 onComplete 回调之后被销毁,所以请不要持有它的引用并在结束回调之后依赖它的内容执行任何逻辑,有这种需求的话你可以提前复制它的内容。 * * @class LoadingItems diff --git a/cocos2d/core/load-pipeline/pipeline.js b/cocos2d/core/load-pipeline/pipeline.js index e9ec658f8c..1ee2df3852 100644 --- a/cocos2d/core/load-pipeline/pipeline.js +++ b/cocos2d/core/load-pipeline/pipeline.js @@ -92,30 +92,30 @@ function flow (pipe, item) { /** * !#en - * A pipeline describes a sequence of manipulations, each manipulation is called a pipe.
- * It's designed for loading process. so items should be urls, and the url will be the identity of each item during the process.
- * A list of items can flow in the pipeline and it will output the results of all pipes.
- * They flow in the pipeline like water in tubes, they go through pipe by pipe separately.
+ * A pipeline describes a sequence of manipulations, each manipulation is called a pipe.
+ * It's designed for loading process. so items should be urls, and the url will be the identity of each item during the process.
+ * A list of items can flow in the pipeline and it will output the results of all pipes.
+ * They flow in the pipeline like water in tubes, they go through pipe by pipe separately.
* Finally all items will flow out the pipeline and the process is finished. * * !#zh - * pipeline 描述了一系列的操作,每个操作都被称为 pipe。
- * 它被设计来做加载过程的流程管理。所以 item 应该是 url,并且该 url 将是在处理中的每个 item 的身份标识。
- * 一个 item 列表可以在 pipeline 中流动,它将输出加载项经过所有 pipe 之后的结果。
- * 它们穿过 pipeline 就像水在管子里流动,将会按顺序流过每个 pipe。
+ * pipeline 描述了一系列的操作,每个操作都被称为 pipe。
+ * 它被设计来做加载过程的流程管理。所以 item 应该是 url,并且该 url 将是在处理中的每个 item 的身份标识。
+ * 一个 item 列表可以在 pipeline 中流动,它将输出加载项经过所有 pipe 之后的结果。
+ * 它们穿过 pipeline 就像水在管子里流动,将会按顺序流过每个 pipe。
* 最后当所有加载项都流出 pipeline 时,整个加载流程就结束了。 * @class Pipeline */ /** * !#en * Constructor, pass an array of pipes to construct a new Pipeline, - * the pipes will be chained in the given order.
+ * the pipes will be chained in the given order.
* A pipe is an object which must contain an `id` in string and a `handle` function, - * the id must be unique in the pipeline.
+ * the id must be unique in the pipeline.
* It can also include `async` property to identify whether it's an asynchronous process. * !#zh - * 构造函数,通过一系列的 pipe 来构造一个新的 pipeline,pipes 将会在给定的顺序中被锁定。
- * 一个 pipe 就是一个对象,它包含了字符串类型的 ‘id’ 和 ‘handle’ 函数,在 pipeline 中 id 必须是唯一的。
+ * 构造函数,通过一系列的 pipe 来构造一个新的 pipeline,pipes 将会在给定的顺序中被锁定。
+ * 一个 pipe 就是一个对象,它包含了字符串类型的 ‘id’ 和 ‘handle’ 函数,在 pipeline 中 id 必须是唯一的。
* 它还可以包括 ‘async’ 属性以确定它是否是一个异步过程。 * * @method constructor @@ -152,10 +152,10 @@ var proto = Pipeline.prototype; /** * !#en - * Insert a new pipe at the given index of the pipeline.
+ * Insert a new pipe at the given index of the pipeline.
* A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline. * !#zh - * 在给定的索引位置插入一个新的 pipe。
+ * 在给定的索引位置插入一个新的 pipe。
* 一个 pipe 必须包含一个字符串类型的 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。 * @method insertPipe * @param {Object} pipe The pipe to be inserted @@ -212,10 +212,10 @@ proto.insertPipeAfter = function (refPipe, newPipe) { /** * !#en - * Add a new pipe at the end of the pipeline.
+ * Add a new pipe at the end of the pipeline.
* A pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline. * !#zh - * 添加一个新的 pipe 到 pipeline 尾部。
+ * 添加一个新的 pipe 到 pipeline 尾部。
* 该 pipe 必须包含一个字符串类型 ‘id’ 和 ‘handle’ 函数,该 id 在 pipeline 必须是唯一标识。 * @method appendPipe * @param {Object} pipe The pipe to be appended @@ -236,18 +236,18 @@ proto.appendPipe = function (pipe) { /** * !#en - * Let new items flow into the pipeline.
+ * Let new items flow into the pipeline.
* Each item can be a simple url string or an object, - * if it's an object, it must contain `id` property.
- * You can specify its type by `type` property, by default, the type is the extension name in url.
- * By adding a `skips` property including pipe ids, you can skip these pipe.
- * The object can contain any supplementary property as you want.
+ * if it's an object, it must contain `id` property.
+ * You can specify its type by `type` property, by default, the type is the extension name in url.
+ * By adding a `skips` property including pipe ids, you can skip these pipe.
+ * The object can contain any supplementary property as you want.
* !#zh - * 让新的 item 流入 pipeline 中。
+ * 让新的 item 流入 pipeline 中。
* 这里的每个 item 可以是一个简单字符串类型的 url 或者是一个对象, - * 如果它是一个对象的话,他必须要包含 ‘id’ 属性。
- * 你也可以指定它的 ‘type’ 属性类型,默认情况下,该类型是 ‘url’ 的后缀名。
- * 也通过添加一个 包含 ‘skips’ 属性的 item 对象,你就可以跳过 skips 中包含的 pipe。
+ * 如果它是一个对象的话,他必须要包含 ‘id’ 属性。
+ * 你也可以指定它的 ‘type’ 属性类型,默认情况下,该类型是 ‘url’ 的后缀名。
+ * 也通过添加一个 包含 ‘skips’ 属性的 item 对象,你就可以跳过 skips 中包含的 pipe。
* 该对象可以包含任何附加属性。 * @method flowIn * @param {Array} items @@ -284,15 +284,15 @@ proto.flowIn = function (items) { /* * !#en - * Let new items flow into the pipeline and give a callback when the list of items are all completed.
- * This is for loading dependencies for an existing item in flow, usually used in a pipe logic.
- * For example, we have a loader for scene configuration file in JSON, the scene will only be fully loaded
- * after all its dependencies are loaded, then you will need to use function to flow in all dependencies
+ * Let new items flow into the pipeline and give a callback when the list of items are all completed.
+ * This is for loading dependencies for an existing item in flow, usually used in a pipe logic.
+ * For example, we have a loader for scene configuration file in JSON, the scene will only be fully loaded
+ * after all its dependencies are loaded, then you will need to use function to flow in all dependencies
* found in the configuration file, and finish the loader pipe only after all dependencies are loaded (in the callback). * !#zh - * 让新 items 流入 pipeline 并且当 item 列表完成时进行回调函数。
- * 这个 API 的使用通常是为了加载依赖项。
- * 例如:
+ * 让新 items 流入 pipeline 并且当 item 列表完成时进行回调函数。
+ * 这个 API 的使用通常是为了加载依赖项。
+ * 例如:
* 我们需要加载一个场景配置的 JSON 文件,该场景会将所有的依赖项全部都加载完毕以后,进行回调表示加载完毕。 * @method flowInDeps * @deprecated since v1.3 @@ -321,18 +321,18 @@ proto.flowOut = function (item) { /** * !#en - * Copy the item states from one source item to all destination items.
- * It's quite useful when a pipe generate new items from one source item,
- * then you should flowIn these generated items into pipeline,
- * but you probably want them to skip all pipes the source item already go through,
- * you can achieve it with this API.
- *
+ * Copy the item states from one source item to all destination items.
+ * It's quite useful when a pipe generate new items from one source item,
+ * then you should flowIn these generated items into pipeline,
+ * but you probably want them to skip all pipes the source item already go through,
+ * you can achieve it with this API.
+ *
* For example, an unzip pipe will generate more items, but you won't want them to pass unzip or download pipe again. * !#zh - * 从一个源 item 向所有目标 item 复制它的 pipe 状态,用于避免重复通过部分 pipe。
- * 当一个源 item 生成了一系列新的 items 时很有用,
- * 你希望让这些新的依赖项进入 pipeline,但是又不希望它们通过源 item 已经经过的 pipe,
- * 但是你可能希望他们源 item 已经通过并跳过所有 pipes,
+ * 从一个源 item 向所有目标 item 复制它的 pipe 状态,用于避免重复通过部分 pipe。
+ * 当一个源 item 生成了一系列新的 items 时很有用,
+ * 你希望让这些新的依赖项进入 pipeline,但是又不希望它们通过源 item 已经经过的 pipe,
+ * 但是你可能希望他们源 item 已经通过并跳过所有 pipes,
* 这个时候就可以使用这个 API。 * @method copyItemStates * @param {Object} srcItem The source item diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index c8febfc70e..18792b79ce 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -401,10 +401,10 @@ var BaseNode = cc.Class({ /** * !#en - * Properties configuration function
- * All properties in attrs will be set to the node,
- * when the setter of the node is available,
- * the property will be set via setter function.
+ * Properties configuration function
+ * All properties in attrs will be set to the node,
+ * when the setter of the node is available,
+ * the property will be set via setter function.
* !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。 * @method attr * @param {Object} attrs - Properties to be set to node