Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

完善部分文档 #967

Merged
merged 2 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
完善部分文档
  • Loading branch information
xunyi0 committed Jul 27, 2019
commit 33cb5a3ec657aa57108628b6089d9a58b1e5f3a1
2 changes: 1 addition & 1 deletion en/advanced-topics/oc-reflection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import <Foundation/Foundation.h>
+(NSString *)callNativeWithReturnString;
```

## Useage
## Usage

- In JS code, for invoking the native method `callNativeUIWithTitle:andContent:` of `NativeOcClass`, we can use `jsb.reflection.callStaticMethod` API like this:

Expand Down
4 changes: 2 additions & 2 deletions en/components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Click the **Add Component** button at the bottom of the **Properties** panel and
| Property | Function explanation
| -------------- | ----------- |
|Interactable| Boolean type, if set to false then the Button component enters the forbidden state.
|enableAutoGrayEffect| Boolean type, if set to true, the Button's target sprite will turn gray when interactable is false. Don't take effect when Transition type is SPRITE and the disabledSprite property is exists.
|enableAutoGrayEffect| Boolean type, if set to true, the Button's target sprite will turn gray when interactable is false.
|Transition| Enumeration type, including NONE, COLOR and SPRITE. Each type corresponds to a different Transition setting. Please see the **Button Transition** section below for details. |
|Click Event| Default list type is null. Each event added by the user is composed of the node reference, component name and a response function. Please see the **Button Event** section below for details.

Expand Down Expand Up @@ -61,7 +61,7 @@ Button Transition is used to indicate the status of the Button when clicked by t

The Button can additionally add a Click event to respond to the player's click action. There are two ways to do this.

### Add a callback throught the Properties.
### Add a callback through the Properties.

![button-event](./button/button-event.png)

Expand Down
2 changes: 1 addition & 1 deletion en/components/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ row before a new row is started. When choosing Vertical, it will fill an entire

Node:
1. Scaling and rotation of child nodes are not considered.
2. After setting the Layout, the results need to be updated until the next frame, unless you manually 'updateLayout' api.
2. After setting the Layout, the results need to be updated until the next frame, unless you manually call `updateLayout` api.

---

Expand Down
2 changes: 1 addition & 1 deletion en/components/videoplayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For more information about VideoPlayer's scripting interface, please refer to [V
| Current Time | The current time when video start to play.
| Volume | The volume of the video. (0.0 ~ 1.0) |
| Mute | Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume. |
| Keep Aspect Ratio | Whether keep the aspect ration of the original video.
| Keep Aspect Ratio | Whether keep the aspect ratio of the original video.
| Is Fullscreen| Whether play video in fullscreen mode.
| Video Player Event| the video player's callback, it will be triggered when certain event occurs. Please refer to the `VideoPlayer Event` section below or [VideoPlayerEvent API](../../../api/en/classes/VideoPlayer.html#videoplayerevent) for more details.

Expand Down
2 changes: 1 addition & 1 deletion en/content-workflow/node-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ We can add multiple components to one node so that we can extend features to the

Then set the Button component according to the following picture (the actual color attribute can be set freely according to your own taste):

![button property](node-component/button_property.jpeg)
![button property](node-component/button_property.png)

Next, click the **Preview** button on the toolbar ![preview](../getting-started/basics/toolbar/preview.png) and hover the mouse over the sprite image in the browser window. You can then see the color of the image changes which means the **Button** component on the node has taken effect!

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en/content-workflow/node-component/drag_spriteframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en/content-workflow/node-component/inspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion en/content-workflow/node-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ When creating and positioning nodes in **Scene** panel you get the convenience o

**Node tree** is a data structure that arranges the hierarchy of nodes in scene, it's also called **Scene Graph** in cocos2d-x term.

You can read the [Basic concepts chapter of the Cocos2d-x programmer guide](http:https://docs.cocos2d-x.org/cocos2d-x/en/basic_concepts/), it describes the node tree very well with some pictures below.
You can read the [Basic concepts chapter of the Cocos2d-x programmer guide](https:https://docs.cocos.com/cocos2d-x/manual/zh/basic_concepts/), it describes the node tree very well with some pictures below.

Here's a simple game scene with background image, 3 actors, some text and a start game button:

Expand Down
2 changes: 1 addition & 1 deletion en/getting-started/basics/editor-panels/node-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Node Library** is a very simple direct visual control of the warehouse, We can drag and drop the preset node to the **Scene** or **Hierarchy**, quickly complete the creation of preset node.

When wo use the default layout, the node library will be displayed in the editor. If we use the editor's layout is not included node library, We can open the node library via the main menu `Panel->Node Library`, then drag it to editor.
When we use the default layout, the node library will be displayed in the editor. If we use the editor's layout is not included node library, We can open the node library via the main menu `Panel->Node Library`, then drag it to editor.

**Node Library** includes two categories, represented by the two tabs:

Expand Down
4 changes: 2 additions & 2 deletions en/publish/publish-android-instant.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ With games developed by Cocos Creator, just choose Google Play Instant as the pu

![](publish-android-instant/studio_setting.png)

3. If you need **refactor**, you can click the **Record** button in the **build** panel, and simulator will be opened. The simulatior will automatically record the resources used. What we need to do is to play the game according to the game flow and let the simulator record resources information.
3. If you need **refactor**, you can click the **Record** button in the **build** panel, and simulator will be opened. The simulator will automatically record the resources used. What we need to do is to play the game according to the game flow and let the simulator record resources information.

![](./publish-android-instant/record.png)

Expand Down Expand Up @@ -60,7 +60,7 @@ The **Refactor** is used to edit the first package of the game and select the re

![](publish-android-instant/refactor_desc.png)

### Useage
### Usage

1. When you finish the Record, Click **Refactor** to open Refactor panel.

Expand Down
4 changes: 4 additions & 0 deletions en/publish/publish-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Android requires that all APKs be digitally signed with a certificate before the

Creator added the **App Bundle (Google Play)** option to the **v2.0.9**. If you choose Android or Android Instant platform, check this option to package the game into App Bundle format for uploading to Google Play store. Please refer to [Official Document](https://developer.android.com/guide/app-bundle/) for details.

### SDKBox

SDKBox is a free tool for mobile game developers that aids in easily integrating popular social services and other SDKs with just a few lines of code. Support for nearly 30 SDKs such as Apple and Google's IAP In-App Purchases, all SDKs are rigorously tested and officially certified. Please refer to [SDKBox](../sdk/sdkbox.md) for detail.

### Encrypt JS

Encrypt the published script. After build, the JSC file is generated in the `src` directory, which is encrypted. And JS files will be backed up in the `js backups` directory for debugging, and will not enter the APP when packaged.
Expand Down
4 changes: 2 additions & 2 deletions en/publish/publish-oppo-instant-games.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ The specific filling rules for the relevant parameter configuration are as follo

- **Game Package Name**

**Game Package Name** is required and is filled in according to the user's needs.
**Game Package Name** is filled in according to the user's needs. It's required.

- **Game Name**

**Game Name** is required. Is the name of the OPPO Mini Game. And the **Title** at the top of the **Build** panel does not participate in the OPPO mini game packaging process.
**Game Name**, the name of the OPPO Mini Game, is required. And the **Title** at the top of the **Build** panel does not participate in the OPPO mini game packaging process.

- **Desktop Icon**

Expand Down
4 changes: 2 additions & 2 deletions en/publish/publish-vivo-instant-games.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ The specific filling rules for the relevant parameter configuration are as follo

- **App Package Name**

**App Package Name** is required and is filled in according to the user's needs.
**App Package Name** is filled in according to the user's needs. It's require.

- **App Name**

**App Name** is required. Is the name of the vivo Mini Game. And the **Title** at the top of the **Build** panel does not participate in the vivo mini game packaging process.
**App Name**, the name of the vivo Mini Game, is required. And the **Title** at the top of the **Build** panel does not participate in the vivo mini game packaging process.

- **Desktop Icon**

Expand Down
3 changes: 2 additions & 1 deletion en/publish/publish-web.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ When merging assets automatically, all JSON files that the Start Scene depends o

### MD5 Cache

Compute MD5 to rename all resources, to resolve the CDN cache problem.
Append MD5 value to the exported assets for resolving CDN or browser cache issue.
Copy link
Contributor

@jareguo jareguo Jul 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MD5 hash


After being enabled, if any resource fails to load, it is because the renamed new file can not be found. It is usually because some third party resources was not loaded by `cc.loader`. If this happens, you can convert the url before loading, to fix the loading problem.

```js
Expand Down
6 changes: 3 additions & 3 deletions en/publish/publish-wechatgame-sub-domain.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Access to the Open Data Context of WeChat Mini Games

