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.
- package/README.md +145 -70
- package/package.json +10 -2
- package/parser/checker.js +184 -0
- package/parser/checker.test.ts +491 -0
- package/parser/cli.js +34 -2
- package/parser/parser.js +25 -18
- package/src/core/defaultUIHandler.js +309 -0
- package/src/core/defaultUIHandler.js.map +1 -0
- package/{dist/src → src}/core/drawer.js +65 -40
- package/src/core/drawer.js.map +1 -0
- package/{dist/src → src}/core/index.js +188 -257
- package/{dist/src → src}/core/scenarioManager.js +29 -7
- package/src/core/scenarioManager.js.map +1 -0
- package/src/utils/eventBus.js +88 -0
- package/src/utils/eventBus.js.map +1 -0
- package/{dist/src → src}/utils/logger.js +45 -1
- package/src/utils/logger.js.map +1 -0
- package/{dist/src → src}/utils/store.js +5 -0
- package/src/utils/store.js.map +1 -0
- package/.claude/settings.local.json +0 -12
- package/.clinerules +0 -65
- package/.history/README_20240812174230.md +0 -193
- package/.history/README_20240812175424.md +0 -185
- package/.history/README_20240812191012.md +0 -185
- package/.history/README_20240812191155.md +0 -185
- package/.history/README_20240812191211.md +0 -185
- package/.history/README_20240812192035.md +0 -185
- package/.history/dist/src/core/index_20240815021552.js +0 -474
- package/.history/dist/src/core/index_20240815022042.js +0 -476
- package/.history/dist/src/core/index_20240815022206.js +0 -476
- package/.history/dist/src/core/index_20240815023104.js +0 -478
- package/.history/dist/src/core/index_20240817022019.js +0 -494
- package/.history/dist/src/core/index_20240818013827.js +0 -493
- package/.history/dist/src/core/index_20240820001418.js +0 -502
- package/.history/package_20240812174230.json +0 -45
- package/.history/package_20240825011731.json +0 -45
- package/.history/package_20240825011739.json +0 -44
- package/.history/parser/parser_20240812174230.js +0 -50
- package/.history/parser/parser_20240825012739.js +0 -47
- package/.history/parser/parser_20240825012835.js +0 -52
- package/.history/src/core/drawer_20240813091343.ts +0 -262
- package/.history/src/core/drawer_20240815232345.ts +0 -262
- package/.history/src/core/drawer_20240815232350.ts +0 -262
- package/.history/src/core/drawer_20240816025257.ts +0 -357
- package/.history/src/core/drawer_20240816025358.ts +0 -357
- package/.history/src/core/drawer_20240816030148.ts +0 -365
- package/.history/src/core/drawer_20240816231033.ts +0 -294
- package/.history/src/core/drawer_20240816231107.ts +0 -262
- package/.history/src/core/drawer_20240816231234.ts +0 -268
- package/.history/src/core/drawer_20240817013836.ts +0 -290
- package/.history/src/core/drawer_20240817015150.ts +0 -289
- package/.history/src/core/drawer_20240817015353.ts +0 -290
- package/.history/src/core/drawer_20240817021254.ts +0 -291
- package/.history/src/core/drawer_20240817023440.ts +0 -295
- package/.history/src/core/drawer_20240817023445.ts +0 -295
- package/.history/src/core/drawer_20240818015327.ts +0 -295
- package/.history/src/core/drawer_20240819231006.ts +0 -318
- package/.history/src/core/drawer_20240820002829.ts +0 -317
- package/.history/src/core/drawer_20240820003141.ts +0 -295
- package/.history/src/core/drawer_20240824010043.ts +0 -295
- package/.history/src/core/drawer_20240825013311.ts +0 -293
- package/.history/src/core/drawer_20240902235257.ts +0 -295
- package/.history/src/core/drawer_20240904002038.ts +0 -262
- package/.history/src/core/drawer_20240904004020.ts +0 -262
- package/.history/src/core/drawer_20240904004238.ts +0 -262
- package/.history/src/core/drawer_20240904005648.ts +0 -262
- package/.history/src/core/drawer_20240904005808.ts +0 -262
- package/.history/src/core/drawer_20240904010523.ts +0 -262
- package/.history/src/core/drawer_20240904011611.ts +0 -262
- package/.history/src/core/drawer_20240904011740.ts +0 -262
- package/.history/src/core/index_20240812190102.js +0 -443
- package/.history/src/core/index_20240812190105.js +0 -443
- package/.history/src/core/index_20240812205421.js +0 -452
- package/.history/src/core/index_20240812213441.js +0 -452
- package/.history/src/core/index_20240812214203.js +0 -453
- package/.history/src/core/index_20240813090823.js +0 -453
- package/.history/src/core/index_20240813230449.js +0 -452
- package/.history/src/core/index_20240813230539.js +0 -452
- package/.history/src/core/index_20240813231447.js +0 -453
- package/.history/src/core/index_20240813231449.js +0 -453
- package/.history/src/core/index_20240813231511.js +0 -453
- package/.history/src/core/index_20240813231531.js +0 -453
- package/.history/src/core/index_20240813231913.js +0 -453
- package/.history/src/core/index_20240813232356.js +0 -453
- package/.history/src/core/index_20240813232640.js +0 -453
- package/.history/src/core/index_20240813232900.js +0 -453
- package/.history/src/core/index_20240814221127.js +0 -454
- package/.history/src/core/index_20240814221322.js +0 -454
- package/.history/src/core/index_20240814221526.js +0 -454
- package/.history/src/core/index_20240814222048.js +0 -454
- package/.history/src/core/index_20240814222918.js +0 -459
- package/.history/src/core/index_20240814223136.js +0 -459
- package/.history/src/core/index_20240814223501.js +0 -464
- package/.history/src/core/index_20240814224347.js +0 -468
- package/.history/src/core/index_20240815013712.js +0 -474
- package/.history/src/core/index_20240815021534.js +0 -474
- package/.history/src/core/index_20240815023143.js +0 -477
- package/.history/src/core/index_20240815023207.js +0 -479
- package/.history/src/core/index_20240815023344.js +0 -481
- package/.history/src/core/index_20240815035600.js +0 -479
- package/.history/src/core/index_20240815041549.js +0 -480
- package/.history/src/core/index_20240815185515.js +0 -481
- package/.history/src/core/index_20240815192158.js +0 -481
- package/.history/src/core/index_20240815222912.js +0 -482
- package/.history/src/core/index_20240815224052.js +0 -483
- package/.history/src/core/index_20240815224843.js +0 -484
- package/.history/src/core/index_20240815224850.js +0 -483
- package/.history/src/core/index_20240815231706.js +0 -479
- package/.history/src/core/index_20240816025748.js +0 -483
- package/.history/src/core/index_20240816030102.js +0 -484
- package/.history/src/core/index_20240817013329.js +0 -485
- package/.history/src/core/index_20240817013526.js +0 -485
- package/.history/src/core/index_20240817013819.js +0 -488
- package/.history/src/core/index_20240817013829.js +0 -488
- package/.history/src/core/index_20240817014921.js +0 -494
- package/.history/src/core/index_20240817022057.js +0 -494
- package/.history/src/core/index_20240817023316.js +0 -493
- package/.history/src/core/index_20240818005637.js +0 -493
- package/.history/src/core/index_20240818005721.js +0 -493
- package/.history/src/core/index_20240818011804.js +0 -493
- package/.history/src/core/index_20240818013835.js +0 -493
- package/.history/src/core/index_20240818014310.js +0 -493
- package/.history/src/core/index_20240818014323.js +0 -493
- package/.history/src/core/index_20240818014333.js +0 -493
- package/.history/src/core/index_20240818020725.js +0 -496
- package/.history/src/core/index_20240819195504.js +0 -497
- package/.history/src/core/index_20240819202012.js +0 -495
- package/.history/src/core/index_20240819231228.js +0 -501
- package/.history/src/core/index_20240819232555.js +0 -502
- package/.history/src/core/index_20240819233404.js +0 -502
- package/.history/src/core/index_20240820003114.js +0 -495
- package/.history/src/core/index_20240820003120.js +0 -495
- package/.history/src/core/index_20240820003331.js +0 -495
- package/.history/src/core/index_20240820004126.js +0 -498
- package/.history/src/core/index_20240820004357.js +0 -497
- package/.history/src/core/index_20240820005103.js +0 -498
- package/.history/src/core/index_20240820005110.js +0 -499
- package/.history/src/core/index_20240820005206.js +0 -497
- package/.history/src/core/index_20240820005352.js +0 -497
- package/.history/src/core/index_20240823224904.ts +0 -505
- package/.history/src/core/index_20240823224905.js +0 -505
- package/.history/src/core/index_20240823231631.ts +0 -530
- package/.history/src/core/index_20240823231735.ts +0 -530
- package/.history/src/core/index_20240823232123.ts +0 -539
- package/.history/src/core/index_20240823232329.ts +0 -539
- package/.history/src/core/index_20240823233058.ts +0 -539
- package/.history/src/core/index_20240823234946.ts +0 -539
- package/.history/src/core/index_20240824005956.ts +0 -534
- package/.history/src/core/index_20240824010113.ts +0 -534
- package/.history/src/core/index_20240824010124.ts +0 -534
- package/.history/src/core/index_20240824010212.ts +0 -534
- package/.history/src/core/index_20240824010218.ts +0 -534
- package/.history/src/core/index_20240824010407.ts +0 -534
- package/.history/src/core/index_20240824010611.ts +0 -534
- package/.history/src/core/index_20240824010623.ts +0 -534
- package/.history/src/core/index_20240824010652.ts +0 -534
- package/.history/src/core/index_20240824011007.ts +0 -534
- package/.history/src/core/index_20240824210450.ts +0 -534
- package/.history/src/core/index_20240824210703.ts +0 -534
- package/.history/src/core/index_20240824210708.ts +0 -534
- package/.history/src/core/index_20240824211001.ts +0 -537
- package/.history/src/core/index_20240824211258.ts +0 -537
- package/.history/src/core/index_20240824211654.ts +0 -537
- package/.history/src/core/index_20240824211723.ts +0 -537
- package/.history/src/core/index_20240824211808.ts +0 -538
- package/.history/src/core/index_20240824214041.js +0 -538
- package/.history/src/core/index_20240824215312.ts +0 -538
- package/.history/src/core/index_20240824215341.ts +0 -538
- package/.history/src/core/index_20240824220703.ts +0 -538
- package/.history/src/core/index_20240824220709.ts +0 -538
- package/.history/src/core/index_20240825012244.ts +0 -536
- package/.history/src/core/index_20240825012435.ts +0 -539
- package/.history/src/core/index_20240825012440.ts +0 -539
- package/.history/src/core/index_20240826005054.ts +0 -539
- package/.history/src/core/index_20240826005321.ts +0 -540
- package/.history/src/core/index_20240826005410.ts +0 -539
- package/.history/src/core/index_20240826005418.ts +0 -539
- package/.history/src/core/index_20240830231825.ts +0 -539
- package/.history/src/core/index_20240831022416.ts +0 -539
- package/.history/src/core/index_20240901222314.js +0 -459
- package/.history/src/core/index_20240901222951.js +0 -459
- package/.history/src/core/index_20240901223824.js +0 -471
- package/.history/src/core/index_20240901223833.js +0 -468
- package/.history/src/core/index_20240902223954.js +0 -447
- package/.history/src/core/index_20240902224000.js +0 -446
- package/.history/src/core/index_20240902230345.js +0 -448
- package/.history/src/core/index_20240902231130.js +0 -449
- package/.history/src/core/index_20240902231559.js +0 -449
- package/.history/src/core/index_20240902232135.js +0 -449
- package/.history/src/core/index_20240902232809.js +0 -452
- package/.history/src/core/index_20240902232815.js +0 -452
- package/.history/src/core/index_20240903000104.js +0 -467
- package/.history/src/core/index_20240904001731.js +0 -444
- package/.history/src/core/index_20240904002038.ts +0 -539
- package/.history/src/core/index_20240904011848.js +0 -444
- package/.history/src/core/index_20240904012138.js +0 -444
- package/.history/src/core/index_20240904012743.js +0 -444
- package/.history/src/core/index_20240904013051.js +0 -444
- package/.history/src/core/resourceManager_20240403231531.ts +0 -16
- package/.history/src/core/resourceManager_20240823232627.ts +0 -17
- package/.history/src/core/resourceManager_20240824214014.js +0 -16
- package/.history/src/core/resourceManager_20240824214620.js +0 -17
- package/.history/src/core/scenarioManager_20240812203410.ts +0 -86
- package/.history/src/core/scenarioManager_20240812203839.ts +0 -94
- package/.history/src/core/scenarioManager_20240812213437.ts +0 -85
- package/.history/src/core/scenarioManager_20240813225852.ts +0 -85
- package/.history/src/core/scenarioManager_20240823235010.ts +0 -85
- package/.history/src/core/scenarioManager_20240904002038.ts +0 -94
- package/.history/src/core/scenarioManager_20240904012411.ts +0 -94
- package/.history/src/core/scenarioManager_20240904012519.ts +0 -94
- package/.history/src/index_20240403231531.js +0 -6
- package/.history/src/index_20240429233436.js +0 -8
- package/.history/src/index_20240429233926.js +0 -8
- package/.history/src/index_20240429234401.js +0 -7
- package/.history/src/index_20240429234404.js +0 -6
- package/.history/src/resource/soundObject_20240419004314.ts +0 -71
- package/.history/src/resource/soundObject_20240815034420.ts +0 -66
- package/.history/src/resource/soundObject_20240815034836.ts +0 -79
- package/.history/src/resource/soundObject_20240815034919.ts +0 -87
- package/.history/src/resource/soundObject_20240815040724.ts +0 -81
- package/.history/src/resource/soundObject_20240815041022.ts +0 -87
- package/.history/src/resource/soundObject_20240815042103.ts +0 -87
- package/.history/src/resource/soundObject_20240823235929.ts +0 -91
- package/.history/src/resource/soundObject_20240824213129.ts +0 -99
- package/.history/src/resource/soundObject_20240824213611.ts +0 -101
- package/.history/src/resource/soundObject_20240824215734.ts +0 -101
- package/.history/src/resource/soundObject_20240825004926.ts +0 -101
- package/.history/src/resource/soundObject_20240825004947.ts +0 -101
- package/.history/src/utils/logger_20240812174230.ts +0 -13
- package/.history/src/utils/logger_20240823232736.ts +0 -14
- package/.history/src/utils/logger_20240824214930.js +0 -14
- package/.history/src/utils/store_20240812174230.ts +0 -17
- package/.history/src/utils/store_20240823232948.ts +0 -29
- package/.history/src/utils/store_20240824214020.js +0 -17
- package/.history/src/utils/store_20240824214955.js +0 -29
- package/.history/src/utils/waitUtil_20240812174230.ts +0 -4
- package/.history/src/utils/waitUtil_20240823232739.ts +0 -4
- package/.history/src/utils/waitUtil_20240824214024.js +0 -4
- package/.history/src/utils/waitUtil_20240824215009.js +0 -4
- package/.history/test/js/title_20240428215305.js +0 -254
- package/.history/test/js/title_20240429221911.js +0 -227
- package/.history/test/js/title_20240429222806.js +0 -243
- package/.history/test/js/title_20240429222854.js +0 -263
- package/.history/test/js/title_20240429222906.js +0 -263
- package/.history/test/js/title_20240429235639.js +0 -263
- package/.history/test/js/title_20240429235840.js +0 -263
- package/.history/test/js/title_20240430014721.js +0 -262
- package/.history/test/js/title_20240430014759.js +0 -254
- package/.history/test/js/title_20240430134612.js +0 -285
- package/.history/test/js/title_20240430141051.js +0 -285
- package/.history/test/js/title_20240430173745.js +0 -245
- package/.history/tsconfig_20240812174230.json +0 -22
- package/.history/tsconfig_20240824010157.json +0 -19
- package/.history/tsconfig_20240824220700.json +0 -20
- package/.history/tsconfig_20240825011301.json +0 -20
- package/.history/webpack.config_20240423002825.js +0 -37
- package/.history/webpack.config_20240430001157.js +0 -38
- package/.history/webpack.config_20240430001309.js +0 -37
- package/.history/webpack.config_20240430002112.js +0 -37
- package/CLAUDE.md +0 -96
- package/LICENSE +0 -21
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/core/drawer.ts.html +0 -1264
- package/coverage/lcov-report/core/index.html +0 -146
- package/coverage/lcov-report/core/resourceManager.ts.html +0 -136
- package/coverage/lcov-report/core/scenarioManager.ts.html +0 -373
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/resource/ImageObject.ts.html +0 -433
- package/coverage/lcov-report/resource/index.html +0 -131
- package/coverage/lcov-report/resource/soundObject.ts.html +0 -346
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/utils/TextMeasurer.ts.html +0 -520
- package/coverage/lcov-report/utils/index.html +0 -161
- package/coverage/lcov-report/utils/logger.ts.html +0 -142
- package/coverage/lcov-report/utils/store.ts.html +0 -151
- package/coverage/lcov-report/utils/waitUtil.ts.html +0 -97
- package/coverage/lcov.info +0 -882
- package/dist/README.md +0 -294
- package/dist/engineConfig.json +0 -10
- package/dist/package.json +0 -51
- package/dist/parser/cli.js +0 -61
- package/dist/parser/parser.js +0 -53
- package/dist/src/core/drawer.js.map +0 -1
- package/dist/src/core/scenarioManager.js.map +0 -1
- package/dist/src/utils/logger.js.map +0 -1
- package/dist/src/utils/store.js.map +0 -1
- package/dist/webtalekit-alpha-0.2.13.tgz +0 -0
- package/docs/event-system-specification.md +0 -493
- package/docs/glossary.html +0 -833
- package/docs/index.html +0 -296
- package/docs/tag-reference.html +0 -1317
- package/docs/ui-template-guide.html +0 -1068
- package/example/README.md +0 -29
- package/example/engineConfig.json +0 -10
- package/example/package-lock.json +0 -5145
- package/example/package.json +0 -26
- package/example/src/index.js +0 -13
- 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 +0 -28
- package/example/src/scene/background.scene +0 -29
- package/example/src/scene/character.scene +0 -26
- package/example/src/scene/choice.scene +0 -97
- package/example/src/scene/dialog.scene +0 -105
- package/example/src/scene/effects.scene +0 -38
- package/example/src/scene/en/animation.scene +0 -28
- package/example/src/scene/en/background.scene +0 -26
- package/example/src/scene/en/character.scene +0 -26
- package/example/src/scene/en/choice.scene +0 -32
- package/example/src/scene/en/effects.scene +0 -37
- package/example/src/scene/en/sound.scene +0 -26
- package/example/src/scene/en/text.scene +0 -26
- package/example/src/scene/en/title.scene +0 -39
- package/example/src/scene/if_test.scene +0 -37
- package/example/src/scene/resource-error-test.scene +0 -15
- package/example/src/scene/save-load-test.scene +0 -48
- package/example/src/scene/sound.scene +0 -26
- package/example/src/scene/test_error.scene +0 -21
- package/example/src/scene/text.scene +0 -34
- package/example/src/scene/title.scene +0 -51
- package/example/src/screen/incoming.html +0 -474
- package/example/src/screen/title.html +0 -135
- package/example/src/template.html +0 -16
- package/example/test-results/.last-run.json +0 -4
- package/example/webpack.config.js +0 -69
- package/image.png +0 -0
- package/playwright-report/index.html +0 -71
- package/s-plan1-5Light-s-1.jpg +0 -0
- package/test-results/.last-run.json +0 -6
- package/tests/e2e/if-global-attribute.spec.js +0 -90
- package/tests/e2e/resource-error-handling.spec.js +0 -58
- 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/{dist/src → src}/core/resourceManager.js +0 -0
- /package/{dist/src → src}/core/resourceManager.js.map +0 -0
- /package/{dist/src → src}/resource/ImageObject.js +0 -0
- /package/{dist/src → src}/resource/ImageObject.js.map +0 -0
- /package/{dist/src → src}/resource/soundObject.js +0 -0
- /package/{dist/src → src}/resource/soundObject.js.map +0 -0
- /package/{dist/src → src}/utils/fallbackTemplate.js +0 -0
- /package/{dist/src → src}/utils/fallbackTemplate.js.map +0 -0
- /package/{dist/src → src}/utils/waitUtil.js +0 -0
- /package/{dist/src → src}/utils/waitUtil.js.map +0 -0
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { ImageObject } from '../resource/ImageObject'
|
|
2
|
-
import { outputLog } from '../utils/logger'
|
|
3
|
-
import { sleep } from '../utils/waitUtil'
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
drawerの目的
|
|
7
|
-
UIのHTMLとcanvasを描画する。
|
|
8
|
-
*/
|
|
9
|
-
export class Drawer {
|
|
10
|
-
private gameScreen: HTMLElement
|
|
11
|
-
private nameView!: HTMLElement
|
|
12
|
-
private messageText!: HTMLElement
|
|
13
|
-
private interactiveView!: HTMLElement
|
|
14
|
-
private ctx!: CanvasRenderingContext2D
|
|
15
|
-
private screenHtml!: HTMLElement
|
|
16
|
-
private config: any
|
|
17
|
-
isSkip: boolean = false
|
|
18
|
-
readySkip: boolean = false
|
|
19
|
-
|
|
20
|
-
constructor(gameContainer: HTMLElement) {
|
|
21
|
-
this.gameScreen = gameContainer
|
|
22
|
-
// ウィンドウのリサイズ時にスケールを調整
|
|
23
|
-
window.addEventListener('resize', () => this.adjustScale(this.gameScreen))
|
|
24
|
-
// 初期ロード時にもスケールを調整
|
|
25
|
-
this.adjustScale(this.gameScreen)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setScreen(screenHtml: HTMLElement, resolution: { width: number; height: number }) {
|
|
29
|
-
this.screenHtml = screenHtml
|
|
30
|
-
this.nameView = screenHtml.querySelector('#nameView') as HTMLElement
|
|
31
|
-
this.messageText = screenHtml.querySelector('#messageView') as HTMLElement
|
|
32
|
-
this.interactiveView = screenHtml.querySelector(
|
|
33
|
-
'#interactiveView',
|
|
34
|
-
) as HTMLElement
|
|
35
|
-
|
|
36
|
-
// canvasをDOMに追加する
|
|
37
|
-
const canvas = document.createElement('canvas')
|
|
38
|
-
canvas.width = (resolution.width || 1280) * devicePixelRatio;
|
|
39
|
-
canvas.height = (resolution.height || 720) * devicePixelRatio;
|
|
40
|
-
// canvasのコンテキストを取得する
|
|
41
|
-
this.gameScreen.appendChild(canvas)
|
|
42
|
-
this.ctx = canvas.getContext('2d') as CanvasRenderingContext2D
|
|
43
|
-
// 黒で塗りつぶす
|
|
44
|
-
this.ctx.fillStyle = 'black'
|
|
45
|
-
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
46
|
-
// 初期ロード時にもスケールを調整
|
|
47
|
-
this.adjustScale(this.gameScreen)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
drawName(name: string) {
|
|
51
|
-
this.nameView.innerHTML = name
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async drawText(text: string, wait: number) {
|
|
55
|
-
this.messageText.innerHTML = ''
|
|
56
|
-
for (const char of text) {
|
|
57
|
-
//prettier-ignore
|
|
58
|
-
setTimeout(() => { this.readySkip = true, wait });
|
|
59
|
-
// 100ミリ秒待ってから、スキップボタンが押されたら即座に表示
|
|
60
|
-
if (!this.isSkip) {
|
|
61
|
-
this.messageText.innerHTML += char
|
|
62
|
-
await sleep(wait)
|
|
63
|
-
} else {
|
|
64
|
-
if (this.readySkip) {
|
|
65
|
-
this.messageText.innerHTML = text
|
|
66
|
-
this.readySkip = false
|
|
67
|
-
this.isSkip = false
|
|
68
|
-
break
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async drawChoices(choices: any) {
|
|
75
|
-
let isSelect = false
|
|
76
|
-
let selectId = 0
|
|
77
|
-
let onSelect = 0
|
|
78
|
-
|
|
79
|
-
// 選択肢ボタンの配置を設定する
|
|
80
|
-
const interactiveView = document.querySelector(
|
|
81
|
-
'#interactiveView',
|
|
82
|
-
) as HTMLElement
|
|
83
|
-
if (choices.position == 'auto' || choices.position === undefined) {
|
|
84
|
-
interactiveView.className = 'auto'
|
|
85
|
-
} else {
|
|
86
|
-
interactiveView.className = 'manual'
|
|
87
|
-
}
|
|
88
|
-
// 選択肢を表示
|
|
89
|
-
for (const choice of choices.content) {
|
|
90
|
-
const defaultImage =
|
|
91
|
-
choice.default !== undefined
|
|
92
|
-
? choice.default
|
|
93
|
-
: './src/resource/system/systemPicture/02_button/button.png'
|
|
94
|
-
const hoverImage =
|
|
95
|
-
choice.hover !== undefined
|
|
96
|
-
? choice.hover
|
|
97
|
-
: './src/resource/system/systemPicture/02_button/button2.png'
|
|
98
|
-
const selectImage =
|
|
99
|
-
choice.select !== undefined
|
|
100
|
-
? choice.select
|
|
101
|
-
: './src/resource/system/systemPicture/02_button/button3.png'
|
|
102
|
-
const button = document.createElement('div')
|
|
103
|
-
button.className = 'choice'
|
|
104
|
-
if (interactiveView.className == 'manual') {
|
|
105
|
-
button.style.position = 'absolute'
|
|
106
|
-
button.style.top = choice.position?.y || 0
|
|
107
|
-
button.style.left = choice.position?.x || 0
|
|
108
|
-
}
|
|
109
|
-
button.style.color =
|
|
110
|
-
choice.color !== undefined ? choice.color.default : 'black'
|
|
111
|
-
button.style.width = '100%'
|
|
112
|
-
button.style.height = '50px'
|
|
113
|
-
button.style.backgroundImage = `url(${defaultImage})`
|
|
114
|
-
button.style.textAlign = 'center'
|
|
115
|
-
button.style.backgroundRepeat = 'no-repeat'
|
|
116
|
-
button.style.backgroundPosition = 'center'
|
|
117
|
-
button.style.paddingTop = '20px'
|
|
118
|
-
button.addEventListener('mouseenter', function () {
|
|
119
|
-
// マウスが要素の上にあるときの背景色
|
|
120
|
-
this.style.backgroundImage = `url(${hoverImage})`
|
|
121
|
-
this.style.color =
|
|
122
|
-
choice.color !== undefined ? choice.color.hover : 'black'
|
|
123
|
-
})
|
|
124
|
-
button.addEventListener('mouseleave', function () {
|
|
125
|
-
// マウスが要素から離れたときの背景色
|
|
126
|
-
this.style.backgroundImage = `url(${defaultImage})`
|
|
127
|
-
this.style.color =
|
|
128
|
-
choice.color !== undefined ? choice.color.default : 'black'
|
|
129
|
-
})
|
|
130
|
-
button.addEventListener('mousedown', function () {
|
|
131
|
-
// マウスが要素を選択したときの背景色
|
|
132
|
-
this.style.backgroundImage = `url(${selectImage})`
|
|
133
|
-
this.style.color =
|
|
134
|
-
choice.color !== undefined ? choice.color.select : 'black'
|
|
135
|
-
})
|
|
136
|
-
button.innerHTML = choice.label
|
|
137
|
-
button.onclick = () => {
|
|
138
|
-
outputLog('click', 'debug', choice)
|
|
139
|
-
this.interactiveView.querySelectorAll('.choice').forEach((element) => {
|
|
140
|
-
element.parentNode?.removeChild(element)
|
|
141
|
-
})
|
|
142
|
-
selectId = choice.id
|
|
143
|
-
onSelect = choice.content
|
|
144
|
-
isSelect = true
|
|
145
|
-
}
|
|
146
|
-
this.interactiveView.appendChild(button)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// 選択待ち
|
|
150
|
-
return new Promise((resolve) => {
|
|
151
|
-
const intervalId = setInterval(() => {
|
|
152
|
-
if (isSelect) {
|
|
153
|
-
clearInterval(intervalId)
|
|
154
|
-
resolve({ selectId, onSelect })
|
|
155
|
-
}
|
|
156
|
-
}, 100)
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
clear() {
|
|
161
|
-
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
show(displayedImages: any) {
|
|
165
|
-
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
166
|
-
for (let key in displayedImages) {
|
|
167
|
-
const img: ImageObject = displayedImages[key].image
|
|
168
|
-
const pos: { x: number; y: number } = displayedImages[key].pos || {
|
|
169
|
-
x: 0,
|
|
170
|
-
y: 0,
|
|
171
|
-
}
|
|
172
|
-
const size: { width: number; height: number } = displayedImages[key].size
|
|
173
|
-
const reverse: boolean = displayedImages[key].look || false
|
|
174
|
-
const entry: { time: number; wait: boolean } = displayedImages[key]
|
|
175
|
-
.entry || { time: 1, wait: false }
|
|
176
|
-
if (entry.wait) {
|
|
177
|
-
// 表示開始までの遅延処理
|
|
178
|
-
setTimeout(() => {
|
|
179
|
-
this.drawCanvas(img, pos, size, reverse)
|
|
180
|
-
}, entry.time * 1000)
|
|
181
|
-
} else {
|
|
182
|
-
this.drawCanvas(img, pos, size, reverse)
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
moveTo(name: string, displayedImages: any, pos: { x: number; y: number }, durning: number) {
|
|
188
|
-
return new Promise((resolve) => {
|
|
189
|
-
const target = displayedImages[name];
|
|
190
|
-
const startPos = { x: target.pos.x, y: target.pos.y };
|
|
191
|
-
const dest = { x: startPos.x + Number(pos.x), y: startPos.y + Number(pos.y) };
|
|
192
|
-
const startTime = performance.now();
|
|
193
|
-
|
|
194
|
-
const move = (currentTime:any) => {
|
|
195
|
-
const elapsedTime = (currentTime - startTime) / 1000; // 秒単位の経過時間
|
|
196
|
-
const progress = Math.min(elapsedTime / durning, 1); // 0から1の進捗
|
|
197
|
-
|
|
198
|
-
target.pos.x = startPos.x + (dest.x - startPos.x) * progress;
|
|
199
|
-
target.pos.y = startPos.y + (dest.y - startPos.y) * progress;
|
|
200
|
-
|
|
201
|
-
this.show(displayedImages);
|
|
202
|
-
|
|
203
|
-
if (progress < 1) {
|
|
204
|
-
window.requestAnimationFrame(move);
|
|
205
|
-
} else {
|
|
206
|
-
// 最終位置を正確に設定
|
|
207
|
-
target.pos.x = dest.x;
|
|
208
|
-
target.pos.y = dest.y;
|
|
209
|
-
this.show(displayedImages);
|
|
210
|
-
resolve(null);
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
window.requestAnimationFrame(move);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
drawCanvas(img: ImageObject, pos: any, size: any, reverse: any) {
|
|
218
|
-
outputLog('drawCanvas', 'debug', {img, pos, size, reverse})
|
|
219
|
-
const canvas = img.draw(reverse).getCanvas()
|
|
220
|
-
// canvasから画像を取得して、this.ctxに描画
|
|
221
|
-
const imageWidth = size !== undefined ? size.width : canvas.width
|
|
222
|
-
const imageHeight = size !== undefined ? size.height : canvas.height
|
|
223
|
-
this.ctx.drawImage(
|
|
224
|
-
canvas,
|
|
225
|
-
0,
|
|
226
|
-
0,
|
|
227
|
-
canvas.width,
|
|
228
|
-
canvas.height,
|
|
229
|
-
pos.x,
|
|
230
|
-
pos.y,
|
|
231
|
-
imageWidth,
|
|
232
|
-
imageHeight,
|
|
233
|
-
) //CanvasRenderingContext2D.drawImage: Passed-in canvas is empty
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
adjustScale(targetElement: HTMLElement) {
|
|
237
|
-
// ターゲット要素の元の幅と高さ
|
|
238
|
-
const originalWidth = targetElement.scrollWidth // 例: 1280px
|
|
239
|
-
const originalHeight = targetElement.scrollHeight // 例: 720px
|
|
240
|
-
|
|
241
|
-
// ビューポートの幅と高さを取得
|
|
242
|
-
const viewportWidth = window.innerWidth
|
|
243
|
-
const viewportHeight = window.innerHeight
|
|
244
|
-
|
|
245
|
-
// 幅と高さのスケールを計算
|
|
246
|
-
const scaleX = viewportWidth / originalWidth
|
|
247
|
-
const scaleY = viewportHeight / originalHeight
|
|
248
|
-
|
|
249
|
-
// 幅と高さのうち、小さい方のスケールを選択(アスペクト比を維持)
|
|
250
|
-
const scale = Math.min(scaleX, scaleY)
|
|
251
|
-
|
|
252
|
-
// ターゲット要素にスケールを適用
|
|
253
|
-
targetElement.style.transform = `scale(${scale})`
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
setVisibility(name: string, isVisible: boolean) {
|
|
257
|
-
const target = this.screenHtml.querySelector(name) as HTMLElement
|
|
258
|
-
if (target) {
|
|
259
|
-
target.style.visibility = isVisible ? 'visible' : 'hidden'
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { ImageObject } from '../resource/ImageObject'
|
|
2
|
-
import { outputLog } from '../utils/logger'
|
|
3
|
-
import { sleep } from '../utils/waitUtil'
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
drawerの目的
|
|
7
|
-
UIのHTMLとcanvasを描画する。
|
|
8
|
-
*/
|
|
9
|
-
export class Drawer {
|
|
10
|
-
private gameScreen: HTMLElement
|
|
11
|
-
private nameView!: HTMLElement
|
|
12
|
-
private messageText!: HTMLElement
|
|
13
|
-
private interactiveView!: HTMLElement
|
|
14
|
-
private ctx!: CanvasRenderingContext2D
|
|
15
|
-
private screenHtml!: HTMLElement
|
|
16
|
-
private config: any
|
|
17
|
-
isSkip: boolean = false
|
|
18
|
-
readySkip: boolean = false
|
|
19
|
-
|
|
20
|
-
constructor(gameContainer: HTMLElement) {
|
|
21
|
-
this.gameScreen = gameContainer
|
|
22
|
-
// ウィンドウのリサイズ時にスケールを調整
|
|
23
|
-
window.addEventListener('resize', () => this.adjustScale(this.gameScreen))
|
|
24
|
-
// 初期ロード時にもスケールを調整
|
|
25
|
-
this.adjustScale(this.gameScreen)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setScreen(screenHtml: HTMLElement, resolution: { width: number; height: number }) {
|
|
29
|
-
this.screenHtml = screenHtml
|
|
30
|
-
this.nameView = screenHtml.querySelector('#nameView') as HTMLElement
|
|
31
|
-
this.messageText = screenHtml.querySelector('#messageView') as HTMLElement
|
|
32
|
-
this.interactiveView = screenHtml.querySelector(
|
|
33
|
-
'#interactiveView',
|
|
34
|
-
) as HTMLElement
|
|
35
|
-
|
|
36
|
-
// canvasをDOMに追加する
|
|
37
|
-
const canvas = document.createElement('canvas')
|
|
38
|
-
canvas.width = (resolution.width || 1280) * devicePixelRatio;
|
|
39
|
-
canvas.height = (resolution.height || 720) * devicePixelRatio;
|
|
40
|
-
// canvasのコンテキストを取得する
|
|
41
|
-
this.gameScreen.appendChild(canvas)
|
|
42
|
-
this.ctx = canvas.getContext('2d') as CanvasRenderingContext2D
|
|
43
|
-
// 黒で塗りつぶす
|
|
44
|
-
this.ctx.fillStyle = 'black'
|
|
45
|
-
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
46
|
-
// 初期ロード時にもスケールを調整
|
|
47
|
-
this.adjustScale(this.gameScreen)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
drawName(name: string) {
|
|
51
|
-
this.nameView.innerHTML = name
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async drawText(text: string, wait: number) {
|
|
55
|
-
this.messageText.innerHTML = ''
|
|
56
|
-
for (const char of text) {
|
|
57
|
-
//prettier-ignore
|
|
58
|
-
setTimeout(() => { this.readySkip = true, wait });
|
|
59
|
-
// 100ミリ秒待ってから、スキップボタンが押されたら即座に表示
|
|
60
|
-
if (!this.isSkip) {
|
|
61
|
-
this.messageText.innerHTML += char
|
|
62
|
-
await sleep(wait)
|
|
63
|
-
} else {
|
|
64
|
-
if (this.readySkip) {
|
|
65
|
-
this.messageText.innerHTML = text
|
|
66
|
-
this.readySkip = false
|
|
67
|
-
this.isSkip = false
|
|
68
|
-
break
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
clearText() {
|
|
75
|
-
if (this.messageText) {
|
|
76
|
-
this.messageText.innerHTML = '';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async drawChoices(choices: any) {
|
|
81
|
-
let isSelect = false
|
|
82
|
-
let selectId = 0
|
|
83
|
-
let onSelect = 0
|
|
84
|
-
|
|
85
|
-
// 選択肢ボタンの配置を設定する
|
|
86
|
-
const interactiveView = document.querySelector(
|
|
87
|
-
'#interactiveView',
|
|
88
|
-
) as HTMLElement
|
|
89
|
-
if (choices.position == 'auto' || choices.position === undefined) {
|
|
90
|
-
interactiveView.className = 'auto'
|
|
91
|
-
} else {
|
|
92
|
-
interactiveView.className = 'manual'
|
|
93
|
-
}
|
|
94
|
-
// 選択肢を表示
|
|
95
|
-
for (const choice of choices.content) {
|
|
96
|
-
const defaultImage =
|
|
97
|
-
choice.default !== undefined
|
|
98
|
-
? choice.default
|
|
99
|
-
: './src/resource/system/systemPicture/02_button/button.png'
|
|
100
|
-
const hoverImage =
|
|
101
|
-
choice.hover !== undefined
|
|
102
|
-
? choice.hover
|
|
103
|
-
: './src/resource/system/systemPicture/02_button/button2.png'
|
|
104
|
-
const selectImage =
|
|
105
|
-
choice.select !== undefined
|
|
106
|
-
? choice.select
|
|
107
|
-
: './src/resource/system/systemPicture/02_button/button3.png'
|
|
108
|
-
const button = document.createElement('div')
|
|
109
|
-
button.className = 'choice'
|
|
110
|
-
if (interactiveView.className == 'manual') {
|
|
111
|
-
button.style.position = 'absolute'
|
|
112
|
-
button.style.top = choice.position?.y || 0
|
|
113
|
-
button.style.left = choice.position?.x || 0
|
|
114
|
-
}
|
|
115
|
-
button.style.color =
|
|
116
|
-
choice.color !== undefined ? choice.color.default : 'black'
|
|
117
|
-
button.style.width = '100%'
|
|
118
|
-
button.style.height = '50px'
|
|
119
|
-
button.style.backgroundImage = `url(${defaultImage})`
|
|
120
|
-
button.style.textAlign = 'center'
|
|
121
|
-
button.style.backgroundRepeat = 'no-repeat'
|
|
122
|
-
button.style.backgroundPosition = 'center'
|
|
123
|
-
button.style.paddingTop = '20px'
|
|
124
|
-
button.addEventListener('mouseenter', function () {
|
|
125
|
-
// マウスが要素の上にあるときの背景色
|
|
126
|
-
this.style.backgroundImage = `url(${hoverImage})`
|
|
127
|
-
this.style.color =
|
|
128
|
-
choice.color !== undefined ? choice.color.hover : 'black'
|
|
129
|
-
})
|
|
130
|
-
button.addEventListener('mouseleave', function () {
|
|
131
|
-
// マウスが要素から離れたときの背景色
|
|
132
|
-
this.style.backgroundImage = `url(${defaultImage})`
|
|
133
|
-
this.style.color =
|
|
134
|
-
choice.color !== undefined ? choice.color.default : 'black'
|
|
135
|
-
})
|
|
136
|
-
button.addEventListener('mousedown', function () {
|
|
137
|
-
// マウスが要素を選択したときの背景色
|
|
138
|
-
this.style.backgroundImage = `url(${selectImage})`
|
|
139
|
-
this.style.color =
|
|
140
|
-
choice.color !== undefined ? choice.color.select : 'black'
|
|
141
|
-
})
|
|
142
|
-
button.innerHTML = choice.label
|
|
143
|
-
button.onclick = () => {
|
|
144
|
-
outputLog('click', 'debug', choice)
|
|
145
|
-
this.interactiveView.querySelectorAll('.choice').forEach((element) => {
|
|
146
|
-
element.parentNode?.removeChild(element)
|
|
147
|
-
})
|
|
148
|
-
selectId = choice.id
|
|
149
|
-
onSelect = choice.content
|
|
150
|
-
isSelect = true
|
|
151
|
-
}
|
|
152
|
-
this.interactiveView.appendChild(button)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 選択待ち
|
|
156
|
-
return new Promise((resolve) => {
|
|
157
|
-
const intervalId = setInterval(() => {
|
|
158
|
-
if (isSelect) {
|
|
159
|
-
clearInterval(intervalId)
|
|
160
|
-
resolve({ selectId, onSelect })
|
|
161
|
-
}
|
|
162
|
-
}, 100)
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
clear() {
|
|
167
|
-
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
show(displayedImages: any) {
|
|
171
|
-
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height)
|
|
172
|
-
for (let key in displayedImages) {
|
|
173
|
-
const img: ImageObject = displayedImages[key].image
|
|
174
|
-
const pos: { x: number; y: number } = displayedImages[key].pos || {
|
|
175
|
-
x: 0,
|
|
176
|
-
y: 0,
|
|
177
|
-
}
|
|
178
|
-
const size: { width: number; height: number } = displayedImages[key].size
|
|
179
|
-
const reverse: boolean = displayedImages[key].look || false
|
|
180
|
-
const entry: { time: number; wait: boolean } = displayedImages[key]
|
|
181
|
-
.entry || { time: 1, wait: false }
|
|
182
|
-
if (entry.wait) {
|
|
183
|
-
// 表示開始までの遅延処理
|
|
184
|
-
setTimeout(() => {
|
|
185
|
-
this.drawCanvas(img, pos, size, reverse)
|
|
186
|
-
}, entry.time * 1000)
|
|
187
|
-
} else {
|
|
188
|
-
this.drawCanvas(img, pos, size, reverse)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
moveTo(name: string, displayedImages: any, pos: { x: number; y: number }, durning: number) {
|
|
194
|
-
return new Promise((resolve) => {
|
|
195
|
-
const target = displayedImages[name];
|
|
196
|
-
const startPos = { x: target.pos.x, y: target.pos.y };
|
|
197
|
-
const dest = { x: startPos.x + Number(pos.x), y: startPos.y + Number(pos.y) };
|
|
198
|
-
const startTime = performance.now();
|
|
199
|
-
|
|
200
|
-
const move = (currentTime:any) => {
|
|
201
|
-
const elapsedTime = (currentTime - startTime) / 1000; // 秒単位の経過時間
|
|
202
|
-
const progress = Math.min(elapsedTime / durning, 1); // 0から1の進捗
|
|
203
|
-
|
|
204
|
-
target.pos.x = startPos.x + (dest.x - startPos.x) * progress;
|
|
205
|
-
target.pos.y = startPos.y + (dest.y - startPos.y) * progress;
|
|
206
|
-
|
|
207
|
-
this.show(displayedImages);
|
|
208
|
-
|
|
209
|
-
if (progress < 1) {
|
|
210
|
-
window.requestAnimationFrame(move);
|
|
211
|
-
} else {
|
|
212
|
-
// 最終位置を正確に設定
|
|
213
|
-
target.pos.x = dest.x;
|
|
214
|
-
target.pos.y = dest.y;
|
|
215
|
-
this.show(displayedImages);
|
|
216
|
-
resolve(null);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
window.requestAnimationFrame(move);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
drawCanvas(img: ImageObject, pos: any, size: any, reverse: any) {
|
|
224
|
-
outputLog('drawCanvas', 'debug', {img, pos, size, reverse})
|
|
225
|
-
const canvas = img.draw(reverse).getCanvas()
|
|
226
|
-
// canvasから画像を取得して、this.ctxに描画
|
|
227
|
-
const imageWidth = size !== undefined ? size.width : canvas.width
|
|
228
|
-
const imageHeight = size !== undefined ? size.height : canvas.height
|
|
229
|
-
this.ctx.drawImage(
|
|
230
|
-
canvas,
|
|
231
|
-
0,
|
|
232
|
-
0,
|
|
233
|
-
canvas.width,
|
|
234
|
-
canvas.height,
|
|
235
|
-
pos.x,
|
|
236
|
-
pos.y,
|
|
237
|
-
imageWidth,
|
|
238
|
-
imageHeight,
|
|
239
|
-
) //CanvasRenderingContext2D.drawImage: Passed-in canvas is empty
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
adjustScale(targetElement: HTMLElement) {
|
|
243
|
-
// ターゲット要素の元の幅と高さ
|
|
244
|
-
const originalWidth = targetElement.scrollWidth // 例: 1280px
|
|
245
|
-
const originalHeight = targetElement.scrollHeight // 例: 720px
|
|
246
|
-
|
|
247
|
-
// ビューポートの幅と高さを取得
|
|
248
|
-
const viewportWidth = window.innerWidth
|
|
249
|
-
const viewportHeight = window.innerHeight
|
|
250
|
-
|
|
251
|
-
// 幅と高さのスケールを計算
|
|
252
|
-
const scaleX = viewportWidth / originalWidth
|
|
253
|
-
const scaleY = viewportHeight / originalHeight
|
|
254
|
-
|
|
255
|
-
// 幅と高さのうち、小さい方のスケールを選択(アスペクト比を維持)
|
|
256
|
-
const scale = Math.min(scaleX, scaleY)
|
|
257
|
-
|
|
258
|
-
// ターゲット要素にスケールを適用
|
|
259
|
-
targetElement.style.transform = `scale(${scale})`
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
setVisibility(name: string, isVisible: boolean) {
|
|
263
|
-
const target = this.screenHtml.querySelector(name) as HTMLElement
|
|
264
|
-
if (target) {
|
|
265
|
-
target.style.visibility = isVisible ? 'visible' : 'hidden'
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|