Skip to content

Commit 50890c4

Browse files
committed
Revert "fix: update sound attributes and improve scene file handling"
This reverts commit 3fe09bc.
1 parent c236926 commit 50890c4

8 files changed

Lines changed: 28 additions & 37 deletions

File tree

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"main": "src/index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"play": "rimraf dist && node ../parser/cli.js ./src/scene/ ./src/js/ && npx webpack serve --open --mode development",
9-
"dev": "rimraf dist && node ../parser/cli.js ./src/scene/ ./src/js/ && npx webpack serve --mode development",
10-
"build": "rimraf dist && node ../parser/cli.js ./src/scene/ ./src/js/ && webpack --mode production"
8+
"play": "rimraf dist && npx wtc ./src/scene/ ./src/js/ && npx webpack serve --open --mode development",
9+
"dev": "rimraf dist && npx wtc ./src/scene/ ./src/js/ && npx webpack serve --mode development",
10+
"build": "rimraf dist && npx wtc ./src/scene/ ./src/js/ && webpack --mode production"
1111
},
1212
"dependencies": {
1313
"console-browserify": "^1.2.0",

example/src/scene/dialog.scene

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
<text>同僚に連絡します。</text>
9191
</action>
9292
</actions>
93-
</dialog>
9493
</action>
9594
</actions>
9695
</dialog>

example/src/scene/en/sound.scene

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
<say name="Narrator">This scene demonstrates sound features.</say>
44
<sound src="./src/resource/bgm/calm_music.wav" />
55
<say name="Narrator">Background music is now playing. It can loop continuously.</say>
6-
<sound mode="se" src="./src/resource/se/doorbell.mp3" play="true" />
6+
<sound mode="se" src="./src/resource/se/doorbell.mp3" play />
77
<say name="Narrator">That was a sound effect. </say>
8-
<sound mode="se" src="./src/resource/se/doorbell.mp3" play="true" loop="true" />
8+
<sound mode="se" src="./src/resource/se/doorbell.mp3" play loop/>
99
<say name="Narrator">Now the sound effect is playing in a loop. It will stop when we proceed.</say>
10-
<sound name="doorbell.mp3" stop="true" />
10+
<sound name="doorbell.mp3" stop />
1111
<say name="Narrator">The sound effect has been stopped.</say>
12-
<sound src="./src/resource/bgm/nc366476_Virtual_Voyage.mp3" play="true" loop="true" />
12+
<sound src="./src/resource/bgm/nc366476_Virtual_Voyage.mp3" play loop />
1313
<say name="Narrator">We can also switch background music smoothly.</say>
1414
<choice>
1515
<item label="Return to Title" onSelect="title">
16-
<sound src="nc366476_Virtual_Voyage.mp3" stop="true" />
16+
<sound src="nc366476_Virtual_Voyage.mp3" stop />
1717
<route to="title" />
1818
</item>
1919
</choice>

example/src/scene/en/title.scene

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<scene>
22
<scenario>
3-
<sound src="./src/resource/bgm/title_theme.mp3" play="true" loop="true" />
3+
<sound src="./src/resource/bgm/title_theme.mp3" play loop />
44
<say name="Narrator">Welcome to the WebTaleKit Demo Game!</say>
55
<say name="Narrator">Please select a feature to explore:</say>
66
<choice>

example/src/scene/sound.scene

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
<say name="ナレーター">このシーンでは音声機能をデモンストレーションします。</say>
44
<sound mode="bgm" src="./src/resource/bgm/calm_music.wav"/>
55
<say name="ナレーター">今、バックグラウンドミュージックが流れ始めました。これはループ再生することができます。</say>
6-
<sound mode="se" src="./src/resource/se/doorbell.mp3" play="true" />
6+
<sound mode="se" src="./src/resource/se/doorbell.mp3" play />
77
<say name="ナレーター">今のは効果音です。</say>
8-
<sound mode="se" src="./src/resource/se/doorbell.mp3" play="true" loop="true" />
8+
<sound mode="se" src="./src/resource/se/doorbell.mp3" play loop/>
99
<say name="ナレーター">今度は効果音を繰り返し再生しています。次に進むと、止まります。</say>
10-
<sound name="doorbell.mp3" stop="true" />
10+
<sound name="doorbell.mp3" stop />
1111
<say name="ナレーター">効果音を停止しました。</say>
1212
<sound mode="bgm" src="./src/resource/bgm/nc366476_Virtual_Voyage.mp3" />
1313
<say name="ナレーター">このように、バックグラウンドミュージックをスムーズに切り替えることもできます。</say>
1414
<choice>
1515
<item label="タイトルに戻る" onSelect="title">
16-
<sound name="nc366476_Virtual_Voyage.mp3" stop="true" />
16+
<sound name="nc366476_Virtual_Voyage.mp3" stop />
1717
<route to="title" />
1818
</item>
1919
</choice>

example/src/scene/text.scene

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<text>
1111
<color value="red">文字の色を変えたり</color>、<b>太字にしたり</b>、<i>斜体にしたり</i>することもできます。
1212
</text>
13-
<text>改行も<br />簡単に<br />できます。</text>
13+
<text>改行も<br>簡単に<br>できます。</text>
1414
<text>また、テキストの表示中に
1515
<wait time="1000" />一時停止を入れることもできます。
1616
</text>

parser/cli.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const path = require('path')
66
* WebTaleScript パーサー CLI
77
*/
88

9-
const SCENE_EXTENSION = '.scene'
10-
119
const exec = (targetScript) => {
1210
// ファイル名を取得する。(拡張子を除く)
1311
const fileName = path.basename(targetScript).split('.')[0]
@@ -58,22 +56,18 @@ const exec = (targetScript) => {
5856
})
5957
}
6058

61-
const collectSceneFiles = (targetPath) => {
62-
const stat = fs.statSync(targetPath)
63-
64-
if (stat.isFile()) {
65-
return path.extname(targetPath) === SCENE_EXTENSION ? [targetPath] : []
66-
}
67-
68-
if (!stat.isDirectory()) {
69-
return []
70-
}
71-
72-
return fs.readdirSync(targetPath).flatMap((entry) => collectSceneFiles(path.join(targetPath, entry)))
73-
}
74-
7559
// コマンドライン引数から、ファイル一覧を取得する
7660
const targetScripts = process.argv.slice(2)[0]
77-
collectSceneFiles(targetScripts).forEach((file) => {
78-
exec(file)
79-
})
61+
if (fs.statSync(targetScripts).isDirectory()) {
62+
fs.readdir(targetScripts, (err, files) => {
63+
if (err) {
64+
console.error(err)
65+
return
66+
}
67+
files.forEach((file) => {
68+
exec(`${targetScripts}/${file}`)
69+
})
70+
})
71+
} else {
72+
exec(targetScripts)
73+
}

parser/parser.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ module.exports = async (data) => {
3535
*/
3636
/** HTMLを読み込む */
3737
const html = minify(data, {
38-
// Keep spaces between tag attributes; otherwise xmldom receives malformed markup.
39-
removeTagWhitespace: false,
38+
removeTagWhitespace: true,
4039
collapseWhitespace: true,
4140
removeComments: true,
4241
minifyJS: true,
4342
minifyCSS: true,
44-
keepClosingSlash: true,
4543
})
4644
// HTMLをJSONに変換
4745
const parseJson = await HTMLToJSON(html)

0 commit comments

Comments
 (0)