webtalekit-alpha 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/README.md +145 -70
  2. package/package.json +10 -2
  3. package/parser/checker.js +184 -0
  4. package/parser/checker.test.ts +491 -0
  5. package/parser/cli.js +34 -2
  6. package/parser/parser.js +25 -18
  7. package/src/core/defaultUIHandler.js +309 -0
  8. package/src/core/defaultUIHandler.js.map +1 -0
  9. package/{dist/src → src}/core/drawer.js +65 -40
  10. package/src/core/drawer.js.map +1 -0
  11. package/{dist/src → src}/core/index.js +188 -257
  12. package/{dist/src → src}/core/scenarioManager.js +29 -7
  13. package/src/core/scenarioManager.js.map +1 -0
  14. package/src/utils/eventBus.js +88 -0
  15. package/src/utils/eventBus.js.map +1 -0
  16. package/{dist/src → src}/utils/logger.js +45 -1
  17. package/src/utils/logger.js.map +1 -0
  18. package/{dist/src → src}/utils/store.js +5 -0
  19. package/src/utils/store.js.map +1 -0
  20. package/.claude/settings.local.json +0 -12
  21. package/.clinerules +0 -65
  22. package/.history/README_20240812174230.md +0 -193
  23. package/.history/README_20240812175424.md +0 -185
  24. package/.history/README_20240812191012.md +0 -185
  25. package/.history/README_20240812191155.md +0 -185
  26. package/.history/README_20240812191211.md +0 -185
  27. package/.history/README_20240812192035.md +0 -185
  28. package/.history/dist/src/core/index_20240815021552.js +0 -474
  29. package/.history/dist/src/core/index_20240815022042.js +0 -476
  30. package/.history/dist/src/core/index_20240815022206.js +0 -476
  31. package/.history/dist/src/core/index_20240815023104.js +0 -478
  32. package/.history/dist/src/core/index_20240817022019.js +0 -494
  33. package/.history/dist/src/core/index_20240818013827.js +0 -493
  34. package/.history/dist/src/core/index_20240820001418.js +0 -502
  35. package/.history/package_20240812174230.json +0 -45
  36. package/.history/package_20240825011731.json +0 -45
  37. package/.history/package_20240825011739.json +0 -44
  38. package/.history/parser/parser_20240812174230.js +0 -50
  39. package/.history/parser/parser_20240825012739.js +0 -47
  40. package/.history/parser/parser_20240825012835.js +0 -52
  41. package/.history/src/core/drawer_20240813091343.ts +0 -262
  42. package/.history/src/core/drawer_20240815232345.ts +0 -262
  43. package/.history/src/core/drawer_20240815232350.ts +0 -262
  44. package/.history/src/core/drawer_20240816025257.ts +0 -357
  45. package/.history/src/core/drawer_20240816025358.ts +0 -357
  46. package/.history/src/core/drawer_20240816030148.ts +0 -365
  47. package/.history/src/core/drawer_20240816231033.ts +0 -294
  48. package/.history/src/core/drawer_20240816231107.ts +0 -262
  49. package/.history/src/core/drawer_20240816231234.ts +0 -268
  50. package/.history/src/core/drawer_20240817013836.ts +0 -290
  51. package/.history/src/core/drawer_20240817015150.ts +0 -289
  52. package/.history/src/core/drawer_20240817015353.ts +0 -290
  53. package/.history/src/core/drawer_20240817021254.ts +0 -291
  54. package/.history/src/core/drawer_20240817023440.ts +0 -295
  55. package/.history/src/core/drawer_20240817023445.ts +0 -295
  56. package/.history/src/core/drawer_20240818015327.ts +0 -295
  57. package/.history/src/core/drawer_20240819231006.ts +0 -318
  58. package/.history/src/core/drawer_20240820002829.ts +0 -317
  59. package/.history/src/core/drawer_20240820003141.ts +0 -295
  60. package/.history/src/core/drawer_20240824010043.ts +0 -295
  61. package/.history/src/core/drawer_20240825013311.ts +0 -293
  62. package/.history/src/core/drawer_20240902235257.ts +0 -295
  63. package/.history/src/core/drawer_20240904002038.ts +0 -262
  64. package/.history/src/core/drawer_20240904004020.ts +0 -262
  65. package/.history/src/core/drawer_20240904004238.ts +0 -262
  66. package/.history/src/core/drawer_20240904005648.ts +0 -262
  67. package/.history/src/core/drawer_20240904005808.ts +0 -262
  68. package/.history/src/core/drawer_20240904010523.ts +0 -262
  69. package/.history/src/core/drawer_20240904011611.ts +0 -262
  70. package/.history/src/core/drawer_20240904011740.ts +0 -262
  71. package/.history/src/core/index_20240812190102.js +0 -443
  72. package/.history/src/core/index_20240812190105.js +0 -443
  73. package/.history/src/core/index_20240812205421.js +0 -452
  74. package/.history/src/core/index_20240812213441.js +0 -452
  75. package/.history/src/core/index_20240812214203.js +0 -453
  76. package/.history/src/core/index_20240813090823.js +0 -453
  77. package/.history/src/core/index_20240813230449.js +0 -452
  78. package/.history/src/core/index_20240813230539.js +0 -452
  79. package/.history/src/core/index_20240813231447.js +0 -453
  80. package/.history/src/core/index_20240813231449.js +0 -453
  81. package/.history/src/core/index_20240813231511.js +0 -453
  82. package/.history/src/core/index_20240813231531.js +0 -453
  83. package/.history/src/core/index_20240813231913.js +0 -453
  84. package/.history/src/core/index_20240813232356.js +0 -453
  85. package/.history/src/core/index_20240813232640.js +0 -453
  86. package/.history/src/core/index_20240813232900.js +0 -453
  87. package/.history/src/core/index_20240814221127.js +0 -454
  88. package/.history/src/core/index_20240814221322.js +0 -454
  89. package/.history/src/core/index_20240814221526.js +0 -454
  90. package/.history/src/core/index_20240814222048.js +0 -454
  91. package/.history/src/core/index_20240814222918.js +0 -459
  92. package/.history/src/core/index_20240814223136.js +0 -459
  93. package/.history/src/core/index_20240814223501.js +0 -464
  94. package/.history/src/core/index_20240814224347.js +0 -468
  95. package/.history/src/core/index_20240815013712.js +0 -474
  96. package/.history/src/core/index_20240815021534.js +0 -474
  97. package/.history/src/core/index_20240815023143.js +0 -477
  98. package/.history/src/core/index_20240815023207.js +0 -479
  99. package/.history/src/core/index_20240815023344.js +0 -481
  100. package/.history/src/core/index_20240815035600.js +0 -479
  101. package/.history/src/core/index_20240815041549.js +0 -480
  102. package/.history/src/core/index_20240815185515.js +0 -481
  103. package/.history/src/core/index_20240815192158.js +0 -481
  104. package/.history/src/core/index_20240815222912.js +0 -482
  105. package/.history/src/core/index_20240815224052.js +0 -483
  106. package/.history/src/core/index_20240815224843.js +0 -484
  107. package/.history/src/core/index_20240815224850.js +0 -483
  108. package/.history/src/core/index_20240815231706.js +0 -479
  109. package/.history/src/core/index_20240816025748.js +0 -483
  110. package/.history/src/core/index_20240816030102.js +0 -484
  111. package/.history/src/core/index_20240817013329.js +0 -485
  112. package/.history/src/core/index_20240817013526.js +0 -485
  113. package/.history/src/core/index_20240817013819.js +0 -488
  114. package/.history/src/core/index_20240817013829.js +0 -488
  115. package/.history/src/core/index_20240817014921.js +0 -494
  116. package/.history/src/core/index_20240817022057.js +0 -494
  117. package/.history/src/core/index_20240817023316.js +0 -493
  118. package/.history/src/core/index_20240818005637.js +0 -493
  119. package/.history/src/core/index_20240818005721.js +0 -493
  120. package/.history/src/core/index_20240818011804.js +0 -493
  121. package/.history/src/core/index_20240818013835.js +0 -493
  122. package/.history/src/core/index_20240818014310.js +0 -493
  123. package/.history/src/core/index_20240818014323.js +0 -493
  124. package/.history/src/core/index_20240818014333.js +0 -493
  125. package/.history/src/core/index_20240818020725.js +0 -496
  126. package/.history/src/core/index_20240819195504.js +0 -497
  127. package/.history/src/core/index_20240819202012.js +0 -495
  128. package/.history/src/core/index_20240819231228.js +0 -501
  129. package/.history/src/core/index_20240819232555.js +0 -502
  130. package/.history/src/core/index_20240819233404.js +0 -502
  131. package/.history/src/core/index_20240820003114.js +0 -495
  132. package/.history/src/core/index_20240820003120.js +0 -495
  133. package/.history/src/core/index_20240820003331.js +0 -495
  134. package/.history/src/core/index_20240820004126.js +0 -498
  135. package/.history/src/core/index_20240820004357.js +0 -497
  136. package/.history/src/core/index_20240820005103.js +0 -498
  137. package/.history/src/core/index_20240820005110.js +0 -499
  138. package/.history/src/core/index_20240820005206.js +0 -497
  139. package/.history/src/core/index_20240820005352.js +0 -497
  140. package/.history/src/core/index_20240823224904.ts +0 -505
  141. package/.history/src/core/index_20240823224905.js +0 -505
  142. package/.history/src/core/index_20240823231631.ts +0 -530
  143. package/.history/src/core/index_20240823231735.ts +0 -530
  144. package/.history/src/core/index_20240823232123.ts +0 -539
  145. package/.history/src/core/index_20240823232329.ts +0 -539
  146. package/.history/src/core/index_20240823233058.ts +0 -539
  147. package/.history/src/core/index_20240823234946.ts +0 -539
  148. package/.history/src/core/index_20240824005956.ts +0 -534
  149. package/.history/src/core/index_20240824010113.ts +0 -534
  150. package/.history/src/core/index_20240824010124.ts +0 -534
  151. package/.history/src/core/index_20240824010212.ts +0 -534
  152. package/.history/src/core/index_20240824010218.ts +0 -534
  153. package/.history/src/core/index_20240824010407.ts +0 -534
  154. package/.history/src/core/index_20240824010611.ts +0 -534
  155. package/.history/src/core/index_20240824010623.ts +0 -534
  156. package/.history/src/core/index_20240824010652.ts +0 -534
  157. package/.history/src/core/index_20240824011007.ts +0 -534
  158. package/.history/src/core/index_20240824210450.ts +0 -534
  159. package/.history/src/core/index_20240824210703.ts +0 -534
  160. package/.history/src/core/index_20240824210708.ts +0 -534
  161. package/.history/src/core/index_20240824211001.ts +0 -537
  162. package/.history/src/core/index_20240824211258.ts +0 -537
  163. package/.history/src/core/index_20240824211654.ts +0 -537
  164. package/.history/src/core/index_20240824211723.ts +0 -537
  165. package/.history/src/core/index_20240824211808.ts +0 -538
  166. package/.history/src/core/index_20240824214041.js +0 -538
  167. package/.history/src/core/index_20240824215312.ts +0 -538
  168. package/.history/src/core/index_20240824215341.ts +0 -538
  169. package/.history/src/core/index_20240824220703.ts +0 -538
  170. package/.history/src/core/index_20240824220709.ts +0 -538
  171. package/.history/src/core/index_20240825012244.ts +0 -536
  172. package/.history/src/core/index_20240825012435.ts +0 -539
  173. package/.history/src/core/index_20240825012440.ts +0 -539
  174. package/.history/src/core/index_20240826005054.ts +0 -539
  175. package/.history/src/core/index_20240826005321.ts +0 -540
  176. package/.history/src/core/index_20240826005410.ts +0 -539
  177. package/.history/src/core/index_20240826005418.ts +0 -539
  178. package/.history/src/core/index_20240830231825.ts +0 -539
  179. package/.history/src/core/index_20240831022416.ts +0 -539
  180. package/.history/src/core/index_20240901222314.js +0 -459
  181. package/.history/src/core/index_20240901222951.js +0 -459
  182. package/.history/src/core/index_20240901223824.js +0 -471
  183. package/.history/src/core/index_20240901223833.js +0 -468
  184. package/.history/src/core/index_20240902223954.js +0 -447
  185. package/.history/src/core/index_20240902224000.js +0 -446
  186. package/.history/src/core/index_20240902230345.js +0 -448
  187. package/.history/src/core/index_20240902231130.js +0 -449
  188. package/.history/src/core/index_20240902231559.js +0 -449
  189. package/.history/src/core/index_20240902232135.js +0 -449
  190. package/.history/src/core/index_20240902232809.js +0 -452
  191. package/.history/src/core/index_20240902232815.js +0 -452
  192. package/.history/src/core/index_20240903000104.js +0 -467
  193. package/.history/src/core/index_20240904001731.js +0 -444
  194. package/.history/src/core/index_20240904002038.ts +0 -539
  195. package/.history/src/core/index_20240904011848.js +0 -444
  196. package/.history/src/core/index_20240904012138.js +0 -444
  197. package/.history/src/core/index_20240904012743.js +0 -444
  198. package/.history/src/core/index_20240904013051.js +0 -444
  199. package/.history/src/core/resourceManager_20240403231531.ts +0 -16
  200. package/.history/src/core/resourceManager_20240823232627.ts +0 -17
  201. package/.history/src/core/resourceManager_20240824214014.js +0 -16
  202. package/.history/src/core/resourceManager_20240824214620.js +0 -17
  203. package/.history/src/core/scenarioManager_20240812203410.ts +0 -86
  204. package/.history/src/core/scenarioManager_20240812203839.ts +0 -94
  205. package/.history/src/core/scenarioManager_20240812213437.ts +0 -85
  206. package/.history/src/core/scenarioManager_20240813225852.ts +0 -85
  207. package/.history/src/core/scenarioManager_20240823235010.ts +0 -85
  208. package/.history/src/core/scenarioManager_20240904002038.ts +0 -94
  209. package/.history/src/core/scenarioManager_20240904012411.ts +0 -94
  210. package/.history/src/core/scenarioManager_20240904012519.ts +0 -94
  211. package/.history/src/index_20240403231531.js +0 -6
  212. package/.history/src/index_20240429233436.js +0 -8
  213. package/.history/src/index_20240429233926.js +0 -8
  214. package/.history/src/index_20240429234401.js +0 -7
  215. package/.history/src/index_20240429234404.js +0 -6
  216. package/.history/src/resource/soundObject_20240419004314.ts +0 -71
  217. package/.history/src/resource/soundObject_20240815034420.ts +0 -66
  218. package/.history/src/resource/soundObject_20240815034836.ts +0 -79
  219. package/.history/src/resource/soundObject_20240815034919.ts +0 -87
  220. package/.history/src/resource/soundObject_20240815040724.ts +0 -81
  221. package/.history/src/resource/soundObject_20240815041022.ts +0 -87
  222. package/.history/src/resource/soundObject_20240815042103.ts +0 -87
  223. package/.history/src/resource/soundObject_20240823235929.ts +0 -91
  224. package/.history/src/resource/soundObject_20240824213129.ts +0 -99
  225. package/.history/src/resource/soundObject_20240824213611.ts +0 -101
  226. package/.history/src/resource/soundObject_20240824215734.ts +0 -101
  227. package/.history/src/resource/soundObject_20240825004926.ts +0 -101
  228. package/.history/src/resource/soundObject_20240825004947.ts +0 -101
  229. package/.history/src/utils/logger_20240812174230.ts +0 -13
  230. package/.history/src/utils/logger_20240823232736.ts +0 -14
  231. package/.history/src/utils/logger_20240824214930.js +0 -14
  232. package/.history/src/utils/store_20240812174230.ts +0 -17
  233. package/.history/src/utils/store_20240823232948.ts +0 -29
  234. package/.history/src/utils/store_20240824214020.js +0 -17
  235. package/.history/src/utils/store_20240824214955.js +0 -29
  236. package/.history/src/utils/waitUtil_20240812174230.ts +0 -4
  237. package/.history/src/utils/waitUtil_20240823232739.ts +0 -4
  238. package/.history/src/utils/waitUtil_20240824214024.js +0 -4
  239. package/.history/src/utils/waitUtil_20240824215009.js +0 -4
  240. package/.history/test/js/title_20240428215305.js +0 -254
  241. package/.history/test/js/title_20240429221911.js +0 -227
  242. package/.history/test/js/title_20240429222806.js +0 -243
  243. package/.history/test/js/title_20240429222854.js +0 -263
  244. package/.history/test/js/title_20240429222906.js +0 -263
  245. package/.history/test/js/title_20240429235639.js +0 -263
  246. package/.history/test/js/title_20240429235840.js +0 -263
  247. package/.history/test/js/title_20240430014721.js +0 -262
  248. package/.history/test/js/title_20240430014759.js +0 -254
  249. package/.history/test/js/title_20240430134612.js +0 -285
  250. package/.history/test/js/title_20240430141051.js +0 -285
  251. package/.history/test/js/title_20240430173745.js +0 -245
  252. package/.history/tsconfig_20240812174230.json +0 -22
  253. package/.history/tsconfig_20240824010157.json +0 -19
  254. package/.history/tsconfig_20240824220700.json +0 -20
  255. package/.history/tsconfig_20240825011301.json +0 -20
  256. package/.history/webpack.config_20240423002825.js +0 -37
  257. package/.history/webpack.config_20240430001157.js +0 -38
  258. package/.history/webpack.config_20240430001309.js +0 -37
  259. package/.history/webpack.config_20240430002112.js +0 -37
  260. package/CLAUDE.md +0 -96
  261. package/LICENSE +0 -21
  262. package/coverage/lcov-report/base.css +0 -224
  263. package/coverage/lcov-report/block-navigation.js +0 -87
  264. package/coverage/lcov-report/core/drawer.ts.html +0 -1264
  265. package/coverage/lcov-report/core/index.html +0 -146
  266. package/coverage/lcov-report/core/resourceManager.ts.html +0 -136
  267. package/coverage/lcov-report/core/scenarioManager.ts.html +0 -373
  268. package/coverage/lcov-report/favicon.png +0 -0
  269. package/coverage/lcov-report/index.html +0 -146
  270. package/coverage/lcov-report/prettify.css +0 -1
  271. package/coverage/lcov-report/prettify.js +0 -2
  272. package/coverage/lcov-report/resource/ImageObject.ts.html +0 -433
  273. package/coverage/lcov-report/resource/index.html +0 -131
  274. package/coverage/lcov-report/resource/soundObject.ts.html +0 -346
  275. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  276. package/coverage/lcov-report/sorter.js +0 -196
  277. package/coverage/lcov-report/utils/TextMeasurer.ts.html +0 -520
  278. package/coverage/lcov-report/utils/index.html +0 -161
  279. package/coverage/lcov-report/utils/logger.ts.html +0 -142
  280. package/coverage/lcov-report/utils/store.ts.html +0 -151
  281. package/coverage/lcov-report/utils/waitUtil.ts.html +0 -97
  282. package/coverage/lcov.info +0 -882
  283. package/dist/README.md +0 -294
  284. package/dist/engineConfig.json +0 -10
  285. package/dist/package.json +0 -51
  286. package/dist/parser/cli.js +0 -61
  287. package/dist/parser/parser.js +0 -53
  288. package/dist/src/core/drawer.js.map +0 -1
  289. package/dist/src/core/scenarioManager.js.map +0 -1
  290. package/dist/src/utils/logger.js.map +0 -1
  291. package/dist/src/utils/store.js.map +0 -1
  292. package/dist/webtalekit-alpha-0.2.13.tgz +0 -0
  293. package/docs/event-system-specification.md +0 -493
  294. package/docs/glossary.html +0 -833
  295. package/docs/index.html +0 -296
  296. package/docs/tag-reference.html +0 -1317
  297. package/docs/ui-template-guide.html +0 -1068
  298. package/example/README.md +0 -29
  299. package/example/engineConfig.json +0 -10
  300. package/example/package-lock.json +0 -5145
  301. package/example/package.json +0 -26
  302. package/example/src/index.js +0 -13
  303. package/example/src/resource/background/beach.jpg +0 -0
  304. package/example/src/resource/background/city.jpg +0 -0
  305. package/example/src/resource/background/crossroad.jpg +0 -0
  306. package/example/src/resource/background/forest.jpg +0 -0
  307. package/example/src/resource/background/laboratory.jpg +0 -0
  308. package/example/src/resource/background/library.jpg +0 -0
  309. package/example/src/resource/background/living_room.jpg +0 -0
  310. package/example/src/resource/background/music_room.jpg +0 -0
  311. package/example/src/resource/background/stage.jpg +0 -0
  312. package/example/src/resource/background/sunset.jpg +0 -0
  313. package/example/src/resource/background/title_bg.png +0 -0
  314. package/example/src/resource/bgm/calm_music.wav +0 -0
  315. package/example/src/resource/bgm/doorbell.mp3 +0 -0
  316. package/example/src/resource/bgm/nc366476_Virtual_Voyage.mp3 +0 -0
  317. package/example/src/resource/bgm/title_theme.mp3 +0 -0
  318. package/example/src/resource/chara/dancer.png +0 -0
  319. package/example/src/resource/chara/guest.png +0 -0
  320. package/example/src/resource/chara/guide.png +0 -0
  321. package/example/src/resource/chara/scientist.png +0 -0
  322. package/example/src/resource/config.js +0 -0
  323. package/example/src/resource/se/doorbell.mp3 +0 -0
  324. package/example/src/resource/system/systemPicture/01_message/message.png +0 -0
  325. package/example/src/resource/system/systemPicture/02_button/button.png +0 -0
  326. package/example/src/resource/system/systemPicture/02_button/button2.png +0 -0
  327. package/example/src/resource/system/systemPicture/02_button/button3.png +0 -0
  328. package/example/src/resource/system/systemPicture/03_system_button/auto.png +0 -0
  329. package/example/src/resource/system/systemPicture/03_system_button/auto2.png +0 -0
  330. package/example/src/resource/system/systemPicture/03_system_button/close.png +0 -0
  331. package/example/src/resource/system/systemPicture/03_system_button/close2.png +0 -0
  332. package/example/src/resource/system/systemPicture/03_system_button/config.png +0 -0
  333. package/example/src/resource/system/systemPicture/03_system_button/config2.png +0 -0
  334. package/example/src/resource/system/systemPicture/03_system_button/load.png +0 -0
  335. package/example/src/resource/system/systemPicture/03_system_button/load2.png +0 -0
  336. package/example/src/resource/system/systemPicture/03_system_button/log.png +0 -0
  337. package/example/src/resource/system/systemPicture/03_system_button/log2.png +0 -0
  338. package/example/src/resource/system/systemPicture/03_system_button/menu.png +0 -0
  339. package/example/src/resource/system/systemPicture/03_system_button/menu2.png +0 -0
  340. package/example/src/resource/system/systemPicture/03_system_button/qload.png +0 -0
  341. package/example/src/resource/system/systemPicture/03_system_button/qload2.png +0 -0
  342. package/example/src/resource/system/systemPicture/03_system_button/qsave.png +0 -0
  343. package/example/src/resource/system/systemPicture/03_system_button/qsave2.png +0 -0
  344. package/example/src/resource/system/systemPicture/03_system_button/save.png +0 -0
  345. package/example/src/resource/system/systemPicture/03_system_button/save2.png +0 -0
  346. package/example/src/resource/system/systemPicture/03_system_button/screen.png +0 -0
  347. package/example/src/resource/system/systemPicture/03_system_button/screen2.png +0 -0
  348. package/example/src/resource/system/systemPicture/03_system_button/skip.png +0 -0
  349. package/example/src/resource/system/systemPicture/03_system_button/skip2.png +0 -0
  350. package/example/src/resource/system/systemPicture/03_system_button/title.png +0 -0
  351. package/example/src/resource/system/systemPicture/03_system_button/title2.png +0 -0
  352. package/example/src/resource/system/systemPicture//345/210/251/347/224/250/350/246/217/347/264/204.txt +0 -0
  353. package/example/src/resource/system/wait.gif +0 -0
  354. package/example/src/scene/animation.scene +0 -28
  355. package/example/src/scene/background.scene +0 -29
  356. package/example/src/scene/character.scene +0 -26
  357. package/example/src/scene/choice.scene +0 -97
  358. package/example/src/scene/dialog.scene +0 -105
  359. package/example/src/scene/effects.scene +0 -38
  360. package/example/src/scene/en/animation.scene +0 -28
  361. package/example/src/scene/en/background.scene +0 -26
  362. package/example/src/scene/en/character.scene +0 -26
  363. package/example/src/scene/en/choice.scene +0 -32
  364. package/example/src/scene/en/effects.scene +0 -37
  365. package/example/src/scene/en/sound.scene +0 -26
  366. package/example/src/scene/en/text.scene +0 -26
  367. package/example/src/scene/en/title.scene +0 -39
  368. package/example/src/scene/if_test.scene +0 -37
  369. package/example/src/scene/resource-error-test.scene +0 -15
  370. package/example/src/scene/save-load-test.scene +0 -48
  371. package/example/src/scene/sound.scene +0 -26
  372. package/example/src/scene/test_error.scene +0 -21
  373. package/example/src/scene/text.scene +0 -34
  374. package/example/src/scene/title.scene +0 -51
  375. package/example/src/screen/incoming.html +0 -474
  376. package/example/src/screen/title.html +0 -135
  377. package/example/src/template.html +0 -16
  378. package/example/test-results/.last-run.json +0 -4
  379. package/example/webpack.config.js +0 -69
  380. package/image.png +0 -0
  381. package/playwright-report/index.html +0 -71
  382. package/s-plan1-5Light-s-1.jpg +0 -0
  383. package/test-results/.last-run.json +0 -6
  384. package/tests/e2e/if-global-attribute.spec.js +0 -90
  385. package/tests/e2e/resource-error-handling.spec.js +0 -58
  386. package/tests/e2e/screenshots/before-error-check.png +0 -0
  387. package/tests/e2e/screenshots/choices.png +0 -0
  388. package/tests/e2e/screenshots/message-window-click-wait.png +0 -0
  389. /package/{dist/src → src}/core/resourceManager.js +0 -0
  390. /package/{dist/src → src}/core/resourceManager.js.map +0 -0
  391. /package/{dist/src → src}/resource/ImageObject.js +0 -0
  392. /package/{dist/src → src}/resource/ImageObject.js.map +0 -0
  393. /package/{dist/src → src}/resource/soundObject.js +0 -0
  394. /package/{dist/src → src}/resource/soundObject.js.map +0 -0
  395. /package/{dist/src → src}/utils/fallbackTemplate.js +0 -0
  396. /package/{dist/src → src}/utils/fallbackTemplate.js.map +0 -0
  397. /package/{dist/src → src}/utils/waitUtil.js +0 -0
  398. /package/{dist/src → src}/utils/waitUtil.js.map +0 -0