In order to protect its social relationship chain data, **WeChat Mini Games** has added the concept of **Open Data Context**, which is a separate game execution environment. The resources, engines, and programs in the open data context are completely isolated from the main game. Developers can access the `wx.getFriendCloudStorage()` and `wx.getGroupCloudStorage()`, the two APIs provided by __WeChat__, only in the open data context. These API's will help to implement some features, such as leaderboards. Since the open data context can only be rendered on the offscreen canvas, `sharedCanvas`, we need to draw the `sharedCanvas` onto the main context.
In order to protect its social relationship chain data, **WeChat Mini Games** has added the concept of **Open Data Context**, which is a separate game execution environment. The resources, engines, and programs in the open data context are completely isolated from the main game. Developers can access the `wx.getFriendCloudStorage()` and `wx.getGroupCloudStorage()`, the two APIs provided by __WeChat__, only in the open data context. These APIs will help to implement some features, such as leaderboards. Since the open data context can only be rendered on the offscreen canvas, `sharedCanvas`, we need to draw the `sharedCanvas` onto the main context.

Since the open data context is a closed, independent JavaScript scope, developers need to create two projects:

Expand All @@ -17,7 +17,7 @@ The updated version is supported in __v2.0.1__ and higher, for __v1.9.1__ to __v

### Integration method

