Skip to content

Commit

Permalink
修改部分错误 (cocos#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
xunyi0 authored Jan 11, 2021
1 parent 36af930 commit fff3290
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 85 deletions.
7 changes: 3 additions & 4 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"style": "dash"
},
"list-indent": true,
"ul-indent": {
"indent": 4
},
"ul-indent": true,
"no-trailing-spaces": {
"br_spaces": 0
},
Expand All @@ -26,5 +24,6 @@
"fenced-code-language": false,
"single-trailing-newline": true,
"code-fence-style": true,
"no-empty-links": true
"no-empty-links": true,
"no-inline-html": false
}
12 changes: 5 additions & 7 deletions en/asset/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ After the configuration, click on the **Apply** button at the top right and the
2. The mini game subpackage can only be placed locally and cannot be configured as remote packages. So the **Is Remote Bundle** option cannot be checked when the compression type is set to **Mini Game Subpackage**.
3. The Zip compression type is primarily used to reduce the number of network requests and is used by default with the **Is Remote Bundle** option. Since the package doesn't need network requests if it's local, there's no need to use Zip compression.


## Priority

When the folder is set to Asset Bundle, the resources in the folder and the related dependent resources outside the folder are merged into the same Asset Bundle. It is possible to have a resource that is not in the Asset Bundle folder, but belongs to both Asset Bundles, because it is depended upon by both Asset Bundles. As shown in the figure:

![shared](bundle/shared.png)
![shared](bundle/shared.png)

Another possibility is that a resource is in one Asset Bundle folder, but is also depended upon by other Asset Bundles. As shown in the figure:

Expand Down Expand Up @@ -119,7 +118,7 @@ All the **code** and **resources** in the folder configured as the Asset Bundle

The structure of the Asset Bundle directory generated after build is shown below:

![export](bundle/exported.png)
![export](bundle/exported.png)

After building, the Asset Bundle folder will be packaged into the **assets** folder in the release package directory of the corresponding platform. However, there are two special cases.
- If the **Is Remote Bundle** option is checked when configuring the Asset Bundle, this Asset Bundle folder will be packaged into the **remote** folder in the release package directory of the corresponding platform.
Expand All @@ -135,9 +134,9 @@ Each folder contained within these three folders **assets**, **remote** and **su

The Asset Bundle supports script subpackaging. If your Asset Bundle includes the script files, then all the scripts will be merged into a single **js** file and removed from the main package. When loading the Asset Bundle, this **js** file will be attempted to be loaded.

**Note**:
1. Some platforms do not allow the loading of remote script files, such as the WeChat Mini Game, and Creator will copy the code of the Asset Bundle to the `src/bundle-scripts` directory to ensure normal loading.
2. It is recommended that scripts in the different Asset Bundles do not reference each other, otherwise you may not find the corresponding script at runtime. If you need to reference certain classes or variables, you can share them by exposing them in your own global namespace.
> **Notes**:
> 1. Some platforms do not allow the loading of remote script files, such as the WeChat Mini Game, and Creator will copy the code of the Asset Bundle to the `src/bundle-scripts` directory to ensure normal loading.
> 2. It is recommended that scripts in the different Asset Bundles do not reference each other, otherwise you may not find the corresponding script at runtime. If you need to reference certain classes or variables, you can share them by exposing them in your own global namespace.
## Load the Asset Bundle