@@ -1,539 +0,0 @@
1
- import { Drawer } from './drawer'
2
- import { ScenarioManager } from './scenarioManager'
3
- import { ImageObject } from '../resource/ImageObject'
4
- import { ResourceManager } from './resourceManager'
5
- import { SoundObject } from '../resource/soundObject'
6
- import engineConfig from '../../engineConfig.json'
7
- import { outputLog } from '../utils/logger'
8
- import { sleep } from '../utils/waitUtil'
9
-
10
- type CommandList = {
11
- [key: string]: (line: any) => Promise<void> | void;
12
- };
13
-
14
- type DisplayedImage = {
15
- image: ImageObject;
16
- size: {
17
- width: number;
18
- height: number;
19
- };
20
- pos?: {
21
- x: number;
22
- y: number;
23
- };
24
- look?: string;
25
- entry?: {
26
- time: number;
27
- wait: boolean;
28
- };
29
- };
30
-
31
- type UsedSound = {
32
- audio: SoundObject;
33
- };
34
-
35
- export class Core {
36
- bgm: SoundObject | null = null
37
- isAuto = false
38
- isNext = false
39
- isSkip = false
40
- onNextHandler = () => { }
41
- sceneFile: { [key: string]: any } = {};
42
- sceneConfig: { [key: string]: any } = {};
43
- commandList: CommandList = {
44
- text: this.textHandler,
45
- choice: this.choiceHandler,
46
- show: this.showHandler,
47
- newpage: this.newpageHandler,
48
- hide: this.hideHandler,
49
- jump: this.jumpHandler,
50
- sound: this.soundHandler,
51
- say: this.sayHandler,
52
- if: this.ifHandler,
53
- call: this.callHandler,
54
- moveto: this.moveToHandler,
55
- route: this.routeHandler,
56
- wait: this.waitHandler,
57
- }
58
-
59
- gameContainer: HTMLElement;
60
- drawer: Drawer;
61
- scenarioManager: ScenarioManager;
62
- resourceManager: ResourceManager;
63
- displayedImages: { [key: string]: DisplayedImage } = {};
64
- usedSounds: { [key: string]: UsedSound } = {};
65
- tempImages: { [key: string]: DisplayedImage } = {};
66
-
67
- constructor() {
68
- // TODO: コンストラクターのエラーハンドリングを追加する
69
- const tempElement = document.getElementById('gameContainer')
70
- if (!tempElement) {
71
- throw new Error('gameContainer not found')
72
- }
73
- this.gameContainer = tempElement
74
- // Drawerの初期化(canvasタグのサイズを設定する)
75
- this.drawer = new Drawer(this.gameContainer)
76
- // ScenarioManagerの初期化(変数の初期値設定)
77
- this.scenarioManager = new ScenarioManager()
78
- // ResourceManagerの初期化(引数にconfigを渡して、リソース管理配列を作る)
79
- this.resourceManager = new ResourceManager()
80
- this.displayedImages = {}
81
- this.usedSounds = {}
82
- }
83
-
84
- async start() {
85
- outputLog('call', 'debug')
86
- // TODO: ブラウザ用のビルドの場合は、最初にクリックしてもらう
87
- // titleタグの内容を書き換える
88
- document.title = engineConfig.title
89
- // sceneファイルを読み込む
90
- await this.loadScene('title')
91
- // 画面を表示する
92
- await this.loadScreen(this.sceneConfig)
93
- // 入力イベントを設定する
94
- document.addEventListener('keydown', (e) => {
95
- if (e.key === 'Enter') {
96
- this.onNextHandler()
97
- } else if (e.key === 'Control') {
98
- this.drawer.isSkip = true
99
- this.isNext = true
100
- }
101
- })
102
- document.addEventListener('keyup', (e) => {
103
- if (e.key === 'Control') {
104
- this.drawer.isSkip = true
105
- this.isNext = false
106
- }
107
- })
108
- document.addEventListener('click', (e) => {
109
- this.onNextHandler()
110
- })
111
-
112
- await this.textHandler('タップでスタート')
113
- // BGMを再生する
114
- this.bgm!.play(true)
115
- // シナリオを実行する
116
- while (this.scenarioManager.hasNext()) {
117
- await this.runScenario()
118
- }
119
- }
120
-
121
- async loadScene(sceneFileName: string) {
122
- outputLog('call', 'debug', sceneFileName)
123
- // sceneファイルを読み込む
124
- this.sceneFile = await import(/* webpackChunkName: "[request]" */ `/src/js/${sceneFileName}.js`)
125
- this.scenarioManager.setScenario(this.sceneFile.scenario, sceneFileName)
126
- this.sceneConfig = { ...this.sceneConfig, ...this.sceneFile.sceneConfig }
127
- outputLog('sceneFile', 'debug', this.sceneFile)
128
- }
129
-
130
- async loadScreen(sceneConfig: { [key: string]: string }) {
131
- outputLog('call', 'debug', sceneConfig)
132
- // sceneConfig.templateを読み込んで、HTMLを表示する
133
- const htmlString = await (await fetch(sceneConfig.template)).text()
134
- // 読み込んだhtmlからIDにmainを持つdivタグとStyleタグ以下を取り出して、gameContainerに表示する
135
- var parser = new DOMParser()
136
- var doc = parser.parseFromString(htmlString, 'text/html')
137
- this.gameContainer.innerHTML = doc.getElementById('main')!.innerHTML
138
- // Styleタグを取り出して、headタグに追加する
139
- const styleElement = doc.head.getElementsByTagName('style')[0]
140
- document.head.appendChild(styleElement)
141
- // ゲーム進行用に必要な情報をセットする
142
- this.drawer.setScreen(this.gameContainer, engineConfig.resolution)
143
- // シナリオの進行状況を保存
144
- this.scenarioManager.setSceneName(sceneConfig.name)
145
- // 背景画像を表示する
146
- const background = await new ImageObject().setImageAsync(sceneConfig.background)
147
- this.displayedImages['background'] = {
148
- image: background,
149
- size: {
150
- width: this.gameContainer.clientWidth,
151
- height: this.gameContainer.clientHeight,
152
- },
153
- }
154
- this.drawer.show(this.displayedImages)
155
- this.bgm = await new SoundObject().setAudioAsync(sceneConfig.bgm)
156
- }
157
-
158
- async runScenario() {
159
- outputLog('call index:', 'debug', this.scenarioManager.getIndex())
160
- let scenarioObject = this.scenarioManager.next()
161
- if (!scenarioObject) {
162
- return
163
- }
164
- outputLog('scenarioObject', 'debug', scenarioObject)
165
- // prettier-ignore
166
- const boundFunction = this.commandList[scenarioObject.type || 'text'].bind(this)
167
- // prettier-ignore
168
- outputLog(`boundFunction:${boundFunction.name.split(' ')[1]}`, 'debug', scenarioObject)
169
- scenarioObject = await this.httpHandler(scenarioObject)
170
- await boundFunction(scenarioObject)
171
- }
172
-
173
- async textHandler(line: any) {
174
- outputLog('textHandler:line', 'debug', line)
175
- // 文章だけの場合は、contentプロパティに配列として設定する
176
- if (typeof line === 'string') line = { content: [line] }
177
- // httpレスポンスがある場合は、list.contentに追加して、表示対象に加える
178
- if (line.then || line.error) {
179
- line.content = line.content.concat(line.then || line.error)
180
- }
181
- outputLog('call', 'debug', line)
182
-
183
- // 名前が設定されている場合は、名前を表示する
184
- if (line.name) {
185
- this.drawer.drawName(line.name)
186
- } else {
187
- this.drawer.drawName('')
188
- }
189
-
190
- //prettier-ignore
191
- this.onNextHandler = () => { this.drawer.isSkip = true }
192
- // 表示する文章を1行ずつ表示する
193
- for (const text of line.content) {
194
- // scenarioObject.content内にオブジェクトが含まれている場合は、クリア処理をスキップする
195
- if (!text.content.some((item: any) => typeof item === 'object' && item !== null)) {
196
- this.drawer.clearText(); // テキスト表示領域をクリア
197
- }
198
-
199
- if (typeof text === 'string') {
200
- await this.drawer.drawText(this.expandVariable(text), 50)
201
- } else {
202
- if (text.content[0].type === 'br') {
203
- //prettier-ignore
204
- this.onNextHandler = () => { this.isNext = true }
205
- if (typeof text.wait === 'number') {
206
- if (text.wait > 0 || this.isAuto) {
207
- const waitTime = text.wait || 1500
208
- // 指定された時間だけ待機
209
- await sleep(waitTime)
210
- }
211
- } else {
212
- // 改行ごとに入力待ち
213
- await this.clickWait()
214
- }
215
- }
216
- const container = this.drawer.createDecoratedElement(text);
217
- await this.drawer.drawText(this.expandVariable(text.content[0]), text.speed || 50, container)
218
- }
219
-
220
- }
221
- this.drawer.isSkip = false
222
- this.scenarioManager.setHistory(line.content)
223
- }
224
-
225
- expandVariable(text: string) {
226
- outputLog('call', 'debug', text)
227
- return text.replace(/{{([^{}]+)}}/g, (match) => {
228
- const expr = match.slice(2, -2)
229
- const returnValue = this.executeCode(`return ${expr}`)
230
- return typeof returnValue == 'object' ? JSON.stringify(returnValue) : returnValue
231
- })
232
- }
233
-
234
- // クリック待ち処理
235
- async clickWait() {
236
- outputLog('call', 'debug')
237
- this.drawer.setVisibility('#waitCircle', true)
238
- return new Promise((resolve) => {
239
- const intervalId = setInterval(() => {
240
- if (this.isNext) {
241
- this.drawer.setVisibility('#waitCircle', false)
242
- clearInterval(intervalId)
243
- this.isNext = false
244
- resolve(null)
245
- }
246
- }, 500)
247
- })
248
- }
249
-
250
- async sayHandler(line: any) {
251
- outputLog('call', 'debug', line)
252
- // say(name:string, pattern: string, voice: {playの引数}, ...text)
253
- if (line.voice) await this.soundHandler({ path: line.voice, play: undefined })
254
- await this.textHandler({ content: line.content, name: line.name })
255
- this.scenarioManager.setHistory(line)
256
- }
257
-
258
- async choiceHandler(line: any) {
259
- outputLog('call', 'debug', line)
260
- if (line.prompt) this.textHandler(line.prompt) // promptがある場合は、表示する
261
- const { selectId, onSelect: selectHandler } = await this.drawer.drawChoices(line)
262
- if (selectHandler !== undefined) {
263
- this.scenarioManager.addScenario(selectHandler)
264
- }
265
- this.scenarioManager.setHistory(line)
266
- }
267
-
268
- jumpHandler(line: any) {
269
- outputLog('call:', 'debug', line.index)
270
- this.newpageHandler()
271
- this.scenarioManager.setIndex(Number(line.index))
272
- }
273
-
274
- async showHandler(line: any) {
275
- outputLog('line', 'debug', line)
276
- // 表示する画像の情報を管理オブジェクトに追加
277
- const modeList: { [key: string]: string } = { 'bg': 'background', 'cutin': '', 'chara': '', 'cg': 'background', 'effect': 'effect' }
278
- const key = Object.keys(modeList).includes(line.mode) ? modeList[line.mode] : line.name || line.src.split('/').pop()
279
- const baseLine = engineConfig.resolution.height / 2
280
- const centerPoint: { [key: string]: { x: number, y: number } } = {
281
- left: { x: engineConfig.resolution.width * 0.25, y: baseLine },
282
- center: { x: engineConfig.resolution.width * 0.5, y: baseLine },
283
- right: { x: engineConfig.resolution.width * 0.75, y: baseLine },
284
- }
285
-
286
- const image = await this.getImageObject(line)
287
- // 画像の表示位置を設定
288
- let position = { x: line.x || 0, y: line.y || 0 }
289
- // prettier-ignore
290
- let size = line.width && line.height ? { width: line.width, height: line.height } : { width: image.getSize().width, height: image.getSize().height }
291
-
292
- // line.modeが'cutin'の場合、center:middleのエイリアスを強制する
293
- if (line.mode === 'cutin') {
294
- line.pos = 'center:middle'
295
- }
296
-
297
- if (line.mode === 'cg') {
298
- this.tempImages = { ...this.displayedImages }
299
- this.displayedImages = { background: line.src }
300
- size = { width: engineConfig.resolution.width, height: engineConfig.resolution.height }
301
- }
302
-
303
- if (line.pos) {
304
- const pos = line.pos.split(':')
305
- const baseLines: { [key: string]: number } = {
306
- top: 0,
307
- middle: engineConfig.resolution.height / 2,
308
- bottom: engineConfig.resolution.height,
309
- }
310
- // エイリアスが設定されている場合、画像の中心点を求めて、画像の表示位置を設定する
311
- position.x = centerPoint[pos[0]].x - size.width / 2
312
- if (pos[1] === 'middle') {
313
- position.y = baseLines[pos[1]] - size.width / 2
314
- } else if (pos[1]) {
315
- position.y = baseLines[pos[1]]
316
- } else {
317
- position.y = baseLine / 2
318
- }
319
- }
320
- this.displayedImages[key] = {
321
- image,
322
- pos: position,
323
- size: size,
324
- look: line.look,
325
- entry: line.entry,
326
- }
327
- outputLog('displayedImages', 'debug', this.displayedImages[key])
328
- if (line.sepia) this.displayedImages[key].image.setSepia(line.sepia)
329
- if (line.mono) this.displayedImages[key].image.setMonochrome(line.mono)
330
- if (line.blur) this.displayedImages[key].image.setBlur(line.blur)
331
- if (line.opacity) this.displayedImages[key].image.setOpacity(line.opacity)
332
- this.drawer.show(this.displayedImages)
333
- outputLog('this.displayedImages', 'debug', this.displayedImages)
334
- }
335
-
336
- hideHandler(line: any) {
337
- outputLog('call', 'debug', line)
338
- if (line.mode === 'cg') {
339
- this.displayedImages = { ...this.tempImages }
340
- this.tempImages = {}
341
- } else {
342
- delete this.displayedImages[line.name]
343
- }
344
- this.drawer.show(this.displayedImages)
345
- }
346
-
347
- async moveToHandler(line: any) {
348
- outputLog('moveToHandler:line', 'debug', line)
349
- const key = line.name
350
- outputLog('moveToHandler:displayedImages', 'debug', this.displayedImages)
351
- await this.drawer.moveTo(key, this.displayedImages, { x: line.x, y: line.y }, line.duration | 1)
352
- }
353
-
354
- async getImageObject(line: any) {
355
- outputLog('call', 'debug', line)
356
- let image
357
- // 既にインスタンスがある場合は、それを使う
358
- if (line.name) {
359
- const targetImage = this.displayedImages[line.name]
360
- const imageObject = targetImage ? targetImage.image : new ImageObject()
361
- image = await imageObject.setImageAsync(line.src)
362
- } else {
363
- image = await new ImageObject().setImageAsync(line.src)
364
- }
365
- return image
366
- }
367
-
368
- async soundHandler(line: any) {
369
- outputLog('call', 'debug', line)
370
- let soundObject = await this.getSoundObject(line)
371
- if (line.mode === 'bgm') {
372
- if (this.bgm!.isPlaying) {
373
- this.bgm!.stop()
374
- }
375
- this.bgm = soundObject
376
- }
377
- // playプロパティが存在する場合は、再生する
378
- if ('play' in line) {
379
- 'loop' in line ? soundObject.play(true) : soundObject.play()
380
- } else if ('stop' in line) {
381
- soundObject.stop()
382
- } else if ('pause' in line) {
383
- soundObject.pause()
384
- }
385
- // soundObjectを管理オブジェクトに追加
386
- const key = line.name || line.src.split('/').pop()
387
- this.usedSounds[key] = {
388
- audio: soundObject,
389
- }
390
- }
391
-
392
- async getSoundObject(line: any) {
393
- outputLog('call', 'debug', line)
394
- let resource
395
- if (line.name) {
396
- const targetResource = this.usedSounds[line.name]
397
- const soundObject = targetResource ? targetResource.audio : new SoundObject()
398
- resource = await soundObject.setAudioAsync(line.src)
399
- } else {
400
- resource = await new SoundObject().setAudioAsync(line.src)
401
- }
402
- return resource
403
- }
404
-
405
- newpageHandler() {
406
- outputLog('call', 'debug')
407
- this.displayedImages = {
408
- background: {
409
- image: this.getBackground(),
410
- size: {
411
- width: this.gameContainer.clientWidth,
412
- height: this.gameContainer.clientHeight,
413
- },
414
- },
415
- }
416
- this.drawer.clear()
417
- this.drawer.show(this.displayedImages)
418
- }
419
-
420
- async ifHandler(line: any) {
421
- outputLog('call', 'debug', line)
422
- const isTrue = this.executeCode(`return ${line.condition}`)
423
- outputLog(`${isTrue}`, 'debug')
424
- if (isTrue) {
425
- outputLog('', 'debug', line.content[0].content)
426
- this.scenarioManager.addScenario(line.content[0].content)
427
- } else {
428
- outputLog('', 'debug', line.content[1].content)
429
- this.scenarioManager.addScenario(line.content[1].content)
430
- }
431
- }
432
-
433
- async routeHandler(line: any) {
434
- outputLog('call', 'debug', line)
435
- if (this.bgm!.isPlaying) {
436
- this.bgm!.stop()
437
- this.bgm = null
438
- }
439
- this.newpageHandler()
440
- // sceneファイルを読み込む
441
- await this.loadScene(line.to)
442
- // 画面を表示する
443
- await this.loadScreen(this.sceneConfig)
444
- // BGMを再生する
445
- this.bgm!.play(true)
446
- }
447
-
448
- // Sceneファイルに、ビルド時に実行処理を追加して、そこに処理をお願いしたほうがいいかも?
449
- callHandler(line: any) {
450
- outputLog('call', 'debug', line)
451
- this.executeCode(line.func)
452
- }
453
-
454
- async httpHandler(line: any) {
455
- if (!(line.get || line.post || line.put || line.delete)) {
456
- return line
457
- }
458
- outputLog('call', 'debug', line)
459
- // progress属性を処理する
460
- // prettier-ignore
461
- const progressText = line.content.filter((content: any) => content.type === 'progress')[0]
462
- if (progressText) {
463
- await this.textHandler({ content: [progressText.content][0], wait: 0 })
464
- }
465
- // get,post,put,delete属性を処理する
466
- const headers = line.content
467
- .filter((content: any) => content.type === 'header')[0]
468
- .content.reduce(
469
- (acc: any, header: any) => ({
470
- ...acc,
471
- [header.type]: header.content,
472
- }),
473
- {},
474
- )
475
- const body = line.content
476
- .filter((content: any) => content.type === 'data')[0]
477
- .content.reduce(
478
- (acc: any, header: any) => ({
479
- ...acc,
480
- [header.type]: header.content,
481
- }),
482
- {},
483
- )
484
- outputLog('headers', 'debug', headers)
485
- outputLog('body', 'debug', body)
486
- const response = await fetch(line.get || line.post || line.put || line.delete, {
487
- method: line.get ? 'GET' : line.post ? 'POST' : line.put ? 'PUT' : 'DELETE',
488
- headers: headers,
489
- body: JSON.stringify(body),
490
- })
491
- if (response.ok) {
492
- const json = await response.json()
493
- this.sceneFile.res = json
494
- outputLog('res', 'debug', json)
495
- line.then = line.content.filter((content: any) => content.type === 'then')[0].content
496
- } else {
497
- line.error = line.content.filter((content: any) => content.type === 'error')[0].content
498
- }
499
- if (line.content) {
500
- line.content = line.content.filter(
501
- (content: any) =>
502
- !(
503
- content.type &&
504
- (content.type === 'header' ||
505
- content.type === 'data' ||
506
- content.type === 'then' ||
507
- content.type === 'error' ||
508
- content.type === 'progress')
509
- ),
510
- )
511
- }
512
- return line
513
- }
514
-
515
- async waitHandler(line: any) {
516
- outputLog('call', 'debug', line)
517
- if (line.time) {
518
- await sleep(line.time)
519
- }
520
- }
521
-
522
- setBackground(image: DisplayedImage) {
523
- this.displayedImages["background"] = image
524
- }
525
-
526
- getBackground() {
527
- return this.displayedImages["background"].image
528
- }
529
-
530
- executeCode(code: string) {
531
- try {
532
- const context = { ...this.sceneFile }
533
- const func = new Function(...Object.keys(context), code)
534
- return func.apply(null, Object.values(context))
535
- } catch (error) {
536
- console.error('Error executing code:', error)
537
- }
538
- }
539
- }