- Create an open data context project to obtain user data through the relevant API, and create a display of ui according to your own needs. The entire open data context project should only contain its content UI. The design resolution of the Canvas component in the scene should be set to the full resolution of the UI, without the corresponding main context resolution.
- Create an open data context project to obtain user data through the relevant API, and create a display of UI according to your own needs. The entire open data context project should only contain its content UI. The design resolution of the Canvas component in the scene should be set to the full resolution of the UI, without the corresponding main context resolution.
- Create a node in the main context as an open data context container, add the `WXSubContextView` component to set the open data context view and update the open data context texture. The aspect ratio of this node should be equal to the aspect ratio of the open data context design resolution (otherwise stretching happens).

The difference from the previous version is:
Expand Down Expand Up @@ -100,7 +100,7 @@ The following method is applicable to v2.0.0. For earlier versions, please refer

### Integration method

- Create an open data context project to obtain user data through the relevant API, and create a display of ui according to your own needs. The open data context must use a full screen window, maintaining the same design resolution and adaptation mode as the main context.
- Create an open data context project to obtain user data through the relevant API, and create a display of UI according to your own needs. The open data context must use a full screen window, maintaining the same design resolution and adaptation mode as the main context.
- The main context creates the Texture2D by acquiring the global object sharedCanvas (Canvas of the open data context), and then creates the SpriteFrame through the Texture2D, thereby assigning the SpriteFrame to the Sprite to be displayed to the main context, if the open data context is operational function (for example, operations such as sliding, dragging, etc.), then the main context needs to get the sharedCanvas in real time in the update to refresh the sprite.

### Module selection
Expand Down
2 changes: 1 addition & 1 deletion en/scripting/access-node-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ If you already have the reference of a node or component in somewhere, you can a

> You should use global variable with care and understanding, we do not recommend using it, you had better keep them readonly if really need to do that.

Let's define a global object `window.Global`, it will cantain two properties, `backNode` and `backLabel`.
Let's define a global object `window.Global`, it will contain two properties, `backNode` and `backLabel`.

```js
// Globals.js, this file can have any name
Expand Down
2 changes: 1 addition & 1 deletion en/scripting/action-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The developer can get to know the basic API for every action type in these actio
| cc.flipX | X-axis flip | [API description](../../../api/en/modules/cc.html#flipX) |
| cc.flipY | Y-axis flip | [API description](../../../api/en/modules/cc.html#flipY) |
| cc.place | place at the target location | [API description](../../../api/en/modules/cc.html#place) |
| cc.callFunc | execute callback fuction | [API description](../../../api/en/modules/cc.html#callFunc) |
| cc.callFunc | execute callback function | [API description](../../../api/en/modules/cc.html#callFunc) |
| cc.targetedAction | create action with existant action and a new target node | [API description](../../../api/en/modules/cc.html#targetedAction) |

## Interval action
Expand Down
2 changes: 1 addition & 1 deletion en/scripting/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var obj = new Sprite();

## Judge class

When you need to judget the class of an object, you can use the JavaScript built-in `instanceof`:
When you need to judge the class of an object, you can use the JavaScript built-in `instanceof`:

```javascript
cc.log(obj instanceof Sprite); // true
Expand Down
2 changes: 1 addition & 1 deletion en/scripting/internal-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The Mouse event will only be triggered on desktop platforms, the event types the