Expand Down Expand Up @@ -279,7 +278,6 @@ After loading the resources, all the resources are temporarily cached in `assetM

2. Use `release` method provided by the Asset Bundle, then pass in the path and type to release resources, but can only release the single resource in the Asset Bundle. The arguments can be the same as those used in the `load` method of the Asset Bundle.


```typescript
bundle.load(`image`, SpriteFrame, function (err, spriteFrame) {
bundle.release(`image`, SpriteFrame);
Expand Down
6 changes: 3 additions & 3 deletions en/asset/release-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ onDestroy () {

The advantage of auto-release is that you don't have to explicitly call the release interface, you just need to maintain the reference count of the resource and Creator will release it automatically based on the reference count. This greatly reduces the possibility of releasing resources by mistake, and you don't need to understand the complex referencing relationships between resources. For projects with no special requirements, it is recommended that you use automatic release to release resources as much as possible.

#### Release Check
### Release Check

To prevent rendering or other problems caused by incorrectly releasing resources being used, Creator will perform a series of checks before auto-releasing resources:

Expand All @@ -61,7 +61,7 @@ assetManager.releaseAsset(texture);

Since the resource management module was upgraded in v2.4, the release interface differs slightly from the previous version:

1. The `assetManager.releaseAsset` interface can only release a single resource, and for the sake of uniformity, the interface can only release resources through the resource itself, not via attributes such as resource uuid, resource url, etc.
1. The `assetManager.releaseAsset` interface can only release a single resource, and for the sake of uniformity, the interface can only release resources through the resource itself, not via attributes such as resource uuid, resource url, etc.

2. When releasing a resource, you only need to focus on the resource itself and the engine will automatically release its dependent resources instead of fetching them manually via `getDependsRecursively`.

Expand Down Expand Up @@ -101,7 +101,7 @@ This is because a resource can only be auto-released if its reference count is 0
- The reference count of the Material a changes to 0 and is released; so the reference count of the Texture α minus 1 changes to 0 and is also released.
- The reference count of the Material b changes to 1 and is retained, so the reference count of the Texture β is still 1 and is also retained.
- Because the Prefab B is not released, the reference count for the Material c remains at 1 and is retained.

![](release-manager/picc.png)

### Dynamic Referencing of Resources
Expand Down
8 changes: 4 additions & 4 deletions en/asset/sprite-frame.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Image assets will use thumbnails of their own pictures as icons in the **Assets*

## Using a Sprite Frame

**1. The object contained in the container is using textures**
### The object contained in the container is using textures

In the editor, drag the __SpriteFrame__ asset to the __Sprite Frame__ property of the **Sprite** component to switch the image displayed by the __Sprite__. At runtime, taking the content picture in the above picture as an example, The entire asset is divided into image asset (`content`), its sub-asset (`spriteFrame`) and sub-asset (`texture`). The assets in the game package can be obtained by the following methods:

Expand All @@ -21,7 +21,7 @@ __Method 1__: (load __ImageAsset__):
```typescript
const self = this;
const url = 'test_assets/test_altas/content';
resources.load(url, ImageAsset,(err: any, imageAsset) => {
resources.load(url, ImageAsset, (err: any, imageAsset) => {
const sprite = this.getComponent(Sprite);
const spriteFrame = new SpriteFrame();
const tex = new Texture2D();
Expand All @@ -36,7 +36,7 @@ __Method 2__: (load SpriteFrame):
```typescript
const self = this;
const url = 'test_assets/test_altas/content/spriteFrame';
resources.load(url, SpriteFrame,(err: any, spriteFrame) => {
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
const sprite = this.getComponent(Sprite);
sprite.spriteFrame = spriteFrame;
});
Expand All @@ -46,7 +46,7 @@ __Assets__ on the server can only be loaded into __ImageAsset__. For specific me

__Cocos Creator__ will provide a way to package an __Image Asset__ as a __SpriteFrame__ in a later release to make it easier for users to use image assets.

**2. The container contains objects that are used by RenderTexture**
### The container contains objects that are used by RenderTexture

__RenderTexture__ is a rendering texture that renders content from the camera directly to a texture instead of the screen. __SpriteFrame__ can easily display 3D camera content on the UI by managing __RenderTexture__. Use is as follows:

Expand Down
8 changes: 4 additions & 4 deletions en/editor/lightmap/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ The __baking system__ is the process of finally generating light maps and applyi
The following three steps are required to turn on the baking system:

1. Click the menu button in the top menu bar `Project (Project)`, click the `Lightmap (light map)` button in the pop-up menu bar to pop up the lightmap panel.

![create lightmap](./images/bake_menu.png)

2. Before baking, you need to set `bakeable` to `true` in the static light attribute of the light source component in the editor,

> **Note**: currently only one main direction light source is supported.
![enable lightbake](./images/bakeable.png)

| Property | Description |
| :--- | :--- |
| Bakeable | When checked, enable bake lighting |
Expand All @@ -27,7 +27,7 @@ The following three steps are required to turn on the baking system:
3. In the lightmap panel that pops up, after setting the corresponding parameters, click the `Lightmap Generate` button and select the corresponding storage folder to generate the lightmap

> **Note**: the storage folder must be under Effective Assets.
![create lightmap asset](./images/lightmap_generate.png)

## Using
Expand Down
4 changes: 2 additions & 2 deletions en/material-system/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ Here are the complete list of properties and macros for it:
| alphaThreshold | test threshold for discarding pixels, any pixel with target channel value lower than this threshold will be discarded |
| normalMap | normal map texture, enhancing surface details |
| normalStrenth | strenth of the normal map, the bigger the bumpier |
| pbrMap | PBR parameter all-in-one texture: occlusion, roughness and metallic<br>sample result will be multiplied by the matching constants |
| metallicRoughnessMap | metallic and roughness texture<br>sample result will be multiplied by the matching constants |
| pbrMap<br>**R** (AO)<br>**G** (Roughness)<br>**B** (Metallic) | PBR parameter all-in-one texture: occlusion, roughness and metallic<br>sample result will be multiplied by the matching constants |
| metallicRoughnessMap<br>**G** (Roughness)<br>**B** (Metallic) | metallic and roughness texture<br>sample result will be multiplied by the matching constants |
| occlusionMap | independent occlusion texture<br>sample result will be multiplied by the matching constants |
| occlusion | occlusion constant |
| roughness | roughness constant |
Expand Down
2 changes: 1 addition & 1 deletion en/physics/physics-raycast.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The `ray` is composed of **start point** and **direction**. There are the follow
cameraCom.screenPointToRay(0, 0, outRay);
```

> **Notes**:
> **Notes**:
> 1. You need to get a reference to a camera component or camera instance.
> 2. The order of the interface parameters exposed by both the camera component and the camera instance is not the same.

Expand Down
2 changes: 1 addition & 1 deletion en/scripting/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ markAsWarning(math, 'math', [

- `replaceProperty` does not pass in `newName` or `newTarget`, which means it is consistent with `name` or `target`.

- If you want to control the number of times, it is best to call `setDefaultLogTimes` before use, because other modules may change the default times.
- If you want to control the number of times, it is best to call `setDefaultLogTimes` before use, because other modules may change the default times.
2 changes: 1 addition & 1 deletion en/scripting/scene-managing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Since the callback function can only be written in this script, the scene loadin

```ts
director.preloadScene("table", function () {
console.log("Next scene preloaded");
console.log('Next scene preloaded');
});
```

Expand Down
3 changes: 1 addition & 2 deletions en/ui-system/components/editor/slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Click the __Add Component__ button at the bottom of the __Inspector__ panel and

To use `Slider`, please refer to the [Slider API](../../../api/en/classes/ui.slider.html) documentation and the [slider](https://github.com/cocos-creator/test-cases-3d/tree/master/assets/cases/ui/10.slider) scene of the test-cases-3d project.


## Slider Properties

| Properties | Function Explanation |
Expand Down Expand Up @@ -81,7 +80,7 @@ export class example extends Component {
@property(SliderComponent)
slider: SliderComponent | null = null;
onLoad(){
this.toggle.node.on('toggle', this.callback, this);
this.slider.node.on('slider', this.callback, this);
}

callback(slider: SliderComponent){
Expand Down
11 changes: 5 additions & 6 deletions en/ui-system/components/engine/ui-material.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ Using a UI built-in material works the same as custom materials. However, there
5. To perform uniform assignment operations to custom materials, they can operate by obtaining the material on the Sprite. We provide different interfaces to deal with different operating conditions, as shown in the following code: **(Please pay attention to the difference Notes on the interface!)**
```ts
let spriteCom = this.node.getComponent(Sprite);
// What is obtained through the sharedMaterial method is a shared material resource, and operations on material will affect all rendering objects that use this material
let material = spriteCom.sharedMaterial;
// The material trial used by the current rendering component obtained through the material method, the operation for material Instance will only affect the current component
let materialInstance = spriteCom.material;
let spriteCom = this.node.getComponent(Sprite);
// What is obtained through the sharedMaterial method is a shared material resource, and operations on material will affect all rendering objects that use this material
let material = spriteCom.sharedMaterial;
// The material trial used by the current rendering component obtained through the material method, the operation for material Instance will only affect the current component
let materialInstance = spriteCom.material;
```
Loading

0 comments on commit fff3290

Please sign in to comment.