Skip to content

Commit 61e6524

Browse files
authored
完善部分文档 (cocos#1570)
* 完善部分文档 * Commit changes
1 parent 8a57b79 commit 61e6524

File tree

130 files changed

+581
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+581
-603
lines changed

en/asset/asset-manager-upgrade-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Asset Manager Upgrade Guide
22

33
> Author: Santy-Wang, Xunyi
4-
4+
>
55
> This article details what to expect when upgrading from loader to assetManager.
66
77
Before Creator v2.4, [Acquire and load asset](https://github.com/cocos-creator/creator-docs/blob/e02ac31bab12d3ee767c0549050b0e42bd22bc5b/en/scripting/load-assets.md) was implemented through the `loader` module (including the APIs `loader.load`, `loader.loadRes`, `loader.loadResDir`, etc.), which was primarily used to load resources. However, with the continuous development of Creator, developers' demands for resource management have been increasing. The original `loader` module has been unable to meet a large number of resource management needs, and a new resource management module is in the air.

en/asset/dcc-export-mesh.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You can see that the rotation data is gone in __Cocos Creator 3.0__.
2828

2929
## Exporting glTF
3030

31-
Please read ther following documents:
31+
Please read their following documents:
3232
- [glTF also uses a right-handed coordinate system](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#coordinate-system-and-units)
3333
- [Options for exporting glTF in Blender](https://docs.blender.org/manual/en/2.80/addons/io_scene_gltf2.html). It is relatively simple, as long as the __+y up__ option is checked, there is no rotation value in the exported data.
3434

en/asset/dynamic-load-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ resources.load("test assets/anim", AnimationClip, (err, clip) => {
3434
After the image is set to a spriteframe, texture or other image types, an asset of the corresponding type will be generated in the **Assets Panel**. But if `test assets/image` is loaded directly, and the type will be `ImageAsset`. You must specify the full path of sub asset, then the generated SpriteFrame can be loaded.
3535

3636
```typescript
37-
// load a SpriteFrameimage is ImageAssetspriteFrame is image/spriteFrame, texture is image/texture
37+
// load a SpriteFrame, image is ImageAsset, spriteFrame is image/spriteFrame, texture is image/texture
3838
resources.load("test assets/image/spriteFrame", SpriteFrame, (err, spriteFrame) => {
3939
this.node.getComponent(Sprite).spriteFrame = spriteFrame;
4040
});

en/asset/render-texture.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export class CaptureToWeb extends Component {
2929
borderRight: spriteframe.insetRight,
3030
});
3131

32-
const rendetTex = this._renderTex = new RenderTexture();
33-
rendetTex.reset({
32+
const renderTex = this._renderTex = new RenderTexture();
33+
renderTex.reset({
3434
width: 256,
3535
height: 256,
3636
colorFormat: RenderTexture.PixelFormat.RGBA8888,
3737
depthStencilFormat: RenderTexture.DepthStencilFormat.DEPTH_24_STENCIL_8
3838
});
39-
this.camera.targetTexture = rendetTex;
40-
sp.texture = rendetTex;
39+
this.camera.targetTexture = renderTex;
40+
sp.texture = renderTex;
4141
this.sprite.spriteFrame = sp;
4242
}
4343
}
@@ -65,4 +65,4 @@ export class RenderCameraToModel extends Component {
6565
}
6666
```
6767

68-
For more __Render Texture__ examples, please see these [test casees](https://github.com/cocos-creator/test-cases-3d/tree/master/assets/cases/rendertexture).
68+
For more __Render Texture__ examples, please see these [test cases](https://github.com/cocos-creator/test-cases-3d/tree/v3.0/assets/cases/rendertexture).

en/concepts/scene/fog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To increase the density of Linear Fog when the distance between the camera and t
3333
1. fix the value of `FogStart` and decrease the value of `FogEnd`.
3434
2. Decrease the value of `FogStart` and fix the value of `FogEnd`.
3535

36-
To adjust the fog effect to the right consistency, it is best to adjust both the `FogStart` and `FogEnd` properties appropriately. An example effect of Linear Fog is shown below
36+
To adjust the fog effect to the right consistency, it is best to adjust both the `FogStart` and `FogEnd` properties appropriately. An example effect of Linear Fog is shown below:
3737

3838
![image](./fog/linear_fog.png)
3939

en/editor/components/dragonbones.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ The following is an example of how DragonBones replaces the texture. Replace the
8383
this._rightDisplayIndex %= this._rightDisplayNames.length;
8484
let armature = this.armatureDisplay!.armature();
8585
let slot = armature!.getSlot("weapon_hand_r");
86+
let replaceArmatureName = this.replaceArmatureDisplay!.armatureName;
8687
const displayName = this._rightDisplayNames[this._rightDisplayIndex];
8788
let factory = dragonBones.CCFactory.getInstance() as any;
88-
factory.replaceSlotDisplay(this.replaceArmatureDisplay!.getArmatureKey(), "weapon", "weapon_r", displayName, slot);
89+
factory.replaceSlotDisplay(this.replaceArmatureDisplay!.getArmatureKey(), replaceArmatureName , "weapon_r", displayName, slot);
8990

9091
let offset = this._rightDisplayOffset[this._rightDisplayIndex];
9192
slot!.parent.offset.x = offset.x;
@@ -111,7 +112,9 @@ The following is an example of how DragonBones replaces the texture. Replace the
111112
112113
![dragonbones-cloth](./dragonbones/cloth4.png)
113114
114-
> **Note**: if the scene is not displayed when previewing, check that the `Layer` property of each node is consistent with that of the `Camera` node.
115+
> **Notes**:
116+
> 1. After the example is run, the weapon style replaced by the right hand is not consistent with the weapon style prepared in the Scene, which is caused by the resource problem, please refer to the specific code implementation.
117+
> 2. If the scene is not displayed when previewing, check that the `Layer` property of each node is consistent with that of the `Camera` node.
115118
>
116119
> ![layer](./dragonbones/layer.png)
117120

en/editor/extension/contributions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ interface contributions {
2525
}
2626
```
2727

28-
The name is the name of the function or extension, and the value is of any type, which is defined by the author of the name function (extension).
28+
The `name` is the name of the function or extension, and the `value` is of type `any`, which is defined by the author of the `name` function (extension).
2929

30-
At this stage, only contributions to the internal functions of the editor are opened. In the future, we will provide the ability to use contributions between extensions.
30+
At this stage, only `contributions` to the internal functions of the editor is opened, in the future we will provide a more convenient way of using `contributions` between extensions.

en/editor/project/physics-configs.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ Physical configuration is used to configure various commonly used properties.
66

77
![Physics](./index/physics-index.png)
88

9-
- `gravity` Gravity direction vector, the sign means the positive or negative direction on the axis. **Default:** `{ x: 0, y: -10, z: 0 }`.
10-
- `allowSleep` Whether to allow rigid bodies to enter sleep state. **Default:** `true`.
11-
- `sleepThreshold` The maximum speed threshold for entering sleep. **Default:** `0.1`**Min:** `0`.
9+
- `gravity` Gravity direction vector, the sign means the positive or negative direction on the axis. **Default**: `{ x: 0, y: -10, z: 0 }`.
10+
- `allowSleep` Whether to allow rigid bodies to enter sleep state. **Default**: `true`.
11+
- `sleepThreshold` The maximum speed threshold for entering sleep. **Default**: `0.1`. **Min**: `0`.
1212
- `autoSimulation` Whether to enable automatic simulation.
13-
- `fixedTimeStep` Fixed time step between each simulation. **Default:** `1/60`, **Min:** `0`.
14-
- `maxSubSteps` Maximum number of substeps per simulation step. **Default:** `1`, **Min:** `0`.
15-
- `friction` Coefficient of friction. **Default:** `0.5`.
16-
- `rollingFriction` Rolling friction coefficient. **Default:** `0.1`.
17-
- `spinningFriction` Spin friction coefficient. **Default:** `0.1`.
18-
- `restitution` Coefficient of elasticity. **Default:** `0.1`.
13+
- `fixedTimeStep` Fixed time step between each simulation. **Default**: `1/60`. **Min**: `0`.
14+
- `maxSubSteps` Maximum number of substeps per simulation step. **Default**: `1`. **Min**: `0`.
15+
- `friction` Coefficient of friction. **Default**: `0.5`.
16+
- `rollingFriction` Rolling friction coefficient. **Default**: `0.1`.
17+
- `spinningFriction` Spin friction coefficient. **Default**: `0.1`.
18+
- `restitution` Coefficient of elasticity. **Default**: `0.1`.
1919
- `collisionMatrix` The collision matrix, used only for initialization.
2020
<!-- - `useNodeChains` Whether to use a node chain to combine rigid bodies. **Default:** `true`. -->
2121

en/editor/publish/publish-bytedance-mini-game.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The game submission, review and release process of a mini-game needs to comply w
88

99
## Publish to ByteDance with Cocos Creator
1010

11-
1. Download the **ByteDance DevTools** on [ByteDance Official Website [cn]](https://microapp.bytedance.com/docs/zh-CN/mini-game/develop/developer-instrument/developer-instrument-update-and-download).
11+
1. Download the [ByteDance DevTools [cn]](https://microapp.bytedance.com/docs/zh-CN/mini-game/develop/developer-instrument/developer-instrument-update-and-download).
1212

13-
2. Log in to [Developer Platform [cn]](https://microapp.bytedance.com/)to find your `mini game appid`. For details, please refer to the official [Access Guide [cn]](https://microapp.bytedance.com/docs/zh-CN/mini-game/introduction/plugin-reference/set-up-mini-game) documentation.
13+
2. Log in to [Developer Platform [cn]](https://microapp.bytedance.com/)to find your `mini game appid`. For details, please refer to the official [Access Guide [cn]](https://microapp.bytedance.com/docs/zh-CN/mini-game/introduction/plugin-reference/sign) documentation.
1414

1515
![appid](./publish-bytedance-mini-game/appid.png)
1616

en/editor/publish/publish-huawei-agc.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Use Cocos Creator to open the project that needs to be released. Open the **Buil
1818

1919
For the settings of the general options, please refer to the [Build Options](build-options.md) document.
2020

21-
- **agconnect-services Config**Used to configure Huawei parameter file `agconnect-services.json`. Please refer to the [Configs HUAWEI Parameter File](https://service.cocos.com/document/en/sdkhub-plugins/sdkhub-hms.html#configs-huawei-config-file) for the specific configuration method.
21+
- **agconnect-services Config**: Used to configure Huawei parameter file `agconnect-services.json`. Please refer to the [Configs HUAWEI Parameter File](https://service.cocos.com/document/en/sdkhub-plugins/sdkhub-hms.html#configs-huawei-config-file) for the specific configuration method.
2222

23-
- **Cocos SDKHub Config Set**: This option is used to help the game quickly intergrate the channel SDK. Please select the SDKHub service that you have previously enabled in the Cocos Services panel.
23+
- **Cocos SDKHub Config Set**: This option is used to help the game quickly integrate the channel SDK. Please select the SDKHub service that you have previously enabled in the Cocos Services panel.
2424

2525
![sdkhub](./publish-huawei-agc/sdkhub.png)
2626

en/editor/publish/setup-native-development.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ On Windows platform, please confirm if `JAVA_HOME` is included in your environme
3434

3535
After installing **Android Studio**, refer to the official documentation and open the **SDK Manager**: [SDK Manager Instructions](https://developer.android.com/studio/intro/update.html#sdk-manager).
3636

37-
1. In the **SDK Platforms** tab page, check the API level you want to install, and it is recommended to select the required mainstream API Level such as `API Level 23 (6.0)`, `API Level 26 (8.0)` and `API Level 28 (9.0)`, etc.
37+
1. In the **SDK Platforms** tab page, check the API level you want to install, and it is recommended to select the required mainstream API Level such as `API Level 26 (8.0)`, `API Level 28 (9.0)`, etc.
3838
2. In the **SDK Tools** tab page, first check the lower right corner of the **Show Package Details**, show the version of the tool selection.
3939
3. In the **Android SDK Build-Tools**, select the latest build Tools version.
4040
4. Check the **Android SDK Platform-Tools** and **CMake**. If you need to install the **Android Support Library**, please refer to the official [Support Library Setup](https://developer.android.com/topic/libraries/support-library/setup).
41-
5. Check the **NDK** and the recommended version is **r20**.
41+
5. Check the **NDK** and the recommended version is **r20~21**. Note that the **NDK-r22** is not supported currently.
4242
6. Take note of the path of **Android SDK Location** on top of the **SDK Manager** window. Later we need to fill in the location of the SDK in **Cocos Creator**.
4343
7. Click **OK** and follow the prompts to complete the installation.
4444

@@ -48,14 +48,14 @@ After installing **Android Studio**, refer to the official documentation and ope
4848

4949
Please install the following running environment:
5050

51-
- Python **2.7.5+**, [download page](https://www.python.org/downloads/). **Pay attention! Don't download Python 3.x version**.
52-
5351
- In Windows, the installation of [Visual Studio 2017/2019 Community Edition](https://www.visualstudio.com/downloads/download-visual-studio-vs) is needed. When installing Visual Studio, please check **Desktop development with C++** and **Game development with C++** two modules.
5452

5553
> **Note**: there is a **Cocos** option in the **Game development with C++** module. Do **NOT** check it.
5654
5755
- In Mac, the installation of [Xcode](https://developer.apple.com/xcode/download/) and command line tool is needed.
5856

57+
> **Note**: Starting with v3.0.1, Xcode v11.5 and above is required.
58+
5959
## Configure Native Develop environments path
6060

6161
Next, go back to Cocos Creator to configure the environmental path of the native platform. Choose **Cocos Creator -> Preferences** in the main menu, and open the **Preferences** panel. We need to configure the following two paths here:

en/engine/animation/animation-clip.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ When the animation system is operating, the __Animation Component__ calculates t
1111
The following code snippet demonstrates how to create __Animation Clips__ programmatically:
1212

1313
```ts
14-
import { AnimationClip, animation, js } from "cc";
14+
import { AnimationClip, animation, js } from 'cc';
1515
const animationClip = new AnimationClip();
1616
animationClip.duration = 1.0; // The cycle of the entire animation clip, no frame time should be greater than this attribute.
1717
animationClip.keys = [ [ 0.3, 0.6, 0.9 ] ]; // Frame time shared by all curves of this animation clip
@@ -221,7 +221,7 @@ When the `interpolate` property of the curve data is `true`, the curve will try
221221
If the curve value does not satisfy any of the above conditions, or when the `interpolate` property of the curve data is `false`, there will be no interpolation operation. Always use the curve value of the previous frame as the result.
222222

223223
```ts
224-
import { AnimationClip, color, IPropertyCurveData, SpriteFrame, Vec3 } from "cc";
224+
import { AnimationClip, color, IPropertyCurveData, SpriteFrame, Vec3 } from 'cc';
225225

226226
const animationClip = new AnimationClip();
227227

@@ -266,7 +266,7 @@ const spriteCurve: IPropertyCurveData = {
266266
The following code shows how to customize the **interpolation** algorithm:
267267

268268
```ts
269-
import { ILerpable, IPropertyCurveData, Quat, quat, Vec3, vmath } from "cc";
269+
import { ILerpable, IPropertyCurveData, Quat, quat, Vec3, vmath } from 'cc';
270270

271271
class MyCurveValue implements ILerpable {
272272
public position: Vec3;

en/engine/animation/animation-component.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ __Animation components__ control the playback of animations.
55
__Animation components__ are added to nodes in exactly the same way as other components:
66

77
```ts
8-
import { Animation, Node } from "cc";
8+
import { Animation, Node } from 'cc';
99

1010
function (node: Node) {
1111
const animationComponent = node.addComponent(Animation);
@@ -85,7 +85,7 @@ The `events` of an `AnimationClip` contains all event descriptions for the anima
8585
`func` represents the method name that is called back when the event is triggered. When the event is triggered, a **search** for a method named `func` on all components of the current node, once found, it is called with `params` passed to it. Example:
8686

8787
```ts
88-
import { Animation, Component } from "cc";
88+
import { Animation, Component } from 'cc';
8989
class MyScript extends Component {
9090
constructor() {
9191

en/engine/event/event-emit.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Event processing is done in the `Node`. Components can register and monitor even
99
xxx.on(type, func, target?);
1010
```
1111
12-
The `type` is the event registration string. `func` is the callback to listen to when the event is executed. And `target` is the event receive object. If `target` is not setthen `this` in the callback refers to the object that is currently executing the callback.
12+
The `type` is the event registration string. `func` is the callback to listen to when the event is executed. And `target` is the event receive object. If `target` is not set, then `this` in the callback refers to the object that is currently executing the callback.
1313
1414
The event listener function `on` can pass to the third parameter target to bind the caller of the response function. The following two calling methods have the same effect:
1515
@@ -45,7 +45,7 @@ One thing to note is that the parameter of `off` must be in one-to-one correspon
4545
Example:
4646
4747
```ts
48-
import { _decorator, Component, Node } from "cc";
48+
import { _decorator, Component, Node } from 'cc';
4949
const { ccclass } = _decorator;
5050

5151
@ccclass("Example")
@@ -78,7 +78,7 @@ xxx.emit(type, ...args);
7878
When emitting events, start passing the event parameters as the second argument of the emit function.
7979
8080
```ts
81-
import { _decorator, Component, Node } from "cc";
81+
import { _decorator, Component, Node } from 'cc';
8282
const { ccclass } = _decorator;
8383

8484
@ccclass("Example")

en/engine/event/event-input.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Event types included:
3737
- Event: [API Reference](__APIDOC__/en/classes/event.event-1.html)
3838

3939
```ts
40-
import { _decorator, Component, Node, systemEvent, SystemEventType, EventKeyboard, macro } from "cc";
40+
import { _decorator, Component, Node, systemEvent, SystemEventType, EventKeyboard, macro } from 'cc';
4141
const { ccclass } = _decorator;
4242

4343
@ccclass("Example")
@@ -79,7 +79,7 @@ export class Example extends Component {
7979
- Event: [API Reference](__APIDOC__/en/classes/event.event-1.html)
8080

8181
```ts
82-
import { _decorator, Component, Node, systemEvent, SystemEventType, log } from "cc";
82+
import { _decorator, Component, Node, systemEvent, SystemEventType, log } from 'cc';
8383
const { ccclass } = _decorator;
8484

8585
@ccclass("Example")

en/getting-started/first-game/index.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ It is necessary for the main character to be affected when the mouse moves. To d
9999
There are already some pre-set code blocks in the `PlayerController` script. Example:
100100

101101
```ts
102-
import { _decorator, Component } from "cc";
102+
import { _decorator, Component } from 'cc';
103103
const { ccclass, property } = _decorator;
104104

105105
@ccclass("PlayerController")
@@ -126,7 +126,7 @@ This code is the structure needed to write a __component__. Scripts with this st
126126
Monitoring of mouse events needs to be added in the script to let the `Player` node move. Modify the code in `PlayerController` as follows:
127127

128128
```ts
129-
import { _decorator, Component, Vec3, systemEvent, SystemEvent, EventMouse, Animation } from "cc";
129+
import { _decorator, Component, Vec3, systemEvent, SystemEvent, EventMouse, Animation } from 'cc';
130130
const { ccclass, property } = _decorator;
131131

132132
@ccclass("PlayerController")
@@ -295,7 +295,7 @@ It is necessary to make the basic element `cube` of the road into a __Prefab__,
295295
A very long road is needed. The ideal method is to dynamically increase the length of the road, so that the `Player` can run forever. First, generate a fixed-length road with a length that is arbitrary. To do so, replace the code in the `GameManager` script with the following code:
296296

297297
```ts
298-
import { _decorator, Component, Prefab, instantiate, Node, CCInteger} from "cc";
298+
import { _decorator, Component, Prefab, instantiate, Node, CCInteger} from 'cc';
299299
const { ccclass, property } = _decorator;
300300
301301
enum BlockType{
@@ -776,7 +776,7 @@ When previewing, the results are as follows:
776776
The final code for `PlayerController.ts` should look like this:
777777

778778
```ts
779-
import { _decorator, Component, Vec3, systemEvent, SystemEvent, EventMouse, Animation, SkeletalAnimation } from "cc";
779+
import { _decorator, Component, Vec3, systemEvent, SystemEvent, EventMouse, Animation, SkeletalAnimation } from 'cc';
780780
const { ccclass, property } = _decorator;
781781

782782
@ccclass("PlayerController")
@@ -883,7 +883,7 @@ export class PlayerController extends Component {
883883
The final code for `GameManager.ts` should look like this:
884884

885885
```ts
886-
import { _decorator, Component, Prefab, instantiate, Node, Label, CCInteger, Vec3 } from "cc";
886+
import { _decorator, Component, Prefab, instantiate, Node, Label, CCInteger, Vec3 } from 'cc';
887887
import { PlayerController } from "./PlayerController";
888888
const { ccclass, property } = _decorator;
889889

0 commit comments

Comments
 (0)