Skip to content

Commit

Permalink
Merge pull request #381 from MakinoharaShoko/dev
Browse files Browse the repository at this point in the history
4.4.5
  • Loading branch information
MakinoharaShoko committed Sep 23, 2023
2 parents 7ef7919 + 43e1cea commit 875378c
Show file tree
Hide file tree
Showing 114 changed files with 1,659 additions and 1,021 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,6 @@ https://demo.openwebgal.com

**想要参与引擎开发的开发者请阅读 [此项目的参与指南](https://docs.openwebgal.com/developers/)**

### 关于Live2D
本引擎现已支持使用 live2D 立绘。如果你要使用 live2D 立绘,请:

1、自行取得 live2D 的授权

2、到 https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.jshttps://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js 分别下载 live2D 和 cubismcore

3、分别重命名为 `l2d.js``live2dcubismcore.min.js` ,然后将文件放到`packages/webgal/src/assets/lib`,然后到 `packages/webgal/index.html`,取消注释以下两行,使其变为:
```html
<script src="/src/assets/lib/l2d.js"></script>
<script src="/src/assets/lib/live2dcubismcore.min.js"></script>
```
4、到 `packages/webgal/src/Core/controller/stage/pixi/PixiController.ts` ,取消注释
`import { Live2DModel, SoundManager } from 'pixi-live2d-display';``public addLive2dFigure(key: string, jsonPath: string, pos: string, motion: string) {...... 取消注释这一整个函数}`

5、到 `packages/webgal/src/Components/Stage/MainStage/useSetFigure.ts` 取消注释 `return WebGAL.gameplay.pixiStage?.addLive2dFigure(...args);`

6、现在开始你可以使用 live2D 作为立绘了。你需要将整个模型的目录放入 `game/figure` 目录中,调用立绘的方法是调用立绘的 json 文件。

**注意:本项目的作者没有使用任何 live2D SDK 的源码和模型,由于使用 live2D 造成的任何版权纠纷,皆由二次开发者或制作者自行承担!**

### 赞助

WebGAL 是一款开源软件,因此你可以免费在 MPL-2.0 开源协议的范畴下使用本软件,并可用于商业使用。
Expand Down
36 changes: 0 additions & 36 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,6 @@ Whether using WebGAL scripts or the visual editor for development, everything is

**Developers who want to participate in engine development, please read [the participation guide for this project](https://docs.openwebgal.com/developers/)**

### About Live2D
The engine now supports the use of Live2D character models. If you want to use Live2D models, please follow these steps:

1. Obtain the necessary authorization for using Live2D.

2. Download Live2D and CubismCore from the following links:

- Live2D: https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js
- CubismCore: https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js

3. Rename `l2d.js` and `live2dcubismcore.min.js` respectively, then put the files in `packages/webgal/src/assets/lib`, and then go to `packages/webgal/index.html`, and uncomment the following two lines so that they become:
```
htmlCopy code<script src="/src/assets/lib/l2d.js"></script>
<script src="/src/assets/lib/live2dcubismcore.min.js"></script>
```

4. In the `packages/webgal/src/Core/controller/stage/pixi/PixiController.ts` file, uncomment the following lines:

```
javascriptCopy codeimport { Live2DModel, SoundManager } from 'pixi-live2d-display';
public addLive2dFigure(key: string, jsonPath: string, pos: string, motion: string) {
// ...
}
```

5. In the `packages/webgal/src/Components/Stage/MainStage/useSetFigure.ts` file, uncomment the following line:

```
javascriptCopy code
return WebGAL.gameplay.pixiStage?.addLive2dFigure(...args);
```

6. You can now use Live2D character models as part of your illustrations. Place the entire model directory inside the `game/figure` directory. To display a character model, call the corresponding JSON file.

**Note: The author of this project has not used any Live2D SDK source code or models. Any copyright disputes arising from the use of Live2D are the sole responsibility of the developers or creators of the modified project!**

### Sponsorship

WebGAL is an open-source software, so you can use this software for free under the scope of the MPL-2.0 open-source license, and it is available for commercial use.
Expand Down
38 changes: 1 addition & 37 deletions README_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,42 +51,6 @@ Que vous utilisiez les scripts WebGAL ou l'éditeur visuel pour le développemen

**Les développeurs souhaitant participer au développement du moteur, veuillez lire [le guide de participation pour ce projet](https://docs.openwebgal.com/developers/)**

### À propos de Live2D
Le moteur prend désormais en charge l'utilisation de modèles de personnages Live2D. Si vous souhaitez utiliser des modèles Live2D, suivez ces étapes :

1. Obtenir l'autorisation nécessaire pour utiliser Live2D.

2. Téléchargez Live2D et CubismCore aux liens suivants :

- Live2D : https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js
- CubismCore : https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js

3. Renommez `l2d.js` et `live2dcubismcore.min.js` respectivement, puis placez les fichiers dans `packages/webgal/src/assets/lib`, et décommentez ensuite les deux lignes suivantes dans `packages/webgal/index.html` pour qu'elles deviennent :
```
htmlCopy code<script src="/src/assets/lib/l2d.js"></script>
<script src="/src/assets/lib/live2dcubismcore.min.js"></script>
```

4. Dans le fichier `packages/webgal/src/Core/controller/stage/pixi/PixiController.ts`, décommentez les lignes suivantes :

```
javascriptCopy codeimport { Live2DModel, SoundManager } from 'pixi-live2d-display';
public addLive2dFigure(key: string, jsonPath: string, pos: string, motion: string) {
// ...
}
```

5. Dans le fichier `packages/webgal/src/Components/Stage/MainStage/useSetFigure.ts`, décommentez la ligne suivante :

```
javascriptCopy code
return WebGAL.gameplay.pixiStage?.addLive2dFigure(...args);
```

6. Vous pouvez désormais utiliser des modèles de personnages Live2D dans vos illustrations. Placez le répertoire complet du modèle dans le répertoire `game/figure`. Pour afficher un modèle de personnage, appelez le fichier JSON correspondant.

**Note : L'auteur de ce projet n'a utilisé aucun code source ou modèle du SDK Live2D. Toute demande de droits d'auteur découlant de l'utilisation de Live2D relève de la responsabilité exclusive des développeurs ou créateurs du projet modifié !**

### Soutenir

WebGAL est un logiciel open-source, vous pouvez donc utiliser ce logiciel gratuitement dans le cadre de la licence open-source MPL-2.0, et il est disponible pour une utilisation commerciale.
Expand Down Expand Up @@ -115,4 +79,4 @@ Cependant, votre soutien peut motiver les développeurs à avancer et à rendre

## Pour les amateurs de Stargazers (Historique GitHub stars)

[![Stargazers au fil du temps](https://starchart.cc/MakinoharaShoko/WebGAL.svg)](https://starchart.cc/MakinoharaShoko/WebGAL)
[![Stargazers au fil du temps](https://starchart.cc/MakinoharaShoko/WebGAL.svg)](https://starchart.cc/MakinoharaShoko/WebGAL)
37 changes: 0 additions & 37 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,6 @@ WebGALは、プログラミング知識が不要で、簡単にビジュアル
**エンジン開発に参加したい開発者は、[このプロジェクトの参加ガイド](https://docs.openwebgal.com/developers/)をお読みください**
<br>上記のDiscordに参加すると多くの情報を得ることができます。

### About Live2D
本エンジンでは、Live2Dのキャラクターモデルの使用がサポートされています。Live2Dモデルを使用する場合は、以下の手順に従ってください:

1. Live2Dの使用に必要な許可を取得します。

2. 以下のリンクからLive2DとCubismCoreをダウンロードします:

- Live2D: https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js
- CubismCore: https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js

3. l2d.js``live2dcubismcore.min.js`の名前をそれぞれ変更し、そのファイルを`packages/webgal/src/assets/lib`に置いてから、`packages/webgal/index.html`に移動し、以下の2行をアンコメントする:

```
htmlCopy code<script src="/src/assets/lib/l2d.js"></script>
<script src="/src/assets/lib/live2dcubismcore.min.js"></script>
```

4. `packages/webgal/src/Core/controller/stage/pixi/PixiController.ts`ファイルで、以下の行のコメントを解除します:

```
javascriptCopy codeimport { Live2DModel, SoundManager } from 'pixi-live2d-display';
public addLive2dFigure(key: string, jsonPath: string, pos: string, motion: string) {
// ...
}
```

5. `packages/webgal/src/Components/Stage/MainStage/useSetFigure.ts`ファイルで、以下の行のコメントを解除します:

```
javascriptCopy code
return WebGAL.gameplay.pixiStage?.addLive2dFigure(...args);
```

6. これでLive2Dキャラクターモデルを立ち絵として使用することができます。キャラクターモデルのディレクトリ全体を`game/figure`ディレクトリに配置します。キャラクターモデルを表示するには、対応するJSONファイルを呼び出します。

**注意:このプロジェクトの作者は、Live2D SDKのソースコードやモデルを使用していません。Live2Dの使用によって引き起こされる著作権の問題については、二次開発者または制作者が全ての責任を負います!**

### スポンサーシップ

WebGAL はオープンソース ソフトウェアであるため、MPL-2.0 オープンソース ライセンスの範囲内で無料で使用でき、商用利用も可能です。
Expand Down
36 changes: 0 additions & 36 deletions README_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,6 @@ WebGAL 스크립트를 사용하든 비주얼 에디터를 사용하든 개발

**엔진 개발에 참여하고 싶은 개발자는 [이 프로젝트에 참여하기 위한 안내서](https://docs.openwebgal.com/developers/)를 읽어주세요.**

### Live2D에 대하여
엔진은 이제 Live2D 캐릭터 모델의 사용을 지원합니다. Live2D 모델을 사용하려면 다음 단계를 따르세요:

1. Live2D 사용에 필요한 권한을 얻습니다.

2. 다음 링크에서 Live2D와 CubismCore를 다운로드합니다:

- Live2D: https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js
- CubismCore: https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js

3. `l2d.js``live2dcubismcore.min.js`를 각각 이름 변경하고, 파일을 `packages/webgal/src/assets/lib`에 넣은 다음 `packages/webgal/index.html`로 이동하여 다음 두 줄의 주석을 해제합니다:
```
htmlCopy code<script src="/src/assets/lib/l2d.js"></script>
<script src="/src/assets/lib/live2dcubismcore.min.js"></script>
```

4. `packages/webgal/src/Core/controller/stage/pixi/PixiController.ts` 파일에서 다음 줄의 주석을 해제합니다:

```
javascriptCopy codeimport { Live2DModel, SoundManager } from 'pixi-live2d-display';
public addLive2dFigure(key: string, jsonPath: string, pos: string, motion: string) {
// ...
}
```

5. `packages/webgal/src/Components/Stage/MainStage/useSetFigure.ts` 파일에서 다음 줄의 주석을 해제합니다:

```
javascriptCopy code
return WebGAL.gameplay.pixiStage?.addLive2dFigure(...args);
```

6. 이제 Live2D 캐릭터 모델을 삽화의 일부로 사용할 수 있습니다. 전체 모델 디렉토리를 `game/figure` 디렉토리 안에 넣습니다. 캐릭터 모델을 표시하려면 해당 JSON 파일을 호출합니다.

**주의: 이 프로젝트의 작성자는 Live2D SDK 소스 코드나 모델을 사용하지 않았습니다. Live2D 사용으로 인해 발생하는 저작권 분쟁은 수정된 프로젝트의 개발자나 창작자의 단독 책임입니다!**

### 후원

WebGAL은 오픈소스 소프트웨어이므로 MPL-2.0 오픈소스 라이센스의 범위 내에서 이 소프트웨어를 무료로 사용할 수 있으며, 상업적으로 사용할 수 있습니다.
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-parser",
"version": "4.4.3",
"version": "4.4.5-fix2",
"description": "WebGAL script parser",
"scripts": {
"test": "vitest",
Expand Down
62 changes: 59 additions & 3 deletions packages/parser/src/configParser/configParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
export function configParser(configText:string){
// TODO
return configText
import {argsParser} from "../scriptParser/argsParser";

interface IOptionItem{
key:string;
value:string | number | boolean;
}
interface IConfigItem{
command:string;
args:string[]
options:IOptionItem[];
}

export type WebgalConfig = IConfigItem[]


function configLineParser(inputLine:string):IConfigItem{
const options:Array<IOptionItem> = [];
let command: string;

let newSentenceRaw = inputLine.split(";")[0];
if (newSentenceRaw === "") {
// 注释提前返回
return {
command:'',
args:[],
options:[]
};
}
// 截取命令
const getCommandResult = /:/.exec(newSentenceRaw);

// 没有command
if (getCommandResult === null) {
command = '';
} else {
command = newSentenceRaw.substring(0, getCommandResult.index);
// 划分命令区域和content区域
newSentenceRaw = newSentenceRaw.substring(getCommandResult.index + 1, newSentenceRaw.length);
}
// 截取 Options 区域
const getOptionsResult = / -/.exec(newSentenceRaw);
// 获取到参数
if (getOptionsResult) {
const optionsRaw = newSentenceRaw.substring(getOptionsResult.index, newSentenceRaw.length);
newSentenceRaw = newSentenceRaw.substring(0, getOptionsResult.index);
for (const e of argsParser(optionsRaw, (name,_)=>{return name})) {
options.push(e);
}
}
return {
command,
args:newSentenceRaw.split('|').map(e=>e.trim()).filter(e=>e!==''),
options
};
}

export function configParser(configText:string):WebgalConfig{
const configLines = configText.replaceAll(`\r`,'').split('\n');
return configLines.map(e=>configLineParser(e)).filter(e=>e.command!=='');
}
11 changes: 10 additions & 1 deletion packages/parser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {commandType, IAsset} from "./interface/sceneInterface";
import {fileType} from "./interface/assets";
import {sceneParser} from "./sceneParser";
import {ADD_NEXT_ARG_LIST, SCRIPT_CONFIG} from "./config/scriptConfig";
import {configParser} from "@/configParser/configParser";
import {configParser, WebgalConfig} from "./configParser/configParser";

export default class SceneParser {

Expand All @@ -28,6 +28,15 @@ export default class SceneParser {
parseConfig(configText: string) {
return configParser(configText)
}

stringifyConfig(config: WebgalConfig) {
return config
.reduce(
(previousValue, curr) =>
(previousValue + `${curr.command}:${curr.args.join('|')}${curr.options.length <= 0 ? '' : curr.options.reduce((p, c) => (p + ' -' + c.key + '=' + c.value), '')};\n`),
''
)
}
}

export {ADD_NEXT_ARG_LIST, SCRIPT_CONFIG};
2 changes: 1 addition & 1 deletion packages/parser/src/scriptParser/argsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function argsParser(argsRaw: string, assetSetter: (fileName: string, asse
argValue = undefined;
}
// 判断是不是语音参数
if (e.match(/.ogg|.mp3|.wav/)) {
if (argName.match(/.ogg|.mp3|.wav/)) {
returnArrayList.push({
key: "vocal",
value: assetSetter(e, fileType.vocal)
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/src/scriptParser/commandParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const commandParser = (commandRaw: string, ADD_NEXT_ARG_LIST:any, SCRIPT_
const type: commandType = getCommandType(commandRaw, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);
returnCommand.type = type;
// 如果是对话,加上额外的参数
if (type === commandType.say) {
if (type === commandType.say && commandRaw!== 'say') {
returnCommand.additionalArgs.push({
key: "speaker",
value: commandRaw
Expand Down
9 changes: 9 additions & 0 deletions packages/parser/test/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ async function debug() {

const result = parser.parse(sceneText, "var", "/var.txt");
console.log(result)
const configFesult = parser.parseConfig(`
Game_name:欢迎使用WebGAL!;
Game_key:0f86dstRf;
Title_img:WebGAL_New_Enter_Image.png;
Title_bgm:s_Title.mp3;
Title_logos: 1.png | 2.png | Image Logo.png| -show -active=false -add=op! -count=3;This is a fake config, do not reference anything.
`)
console.log(configFesult)
console.log(parser.stringifyConfig(configFesult))
}

debug();
Loading

0 comments on commit 875378c

Please sign in to comment.