webtalekit-alpha 0.2.11 → 0.2.13
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.
- package/.claude/settings.local.json +12 -0
- package/.clinerules +65 -0
- package/.history/README_20240812174230.md +193 -0
- package/.history/README_20240812175424.md +185 -0
- package/.history/README_20240812191012.md +185 -0
- package/.history/README_20240812191155.md +185 -0
- package/.history/README_20240812191211.md +185 -0
- package/.history/README_20240812192035.md +185 -0
- package/.history/dist/src/core/index_20240815021552.js +474 -0
- package/.history/dist/src/core/index_20240815022042.js +476 -0
- package/.history/dist/src/core/index_20240815022206.js +476 -0
- package/.history/dist/src/core/index_20240815023104.js +478 -0
- package/.history/dist/src/core/index_20240817022019.js +494 -0
- package/.history/dist/src/core/index_20240818013827.js +493 -0
- package/.history/dist/src/core/index_20240820001418.js +502 -0
- package/.history/package_20240812174230.json +45 -0
- package/.history/package_20240825011731.json +45 -0
- package/.history/package_20240825011739.json +44 -0
- package/.history/parser/parser_20240812174230.js +50 -0
- package/.history/parser/parser_20240825012739.js +47 -0
- package/.history/parser/parser_20240825012835.js +52 -0
- package/.history/src/core/drawer_20240813091343.ts +262 -0
- package/.history/src/core/drawer_20240815232345.ts +262 -0
- package/.history/src/core/drawer_20240815232350.ts +262 -0
- package/.history/src/core/drawer_20240816025257.ts +357 -0
- package/.history/src/core/drawer_20240816025358.ts +357 -0
- package/.history/src/core/drawer_20240816030148.ts +365 -0
- package/.history/src/core/drawer_20240816231033.ts +294 -0
- package/.history/src/core/drawer_20240816231107.ts +262 -0
- package/.history/src/core/drawer_20240816231234.ts +268 -0
- package/.history/src/core/drawer_20240817013836.ts +290 -0
- package/.history/src/core/drawer_20240817015150.ts +289 -0
- package/.history/src/core/drawer_20240817015353.ts +290 -0
- package/.history/src/core/drawer_20240817021254.ts +291 -0
- package/.history/src/core/drawer_20240817023440.ts +295 -0
- package/.history/src/core/drawer_20240817023445.ts +295 -0
- package/.history/src/core/drawer_20240818015327.ts +295 -0
- package/.history/src/core/drawer_20240819231006.ts +318 -0
- package/.history/src/core/drawer_20240820002829.ts +317 -0
- package/.history/src/core/drawer_20240820003141.ts +295 -0
- package/.history/src/core/drawer_20240824010043.ts +295 -0
- package/.history/src/core/drawer_20240825013311.ts +293 -0
- package/.history/src/core/drawer_20240902235257.ts +295 -0
- package/.history/src/core/drawer_20240904002038.ts +262 -0
- package/.history/src/core/drawer_20240904004020.ts +262 -0
- package/.history/src/core/drawer_20240904004238.ts +262 -0
- package/.history/src/core/drawer_20240904005648.ts +262 -0
- package/.history/src/core/drawer_20240904005808.ts +262 -0
- package/.history/src/core/drawer_20240904010523.ts +262 -0
- package/.history/src/core/drawer_20240904011611.ts +262 -0
- package/.history/src/core/drawer_20240904011740.ts +262 -0
- package/.history/src/core/index_20240812190102.js +443 -0
- package/.history/src/core/index_20240812190105.js +443 -0
- package/.history/src/core/index_20240812205421.js +452 -0
- package/.history/src/core/index_20240812213441.js +452 -0
- package/.history/src/core/index_20240812214203.js +453 -0
- package/.history/src/core/index_20240813090823.js +453 -0
- package/.history/src/core/index_20240813230449.js +452 -0
- package/.history/src/core/index_20240813230539.js +452 -0
- package/.history/src/core/index_20240813231447.js +453 -0
- package/.history/src/core/index_20240813231449.js +453 -0
- package/.history/src/core/index_20240813231511.js +453 -0
- package/.history/src/core/index_20240813231531.js +453 -0
- package/.history/src/core/index_20240813231913.js +453 -0
- package/.history/src/core/index_20240813232356.js +453 -0
- package/.history/src/core/index_20240813232640.js +453 -0
- package/.history/src/core/index_20240813232900.js +453 -0
- package/.history/src/core/index_20240814221127.js +454 -0
- package/.history/src/core/index_20240814221322.js +454 -0
- package/.history/src/core/index_20240814221526.js +454 -0
- package/.history/src/core/index_20240814222048.js +454 -0
- package/.history/src/core/index_20240814222918.js +459 -0
- package/.history/src/core/index_20240814223136.js +459 -0
- package/.history/src/core/index_20240814223501.js +464 -0
- package/.history/src/core/index_20240814224347.js +468 -0
- package/.history/src/core/index_20240815013712.js +474 -0
- package/.history/src/core/index_20240815021534.js +474 -0
- package/.history/src/core/index_20240815023143.js +477 -0
- package/.history/src/core/index_20240815023207.js +479 -0
- package/.history/src/core/index_20240815023344.js +481 -0
- package/.history/src/core/index_20240815035600.js +479 -0
- package/.history/src/core/index_20240815041549.js +480 -0
- package/.history/src/core/index_20240815185515.js +481 -0
- package/.history/src/core/index_20240815192158.js +481 -0
- package/.history/src/core/index_20240815222912.js +482 -0
- package/.history/src/core/index_20240815224052.js +483 -0
- package/.history/src/core/index_20240815224843.js +484 -0
- package/.history/src/core/index_20240815224850.js +483 -0
- package/.history/src/core/index_20240815231706.js +479 -0
- package/.history/src/core/index_20240816025748.js +483 -0
- package/.history/src/core/index_20240816030102.js +484 -0
- package/.history/src/core/index_20240817013329.js +485 -0
- package/.history/src/core/index_20240817013526.js +485 -0
- package/.history/src/core/index_20240817013819.js +488 -0
- package/.history/src/core/index_20240817013829.js +488 -0
- package/.history/src/core/index_20240817014921.js +494 -0
- package/.history/src/core/index_20240817022057.js +494 -0
- package/.history/src/core/index_20240817023316.js +493 -0
- package/.history/src/core/index_20240818005637.js +493 -0
- package/.history/src/core/index_20240818005721.js +493 -0
- package/.history/src/core/index_20240818011804.js +493 -0
- package/.history/src/core/index_20240818013835.js +493 -0
- package/.history/src/core/index_20240818014310.js +493 -0
- package/.history/src/core/index_20240818014323.js +493 -0
- package/.history/src/core/index_20240818014333.js +493 -0
- package/.history/src/core/index_20240818020725.js +496 -0
- package/.history/src/core/index_20240819195504.js +497 -0
- package/.history/src/core/index_20240819202012.js +495 -0
- package/.history/src/core/index_20240819231228.js +501 -0
- package/.history/src/core/index_20240819232555.js +502 -0
- package/.history/src/core/index_20240819233404.js +502 -0
- package/.history/src/core/index_20240820003114.js +495 -0
- package/.history/src/core/index_20240820003120.js +495 -0
- package/.history/src/core/index_20240820003331.js +495 -0
- package/.history/src/core/index_20240820004126.js +498 -0
- package/.history/src/core/index_20240820004357.js +497 -0
- package/.history/src/core/index_20240820005103.js +498 -0
- package/.history/src/core/index_20240820005110.js +499 -0
- package/.history/src/core/index_20240820005206.js +497 -0
- package/.history/src/core/index_20240820005352.js +497 -0
- package/{src/core/index.js → .history/src/core/index_20240823224904.ts} +75 -231
- package/.history/src/core/index_20240823224905.js +505 -0
- package/.history/src/core/index_20240823231631.ts +530 -0
- package/.history/src/core/index_20240823231735.ts +530 -0
- package/.history/src/core/index_20240823232123.ts +539 -0
- package/.history/src/core/index_20240823232329.ts +539 -0
- package/.history/src/core/index_20240823233058.ts +539 -0
- package/.history/src/core/index_20240823234946.ts +539 -0
- package/.history/src/core/index_20240824005956.ts +534 -0
- package/.history/src/core/index_20240824010113.ts +534 -0
- package/.history/src/core/index_20240824010124.ts +534 -0
- package/.history/src/core/index_20240824010212.ts +534 -0
- package/.history/src/core/index_20240824010218.ts +534 -0
- package/.history/src/core/index_20240824010407.ts +534 -0
- package/.history/src/core/index_20240824010611.ts +534 -0
- package/.history/src/core/index_20240824010623.ts +534 -0
- package/.history/src/core/index_20240824010652.ts +534 -0
- package/.history/src/core/index_20240824011007.ts +534 -0
- package/.history/src/core/index_20240824210450.ts +534 -0
- package/.history/src/core/index_20240824210703.ts +534 -0
- package/.history/src/core/index_20240824210708.ts +534 -0
- package/.history/src/core/index_20240824211001.ts +537 -0
- package/.history/src/core/index_20240824211258.ts +537 -0
- package/.history/src/core/index_20240824211654.ts +537 -0
- package/.history/src/core/index_20240824211723.ts +537 -0
- package/.history/src/core/index_20240824211808.ts +538 -0
- package/.history/src/core/index_20240824214041.js +538 -0
- package/.history/src/core/index_20240824215312.ts +538 -0
- package/.history/src/core/index_20240824215341.ts +538 -0
- package/.history/src/core/index_20240824220703.ts +538 -0
- package/.history/src/core/index_20240824220709.ts +538 -0
- package/.history/src/core/index_20240825012244.ts +536 -0
- package/.history/src/core/index_20240825012435.ts +539 -0
- package/.history/src/core/index_20240825012440.ts +539 -0
- package/.history/src/core/index_20240826005054.ts +539 -0
- package/.history/src/core/index_20240826005321.ts +540 -0
- package/.history/src/core/index_20240826005410.ts +539 -0
- package/.history/src/core/index_20240826005418.ts +539 -0
- package/.history/src/core/index_20240830231825.ts +539 -0
- package/.history/src/core/index_20240831022416.ts +539 -0
- package/.history/src/core/index_20240901222314.js +459 -0
- package/.history/src/core/index_20240901222951.js +459 -0
- package/.history/src/core/index_20240901223824.js +471 -0
- package/.history/src/core/index_20240901223833.js +468 -0
- package/.history/src/core/index_20240902223954.js +447 -0
- package/.history/src/core/index_20240902224000.js +446 -0
- package/.history/src/core/index_20240902230345.js +448 -0
- package/.history/src/core/index_20240902231130.js +449 -0
- package/.history/src/core/index_20240902231559.js +449 -0
- package/.history/src/core/index_20240902232135.js +449 -0
- package/.history/src/core/index_20240902232809.js +452 -0
- package/.history/src/core/index_20240902232815.js +452 -0
- package/.history/src/core/index_20240903000104.js +467 -0
- package/.history/src/core/index_20240904001731.js +444 -0
- package/.history/src/core/index_20240904002038.ts +539 -0
- package/.history/src/core/index_20240904011848.js +444 -0
- package/.history/src/core/index_20240904012138.js +444 -0
- package/.history/src/core/index_20240904012743.js +444 -0
- package/.history/src/core/index_20240904013051.js +444 -0
- package/.history/src/core/resourceManager_20240403231531.ts +16 -0
- package/.history/src/core/resourceManager_20240823232627.ts +17 -0
- package/.history/src/core/resourceManager_20240824214014.js +16 -0
- package/.history/src/core/resourceManager_20240824214620.js +17 -0
- package/.history/src/core/scenarioManager_20240812203410.ts +86 -0
- package/.history/src/core/scenarioManager_20240812203839.ts +94 -0
- package/.history/src/core/scenarioManager_20240812213437.ts +85 -0
- package/.history/src/core/scenarioManager_20240813225852.ts +85 -0
- package/.history/src/core/scenarioManager_20240823235010.ts +85 -0
- package/.history/src/core/scenarioManager_20240904002038.ts +94 -0
- package/.history/src/core/scenarioManager_20240904012411.ts +94 -0
- package/.history/src/core/scenarioManager_20240904012519.ts +94 -0
- package/.history/src/index_20240403231531.js +6 -0
- package/.history/src/index_20240429233436.js +8 -0
- package/.history/src/index_20240429233926.js +8 -0
- package/.history/src/index_20240429234401.js +7 -0
- package/.history/src/index_20240429234404.js +6 -0
- package/.history/src/resource/soundObject_20240419004314.ts +71 -0
- package/.history/src/resource/soundObject_20240815034420.ts +66 -0
- package/.history/src/resource/soundObject_20240815034836.ts +79 -0
- package/.history/src/resource/soundObject_20240815034919.ts +87 -0
- package/.history/src/resource/soundObject_20240815040724.ts +81 -0
- package/.history/src/resource/soundObject_20240815041022.ts +87 -0
- package/.history/src/resource/soundObject_20240815042103.ts +87 -0
- package/.history/src/resource/soundObject_20240823235929.ts +91 -0
- package/.history/src/resource/soundObject_20240824213129.ts +99 -0
- package/.history/src/resource/soundObject_20240824213611.ts +101 -0
- package/.history/src/resource/soundObject_20240824215734.ts +101 -0
- package/.history/src/resource/soundObject_20240825004926.ts +101 -0
- package/.history/src/resource/soundObject_20240825004947.ts +101 -0
- package/.history/src/utils/logger_20240812174230.ts +13 -0
- package/.history/src/utils/logger_20240823232736.ts +14 -0
- package/.history/src/utils/logger_20240824214930.js +14 -0
- package/.history/src/utils/store_20240812174230.ts +17 -0
- package/.history/src/utils/store_20240823232948.ts +29 -0
- package/.history/src/utils/store_20240824214020.js +17 -0
- package/.history/src/utils/store_20240824214955.js +29 -0
- package/.history/src/utils/waitUtil_20240812174230.ts +4 -0
- package/.history/src/utils/waitUtil_20240823232739.ts +4 -0
- package/.history/src/utils/waitUtil_20240824214024.js +4 -0
- package/.history/src/utils/waitUtil_20240824215009.js +4 -0
- package/.history/test/js/title_20240428215305.js +254 -0
- package/.history/test/js/title_20240429221911.js +227 -0
- package/.history/test/js/title_20240429222806.js +243 -0
- package/.history/test/js/title_20240429222854.js +263 -0
- package/.history/test/js/title_20240429222906.js +263 -0
- package/.history/test/js/title_20240429235639.js +263 -0
- package/.history/test/js/title_20240429235840.js +263 -0
- package/.history/test/js/title_20240430014721.js +262 -0
- package/.history/test/js/title_20240430014759.js +254 -0
- package/.history/test/js/title_20240430134612.js +285 -0
- package/.history/test/js/title_20240430141051.js +285 -0
- package/.history/test/js/title_20240430173745.js +245 -0
- package/.history/tsconfig_20240812174230.json +22 -0
- package/.history/tsconfig_20240824010157.json +19 -0
- package/.history/tsconfig_20240824220700.json +20 -0
- package/.history/tsconfig_20240825011301.json +20 -0
- package/.history/webpack.config_20240423002825.js +37 -0
- package/.history/webpack.config_20240430001157.js +38 -0
- package/.history/webpack.config_20240430001309.js +37 -0
- package/.history/webpack.config_20240430002112.js +37 -0
- package/CLAUDE.md +96 -0
- package/LICENSE +21 -0
- package/README.md +108 -39
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/core/drawer.ts.html +1264 -0
- package/coverage/lcov-report/core/index.html +146 -0
- package/coverage/lcov-report/core/resourceManager.ts.html +136 -0
- package/coverage/lcov-report/core/scenarioManager.ts.html +373 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +146 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/resource/ImageObject.ts.html +433 -0
- package/coverage/lcov-report/resource/index.html +131 -0
- package/coverage/lcov-report/resource/soundObject.ts.html +346 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/utils/TextMeasurer.ts.html +520 -0
- package/coverage/lcov-report/utils/index.html +161 -0
- package/coverage/lcov-report/utils/logger.ts.html +142 -0
- package/coverage/lcov-report/utils/store.ts.html +151 -0
- package/coverage/lcov-report/utils/waitUtil.ts.html +97 -0
- package/coverage/lcov.info +882 -0
- package/dist/README.md +294 -0
- package/dist/engineConfig.json +10 -0
- package/dist/package.json +51 -0
- package/dist/parser/cli.js +61 -0
- package/dist/parser/parser.js +53 -0
- package/{src → dist/src}/core/drawer.js +0 -9
- package/dist/src/core/drawer.js.map +1 -0
- package/dist/src/core/index.js +969 -0
- package/{src → dist/src}/core/scenarioManager.js +5 -6
- package/dist/src/core/scenarioManager.js.map +1 -0
- package/{src → dist/src}/resource/soundObject.js +4 -2
- package/dist/src/resource/soundObject.js.map +1 -0
- package/dist/src/utils/fallbackTemplate.js +13 -0
- package/dist/src/utils/fallbackTemplate.js.map +1 -0
- package/dist/webtalekit-alpha-0.2.13.tgz +0 -0
- package/docs/event-system-specification.md +493 -0
- package/docs/glossary.html +833 -0
- package/docs/index.html +296 -0
- package/docs/tag-reference.html +1317 -0
- package/docs/ui-template-guide.html +1068 -0
- package/example/README.md +29 -0
- package/example/engineConfig.json +10 -0
- package/example/package-lock.json +5145 -0
- package/example/package.json +26 -0
- package/example/src/index.js +13 -0
- package/example/src/resource/background/beach.jpg +0 -0
- package/example/src/resource/background/city.jpg +0 -0
- package/example/src/resource/background/crossroad.jpg +0 -0
- package/example/src/resource/background/forest.jpg +0 -0
- package/example/src/resource/background/laboratory.jpg +0 -0
- package/example/src/resource/background/library.jpg +0 -0
- package/example/src/resource/background/living_room.jpg +0 -0
- package/example/src/resource/background/music_room.jpg +0 -0
- package/example/src/resource/background/stage.jpg +0 -0
- package/example/src/resource/background/sunset.jpg +0 -0
- package/example/src/resource/background/title_bg.png +0 -0
- package/example/src/resource/bgm/calm_music.wav +0 -0
- package/example/src/resource/bgm/doorbell.mp3 +0 -0
- package/example/src/resource/bgm/nc366476_Virtual_Voyage.mp3 +0 -0
- package/example/src/resource/bgm/title_theme.mp3 +0 -0
- package/example/src/resource/chara/dancer.png +0 -0
- package/example/src/resource/chara/guest.png +0 -0
- package/example/src/resource/chara/guide.png +0 -0
- package/example/src/resource/chara/scientist.png +0 -0
- package/example/src/resource/config.js +0 -0
- package/example/src/resource/se/doorbell.mp3 +0 -0
- package/example/src/resource/system/systemPicture/01_message/message.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button2.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button3.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/auto.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/auto2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/close.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/close2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/config.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/config2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/load.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/load2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/log.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/log2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/menu.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/menu2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qload.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qload2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qsave.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qsave2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/save.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/save2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/screen.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/screen2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/skip.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/skip2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/title.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/title2.png +0 -0
- package/example/src/resource/system/systemPicture//345/210/251/347/224/250/350/246/217/347/264/204.txt +0 -0
- package/example/src/resource/system/wait.gif +0 -0
- package/example/src/scene/animation.scene +28 -0
- package/example/src/scene/background.scene +29 -0
- package/example/src/scene/character.scene +26 -0
- package/example/src/scene/choice.scene +97 -0
- package/example/src/scene/dialog.scene +105 -0
- package/example/src/scene/effects.scene +38 -0
- package/example/src/scene/en/animation.scene +28 -0
- package/example/src/scene/en/background.scene +26 -0
- package/example/src/scene/en/character.scene +26 -0
- package/example/src/scene/en/choice.scene +32 -0
- package/example/src/scene/en/effects.scene +37 -0
- package/example/src/scene/en/sound.scene +26 -0
- package/example/src/scene/en/text.scene +26 -0
- package/example/src/scene/en/title.scene +39 -0
- package/example/src/scene/if_test.scene +37 -0
- package/example/src/scene/resource-error-test.scene +15 -0
- package/example/src/scene/save-load-test.scene +48 -0
- package/example/src/scene/sound.scene +26 -0
- package/example/src/scene/test_error.scene +21 -0
- package/example/src/scene/text.scene +34 -0
- package/example/src/scene/title.scene +51 -0
- package/example/src/screen/incoming.html +474 -0
- package/example/src/screen/title.html +135 -0
- package/example/src/template.html +16 -0
- package/example/test-results/.last-run.json +4 -0
- package/example/webpack.config.js +69 -0
- package/image.png +0 -0
- package/package.json +3 -1
- package/playwright-report/index.html +71 -0
- package/s-plan1-5Light-s-1.jpg +0 -0
- package/test-results/.last-run.json +6 -0
- package/tests/e2e/if-global-attribute.spec.js +90 -0
- package/tests/e2e/resource-error-handling.spec.js +58 -0
- package/tests/e2e/screenshots/before-error-check.png +0 -0
- package/tests/e2e/screenshots/choices.png +0 -0
- package/tests/e2e/screenshots/message-window-click-wait.png +0 -0
- package/src/core/drawer.js.map +0 -1
- package/src/core/scenarioManager.js.map +0 -1
- package/src/resource/soundObject.js.map +0 -1
- /package/{src → dist/src}/core/resourceManager.js +0 -0
- /package/{src → dist/src}/core/resourceManager.js.map +0 -0
- /package/{src → dist/src}/resource/ImageObject.js +0 -0
- /package/{src → dist/src}/resource/ImageObject.js.map +0 -0
- /package/{src → dist/src}/utils/logger.js +0 -0
- /package/{src → dist/src}/utils/logger.js.map +0 -0
- /package/{src → dist/src}/utils/store.js +0 -0
- /package/{src → dist/src}/utils/store.js.map +0 -0
- /package/{src → dist/src}/utils/waitUtil.js +0 -0
- /package/{src → dist/src}/utils/waitUtil.js.map +0 -0
|
@@ -22,7 +22,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.ScenarioManager = void 0;
|
|
24
24
|
var ImageObject_1 = require("../resource/ImageObject");
|
|
25
|
-
var logger_1 = require("../utils/logger");
|
|
26
25
|
var ScenarioManager = /** @class */ (function () {
|
|
27
26
|
function ScenarioManager() {
|
|
28
27
|
this.background = new ImageObject_1.ImageObject();
|
|
@@ -39,7 +38,6 @@ var ScenarioManager = /** @class */ (function () {
|
|
|
39
38
|
}
|
|
40
39
|
ScenarioManager.prototype.setScenario = function (scenario, sceneName) {
|
|
41
40
|
if (sceneName === void 0) { sceneName = ''; }
|
|
42
|
-
(0, logger_1.outputLog)('call', 'debug', { scenario: scenario, sceneName: sceneName });
|
|
43
41
|
this.scenarioData = scenario;
|
|
44
42
|
this.progress.currentScene = sceneName;
|
|
45
43
|
this.progress.currentIndex = 0;
|
|
@@ -48,7 +46,8 @@ var ScenarioManager = /** @class */ (function () {
|
|
|
48
46
|
var _a, _b;
|
|
49
47
|
// 区別にsub=trueを追加
|
|
50
48
|
var _scenario = scenario.map(function (item) { return (__assign(__assign({}, item), { sub: true })); });
|
|
51
|
-
|
|
49
|
+
// この行を消すと動く
|
|
50
|
+
// ('call','debug', {scenario, index})
|
|
52
51
|
// index指定がある場合はその値に挿入する
|
|
53
52
|
if (index) {
|
|
54
53
|
(_a = this.scenarioData).splice.apply(_a, __spreadArray([index, 0], _scenario, false));
|
|
@@ -57,13 +56,11 @@ var ScenarioManager = /** @class */ (function () {
|
|
|
57
56
|
// 現在の位置に挿入する
|
|
58
57
|
(_b = this.scenarioData).splice.apply(_b, __spreadArray([this.progress.currentIndex, 0], _scenario, false));
|
|
59
58
|
}
|
|
60
|
-
(0, logger_1.outputLog)('call', 'debug', this.scenarioData);
|
|
61
59
|
};
|
|
62
60
|
ScenarioManager.prototype.getScenario = function () {
|
|
63
61
|
return this.scenarioData;
|
|
64
62
|
};
|
|
65
63
|
ScenarioManager.prototype.next = function () {
|
|
66
|
-
(0, logger_1.outputLog)('call: index:', 'debug', this.progress.currentIndex);
|
|
67
64
|
if (this.progress.currentIndex <= this.scenarioData.length) {
|
|
68
65
|
var nextScenario = this.scenarioData[this.progress.currentIndex];
|
|
69
66
|
this.progress.currentIndex += 1;
|
|
@@ -80,7 +77,6 @@ var ScenarioManager = /** @class */ (function () {
|
|
|
80
77
|
return this.progress.currentIndex;
|
|
81
78
|
};
|
|
82
79
|
ScenarioManager.prototype.setIndex = function (index) {
|
|
83
|
-
(0, logger_1.outputLog)('call index:', 'debug', index);
|
|
84
80
|
this.progress.currentIndex = index;
|
|
85
81
|
};
|
|
86
82
|
ScenarioManager.prototype.setSceneName = function (sceneName) {
|
|
@@ -92,6 +88,9 @@ var ScenarioManager = /** @class */ (function () {
|
|
|
92
88
|
ScenarioManager.prototype.setHistory = function (text) {
|
|
93
89
|
this.backlist.push(text);
|
|
94
90
|
};
|
|
91
|
+
ScenarioManager.prototype.getHistory = function () {
|
|
92
|
+
return this.backlist;
|
|
93
|
+
};
|
|
95
94
|
ScenarioManager.prototype.setSelectedChoice = function (prompt, id) {
|
|
96
95
|
this.progress.selected[this.progress.currentScene] = { prompt: prompt, id: id };
|
|
97
96
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenarioManager.js","sourceRoot":"","sources":["../../../src/core/scenarioManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -42,8 +42,9 @@ var SoundObject = /** @class */ (function () {
|
|
|
42
42
|
// 表示済みの画像を管理するクラス
|
|
43
43
|
this.audio = null;
|
|
44
44
|
this.ctx = new AudioContext();
|
|
45
|
-
this.source = this.ctx.createBufferSource();
|
|
46
45
|
this.isPlaying = false;
|
|
46
|
+
this.source = this.ctx.createBufferSource();
|
|
47
|
+
this.src = '';
|
|
47
48
|
this.ctx = new AudioContext();
|
|
48
49
|
}
|
|
49
50
|
SoundObject.prototype.getAudio = function () {
|
|
@@ -89,6 +90,7 @@ var SoundObject = /** @class */ (function () {
|
|
|
89
90
|
if (!src || src.length == 0) {
|
|
90
91
|
return [2 /*return*/, this];
|
|
91
92
|
}
|
|
93
|
+
this.src = src;
|
|
92
94
|
return [4 /*yield*/, fetch(src)];
|
|
93
95
|
case 1: return [4 /*yield*/, (_b.sent()).arrayBuffer()];
|
|
94
96
|
case 2:
|
|
@@ -126,7 +128,7 @@ var SoundObject = /** @class */ (function () {
|
|
|
126
128
|
};
|
|
127
129
|
};
|
|
128
130
|
SoundObject.prototype.stop = function () {
|
|
129
|
-
if (this.source
|
|
131
|
+
if (this.source) {
|
|
130
132
|
this.source.stop();
|
|
131
133
|
this.source.disconnect();
|
|
132
134
|
this.source = null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soundObject.js","sourceRoot":"","sources":["../../../src/resource/soundObject.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultDialogTemplate = void 0;
|
|
4
|
+
function getDefaultDialogTemplate() {
|
|
5
|
+
var htmlString = "\n <dialog id=\"dialogContainer\">\n <div class=\"dialog-content\">\n <div class=\"dialog-header\">\n <button data-close class=\"dialog-close\">×</button>\n </div>\n <div class=\"dialog-body\">\n <p data-prompt class=\"dialog-prompt\"></p>\n <div data-buttons class=\"dialog-buttons\">\n </div>\n </div>\n <div class=\"dialog-footer\" data-options></div>\n </div>\n </dialog>\n ";
|
|
6
|
+
var styleString = "\n #dialogContainer {\n border: 1px solid #ccc;\n border-radius: 4px;\n padding: 0;\n width: 400px;\n }\n .dialog-content { padding: 20px; }\n .dialog-header { text-align: right; margin-bottom: 10px; }\n .dialog-close { background: none; border: none; font-size: 18px; cursor: pointer; }\n .dialog-body { display: flex; flex-direction: column; align-items: center; }\n .dialog-footer { display: flex; gap: 10px; justify-content: flex-end; }\n .display-buttons { display: flex; justify-content: flex-end; width: 100%; gap: 5px; }\n .dialog-button {\n padding: 8px 16px;\n border: 1px solid #007bff;\n background: #007bff;\n color: white;\n border-radius: 4px;\n cursor: pointer;\n }\n .dialog-button:hover { background: #0056b3; }\n dialog::backdrop {\n background-color: rgba(0, 0, 0, 0.8);\n }\n ";
|
|
7
|
+
return {
|
|
8
|
+
htmlString: htmlString,
|
|
9
|
+
styleString: styleString
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
exports.getDefaultDialogTemplate = getDefaultDialogTemplate;
|
|
13
|
+
//# sourceMappingURL=fallbackTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallbackTemplate.js","sourceRoot":"","sources":["../../../src/utils/fallbackTemplate.ts"],"names":[],"mappings":";;;AAAA,SAAgB,wBAAwB;IACtC,IAAM,UAAU,GAAG,seAchB,CAAC;IACJ,IAAM,WAAW,GAAG,g+BAyBjB,CAAC;IACJ,OAAO;QACL,UAAU,YAAA;QACV,WAAW,aAAA;KACZ,CAAC;AACJ,CAAC;AA9CD,4DA8CC"}
|
|
Binary file
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# WebTaleKit イベント発火機能 仕様書
|
|
2
|
+
|
|
3
|
+
## 概要
|
|
4
|
+
|
|
5
|
+
WebTaleKitのフロントエンドフレームワーク向けイベント発火機能の完全仕様です。全メソッド実行時に前後でイベントを発火し、キューベースで順次処理を行います。
|
|
6
|
+
|
|
7
|
+
## 1. 対象メソッドの範囲
|
|
8
|
+
|
|
9
|
+
### 対象クラス
|
|
10
|
+
- **Core クラス**: メインゲームエンジン
|
|
11
|
+
- **ScenarioManager クラス**: シナリオ管理
|
|
12
|
+
- **Drawer クラス**: 描画処理
|
|
13
|
+
- **ResourceManager クラス**: リソース管理
|
|
14
|
+
- **ImageObject クラス**: 画像オブジェクト
|
|
15
|
+
- **SoundObject クラス**: 音声オブジェクト
|
|
16
|
+
|
|
17
|
+
### 対象メソッド
|
|
18
|
+
各クラスの全メソッド(constructorを除く)
|
|
19
|
+
|
|
20
|
+
#### Core クラスの主要メソッド
|
|
21
|
+
- `textHandler`, `choiceHandler`, `showHandler`, `hideHandler`
|
|
22
|
+
- `jumpHandler`, `soundHandler`, `sayHandler`, `ifHandler`
|
|
23
|
+
- `callHandler`, `moveToHandler`, `routeHandler`, `waitHandler`
|
|
24
|
+
- `dialogHandler`, `newpageHandler`, `executeCode`
|
|
25
|
+
- `setBackground`, `getBackground` など
|
|
26
|
+
|
|
27
|
+
#### ScenarioManager クラスの主要メソッド
|
|
28
|
+
- `setScenario`, `addScenario`, `getScenario`
|
|
29
|
+
- `next`, `hasNext`, `getIndex`, `setIndex`
|
|
30
|
+
- `setSceneName`, `getSceneName`, `setHistory`
|
|
31
|
+
- `setSelectedChoice` など
|
|
32
|
+
|
|
33
|
+
#### Drawer クラスの主要メソッド
|
|
34
|
+
- `drawName`, `drawText`, `drawChoices`
|
|
35
|
+
- `fadeIn`, `fadeOut`, `show`, `moveTo`
|
|
36
|
+
- `clear`, `drawCanvas`, `setVisibility` など
|
|
37
|
+
|
|
38
|
+
## 2. イベント仕様
|
|
39
|
+
|
|
40
|
+
### イベントタイミング
|
|
41
|
+
- **メソッド実行前**: `method:before`
|
|
42
|
+
- **メソッド実行後**: `method:after`
|
|
43
|
+
|
|
44
|
+
### イベントデータ構造
|
|
45
|
+
```typescript
|
|
46
|
+
interface EventData {
|
|
47
|
+
eventType: 'method:before' | 'method:after'
|
|
48
|
+
className: string // 'Core', 'Drawer', 'ScenarioManager' など
|
|
49
|
+
methodName: string // 'textHandler', 'drawText' など
|
|
50
|
+
arguments: any[] // メソッドの引数配列
|
|
51
|
+
result?: any // 実行結果(afterのみ)
|
|
52
|
+
timestamp: number // 実行タイムスタンプ
|
|
53
|
+
executionTime?: number // 実行時間(afterのみ、ms)
|
|
54
|
+
id: string // イベント固有ID
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### イベント名規則
|
|
59
|
+
- **実行前**: `webtalekit:method:before`
|
|
60
|
+
- **実行後**: `webtalekit:method:after`
|
|
61
|
+
|
|
62
|
+
## 3. キューベースのイベント発火機構
|
|
63
|
+
|
|
64
|
+
### EventQueue クラス
|
|
65
|
+
```typescript
|
|
66
|
+
interface EventData {
|
|
67
|
+
eventType: 'method:before' | 'method:after'
|
|
68
|
+
className: string
|
|
69
|
+
methodName: string
|
|
70
|
+
arguments: any[]
|
|
71
|
+
result?: any
|
|
72
|
+
timestamp: number
|
|
73
|
+
executionTime?: number
|
|
74
|
+
id: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
class EventQueue {
|
|
78
|
+
private queue: EventData[] = []
|
|
79
|
+
private isProcessing: boolean = false
|
|
80
|
+
private maxQueueSize: number = 1000
|
|
81
|
+
private batchSize: number = 10
|
|
82
|
+
|
|
83
|
+
enqueue(event: EventData): void {
|
|
84
|
+
// キューサイズ制限
|
|
85
|
+
if (this.queue.length >= this.maxQueueSize) {
|
|
86
|
+
this.queue.shift() // 古いイベントを削除
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.queue.push(event)
|
|
90
|
+
|
|
91
|
+
if (!this.isProcessing) {
|
|
92
|
+
this.processQueue()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private async processQueue(): Promise<void> {
|
|
97
|
+
this.isProcessing = true
|
|
98
|
+
|
|
99
|
+
while (this.queue.length > 0) {
|
|
100
|
+
const batch = this.queue.splice(0, this.batchSize)
|
|
101
|
+
|
|
102
|
+
// バッチ処理で複数イベントを同時発火
|
|
103
|
+
await Promise.all(
|
|
104
|
+
batch.map(event => this.dispatchEvent(event))
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
// CPU負荷を軽減するための遅延
|
|
108
|
+
if (this.queue.length > 0) {
|
|
109
|
+
await new Promise(resolve => setTimeout(resolve, 1))
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this.isProcessing = false
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private async dispatchEvent(event: EventData): Promise<void> {
|
|
117
|
+
const customEvent = new CustomEvent(`webtalekit:${event.eventType}`, {
|
|
118
|
+
detail: event,
|
|
119
|
+
bubbles: false,
|
|
120
|
+
cancelable: false
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// 非同期でイベント発火
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
document.dispatchEvent(customEvent)
|
|
126
|
+
}, 0)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### EventEmitter クラス
|
|
132
|
+
```typescript
|
|
133
|
+
class EventEmitter {
|
|
134
|
+
private static instance: EventEmitter
|
|
135
|
+
private eventQueue: EventQueue = new EventQueue()
|
|
136
|
+
private eventId: number = 0
|
|
137
|
+
|
|
138
|
+
static getInstance(): EventEmitter {
|
|
139
|
+
if (!EventEmitter.instance) {
|
|
140
|
+
EventEmitter.instance = new EventEmitter()
|
|
141
|
+
}
|
|
142
|
+
return EventEmitter.instance
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
emitBefore(className: string, methodName: string, args: any[]): string {
|
|
146
|
+
const eventId = this.generateEventId()
|
|
147
|
+
const event: EventData = {
|
|
148
|
+
eventType: 'method:before',
|
|
149
|
+
className,
|
|
150
|
+
methodName,
|
|
151
|
+
arguments: args,
|
|
152
|
+
timestamp: performance.now(),
|
|
153
|
+
id: eventId
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.eventQueue.enqueue(event)
|
|
157
|
+
return eventId
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
emitAfter(eventId: string, className: string, methodName: string,
|
|
161
|
+
args: any[], result: any, startTime: number): void {
|
|
162
|
+
const event: EventData = {
|
|
163
|
+
eventType: 'method:after',
|
|
164
|
+
className,
|
|
165
|
+
methodName,
|
|
166
|
+
arguments: args,
|
|
167
|
+
result,
|
|
168
|
+
timestamp: performance.now(),
|
|
169
|
+
executionTime: performance.now() - startTime,
|
|
170
|
+
id: eventId
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.eventQueue.enqueue(event)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private generateEventId(): string {
|
|
177
|
+
return `evt_${++this.eventId}_${Date.now()}`
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### メソッドラッパーの実装
|
|
183
|
+
```typescript
|
|
184
|
+
function withEventEmission(target: any, className: string) {
|
|
185
|
+
const emitter = EventEmitter.getInstance()
|
|
186
|
+
|
|
187
|
+
// クラスの全メソッドをラップ
|
|
188
|
+
Object.getOwnPropertyNames(target.prototype).forEach(methodName => {
|
|
189
|
+
if (methodName !== 'constructor' &&
|
|
190
|
+
typeof target.prototype[methodName] === 'function') {
|
|
191
|
+
|
|
192
|
+
const originalMethod = target.prototype[methodName]
|
|
193
|
+
|
|
194
|
+
target.prototype[methodName] = function(...args: any[]) {
|
|
195
|
+
const startTime = performance.now()
|
|
196
|
+
const eventId = emitter.emitBefore(className, methodName, args)
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
const result = originalMethod.apply(this, args)
|
|
200
|
+
|
|
201
|
+
// Promiseの場合
|
|
202
|
+
if (result instanceof Promise) {
|
|
203
|
+
return result.then(resolvedResult => {
|
|
204
|
+
emitter.emitAfter(eventId, className, methodName,
|
|
205
|
+
args, resolvedResult, startTime)
|
|
206
|
+
return resolvedResult
|
|
207
|
+
}).catch(error => {
|
|
208
|
+
emitter.emitAfter(eventId, className, methodName,
|
|
209
|
+
args, error, startTime)
|
|
210
|
+
throw error
|
|
211
|
+
})
|
|
212
|
+
} else {
|
|
213
|
+
emitter.emitAfter(eventId, className, methodName,
|
|
214
|
+
args, result, startTime)
|
|
215
|
+
return result
|
|
216
|
+
}
|
|
217
|
+
} catch (error) {
|
|
218
|
+
emitter.emitAfter(eventId, className, methodName,
|
|
219
|
+
args, error, startTime)
|
|
220
|
+
throw error
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 4. フロントエンド向けAPIインターフェース
|
|
229
|
+
|
|
230
|
+
### 基本的なイベントリスナー登録
|
|
231
|
+
```javascript
|
|
232
|
+
// 全メソッドの実行前後を監視
|
|
233
|
+
document.addEventListener('webtalekit:method:before', (event) => {
|
|
234
|
+
const { className, methodName, arguments: args } = event.detail
|
|
235
|
+
console.log(`[BEFORE] ${className}.${methodName}`, args)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
document.addEventListener('webtalekit:method:after', (event) => {
|
|
239
|
+
const { className, methodName, result, executionTime } = event.detail
|
|
240
|
+
console.log(`[AFTER] ${className}.${methodName}`, result, `${executionTime}ms`)
|
|
241
|
+
})
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### フィルタリング機能付きAPI
|
|
245
|
+
```javascript
|
|
246
|
+
// WebTaleKit専用のイベント管理クラス
|
|
247
|
+
class WebTaleKitEvents {
|
|
248
|
+
// 特定のクラスのメソッドのみ監視
|
|
249
|
+
onClassMethod(className, callback) {
|
|
250
|
+
const handler = (event) => {
|
|
251
|
+
if (event.detail.className === className) {
|
|
252
|
+
callback(event.detail)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
document.addEventListener('webtalekit:method:before', handler)
|
|
256
|
+
document.addEventListener('webtalekit:method:after', handler)
|
|
257
|
+
|
|
258
|
+
return () => {
|
|
259
|
+
document.removeEventListener('webtalekit:method:before', handler)
|
|
260
|
+
document.removeEventListener('webtalekit:method:after', handler)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// 特定のメソッドのみ監視
|
|
265
|
+
onMethod(className, methodName, callback) {
|
|
266
|
+
const handler = (event) => {
|
|
267
|
+
const detail = event.detail
|
|
268
|
+
if (detail.className === className && detail.methodName === methodName) {
|
|
269
|
+
callback(detail)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
document.addEventListener('webtalekit:method:before', handler)
|
|
273
|
+
document.addEventListener('webtalekit:method:after', handler)
|
|
274
|
+
|
|
275
|
+
return () => {
|
|
276
|
+
document.removeEventListener('webtalekit:method:before', handler)
|
|
277
|
+
document.removeEventListener('webtalekit:method:after', handler)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// beforeのみ監視
|
|
282
|
+
onBefore(className, methodName, callback) {
|
|
283
|
+
const handler = (event) => {
|
|
284
|
+
const detail = event.detail
|
|
285
|
+
if (detail.className === className && detail.methodName === methodName) {
|
|
286
|
+
callback(detail)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
document.addEventListener('webtalekit:method:before', handler)
|
|
290
|
+
|
|
291
|
+
return () => {
|
|
292
|
+
document.removeEventListener('webtalekit:method:before', handler)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// afterのみ監視
|
|
297
|
+
onAfter(className, methodName, callback) {
|
|
298
|
+
const handler = (event) => {
|
|
299
|
+
const detail = event.detail
|
|
300
|
+
if (detail.className === className && detail.methodName === methodName) {
|
|
301
|
+
callback(detail)
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
document.addEventListener('webtalekit:method:after', handler)
|
|
305
|
+
|
|
306
|
+
return () => {
|
|
307
|
+
document.removeEventListener('webtalekit:method:after', handler)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// グローバルに公開
|
|
313
|
+
window.WebTaleKitEvents = new WebTaleKitEvents()
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### React向けのカスタムフック
|
|
317
|
+
```javascript
|
|
318
|
+
// React用カスタムフック
|
|
319
|
+
function useWebTaleKitMethod(className, methodName, eventType = 'both') {
|
|
320
|
+
const [eventData, setEventData] = useState(null)
|
|
321
|
+
|
|
322
|
+
useEffect(() => {
|
|
323
|
+
const unsubscribers = []
|
|
324
|
+
|
|
325
|
+
if (eventType === 'before' || eventType === 'both') {
|
|
326
|
+
const unsubBefore = window.WebTaleKitEvents.onBefore(
|
|
327
|
+
className, methodName, setEventData
|
|
328
|
+
)
|
|
329
|
+
unsubscribers.push(unsubBefore)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (eventType === 'after' || eventType === 'both') {
|
|
333
|
+
const unsubAfter = window.WebTaleKitEvents.onAfter(
|
|
334
|
+
className, methodName, setEventData
|
|
335
|
+
)
|
|
336
|
+
unsubscribers.push(unsubAfter)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return () => {
|
|
340
|
+
unsubscribers.forEach(unsub => unsub())
|
|
341
|
+
}
|
|
342
|
+
}, [className, methodName, eventType])
|
|
343
|
+
|
|
344
|
+
return eventData
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// 使用例
|
|
348
|
+
function GameDebugPanel() {
|
|
349
|
+
const textEvent = useWebTaleKitMethod('Core', 'textHandler')
|
|
350
|
+
const drawEvent = useWebTaleKitMethod('Drawer', 'drawText')
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<div>
|
|
354
|
+
<div>Last text: {textEvent?.arguments?.[0]}</div>
|
|
355
|
+
<div>Draw time: {drawEvent?.executionTime}ms</div>
|
|
356
|
+
</div>
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Vue.js向けのComposable
|
|
362
|
+
```javascript
|
|
363
|
+
// Vue 3 Composition API用
|
|
364
|
+
function useWebTaleKitEvents() {
|
|
365
|
+
const events = ref([])
|
|
366
|
+
const latestEvent = ref(null)
|
|
367
|
+
|
|
368
|
+
const subscribe = (className, methodName, eventType = 'both') => {
|
|
369
|
+
const unsubscribers = []
|
|
370
|
+
|
|
371
|
+
const handler = (eventData) => {
|
|
372
|
+
events.value.push(eventData)
|
|
373
|
+
latestEvent.value = eventData
|
|
374
|
+
|
|
375
|
+
// 最新100件のみ保持
|
|
376
|
+
if (events.value.length > 100) {
|
|
377
|
+
events.value.shift()
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (eventType === 'before' || eventType === 'both') {
|
|
382
|
+
unsubscribers.push(
|
|
383
|
+
window.WebTaleKitEvents.onBefore(className, methodName, handler)
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (eventType === 'after' || eventType === 'both') {
|
|
388
|
+
unsubscribers.push(
|
|
389
|
+
window.WebTaleKitEvents.onAfter(className, methodName, handler)
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return () => {
|
|
394
|
+
unsubscribers.forEach(unsub => unsub())
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return {
|
|
399
|
+
events: readonly(events),
|
|
400
|
+
latestEvent: readonly(latestEvent),
|
|
401
|
+
subscribe
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## 5. 実装手順
|
|
407
|
+
|
|
408
|
+
### 1. 初期化コード
|
|
409
|
+
```javascript
|
|
410
|
+
// 各クラスにイベント発火機能を追加
|
|
411
|
+
withEventEmission(Core, 'Core')
|
|
412
|
+
withEventEmission(Drawer, 'Drawer')
|
|
413
|
+
withEventEmission(ScenarioManager, 'ScenarioManager')
|
|
414
|
+
withEventEmission(ResourceManager, 'ResourceManager')
|
|
415
|
+
withEventEmission(ImageObject, 'ImageObject')
|
|
416
|
+
withEventEmission(SoundObject, 'SoundObject')
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### 2. 利用例
|
|
420
|
+
|
|
421
|
+
#### 基本的な使用方法
|
|
422
|
+
```javascript
|
|
423
|
+
document.addEventListener('webtalekit:method:before', (event) => {
|
|
424
|
+
console.log('実行前:', event.detail)
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
document.addEventListener('webtalekit:method:after', (event) => {
|
|
428
|
+
console.log('実行後:', event.detail)
|
|
429
|
+
})
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
#### 特定メソッドのみ監視
|
|
433
|
+
```javascript
|
|
434
|
+
const unsubscribe = window.WebTaleKitEvents.onMethod(
|
|
435
|
+
'Core', 'textHandler', (eventData) => {
|
|
436
|
+
console.log('テキスト表示:', eventData)
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
// 監視停止
|
|
441
|
+
unsubscribe()
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### React での使用
|
|
445
|
+
```javascript
|
|
446
|
+
function MyComponent() {
|
|
447
|
+
const textEvent = useWebTaleKitMethod('Core', 'textHandler')
|
|
448
|
+
|
|
449
|
+
return (
|
|
450
|
+
<div>
|
|
451
|
+
{textEvent && (
|
|
452
|
+
<p>最新のテキスト: {textEvent.arguments?.[0]}</p>
|
|
453
|
+
)}
|
|
454
|
+
</div>
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
## 6. パフォーマンス考慮事項
|
|
460
|
+
|
|
461
|
+
### キューシステム
|
|
462
|
+
- **最大キューサイズ**: 1000イベント
|
|
463
|
+
- **バッチサイズ**: 10イベント/バッチ
|
|
464
|
+
- **バッチ間遅延**: 1ms
|
|
465
|
+
|
|
466
|
+
### メモリ管理
|
|
467
|
+
- 古いイベントの自動削除
|
|
468
|
+
- WeakRef使用による循環参照防止
|
|
469
|
+
|
|
470
|
+
### CPU負荷軽減
|
|
471
|
+
- 非同期イベント発火
|
|
472
|
+
- バッチ処理による効率化
|
|
473
|
+
|
|
474
|
+
## 7. 注意事項
|
|
475
|
+
|
|
476
|
+
- **非同期実行**: イベントは非同期で発火されるため、メソッド実行の直後に完了していない場合があります
|
|
477
|
+
- **エラー処理**: メソッドでエラーが発生した場合もafterイベントは発火され、resultにErrorオブジェクトが含まれます
|
|
478
|
+
- **パフォーマンス**: 大量のイベントが発生する場合、キューによる制御が行われます
|
|
479
|
+
|
|
480
|
+
## 8. 拡張可能性
|
|
481
|
+
|
|
482
|
+
この設計により以下の拡張が可能です:
|
|
483
|
+
|
|
484
|
+
- イベントフィルタリングの詳細化
|
|
485
|
+
- イベントの永続化(ログ保存)
|
|
486
|
+
- リアルタイム監視ダッシュボード
|
|
487
|
+
- デバッグツールとの連携
|
|
488
|
+
- メトリクス収集機能
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
**作成日**: 2025-08-08
|
|
493
|
+
**バージョン**: 1.0.0
|