The important APIs of mouse events(`cc.Event.EventMouse`)are as follows(`cc.Event` standard events API excluded):

| fuction name | returned value type | meaning |
| function name | returned value type | meaning |
| ------ |:-------:|:----:|
| `getScrollY` | `Number` | get the y axis distance wheel scrolled, effective only when scrolling |
| `getLocation` | `Object` | get mouse location object which includes x and y properties |
Expand Down
8 changes: 4 additions & 4 deletions en/scripting/javascript-primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ myProfile.name; // Jare Guo
myProfile.friends[1].name; // Nantas
```

Objects are being largely used in JavaScript, and so is it in the fuction parameter passing. For example, in Cocos Creator, we can define the FireClass object like this:
Objects are being largely used in JavaScript, and so is it in the function parameter passing. For example, in Cocos Creator, we can define the FireClass object like this:

```js
var MyComponent = cc.Class({
Expand All @@ -208,7 +208,7 @@ myFunction = function (myArgument) {
}
```

Now let's go over the method of introducing a function as a parameter into other fuctions:
Now let's go over the method of introducing a function as a parameter into other functions:

```js
square = function (a) {
Expand Down Expand Up @@ -244,10 +244,10 @@ Now, we will introduce a type of grammar often used in array and character strin
var myArray = [123, 456];
myArray.push(789) // 123, 456, 789
var myString = "abcdef";
myString.replace("a", "z"); // "zbcdef"
myString = myString.replace("a", "z"); // "zbcdef"
```

The point symbol in the code above means "call `replace` a fuction of the `myString` character string object, and pass `a` and `z` as parameters, then get the returned value".
The point symbol in the code above means "call `replace` a function of the `myString` character string object, and pass `a` and `z` as parameters, then get the returned value".

The biggest advantage of using point symbol expression is that you can link multiple tasks into one expression, which of course is on the condition of each function being called having the proper returned value. We won't spend too much time on introducing how to define a linkable function, but it's pretty simple to use them as long as you use the following pattern: `something.function1().function2().function3()`

Expand Down
2 changes: 1 addition & 1 deletion en/scripting/scheduler.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ Below are all the functions of the timer in the component:

These detailed descriptions about API can all be found in [Component API](http:https://docs.cocos2d-x.org/creator-api/en/classes/Component.html).

Besides this, if every frame needs to run a function, please add function `update` directly in to the component, so this function will be called by every frame. A detailed description can be found in [life cycle file](life-cycle-callbacks.md#update).
Besides this, if every frame needs to run a function, please add function `update` directly into the component, so this function will be called by every frame. A detailed description can be found in [life cycle file](life-cycle-callbacks.md#update).

### Caution: `cc.Node` does not contain Scheduler API
12 changes: 6 additions & 6 deletions en/scripting/tween.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,28 @@ cc.tween().to(1, { scale: 2 }, { easing: 'sineOutIn'})
cc.tween().to(1, { scale: 2 }, { easing: t => t*t; })

// Use the easing function only for a single property
// value must be used with easing or process
// value must be used with easing or progress
cc.tween().to(1, { scale: 2, position: { value: cc.v3(100, 100, 100), easing: 'sineOutIn' } })
```

## Custom process
## Custom progress

Compared to easing, custom process function has more freedom to control the easing process.
Compared to easing, custom progress function has more freedom to control the easing process.

```js
// Customize the process for all properties
// Customize the progress for all properties
cc.tween().to(1, { scale: 2, rotation: 90 }, {
progress: (start, end, current, ratio) => {
return start + (end - start) * ratio;
}
})

// Customize the process for a single property
// Customize the progress for a single property
cc.tween().to(1, {
scale: 2,
position: {
value: cc.v3(),
process: (start, end, current, t) => {
progress: (start, end, current, t) => {
// Note that the passed in property is cc.Vec3, so you need to use Vec3.lerp for interpolation calculations
return start.lerp(end, t, current);
}
Expand Down
2 changes: 1 addition & 1 deletion en/sdk/anysdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Because the AnySDK service only supports games under the company account, you ne

- **Create a game through the Cocos Account Center**

Create a company game by entering the [Cocos Account Center](https://auth.cocos.com/#/) through Creator's **Service** panel. Please refer to the [Service panel -> Useage](cocos-services.md#usage) for details.
Create a company game by entering the [Cocos Account Center](https://auth.cocos.com/#/) through Creator's **Service** panel. Please refer to the [Service panel -> Usage](cocos-services.md#usage) for details.

![](anysdk/game.png)

Expand Down
Loading