Skip to content

Commit

Permalink
Optimize some documents (cocos#7092)
Browse files Browse the repository at this point in the history
* Optimize some documents

* Update

* Update

* Update
  • Loading branch information
pandamicro authored Aug 12, 2020
2 parents 0c5debb + baa2102 commit 8d142e4
Show file tree
Hide file tree
Showing 60 changed files with 463 additions and 413 deletions.
2 changes: 1 addition & 1 deletion cocos/core/3d/framework/camera-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ export class CameraComponent extends Component {
* @param out 返回在当前传入的 UI 节点下的偏移量
*
* @example
* ```typescript
* ```ts
* this.convertToUINode(target.worldPosition, uiNode.parent, out);
* uiNode.position = out;
* ```
Expand Down
3 changes: 2 additions & 1 deletion cocos/core/animation/animation-clip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export class AnimationClip extends Asset {
* @zh 使用一组序列帧图片来创建动画剪辑
* @example
* ```
* const clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
* import { AnimationClip } from 'cc';
* const clip = AnimationClip.createWithSpriteFrames(spriteFrames, 10);
* ```
*/
public static createWithSpriteFrames (spriteFrames: SpriteFrame[], sample: number) {
Expand Down
4 changes: 2 additions & 2 deletions cocos/core/animation/animation-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export class AnimationComponent extends Eventify(Component) {
* @param target The callee when invoke the callback, could be absent
* @return The registered callback
* @example
* ```typescript
* ```ts
* onPlay: function (type, state) {
* // callback
* }
Expand Down Expand Up @@ -426,7 +426,7 @@ export class AnimationComponent extends Eventify(Component) {
* @param {Function} callback The callback to unregister
* @param {Object} target The callee of the callback, could be absent
* @example
* ```typescript
* ```ts
* // unregister event to all animation
* animation.off('play', this.onPlay, this);
* ```
Expand Down
8 changes: 4 additions & 4 deletions cocos/core/assets/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ import { errorID } from '../platform/debug';
* You may want to override:<br/>
* - createNode<br/>
* - getset functions of _nativeAsset<br/>
* - cc.Object._serialize<br/>
* - cc.Object._deserialize<br/>
* - `Object._serialize`<br/>
* - `Object._deserialize`<br/>
* @zh
* Creator 中的资源基类。<br/>
*
* 您可能需要重写:<br/>
* - createNode <br/>
* - _nativeAsset 的 getset 方法<br/>
* - cc.Object._serialize<br/>
* - cc.Object._deserialize<br/>
* - `Object._serialize`<br/>
* - `Object._deserialize`<br/>
*
* @class Asset
* @extends RawAsset
Expand Down
1 change: 0 additions & 1 deletion cocos/core/assets/bitmap-font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export interface IConfig {
*
* @zh
* 位图字体资源类。
* 可通过 cc.BitmapFont 获取该组件。
*/
@ccclass('cc.BitmapFont')
export class BitmapFont extends Font {
Expand Down
1 change: 0 additions & 1 deletion cocos/core/assets/font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { legacyCC } from '../global-exports';
*
* @zh
* 字体资源类。
* 可通过 cc.Font 获取该组件。
*/
@ccclass('cc.Font')
export class Font extends Asset {
Expand Down
1 change: 0 additions & 1 deletion cocos/core/assets/label-atlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { legacyCC } from '../global-exports';
*
* @zh
* 艺术数字字体资源类。
* 可通过 cc.LabelAtlas 获取该组件。
*
*/
@ccclass('cc.LabelAtlas')
Expand Down
5 changes: 3 additions & 2 deletions cocos/core/assets/prefab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ export default class Prefab extends Asset {
* @default Prefab.OptimizationPolicy.AUTO
* @since 1.10.0
* @example
* ```typescript
* prefab.optimizationPolicy = cc.Prefab.OptimizationPolicy.MULTI_INSTANCE;
* ```ts
* import { Prefab } from 'cc';
* prefab.optimizationPolicy = Prefab.OptimizationPolicy.MULTI_INSTANCE;
* ```
*/
@property
Expand Down
1 change: 0 additions & 1 deletion cocos/core/assets/sprite-atlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ interface ISpriteFrameList {
*
* @zh
* 精灵图集资源类。
* 可通过 cc.SpriteAtlas 获取该组件。
*/
@ccclass('cc.SpriteAtlas')
export class SpriteAtlas extends Asset {
Expand Down
13 changes: 7 additions & 6 deletions cocos/core/assets/sprite-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,23 @@ const temp_uvs: IUV[] = [{ u: 0, v: 0 }, { u: 0, v: 0 }, { u: 0, v: 0 }, { u: 0,

/**
* @en
* A cc.SpriteFrame has:<br/>
* - texture: A cc.Texture2D that will be used by render components<br/>
* A `SpriteFrame` has:<br/>
* - texture: A `Texture2D` that will be used by render components<br/>
* - rectangle: A rectangle of the texture
*
* @zh
* 精灵帧资源。
* 一个 SpriteFrame 包含:<br/>
* - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
* - 矩形:在纹理中的矩形区域。
* 可通过 cc.SpriteFrame 获取该组件。
* 可通过 `SpriteFrame` 获取该组件。
*
* @example
* ```typescript
* ```ts
* import { loader } from 'cc';
* // First way to use a SpriteFrame
* const url = "assets/PurpleMonster/icon/spriteFrame";
* cc.loader.loadRes(url, (err, spriteFrame) => {
* loader.loadRes(url, (err, spriteFrame) => {
* const node = new Node("New Sprite");
* const sprite = node.addComponent(SpriteComponent);
* sprite.spriteFrame = spriteFrame;
Expand All @@ -154,7 +155,7 @@ const temp_uvs: IUV[] = [{ u: 0, v: 0 }, { u: 0, v: 0 }, { u: 0, v: 0 }, { u: 0,
* // Second way to use a SpriteFrame
* const self = this;
* const url = "test_assets/PurpleMonster";
* cc.loader.loadRes(url, (err, imageAsset) => {
* loader.loadRes(url, (err, imageAsset) => {
* if(err){
* return;
* }
Expand Down
2 changes: 1 addition & 1 deletion cocos/core/assets/texture-cube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TextureCube extends SimpleTexture {
* @param out 出口立方体贴图,若未定义则将创建为新的立方体贴图。
* @returns `out`
* @example
* ```typescript
* ```ts
* const textures = new Array<Texture2D>(6);
* textures[TextureCube.FaceIndex.front] = frontImage;
* textures[TextureCube.FaceIndex.back] = backImage;
Expand Down
1 change: 0 additions & 1 deletion cocos/core/assets/ttf-font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { legacyCC } from '../global-exports';
*
* @zh
* TTF 字体资源类。
* 可通过 cc.TTFFont 获取该组件。
*/
@ccclass('cc.TTFFont')
export class TTFFont extends Font {
Expand Down
12 changes: 6 additions & 6 deletions cocos/core/components/component-event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ import { legacyCC } from '../global-exports';
/**
* @zh
* “EventHandler” 类用来设置场景中的事件回调,该类允许用户设置回调目标节点,目标组件名,组件方法名,并可通过 emit 方法调用目标函数。
* 可通过 cc.Component.EventHandler 获得该事件。
*
* @example
* ```typescript
*
* var eventHandler = new cc.Component.EventHandler();
* ```ts
* import { Component } from 'cc';
* const eventHandler = new Component.EventHandler();
* eventHandler.target = newTarget;
* eventHandler.component = "MainMenu";
* eventHandler.handler = "OnClick";
Expand Down Expand Up @@ -113,8 +112,9 @@ export class EventHandler {
*
* @param params - 派发参数数组。
* @example
* ```typescript
* var eventHandler = new cc.Component.EventHandler();
* ```ts
* import { Component } from 'cc';
* const eventHandler = new Component.EventHandler();
* eventHandler.target = newTarget;
* eventHandler.component = "MainMenu";
* eventHandler.handler = "OnClick"
Expand Down
Loading

0 comments on commit 8d142e4

Please sign in to comment.