Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ node_modules/
src/.vuepress/.cache/
src/.vuepress/.temp/
src/.vuepress/dist/
pnpm-lock.yaml
package-lock.json
yarn-error.log
8,329 changes: 0 additions & 8,329 deletions pnpm-lock.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const enSidebar = sidebar({
"video",
"scenes",
"variable",
"flowchart",
"animation",
"special-effect",
]
Expand Down Expand Up @@ -54,6 +55,7 @@ export const enSidebar = sidebar({
"say",
"changeBg",
"changeFigure",
"changeFigureDiff",
"bgm",
"intro",
"changeScene",
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const jaSidebar = sidebar({
"video",
"scenes",
"variable",
"flowchart",
"animation",
"special-effect",
]
Expand Down Expand Up @@ -54,6 +55,7 @@ export const jaSidebar = sidebar({
"say",
"changeBg",
"changeFigure",
"changeFigureDiff",
"bgm",
"intro",
"changeScene",
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const zhSidebar = sidebar({
"video",
"scenes",
"variable",
"flowchart",
"animation",
"special-effect",
"custom-ui",
Expand Down Expand Up @@ -65,6 +66,7 @@ export const zhSidebar = sidebar({
"say",
"changeBg",
"changeFigure",
"changeFigureDiff",
"bgm",
"playVideo",
"pixiPerform",
Expand Down
2 changes: 2 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

- [变量](webgal-script/variable.md)

- [流程图](webgal-script/flowchart.md)

- [动画效果](webgal-script/animation.md)

- [特效](webgal-script/special-effect.md)
Expand Down
22 changes: 21 additions & 1 deletion src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
| Title_bgm | 标题背景音乐,放在 `bgm` 文件夹 |
| Game_Logo | 游戏 Logo,可以显示多个,用 \| 分割 |
| Enable_Appreciation | 是否启用鉴赏功能,包括 CG 和背景音乐鉴赏。 |
| Default_Language | 默认语言,可设置为 'zh_CN', 'zh_TW', 'en', 'ja', 'fr', 'de' |
| Enable_Continue | 是否在标题界面显示「继续游戏」按钮,设置为 true 或 false,默认为 true |
| Enable_flowchart | 是否启用[流程图](webgal-script/flowchart.md),设置为 true 或 false,默认为 false |
| Flowchart_Locked_Node_Visibility | 流程图中未解锁节点的显示方式,可设置为 node、all、none,默认为 node,详见[流程图](webgal-script/flowchart.md#未解锁节点的显示) |
| Default_Language | 默认语言,可设置为 'zh_CN', 'zh_TW', 'en', 'ja', 'fr', 'de', 'pt_BR', 'ko' |
| Show_panic | 是否启用紧急回避功能,设置为 true 或 false |
| Legacy_Expression_Blend_Mode | 是否启用 Live2D 的旧表情混合模式,设置为 true 或 false |
| Max_line | 文本框的最大显示行数 |
| Line_height | 文本框的行高(单位:em) |
| Steam_AppID | Steam 应用 ID,用于初始化 Steam 集成,仅在 Electron 构建环境下有效 |
| Cubism_Memory_Reserved_Size_MB | 为 Live2D(Cubism)预留的内存大小,单位为 MB,需填写 10 及以上的数值,默认为 32 |

以下是配置文件示例:

Expand Down Expand Up @@ -51,7 +55,23 @@ changeScene:start_ja.txt -when=lang==2;
| 3 | Français |
| 4 | Deutsch |
| 5 | 繁體中文 |
| 6 | Português do Brasil |
| 7 | 한국어 |

::: tip
菜单中的语言切换会改变引擎界面语言。如果你希望游戏正文也跟随切换,需要像上面这样在脚本里自行分流到不同语言的场景。
:::

## Live2D 内存预留

Live2D 立绘使用一块预先分配的内存。同时显示的 Live2D 立绘较多、占用超出这块内存后,已经显示的立绘可能会停止更新。

遇到这种情况时,可以用 `Cubism_Memory_Reserved_Size_MB` 调大预留的内存,例如:

``` text
Cubism_Memory_Reserved_Size_MB:64;
```

该值需填写 10 及以上,小于 10 时配置不会生效。

默认的 32 MB 一般足够正常演出使用。如果立绘出现停止更新的问题,建议依次尝试 64、128,直到问题消失。预留得越多,游戏占用的内存也越多,不建议无限调大。
2 changes: 2 additions & 0 deletions src/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

- [Variables](webgal-script/variable.md)

- [Flowchart](webgal-script/flowchart.md)

- [Animation Effects](webgal-script/animation.md)

- [Special Effects](webgal-script/special-effect.md)
Expand Down
22 changes: 21 additions & 1 deletion src/en/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ Under the `game` folder, there is a file named `config.txt`, you can fill in the
| Title_bgm | Title background music, put it in the `bgm` folder |
| Game_Logo | Game Logo, multiple can be displayed, separated by \| |
| Enable_Appreciation | Whether to enable the Appreciation feature, including CG and background music appreciation. |
| Default_Language | Default language, can be set to 'zh_CN', 'zh_TW', 'en', 'ja', 'fr', 'de' |
| Enable_Continue | Whether to show the Continue button on the title screen, set to true or false. Defaults to true |
| Enable_flowchart | Whether to enable the [flowchart](webgal-script/flowchart.md), set to true or false. Defaults to false |
| Flowchart_Locked_Node_Visibility | How locked nodes are displayed in the flowchart: node, all, or none. Defaults to node. See [Flowchart](webgal-script/flowchart.md#displaying-locked-nodes) |
| Default_Language | Default language, can be set to 'zh_CN', 'zh_TW', 'en', 'ja', 'fr', 'de', 'pt_BR', 'ko' |
| Show_panic | Whether to enable the panic button feature, set to true or false |
| Legacy_Expression_Blend_Mode | Whether to enable legacy expression blend mode for Live2D, set to true or false |
| Max_line | Maximum number of displayed lines in the text box |
| Line_height | Line height of the text box (unit: em) |
| Steam_AppID | Steam App ID, used to initialize Steam integration. Only effective in Electron builds |
| Cubism_Memory_Reserved_Size_MB | Memory reserved for Live2D (Cubism), in MB. Must be 10 or greater. Defaults to 32 |

The following is a sample configuration file:

Expand Down Expand Up @@ -51,7 +55,23 @@ The numeric values map to languages as follows:
| 3 | French |
| 4 | German |
| 5 | Traditional Chinese |
| 6 | Brazilian Portuguese |
| 7 | Korean |

::: tip
Changing the language from the menu only changes the engine UI language. If you want the game script itself to switch too, branch to different scene files in your script as shown above.
:::

## Live2D Memory Reservation

Live2D figures use a block of memory allocated in advance. When many Live2D figures are on screen and their usage exceeds this block, figures that are already displayed may stop updating.

In that case, increase the reserved memory with `Cubism_Memory_Reserved_Size_MB`, for example:

``` text
Cubism_Memory_Reserved_Size_MB:64;
```

The value must be 10 or greater. Values below 10 have no effect.

The default of 32 MB is usually enough for normal performances. If figures stop updating, try 64 and then 128 until the problem goes away. Reserving more memory also increases the game's memory usage, so do not raise it more than needed.
11 changes: 10 additions & 1 deletion src/en/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,13 @@ All your game scripts, pictures, and portraits should be placed under the `game`
| bgm | Used to store background music |
| vocal | Used to store dubbing files |
| video | Used to store videos |
| tex | Used to store special effects texture files |
| tex | Used to store special effects texture files |

The `game` folder also contains the following files:

| File / Folder | Purpose |
| :----------------- | :-- |
| config.txt | Game configuration. See [Edit Game Configuration](config.md) |
| template | UI template |
| userStyleSheet.css | Global style sheet loaded when the game starts |
| flowchart.json | Flowchart data. See [Flowchart](webgal-script/flowchart.md) |
6 changes: 6 additions & 0 deletions src/en/script-reference/arguments/ignoreDefault.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### ignoreDefault
- Boolean

Entrance and exit animations (including the entrance animation created by `-transform`) only modify the properties they write. Unwritten [transform and effect](../others/transform-reference.md) properties keep their current values instead of being reset to defaults.

This argument only applies to animations in the legacy format (an array of keyframes).
4 changes: 4 additions & 0 deletions src/en/script-reference/arguments/order-cg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Number
- Default: 0

The position of the image within its series. Smaller numbers come first. Only takes effect when the series contains more than one image.
8 changes: 8 additions & 0 deletions src/en/script-reference/arguments/parallel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### parallel
- Boolean

Plays alongside other animations already running on the same target.

By default, a new `setTransform` `setAnimation` `setTempAnimation` on the same target interrupts the animation currently playing on it. With `-parallel`, the new animation does not interrupt existing ones, and they play at the same time. A later animation without `-parallel` still interrupts all running animations on the target, including parallel ones.

Parallel animations should modify different properties. If several parallel animations modify the same property, the result is unpredictable. With `-parallel`, the animation only modifies the properties it writes.
1 change: 1 addition & 0 deletions src/en/script-reference/arguments/target.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Available targets:
- `fig-center`: center figure
- `fig-left`: left figure
- `fig-right`: right figure
- `fig-left13`, `fig-right13`, `fig-left14`, `fig-right14`: the figure at the corresponding position
- The id of a free figure
- `bg-main`: background
- `stage-main`: stage
10 changes: 10 additions & 0 deletions src/en/script-reference/arguments/transformFrom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### transformFrom
- String
- Available values: `current`, `default`
- Default value: `current`

Specifies where the animation's transform starts from, i.e. how [transform and effect](../others/transform-reference.md) properties not written in the animation are handled.
- `current`: Starts from the object's current transform. The animation only modifies the properties it writes. Other properties keep their current values, and properties being modified by other parallel animations on the same object are not overwritten.
- `default`: Starts from the default transform. Properties not written in the animation are reset to their default values.

When this argument is set, the legacy `writeDefault` argument is ignored.
4 changes: 4 additions & 0 deletions src/en/script-reference/arguments/writeDefault.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### writeDefault
- Boolean

:::warning
This argument is deprecated. Use `transformFrom` instead: `-writeDefault` is equivalent to `-transformFrom=default`. When `transformFrom` is set, this argument is ignored.
:::

When the value is `true`, all unassigned [transform and effect](../others/transform-reference.md) properties are written with their default values.
When the value is `false`, unassigned properties inherit the existing values.
13 changes: 13 additions & 0 deletions src/en/script-reference/commands/changeBg.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ changeBg:bg.png -enter=enter-from-left;
changeBg:bg.png -exit=exit-to-right;
```

<!-- @include: ../arguments/ignoreDefault.md -->
``` webgal
changeBg:bg.png -enter=my-enter -ignoreDefault;
```

<!-- @include: ../arguments/duration.md -->
Applied to the default entrance animation. Default value: 1500.
``` webgal
Expand Down Expand Up @@ -62,6 +67,14 @@ Writing only `series` will not collect the image. Make sure `unlockname` is also
changeBg:bg.png -unlockname=MyCg01 -series=MySeries01;
```

### order
<!-- @include: ../arguments/order-cg.md -->

``` webgal
changeBg:bg.png -unlockname=MyCg01 -series=MySeries01 -order=1;
changeBg:bg2.png -unlockname=MyCg02 -series=MySeries01 -order=2;
```

### enterDuration
- Number
- Unit: milliseconds
Expand Down
21 changes: 21 additions & 0 deletions src/en/script-reference/commands/changeFigure.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ changeFigure:1/open_eyes.png -enter=enter-from-left;
changeFigure:1/open_eyes.png -exit=exit-to-right;
```

<!-- @include: ../arguments/ignoreDefault.md -->
``` webgal
changeFigure:1/open_eyes.png -enter=my-enter -ignoreDefault;
```

<!-- @include: ../arguments/duration.md -->
Applied to the default entrance animation. Default value: 300.
``` webgal
Expand Down Expand Up @@ -138,6 +143,22 @@ changeFigure:1/open_eyes.png -left;
changeFigure:1/open_eyes.png -right;
```

### left13 / right13 / left14 / right14
- Boolean

Places the new figure at another preset position. Unlike `left` and `right`, which align to the stage edges, these four positions align the figure by its center:
- `left13`: the figure's center is at 1/3 of the stage width from the left
- `right13`: the figure's center is at 1/3 of the stage width from the right (2/3 from the left)
- `left14`: the figure's center is at 1/4 of the stage width from the left
- `right14`: the figure's center is at 1/4 of the stage width from the right (3/4 from the left)

If `id` is omitted or an empty string, the figure gets the default id `fig-left13`, `fig-right13`, `fig-left14`, or `fig-right14`.

``` webgal
changeFigure:1/open_eyes.png -left13;
changeFigure:2/open_eyes.png -right13;
```

### id
- String

Expand Down
87 changes: 87 additions & 0 deletions src/en/script-reference/commands/changeFigureDiff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# changeFigureDiff

Switches the variant (diff) of an image figure, such as changing its expression.

## Statement Content

The path of the variant image.

``` webgal
changeFigure:hero/normal.png -id=hero;
; Switch figure hero to the smiling variant
changeFigureDiff:hero/smile.png -id=hero;
```

Unlike [changeFigure](changeFigure.md), which replaces the figure, `changeFigureDiff` only replaces the image. All other state of the figure is kept, including its transform, layer (`zIndex`), blend mode, and enter/exit settings.
Switching a variant is not an exit, so no exit animation is played. These settings take effect later, when `changeFigure` actually replaces the figure.

``` webgal
changeFigure:hero/normal.png -id=hero -exit=exit-to-right;
; Switch the variant; no exit animation is played
changeFigureDiff:hero/smile.png -id=hero;
; Replace the figure; smile.png exits with exit-to-right
changeFigure:other/normal.png -id=hero;
```

When both images have exactly the same size and are fully loaded, the variant switches with a cross-blend of about 200 ms. Otherwise, the old image fades out and the new one fades in, and the figure's transform is kept.

:::info
- Live2D and Spine figures have their own expression and motion systems. Use arguments such as `motion` and `expression` of `changeFigure` instead. If the current figure or the target is a model, this statement is not executed.
- If there is no figure to replace, or the content is `none`, this statement behaves like `changeFigure`.
- To change the transform, animation, or other arguments at the same time, use `changeFigure`.
:::

## Parameters

Apart from the arguments below and general arguments such as `next`, `continue`, and `when`, all other arguments are ignored with a warning in the console.

### id
- String

The id of the figure whose variant is switched. If omitted, the target figure is determined by position arguments such as `left` and `right`, defaulting to the center figure.

``` webgal
changeFigureDiff:hero/smile.png -id=hero;
```

### left
- Boolean

If `id` is omitted, switches the variant of the left figure.

``` webgal
changeFigure:hero/normal.png -left;
changeFigureDiff:hero/smile.png -left;
```

### right
- Boolean

If `id` is omitted, switches the variant of the right figure.

``` webgal
changeFigure:hero/normal.png -right;
changeFigureDiff:hero/smile.png -right;
```

### left13 / right13 / left14 / right14
- Boolean

If `id` is omitted, switches the variant of the figure at the corresponding position.

``` webgal
changeFigure:hero/normal.png -left13;
changeFigureDiff:hero/smile.png -left13;
```

### mouthOpen, mouthHalfOpen, mouthClose, eyesOpen, eyesClose, animationFlag
- String

Mouth and blink variants, used the same way as in [changeFigure](changeFigure.md#mouthopen-mouthhalfopen-mouthclose).
Mouth and blink images usually match a specific expression, so switching a variant replaces them entirely with the arguments of this statement. Any omitted item is disabled.

``` webgal
changeFigure:hero/normal.png -id=hero -mouthOpen=hero/normal_open.png -mouthClose=hero/normal.png;
; The smiling variant uses its own mouth images
changeFigureDiff:hero/smile.png -id=hero -mouthOpen=hero/smile_open.png -mouthClose=hero/smile.png;
```
13 changes: 13 additions & 0 deletions src/en/script-reference/commands/choose.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,16 @@ Condition expressions are written the same way as the common `-when` parameter.
::: warning
`() ` and `[]` must be written to the left of `->`. If the option text needs to display special symbols such as colons, semicolons, or vertical bars, use escaping. See [Escaping Special Characters](../../webgal-script/base.md#escaping-special-characters).
:::

## Parameters

### defaultChoose
- Number

When the editor's live preview fast-forwards past this choice, automatically picks the option at this position (starting from 1), so the preview can continue to later statements. This parameter has no effect during normal play.

If the specified option does not exist, or cannot be chosen because of conditional display or conditional enablement, nothing is picked automatically.

``` webgal
choose:Call her:Chapter-2.txt|Go home:Chapter-3.txt -defaultChoose=2;
```
Loading
Loading