Skip to content

Commit c6723c2

Browse files
xunyi0slackmoehrleLinYunMo
authored
完善并补充部分文档 (cocos#1640)
* 完善并补充部分文档 * Apply suggestions from code review Co-authored-by: Slack-Moehrle <[email protected]> Co-authored-by: ChiaNing <[email protected]> Co-authored-by: Slack-Moehrle <[email protected]> Co-authored-by: ChiaNing <[email protected]>
1 parent b3104c5 commit c6723c2

29 files changed

+1203
-27
lines changed

Diff for: en/asset/dynamic-load-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ assetManager.loadRemote<ImageAsset>(remoteUrl, function (err, imageAsset) {
142142

143143
// Remote texture url without file extensions, then you need to define the file type explicitly
144144
remoteUrl = "http://unknown.org/emoji?id=124982374";
145-
assetManager.loadRemote<ImageAsset>(remoteUrl, {type: 'png'}, function (err, imageAsset) {
145+
assetManager.loadRemote<ImageAsset>(remoteUrl, {ext: 'png'}, function (err, imageAsset) {
146146
const spriteFrame = new SpriteFrame();
147147
const texture = new Texture2D();
148148
texture.image = imageAsset;

Diff for: en/asset/mesh.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ When the model asset file (`.fbx` or `.gltf`) is selected in the __Assets__ pane
3535

3636
![mesh_model](mesh/mesh_model.jpg)
3737

38-
- `Normals` -- Normals information, including **Optional**, **Exclude**, **Require**, **Recalculate**
39-
- `Tangents` -- Tangents information, including **Optional**, **Exclude**, **Require**, **Recalculate**
40-
- `SkipValidation` -- SkipValidation, whether to skip standard checks
38+
| Property | Description |
39+
| :--- | :--- |
40+
| Normals | Normals import setting, including the following four options:<br>1. **Optional**: Import normals only if the model file contains normals.<br>2. **Exclude**: Do not import normals.<br>3. **Required**: Import normals that are contained in the model file, or recalculate if not contained. It is recommended to use this option if the model data itself is fine, without additional processing.<br>4. **Recalculate**: Recalculate normals and import, ignoring whether if the model file contain normals. Selecting this option will increase the calculated amount, but it will eliminate the subsequent problems caused by the absence of normalization of the model's original normal data. |
41+
| Tangents | Tangents import setting, including Optional、Exclude、Require、Recalculate four options, option feature can refer to the description of **Normals**, the two are not very different. |
42+
| Skip Validation | Skip validation of the model file |
43+
| Disable mesh split | Currently there is a joint-counting-based mesh splitting process during the import pipeline to workaround the max uniform vector limit problem for real-time calculated skeletal animation system on many platforms. This process has a preference impact on other runtime system too. So if it can be pre-determined that the real-time calculated skeletal animations (when `useBakedAnimation` option of the **SkeletalAnimation** component is unchecked) will not be used, this option can be checked to improve preference. But note that toggling this would update the corresponding prefab, so all the references in the scene should be updated as well to accompany that. This process will be removed in further refactors. |
4144

4245
### Animation Module
4346

Diff for: en/asset/mesh/mesh_model.jpg

6.52 KB
Loading

Diff for: en/asset/sprite-frame.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@ __Sprite Frame__ is a container for __UI rendering__ and basic graphics, which m
44

55
## Importing Sprite Frame Assets
66

7-
Use the __default asset import__ method to import image assets into the project, then set the type of image as __sprite-frame__ and can then be seen in the **Assets** panel.
7+
Use the default [asset import](asset-workflow.md) method to import image assets into the project, then set the type of image as __sprite-frame__ in the **Inspeactor** panel:
8+
9+
![set sprite-frame](sprite-frame/set-spriteframe.png)
10+
11+
Creator will then automatically create a spriteFrame resource under it as shown below:
812

913
![imported texture](sprite-frame/imported_texture.png)
1014

1115
Image assets will use thumbnails of their own pictures as icons in the **Assets** panel. When the image sub-asset is selected in the **Assets** panel, a thumbnail of the image is displayed below the **Inspector** panel.
1216

17+
The `spriteFrame` has the following properties:
18+
19+
| Property | Description |
20+
| :--- | :--- |
21+
| Packable | Whether to be packed into Dynamic Atlas. |
22+
| Rotated | Read-only property, cannot be changed. Used to see if the sub-asset in the Texture Packer asset is rotated. |
23+
| Offset X, Y | Read-only property, cannot be changed. Used to view the offset of the rectangle in Texture Packer asset. |
24+
| Trim Type | Set the trim type, including:<br>1. Auto -- Automatic trim<br>2. Custom -- Custom trim<br>3. None -- No trim, use original texture<br>For details, please refer to the [Auto Trim for SpriteFrame](trim.md) documentation |
25+
| Trim Threshold | Set the transparency threshold, trim off the pixels whose transparency is below the set value.<br>The default value is 1, and the range of values is 0~1.<br>Only takes effect when **Trim Type** is set to **Auto**. |
26+
| Trim X, Y, Width, Height | Sets the trim rect, only takes effect when **Trim Type** is set to **Custom**. |
27+
| Border Top, Bottom, Left, Right | Set the texture margins of the 9-sliced, which can be edited visually by clicking on the **Edit** button below. |
28+
1329
## Using a Sprite Frame
1430

1531
### The object contained in the container is using textures

Diff for: en/asset/sprite-frame/imported_texture.png

81 Bytes
Loading

Diff for: en/asset/sprite-frame/set-spriteframe.png

9.56 KB
Loading

Diff for: en/editor/components/dragonbones.md

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ The following is an example of how DragonBones replaces the texture. Replace the
5858
@property({ type: dragonBones.ArmatureDisplay })
5959
replaceArmatureDisplay: dragonBones.ArmatureDisplay | null = null;
6060

61-
6261
_leftWeaponIndex = 0;
6362
_rightDisplayIndex = 0;
6463
_rightDisplayNames:string[] = [];

Diff for: en/editor/components/spine.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Select the node and choose **Add Component -> Spine -> Skeleton** on the **Inspe
1818
| SkeletonData | Skeleton information data, drag and drop the skeleton assets exported from Spine. into this property
1919
| Default Skin | Select the default skin.
2020
| Animation | The name of the currently playing animation.
21-
| Animation Cache Mode | Rendering mode, the default is **REALTIME** mode. <br>1. **REALTIME** mode, real-time computing, supports all Spine features. <br>2. **SHARED_CACHE** mode, caches, and shares skeletal animations and texture data, equivalent to pre-baked skeletal animations. **SHARED_CACHE** mode has higher performance, but does not support motion fusion, motion overlay, and only supports motion start and end events. As for memory, when creating N (N>=3) animations with the same skeleton and the same action, the memory advantage is obvious. In summary, **SHARED_CACHE** mode is suitable for scene animations, effects, replica monsters, NPCs, etc., and can greatly improve frame rates and reduce memory consumption. <br>3. **PRIVATE_CACHE** mode, similar to **SHARED_CACHE** but does not share animation and texture data, so there is no memory advantage, only performance advantage. Use **PRIVATE_CACHE** to take advantage of the high performance of the cache mode and to also implement texture replacement (which cannot share the texture data).
21+
| Animation Cache Mode | Rendering mode, the default is **REALTIME** mode. <br>1. **REALTIME** mode, real-time computing, supports all Spine features. <br>2. **SHARED_CACHE** mode, caches, and shares skeletal animations and texture data, equivalent to pre-baked skeletal animations. **SHARED_CACHE** mode has higher performance, but does not support motion fusion, motion overlay, and only supports motion start and end events. As for memory, when creating N (N>=3) animations with the same skeleton and the same action, the memory advantage is obvious. In summary, **SHARED_CACHE** mode is suitable for scene animations, effects, replica monsters, NPCs, etc., and can greatly improve frame rates and reduce memory consumption. <br>3. **PRIVATE_CACHE** mode, similar to **SHARED_CACHE**, but does not share animation and texture data, and will occupy extra memory, there is only a performance advantage, and it may cause stutter if using this mode a lot to play animation. Use **PRIVATE_CACHE** to take advantage of the high performance of the cache mode and to also implement texture replacement (which cannot share the texture data).
2222
| Loop | Whether to loop the current animation.
2323
| Premultiplied Alpha | Whether to enable premultiplied alpha for the image, default is True.<br>This item needs to be disabled when the transparent area of the image appears as a color block, and enabled when the translucent area of the image turns black.
2424
| Time Scale | The time scale of all animations in the current skeleton.

Diff for: en/editor/publish/publish-huawei-mini-game.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ __Cocos Creator__ officially supports the release of games to the **Huawei Quick
66

77
## Environment Configuration
88

9-
- Download the [Huawei Quick APP Loader](https://developer.huawei.com/consumer/en/doc/development/quickApp-Guides/quickapp-installtool) and install it on your Android device (Android Phone 6.0 or above is recommended)
9+
- Download the [Huawei Quick APP Loader](https://developer.huawei.com/consumer/en/doc/development/quickApp-Guides/quickapp-installtool#h1-1575365259108) and install it on your Android device (Android Phone 6.0 or above is recommended)
1010

1111
- Install [nodejs-8.1.4](https://nodejs.org/en/download/) or above, globally.
1212

Diff for: en/engine/renderable/model-component.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The component interfaces for the skinning model are described in [SkinnedMeshRen
1414
| :--- | :---
1515
| **materials** | The material used to render the model, one material corresponds to one submesh in the mesh.
1616
| **LightmapSettings** | For baking Lightmap, please refer to [Lightmapping](../../concepts/scene/light/lightmap.md) for details.
17-
**shadowCastingMode** | Specifies whether the current model will cast shadows, which needs to [enable shadow effect](../../concepts/scene/shadow.md#enable-shadow-effect) in the scene first
17+
| **shadowCastingMode** | Specifies whether the current model will cast shadows, which needs to [enable shadow effect](../../concepts/scene/shadow.md#enable-shadow-effect) in the scene first
1818
| **ReceiveShadow** | Specifies whether the current model will receive and display shadow effects generated by other objects, which needs to [enable shadow effect](../../concepts/scene/shadow.md#enable-shadow-effect) in the scene first. This property takes effect only when the shadow type is __ShadowMap__.
1919
| **mesh** | 3D model assets for rendering.
2020

Diff for: en/release-notes/upgrade-guide-v3.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,4 @@ Notice from the above two figures, there is a big difference between v2.4.3 and
324324
- [Learn TypeScript in Y minutes [cn]](https://learnxinyminutes.com/docs/zh-cn/typescript-cn/)
325325
- [TypeScript GitHub](https://github.com/Microsoft/TypeScript)
326326
- [The Best Resources For Learning TypeScript for Game Development](https://www.cocos.com/en/the-best-resources-for-learning-typescript-for-game-development)
327+
- [3 Excuses Developers Give To Avoid TypeScriptand the Better Reasons They Should Use It](https://betterprogramming.pub/the-bad-reasons-people-avoid-typescript-and-the-better-reasons-why-they-shouldnt-86f8d98534de)

Diff for: en/scripting/index.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ __Cocos Creator__ scripts are used to implement user-defined (game) behaviors.
3131

3232
As a very commonly used system in the engine, we provide a complete and efficient event system for developers to use. For details, please see:
3333

34-
[Event Mechanism](../engine/event/index.md)
34+
[Event Mechanism](../engine/event/index.md)
35+
36+
## More Reference
37+
38+
- [Recommended coding standards](./reference/coding-standards.md)

Diff for: en/scripting/language-support.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ Cocos Creator supports TypeScript 4.1.0. The following restrictions are based on
3737

3838
Developers can still use `tsconfig.json` in their projects to work with the IDE to implement features such as type checking. In order to make the IDE's TypeScript checking compatible with the Creator's behavior, developers need to pay some extra attention to [tsconfig](./tsconfig.md).
3939

40+
### TypeScript Reference Tutorial
41+
42+
- [Tutorial: v3.0 TypeScript question answering and experience sharing](https://discuss.cocos2d-x.org/t/tutorial-3-0-typescript-question-answering-and-experience-sharing/52932)
43+
- [TypeScript Official Website](https://www.typescriptlang.org/)
44+
- [TypeScript - Classes](https://www.typescriptlang.org/docs/handbook/classes.html)
45+
- [TypeScript - Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html)
46+
- [TypeScript - DefinitelyTyped](http://definitelytyped.org/)
47+
- [Learn TypeScript in Y minutes [cn]](https://learnxinyminutes.com/docs/zh-cn/typescript-cn/)
48+
- [TypeScript GitHub](https://github.com/Microsoft/TypeScript)
49+
- [The Best Resources For Learning TypeScript for Game Development](https://www.cocos.com/en/the-best-resources-for-learning-typescript-for-game-development)
50+
- [3 Excuses Developers Give To Avoid TypeScript — and the Better Reasons They Should Use It](https://betterprogramming.pub/the-bad-reasons-people-avoid-typescript-and-the-better-reasons-why-they-shouldnt-86f8d98534de)
51+
4052
## JavaScript
4153

4254
### Language Features
@@ -101,7 +113,7 @@ import blah from './blah-blah';
101113
export default blah;
102114
```
103115

104-
## Related Tutorials
116+
### JavaScript Related Tutorials
105117

106118
- [JavaScript Standard Reference Tutorial [cn]](https://wangdoc.com/javascript/)
107119
- [JavaScript Garden](https://bonsaiden.github.io/JavaScript-Garden/)

0 commit comments

Comments
 (0)