ksaa 2025.11b3__py3-none-any.whl → 2025.11.post1__py3-none-any.whl
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.
- kaa/__init__.py +0 -0
- kaa/application/__init__.py +0 -0
- kaa/application/services/__init__.py +0 -0
- kaa/application/services/config_service.py +112 -0
- kaa/application/{core → services}/feedback_service.py +1 -1
- kaa/application/services/produce_solution_service.py +83 -0
- kaa/application/services/task_service.py +145 -0
- kaa/application/ui/__init__.py +0 -0
- kaa/application/ui/common.py +123 -0
- kaa/application/ui/components/alert.py +251 -0
- kaa/application/ui/components/alert.pyi +257 -0
- kaa/application/ui/components/categorized_select.pyi +697 -0
- kaa/application/ui/facade.py +189 -0
- kaa/application/ui/gradio_view.py +135 -0
- kaa/application/ui/views/__init__.py +0 -0
- kaa/application/ui/views/feedback_view.py +65 -0
- kaa/application/ui/views/produce_view.py +251 -0
- kaa/application/ui/views/settings_view.py +581 -0
- kaa/application/ui/views/status_view.py +171 -0
- kaa/application/ui/views/task_view.py +102 -0
- kaa/application/ui/views/update_view.py +106 -0
- kaa/config/schema.py +2 -0
- kaa/db/constants.py +3 -2
- kaa/main/gr.py +71 -2733
- kaa/metadata.py +71 -1
- kaa/resources/__pycache__/__init__.cpython-310.pyc +0 -0
- kaa/resources/game.db +0 -0
- kaa/resources/game_ver.txt +0 -0
- kaa/sprites/41904062-e218-4b28-972a-b5cfcd058d2c.png +0 -0
- kaa/sprites/5c49d3b3-656e-4c8c-ae1a-9b0209b9dcc3.png +0 -0
- kaa/sprites/__pycache__/__init__.cpython-310.pyc +0 -0
- kaa/sprites/ae4742aa-acda-442d-bf73-b3fe7b66e85c.png +0 -0
- kaa/tasks/R.py +136 -128
- kaa/tasks/R2.py +24 -0
- kaa/tasks/daily/club_reward.py +1 -0
- kaa/tasks/daily/purchase.py +33 -1
- kaa/tasks/daily/upgrade_support_card.py +12 -2
- kaa/tasks/produce/common.py +1 -0
- kaa/tasks/produce/in_purodyuusu.py +21 -7
- kaa/util/reactive.py +182 -0
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/METADATA +21 -21
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/RECORD +303 -278
- /kaa/application/{core → services}/update_service.py +0 -0
- /kaa/sprites/{3cda578a-fa75-4bbd-9cff-be4bc4355a58.png → 01e93c2c-28dc-41f8-8f9a-ec62ec12aa01.png} +0 -0
- /kaa/sprites/{03d22cb3-0193-4dcb-8a0d-98b7ca9c2b4c.png → 02ac01e0-00b0-46d8-a6db-56248c843c6d.png} +0 -0
- /kaa/sprites/{3ffd2992-fa55-499c-8c3b-193518ebbe07.png → 033e73d1-9f45-4bca-bf96-6778410f2fc4.png} +0 -0
- /kaa/sprites/{9f46f543-d7dc-4836-a210-125d686475f9.png → 04036690-5b0f-4ee0-a9d0-022ee822bf0e.png} +0 -0
- /kaa/sprites/{ae106b38-da4f-4b0d-b9c3-541fd58f4de7.png → 041bd3fc-d040-4773-8641-4e4509300d2f.png} +0 -0
- /kaa/sprites/{2abce6a4-111f-42bb-9255-f98d544108de.png → 04974917-b1e8-4ccc-807b-6f651026c955.png} +0 -0
- /kaa/sprites/{114730f6-eddd-4381-b723-aee18cde0d90.png → 04c4e4c2-9908-4be7-bcbe-4d926ca76737.png} +0 -0
- /kaa/sprites/{b76add75-2187-428c-9ede-fb43086bacb6.png → 052ab0f5-8d95-4b5d-8678-3838322d9e5e.png} +0 -0
- /kaa/sprites/{a3fe5859-62ba-403e-9367-65db0ad15943.png → 05b97cdf-f7df-4d91-9ec8-5e9594a46382.png} +0 -0
- /kaa/sprites/{0b436edb-8f6a-429d-87b7-5d4250f651ac.png → 061b032f-860b-4c53-889b-aa126797f062.png} +0 -0
- /kaa/sprites/{7c4ca388-5167-478a-a32b-0e108edad888.png → 07b43eb9-db32-4046-96d3-9f4314bfd80a.png} +0 -0
- /kaa/sprites/{3eb9b21b-abbe-49fd-a3a9-6e1c1a6e91d9.png → 08b12ded-8230-4c7e-bb9f-27c85b0fdabb.png} +0 -0
- /kaa/sprites/{218a6ab3-93f6-4bb1-9848-8c97ff695945.png → 09364c3a-f892-4911-abdc-2f5fea09289f.png} +0 -0
- /kaa/sprites/{307b58f0-20c1-41bd-9eaa-1337fd0e6563.png → 09d2a63d-d2f0-4b97-b3cb-22a61b1530f7.png} +0 -0
- /kaa/sprites/{ae0ce964-eb8f-45a1-aa4d-f47a5c8c720f.png → 0cad6e46-276f-424e-a79e-d272ebaa7c8e.png} +0 -0
- /kaa/sprites/{5a49b6d2-2bcb-49bc-a28f-b8bd1441f60a.png → 0e49fbde-6be6-42b3-b8d1-36e0cb9cc35d.png} +0 -0
- /kaa/sprites/{1a5c147b-e28e-42ad-893a-7430d8f4fc35.png → 0e51d671-928c-4972-8ac0-de446202070b.png} +0 -0
- /kaa/sprites/{a4c6d967-0251-4b33-acb3-81d24f82d5a4.png → 0e6f8981-f46c-4c7d-9d90-fe349f0a1d77.png} +0 -0
- /kaa/sprites/{12455dbd-7d70-4435-a3ba-f40654e75c37.png → 0e9e3dbf-6e94-4a12-b558-3d8ab500c0a6.png} +0 -0
- /kaa/sprites/{95d715c3-d569-48b5-be7b-c21cd2a160db.png → 0eafb6c1-9d85-4fe0-8011-7235704ca9d3.png} +0 -0
- /kaa/sprites/{22071c63-a1bc-4163-8d5a-973b3d579c76.png → 1002a830-1ad5-47a7-b7dd-ed2989e6fc1b.png} +0 -0
- /kaa/sprites/{8d416e23-04ef-47bd-8cc8-7f18d1bab736.png → 10943367-c1d8-41c7-a831-d5d05288875a.png} +0 -0
- /kaa/sprites/{8f9dd0f0-f9af-4eec-a89e-8f2c92f88a98.png → 10f37db0-8c3e-4790-a5c3-cdb841f106a7.png} +0 -0
- /kaa/sprites/{aeab8f9a-fe61-4c2d-a494-ffc19a9cae91.png → 11f65378-b982-4936-9ac7-68560a74a042.png} +0 -0
- /kaa/sprites/{71913fde-c3db-463d-800d-e1b35fa2c8b4.png → 1660acf7-a420-4d92-a90c-55c5ff208da6.png} +0 -0
- /kaa/sprites/{88be2dcc-68ca-4596-9b2c-544a196cab64.png → 170d28bf-d262-4bf1-b35f-8f3d4b4fff6e.png} +0 -0
- /kaa/sprites/{bd4cd421-f702-47c0-9f8b-77914973108c.png → 182d8c71-5ce5-4ee1-9f66-ef99aadae654.png} +0 -0
- /kaa/sprites/{ff8efb8f-e1a4-4202-a6e1-680eb44f58da.png → 18adb1a5-b95d-41ff-9cb9-16613fa4cf6a.png} +0 -0
- /kaa/sprites/{3a211792-1243-496a-b41e-0e3fd121cd5b.png → 18d26894-fd12-4644-8269-a09d11be9520.png} +0 -0
- /kaa/sprites/{4f370ff6-61d1-405a-b29e-e6d0b3072194.png → 1b0dd18b-eb41-4c9c-b031-bab91c93fd5d.png} +0 -0
- /kaa/sprites/{11bc7d35-e58d-4301-a0b0-f557dbd73c7b.png → 1e7a6e19-760c-4fbc-b0f1-f620f51056b9.png} +0 -0
- /kaa/sprites/{6f50cd3b-6e46-46c5-99ed-26728d3212ad.png → 1fbe13d6-3a4d-4935-b687-a76a76a1e32c.png} +0 -0
- /kaa/sprites/{2f9e2dbb-66a1-4b13-9b9e-d62e10efa6d3.png → 1fe31432-a050-48db-acc1-becde42deaf9.png} +0 -0
- /kaa/sprites/{1b3c84c5-16d1-43a7-8513-719bd7a10450.png → 20146fe6-e62b-4c57-b229-901994903b70.png} +0 -0
- /kaa/sprites/{1e57ab88-9962-4024-81df-746529a758f9.png → 20c673e9-fcbe-469b-be35-7844a1d5a9cd.png} +0 -0
- /kaa/sprites/{9f3bfe36-8462-404f-94da-9bc324b1beed.png → 21747ae5-d94d-45d1-bda8-939389dc4874.png} +0 -0
- /kaa/sprites/{12f330a6-4eab-4015-b0e3-4e1a35a7b676.png → 21fbbe96-02bf-4835-aa04-068bc5cc6ca3.png} +0 -0
- /kaa/sprites/{6069f8bc-2a06-45a4-95ca-1ac9d8fa3b04.png → 24be7d90-7944-4a0a-a60c-67c9737b322c.png} +0 -0
- /kaa/sprites/{63b74752-73ce-4020-a7c8-0a71a9f67415.png → 24d6a47c-2099-45e2-9a67-b37767f459fc.png} +0 -0
- /kaa/sprites/{80800c2e-417d-4118-b726-93aaabfc08bd.png → 2568d3d3-b642-4ea4-b929-4dee0b09738a.png} +0 -0
- /kaa/sprites/{4eb665ef-7741-40f9-8174-7b6ca66d045b.png → 263b1037-fb51-4eb1-8c71-5232b03235d2.png} +0 -0
- /kaa/sprites/{81b1b160-2d0f-42ad-924a-9572a54f343a.png → 27dbd535-7f95-4698-8fea-2bed67dd6968.png} +0 -0
- /kaa/sprites/{2a82e2d6-0722-433a-87fa-f1752ce0b9b7.png → 286801f7-3af5-4cd0-9c25-46c12c2cd8f8.png} +0 -0
- /kaa/sprites/{5f2d0b2b-8425-4dd8-8b85-d62f4b75286c.png → 298182ae-747a-44e3-8511-a64d3532b8ac.png} +0 -0
- /kaa/sprites/{f7e34403-a53c-4d3f-935b-25b4acb7f7a5.png → 2aac3a97-435e-4c02-925f-e2d1673b7982.png} +0 -0
- /kaa/sprites/{a2dd125b-9868-4e01-9a46-3b552c2ebdc9.png → 2cc63c6d-5988-4f72-ae88-b03b8246ad97.png} +0 -0
- /kaa/sprites/{0db579bf-d555-4468-8104-c2d2e68d33b1.png → 2d3470f8-a714-4175-a8fe-71eef80921b6.png} +0 -0
- /kaa/sprites/{87ed135a-2eb1-4e21-8928-d0307a22ea66.png → 2e3b2982-d14b-4b49-bb64-da8178311d75.png} +0 -0
- /kaa/sprites/{7e8904fd-5863-471f-8e9a-d69d9ca72f8f.png → 2e41df89-a8d7-4e7e-96cb-7f551414823b.png} +0 -0
- /kaa/sprites/{11870372-dc78-4a80-8320-15bb24da6f25.png → 31e02e56-f266-47b5-8b10-fe79fe06d614.png} +0 -0
- /kaa/sprites/{ed6df33a-c7aa-4542-a87b-9cc9cae0465c.png → 3208d803-2c92-4775-80dc-0527df4b63d9.png} +0 -0
- /kaa/sprites/{330c2207-af32-453b-8db7-889cda83e7cc.png → 3314dc6c-868f-4045-9f60-1f3a17fed324.png} +0 -0
- /kaa/sprites/{ad17ae00-f6ce-4f32-9386-9a8073b5e79a.png → 345435d0-5a5c-494b-95ab-1e086fb88f51.png} +0 -0
- /kaa/sprites/{03d0acec-15fd-4c21-82ce-122764def185.png → 358f1561-c16f-45a0-842d-d62fc735dc80.png} +0 -0
- /kaa/sprites/{3c490171-6810-44f0-b28d-c6b664347a3c.png → 3782897a-f1c2-4f05-a02d-4c760672f52a.png} +0 -0
- /kaa/sprites/{ec35a0b8-1afa-48ff-ae66-9c1ef966348d.png → 385e60df-2063-4caf-b1ea-e6ac909bc49d.png} +0 -0
- /kaa/sprites/{5ec51718-1403-4a79-bd85-46e1fe04d8c9.png → 39450419-26b5-4fbd-a5d4-1bab369ced30.png} +0 -0
- /kaa/sprites/{9088f8c0-59f8-41c6-994c-ae283ac94c24.png → 397c0e24-f35a-48c9-a576-aa1fcfc517b5.png} +0 -0
- /kaa/sprites/{e79a2a08-3b58-4ab0-8c2b-769f30cc8591.png → 3ad30d90-8b57-4641-a9e2-33970e5cea1d.png} +0 -0
- /kaa/sprites/{2d8e6464-aceb-41fd-9e78-7523738d5720.png → 3adef8f4-629d-4cb7-b54a-dadabfea155e.png} +0 -0
- /kaa/sprites/{3fb84a71-ed15-4989-9598-34e7342f38f5.png → 3b86b4ac-aa29-4309-82da-f47a174d88cc.png} +0 -0
- /kaa/sprites/{2460d0c9-50e2-451b-b609-ad466b574395.png → 3c6bbcea-488d-4df8-ab40-21e263aa0b16.png} +0 -0
- /kaa/sprites/{15605f7a-2206-436c-8a71-011d9f95cf4e.png → 3db54e0b-672d-4dfd-8a9b-5db37a08be74.png} +0 -0
- /kaa/sprites/{f237d88e-92ac-4ebf-85e1-80a696b5203a.png → 3e0da5df-a4de-42bd-83bd-13df3c393af4.png} +0 -0
- /kaa/sprites/{9acd9a59-004f-4e1d-a208-0c293f2702d5.png → 402d430d-b507-4aa6-b3e1-db66b38c71b4.png} +0 -0
- /kaa/sprites/{455dcf19-63f5-4b0a-99e6-b23d3876d199.png → 414140a2-de67-4c7f-a7f6-c8b30a6c8d6a.png} +0 -0
- /kaa/sprites/{97a3791d-fa9d-453d-8081-c574fe88b823.png → 4147514f-4f3f-4dd5-952b-0f2cf5f62181.png} +0 -0
- /kaa/sprites/{cb15d9a3-78fe-4f03-bd23-90ba6169ddff.png → 43e53b71-9d69-4f4f-b217-a1abeea8991e.png} +0 -0
- /kaa/sprites/{f333118a-81c2-417f-b54f-64dc4e8df613.png → 44a50906-1835-4e29-ae97-496b4cdde9e9.png} +0 -0
- /kaa/sprites/{3192a62f-224d-44b1-a0b9-b1fc22de8ec1.png → 44fab632-3920-4cd8-9967-f7a8a1ee29a0.png} +0 -0
- /kaa/sprites/{31b4c370-696f-4dfc-a918-839495520266.png → 45f705f9-58fb-4729-ae55-ee10848678d6.png} +0 -0
- /kaa/sprites/{3ea8e354-2684-46f3-9f5a-43f094717c95.png → 4678a5fa-5b1c-4fdc-b7c4-e0b820039546.png} +0 -0
- /kaa/sprites/{affc87db-2f63-4e4a-855e-6ff608226f1e.png → 4738974e-60b8-4583-8548-94211c164291.png} +0 -0
- /kaa/sprites/{0c266b0e-de7a-49c1-9709-b01fb5086f75.png → 474c1678-9c36-495b-aef2-cadbb47b237d.png} +0 -0
- /kaa/sprites/{5a677634-99cf-45b5-bc0c-94120872a518.png → 47783412-9cc7-4ba0-904d-8cd300222889.png} +0 -0
- /kaa/sprites/{72a8bcd2-3f32-4ee5-8295-eedf441d6a1a.png → 47ed66a4-9e7e-4646-b554-469dc86322db.png} +0 -0
- /kaa/sprites/{a9c5aeb0-c0c9-47da-8793-ffe8d172bea0.png → 488a1403-d300-4fa6-94c7-da71d09fd4bb.png} +0 -0
- /kaa/sprites/{d23a600a-7002-4268-96a4-18dc54928ec6.png → 48c16d60-05d6-43bc-97c3-7f099bfc0881.png} +0 -0
- /kaa/sprites/{7b4c3a81-8f09-4a00-90ee-d4df3f57e863.png → 4d0074ad-6db4-4060-b71a-05c0e36e57a6.png} +0 -0
- /kaa/sprites/{e30922ed-a02f-4ede-9968-1656be5a05b2.png → 4e3dbeb5-70bb-4642-9f73-01f9f98bc3aa.png} +0 -0
- /kaa/sprites/{b7f62cab-cc24-480e-bf4c-25c43a1e801e.png → 4f2f8328-a698-40d3-a40f-1f1ae77dc843.png} +0 -0
- /kaa/sprites/{45f09e08-53ea-4e08-97dc-70f689bab002.png → 52d0ff68-7a55-4d53-bc20-a1fa05cfe876.png} +0 -0
- /kaa/sprites/{60896822-de58-4e07-b2d9-86a7f4068de1.png → 52d737a7-5b0b-4ce0-ae3f-5d4048060f12.png} +0 -0
- /kaa/sprites/{bbe59f62-c3e7-404c-a313-b50db70de7b5.png → 54987de4-3e1b-4640-b203-1e4c82d7e98d.png} +0 -0
- /kaa/sprites/{568608bd-a1fa-4faf-ae15-179563a7e84f.png → 54a9cae1-62e5-4546-a46a-a5157f51e8b4.png} +0 -0
- /kaa/sprites/{71976c1a-5df9-44a5-b4ea-08b5d617d813.png → 56d35e14-ada9-4bfa-a48f-e4601054e7eb.png} +0 -0
- /kaa/sprites/{0814c0fd-6f89-47d3-8089-e8cfde569750.png → 575784c1-7c4a-4484-9f38-aa3c280ce56e.png} +0 -0
- /kaa/sprites/{28335ba3-9a0f-46cd-b66d-047781773264.png → 577417ee-6635-4cb4-9f28-d1e1b47ae2cd.png} +0 -0
- /kaa/sprites/{3ea03db7-4de9-45c4-a07b-a9bbc2c63e70.png → 58358122-984b-4c31-91d7-eaf5c8c9353d.png} +0 -0
- /kaa/sprites/{3a4e2d8a-deca-4980-b6c2-37bfc17d2720.png → 5a06a662-ffa9-49a9-a86d-136e5983abdd.png} +0 -0
- /kaa/sprites/{545a9032-a676-4d9d-ac74-2b2c9b330d1a.png → 5a0bfeac-fb22-4b0c-b775-4aa6220bae89.png} +0 -0
- /kaa/sprites/{fe993a91-1a49-488e-b7ff-c1b05b8f2b5f.png → 5aad0930-54a3-4b6d-bec8-250228963f69.png} +0 -0
- /kaa/sprites/{c76c6ccb-d099-4c3c-9eda-13be33aa48ae.png → 5c8eebc5-6d5e-445e-a3d1-66dce2bb6338.png} +0 -0
- /kaa/sprites/{803fb770-6982-4460-8fe0-f9ccd67367c2.png → 5c9a1581-a14a-449b-a1b0-7a31a965facc.png} +0 -0
- /kaa/sprites/{d1bdfa3b-34df-488d-9f9b-8c7b04dd4ab3.png → 5d2b03a2-acb6-4bd2-86e8-1b203d1aeaec.png} +0 -0
- /kaa/sprites/{264d021a-b322-4472-8a7b-5f1322aba993.png → 5f02656f-1314-44d0-ae31-a176c24d758c.png} +0 -0
- /kaa/sprites/{8bf08bab-7c55-45e1-8433-c2213a323480.png → 608c12e2-95dd-4efa-93b2-e648e9583062.png} +0 -0
- /kaa/sprites/{bb3990c8-4618-4d96-9365-a4d1213b59f7.png → 62411b55-7be8-46d9-aa4a-fb56dab6658c.png} +0 -0
- /kaa/sprites/{a42ac612-acbd-45cc-88fb-104ff9b7d2d8.png → 647bb09a-13f8-4d54-a8ac-5b534f1a8d87.png} +0 -0
- /kaa/sprites/{8805fead-f7e2-4905-a42e-05ebba2fbe21.png → 6483c406-26cc-44ee-ad12-2a30ec47aedb.png} +0 -0
- /kaa/sprites/{acd741da-d4ab-4b76-a6a3-4a2fd25870ef.png → 6580ea89-553e-4445-a855-f834d580e6e6.png} +0 -0
- /kaa/sprites/{622d700e-0fd8-4a92-a286-1e8143c70570.png → 67d6a201-dfb9-4c88-b42b-d968cf9a034c.png} +0 -0
- /kaa/sprites/{8d09178a-251e-4f74-b023-12233417621b.png → 686a2bf5-0498-4d53-8ba1-1110ff36f046.png} +0 -0
- /kaa/sprites/{cf49878d-a1c5-4b9f-9502-1e0d9eaadc49.png → 699ca639-3006-45c1-b5fd-8cf9631fd3ea.png} +0 -0
- /kaa/sprites/{15dd89cc-53ed-4c77-a355-62e3bd7a15dd.png → 6a93b483-0848-45e4-a937-51850f296c3d.png} +0 -0
- /kaa/sprites/{20bd834e-c99c-4e80-92db-0740e5bbe746.png → 6b4e4351-b370-48cd-8e8f-ca663d44aa0c.png} +0 -0
- /kaa/sprites/{04ea8503-cdd5-4b3e-a33b-63893b92f6ba.png → 6c961dee-87f3-42f1-acef-9fe7d6be4df1.png} +0 -0
- /kaa/sprites/{6f6d7af3-8380-439b-9d26-3fbd5a103b49.png → 6d22b7ee-6e0f-4f5d-96a4-d4cba26a4d04.png} +0 -0
- /kaa/sprites/{28df544b-72f2-4ed8-8bf3-609ff99633d9.png → 6d5a3e08-257c-4394-96a6-e0719a66e5ae.png} +0 -0
- /kaa/sprites/{e687c2ba-2c30-4fc8-804f-fea5815f6765.png → 6e8325f9-7fdb-4729-ac13-ca67244d97bc.png} +0 -0
- /kaa/sprites/{d91483a2-83fa-4664-8eda-52498c0e77bc.png → 71051aa7-81f1-4144-9318-4405e10547ee.png} +0 -0
- /kaa/sprites/{05251a85-2883-4098-842e-6544391de919.png → 71d0d086-50f1-4f50-bb24-a0190827bd08.png} +0 -0
- /kaa/sprites/{08bde3ff-7554-4bdb-a7f0-193323489d5b.png → 71f87e1c-77f1-45c7-bb9c-16f14498682b.png} +0 -0
- /kaa/sprites/{321b7040-87d7-4f87-9b44-ad2972584a11.png → 732ffc6c-6a17-41f8-9cd1-f218ebc0c23f.png} +0 -0
- /kaa/sprites/{205e03de-46d9-4983-a2ea-a7f7500d508f.png → 737570a7-b8f9-4cd7-b5bd-f40cd51b49f8.png} +0 -0
- /kaa/sprites/{cb0bbf0f-a25b-4ec4-99bd-f5742270a062.png → 744ea25a-9b6e-4f8f-9a00-0ac714571b09.png} +0 -0
- /kaa/sprites/{06cf74aa-635f-48ab-b965-36981f2063d3.png → 745ee069-0f22-4b99-9327-513f365eb922.png} +0 -0
- /kaa/sprites/{67edcd91-d2c1-418b-987a-e60263626f56.png → 74b50642-0b18-45c3-8a5d-013ef1e0eb78.png} +0 -0
- /kaa/sprites/{c4505a31-74c5-4b3d-bfcf-a67c3ef0039e.png → 7601152e-a216-4bf8-92a6-4e3e6ea01d3d.png} +0 -0
- /kaa/sprites/{5f6fafd9-43aa-443e-994e-f2688af5e238.png → 77e7262f-0d12-4bd9-9f22-e8f41a600bf8.png} +0 -0
- /kaa/sprites/{3ae72684-1d40-43cf-9508-511c010de64f.png → 78b928c6-0d24-4e87-a84f-0091d42f8e49.png} +0 -0
- /kaa/sprites/{65f79941-1c78-496a-a67c-c50f4227bd34.png → 7a23d548-4395-40cc-ac19-4497fa3d9fe2.png} +0 -0
- /kaa/sprites/{7d4709f8-6d0d-493f-819e-74cb0f7c166b.png → 7a7871dd-fd07-4234-bd01-c3c9e41bad45.png} +0 -0
- /kaa/sprites/{f7264cee-fea6-47b5-9f9b-8f3f31c03ea0.png → 7c193df5-0a1d-444d-9f92-e9c0db79e53a.png} +0 -0
- /kaa/sprites/{861a4faa-2522-41e9-8e20-7bd9180bea5a.png → 7d3c3a12-8d0f-48a7-9fd4-66db5e58488f.png} +0 -0
- /kaa/sprites/{51eb4be2-22fa-4683-82c7-513f5934f7b9.png → 7d9f8ea3-1fdf-4675-8ddf-38393e235746.png} +0 -0
- /kaa/sprites/{fda4b3eb-e31a-448b-8cb3-9126e1ab7deb.png → 7e729638-f54a-48bb-8bbf-eeaa4d697502.png} +0 -0
- /kaa/sprites/{b9770cd2-b55f-44dc-965f-f29686fba7da.png → 802e717f-d70a-4f34-8b96-be586a8dfde9.png} +0 -0
- /kaa/sprites/{ccfab3e2-7b6d-4ae3-998b-4e5c1863884a.png → 831cac7e-49e9-45d1-bb65-b1db733cda90.png} +0 -0
- /kaa/sprites/{6005bf30-fd7c-401e-8efd-050fa97ad7f3.png → 83f258af-35b8-4918-a971-80ea938a854e.png} +0 -0
- /kaa/sprites/{e05f2c16-926f-48be-bdd0-16182e879394.png → 8411b102-866d-4e41-ab12-507397b80ca5.png} +0 -0
- /kaa/sprites/{09222fb0-78a6-4663-8c1f-1d44e881513d.png → 848a6c94-97a5-44f7-b84b-2f3283dc446b.png} +0 -0
- /kaa/sprites/{e2a0c1a6-c0cf-400e-99be-1ed0d35c6ed8.png → 84b3c8e2-6e37-443c-be9b-8a95aedc6f37.png} +0 -0
- /kaa/sprites/{fa5b5b92-9c60-4811-a44c-8e897c9632c3.png → 85308e03-ba72-499a-9d12-870269fa3cd0.png} +0 -0
- /kaa/sprites/{38426696-ff13-4f20-9f74-b05855990153.png → 86a56df9-47ff-4741-822d-5b7e024d1598.png} +0 -0
- /kaa/sprites/{89437aca-7339-4795-b848-ec529b1e5e8d.png → 8922feef-17db-4b10-93da-1bad30492ac2.png} +0 -0
- /kaa/sprites/{61229c71-303b-4dc9-ba4e-6a14e5ab161e.png → 8a6ed80c-79c6-4df6-ab65-64d67afb2d5b.png} +0 -0
- /kaa/sprites/{504e4927-bfeb-43ee-aa5c-35cec664a4c8.png → 8b04d1a8-6cd6-4d2e-91e7-bdc58c46d939.png} +0 -0
- /kaa/sprites/{648d43f6-b251-4d6f-a808-ae7325c91a59.png → 8b60ce9f-09c0-48a0-93f0-d51e0aa16afb.png} +0 -0
- /kaa/sprites/{76970b91-7864-4413-bfc7-79c04a48dce7.png → 8c0439d9-9eb7-43f3-8d1e-7e41c57c1bbd.png} +0 -0
- /kaa/sprites/{922af7d1-75e9-4ac8-a4e7-2dad8bb1ca87.png → 8c59d3ca-baff-4260-aa0a-6cedac1c2771.png} +0 -0
- /kaa/sprites/{e7630ccb-6824-49e3-986f-2a65a2c4a948.png → 8d7b4761-2555-4398-bb74-b70de3b75e22.png} +0 -0
- /kaa/sprites/{fbbb73f9-880e-4c7f-9ec9-276bdab4b394.png → 8dd3de6d-07d5-4d93-9663-71a3a4c57a32.png} +0 -0
- /kaa/sprites/{ddb59f04-91a0-4fbd-8921-be13acdab291.png → 9009323d-1418-4aed-8a93-075b326d2e7a.png} +0 -0
- /kaa/sprites/{82259f79-2bef-442b-bf16-78cb4f22e3be.png → 901a2e7a-37f3-4dda-a58b-5a7644ead6b9.png} +0 -0
- /kaa/sprites/{fd8a7a5d-f021-4bfd-83f7-a2dd33325837.png → 904d22f7-51be-486f-8dd1-1871c0cf28e3.png} +0 -0
- /kaa/sprites/{bff753bb-b02e-441b-89e5-14845f18c6f6.png → 90943f62-0a03-4a75-804a-0c2fa7b27af4.png} +0 -0
- /kaa/sprites/{e392856d-ac59-4414-8fb8-df93a1a99be4.png → 9180e0e7-2cc4-46c7-95ff-fbe83806baf2.png} +0 -0
- /kaa/sprites/{f9157db8-d70b-4d46-9800-5a833ce7eda8.png → 93f5c33e-ec81-4a70-a11f-b2e8cb1751ee.png} +0 -0
- /kaa/sprites/{ed98a341-5dff-4af7-a194-d28232d481a4.png → 9558b2a5-3961-4ad0-9ce8-379d71920d78.png} +0 -0
- /kaa/sprites/{64dfeb35-61ad-4e9b-9847-a18530f02584.png → 968dff88-5a2f-42c7-b64b-406801e22c87.png} +0 -0
- /kaa/sprites/{8661bc83-9b0a-4555-8b21-2258b31c7f57.png → 99d99d78-ee37-4e84-8768-b5a7f4f9bd51.png} +0 -0
- /kaa/sprites/{6c032aa7-20e3-4e2e-b1a4-1585141ba22b.png → 9caa102c-70af-4a8c-b595-82df9f4c05d8.png} +0 -0
- /kaa/sprites/{73b6f3aa-5179-41d6-a82e-22e14aa8cd6a.png → 9cc77f5e-e7d0-4de4-aeb8-587ab8cb212a.png} +0 -0
- /kaa/sprites/{e57db8c2-c050-43fb-8205-339aeb5875e8.png → 9e06b7d6-5d15-4844-bbfe-ad1af7da3113.png} +0 -0
- /kaa/sprites/{14a697d4-0b58-4644-bb2d-8823d2fefcb8.png → 9e45adeb-4637-4b8b-a687-f1d2cd8c6c18.png} +0 -0
- /kaa/sprites/{38186efc-850c-4d83-97bc-9417f1494b94.png → a006054e-61fb-4d2b-a98e-45ce3c663662.png} +0 -0
- /kaa/sprites/{b77a7e97-dc59-493d-9d76-4ea9c2876978.png → a04ed558-25e3-42d7-a662-250cad9fa5df.png} +0 -0
- /kaa/sprites/{c78fb143-18e3-4697-a0c1-6151514f2a7c.png → a0a62dbf-a027-4b63-86e4-2e863b2edb01.png} +0 -0
- /kaa/sprites/{b02c15b5-04b4-40d9-bb13-267786e8e049.png → a0f98517-e4cf-422c-b29f-395a55939772.png} +0 -0
- /kaa/sprites/{dcea5aae-322e-4cd4-b218-0eac48690755.png → a4b898aa-405e-4235-8075-a34640a2b023.png} +0 -0
- /kaa/sprites/{b40bebbf-2800-40fb-b7a2-1c2d5995e747.png → a5c3108f-c92d-4ce7-8c4e-93b79f55ceb3.png} +0 -0
- /kaa/sprites/{fac7b90a-1174-477b-803b-28798647c307.png → a7e6222f-f8ca-47c2-af1e-f158a87f6a03.png} +0 -0
- /kaa/sprites/{d8ba1932-978c-451c-a717-d7d2b6db35d9.png → a94d76ef-db70-45a9-aeca-ba16344cc572.png} +0 -0
- /kaa/sprites/{cec36685-85a7-4e84-bbbc-4df70b4f7bac.png → ab3d3301-8297-43a8-bf0b-85413c115a7d.png} +0 -0
- /kaa/sprites/{bdb72f31-5808-4451-827f-fffc3b616083.png → ad589feb-6d19-47c7-a582-55ee130ee89d.png} +0 -0
- /kaa/sprites/{c035ac76-39e9-466b-a606-28bc52bc73e8.png → aed87cd4-eb05-4c24-8adf-cd3fab20e9a3.png} +0 -0
- /kaa/sprites/{a888e87e-49fe-405d-b074-3dda30304808.png → afb9e4a9-29a5-4202-9f75-e7d2f1b64aa4.png} +0 -0
- /kaa/sprites/{56ac84af-4c85-4b69-b449-98981c1df292.png → afe7f086-723e-4999-a7aa-3342a797d828.png} +0 -0
- /kaa/sprites/{fce4a481-e71c-4dab-aeac-59ff8b18201b.png → b1f547d4-c1ba-43fc-9398-4ccdc25b8b62.png} +0 -0
- /kaa/sprites/{0455e229-75c9-44ba-8729-745799746979.png → b2036053-36fb-4aa7-8348-e31942731a93.png} +0 -0
- /kaa/sprites/{8a0260f5-b32e-430e-bc98-7b5a77cab6ab.png → b61bd48f-1fe7-49fd-a588-09aac3b66f5a.png} +0 -0
- /kaa/sprites/{5247b052-5b45-4e64-b7fc-d566f5d4bc82.png → b6219452-323a-44eb-9f44-97b2ad0ee49a.png} +0 -0
- /kaa/sprites/{049ecbf6-d434-46fa-a42c-a447475269bb.png → b6da02bf-3f43-4ed0-9b13-f15becb42ce9.png} +0 -0
- /kaa/sprites/{f4195ceb-586a-4a8c-9424-4962239d2120.png → b7550a50-5943-45e7-9c1b-771117364844.png} +0 -0
- /kaa/sprites/{82200c8c-0916-4601-839a-945f96cc4ebc.png → b865eedf-7bea-46f6-bf14-7f8f4e9ab000.png} +0 -0
- /kaa/sprites/{c8c17304-e949-4dfc-b07d-9e7133483e31.png → b8f0ed47-6115-4b88-848a-2fc4a1ab25d8.png} +0 -0
- /kaa/sprites/{bdb1460e-c5db-494a-a58a-688f72b6bdba.png → b9224799-d0c1-43d9-9f11-1d35903fc4d9.png} +0 -0
- /kaa/sprites/{89841ff0-e834-4a7e-b9d5-00a9490b6b7f.png → ba2fd21c-6228-4e2d-b2db-a6d085cb38a6.png} +0 -0
- /kaa/sprites/{c2100faf-1234-49db-b6d4-5a08a4b08272.png → baa9c530-68cb-4111-85f6-060823ad32c4.png} +0 -0
- /kaa/sprites/{7a74b5f5-7a04-4678-8e6e-57b5de127182.png → bb224de8-828e-4bc5-a986-632c72fc9157.png} +0 -0
- /kaa/sprites/{a34502b4-10bd-42ca-9ada-a9cdb57097dc.png → bcc6ee72-ad5a-4d5c-b6c7-1b3fdfc5fa81.png} +0 -0
- /kaa/sprites/{a6ed21f0-4da4-4065-bb59-062a70e132ca.png → bebf9f6d-7cca-44c5-9b9f-fa36e29e97b3.png} +0 -0
- /kaa/sprites/{de81f919-4d01-4a4e-bdc1-ffe6e23a5c22.png → bed54f67-d828-403c-9cb3-6a7c85695c2a.png} +0 -0
- /kaa/sprites/{a2545c5c-b5cc-4fd2-93c1-04c74c17ee16.png → befadc5e-862a-4818-9223-5d58e4ac03cb.png} +0 -0
- /kaa/sprites/{8fdc102b-d8f3-4d16-b8ef-1d804f5aff07.png → c0d1896c-71a1-47d6-9847-b87543a942e9.png} +0 -0
- /kaa/sprites/{cdf310f0-b917-4f92-95a9-893af76e3c3a.png → c2984c0f-3e17-45c3-9d7c-dc4f14440b13.png} +0 -0
- /kaa/sprites/{054db45e-1434-4604-91ec-7ac586ca11b5.png → c4d0b0c9-ffbe-4b6c-9bf3-b05919e1a07c.png} +0 -0
- /kaa/sprites/{64f8ef99-4766-471b-aeb0-b109704d9615.png → c6b53acc-bc89-465e-9814-0138513327ac.png} +0 -0
- /kaa/sprites/{7c62081d-097a-4514-a69d-69e96201e816.png → c72a4609-6bf0-4568-8ebc-73c30d67c61e.png} +0 -0
- /kaa/sprites/{7e16af89-bb51-4889-8a7e-25715ff5faa1.png → c7829f82-bfce-4259-9ec6-f1cfb7bac925.png} +0 -0
- /kaa/sprites/{99a27ff1-bc1c-48a2-9f9b-0803338d1bd8.png → c82ebc01-0127-417f-831a-9d17a84b2691.png} +0 -0
- /kaa/sprites/{f1eb4089-8cd1-4830-b00e-40535ddcd116.png → c8747b3b-745c-45ed-84b6-dde1b2558ce8.png} +0 -0
- /kaa/sprites/{5f4abae0-a1f0-4c8c-9d93-a8525caa9dd0.png → c893e762-f328-4ef6-b862-5da8eb049f9c.png} +0 -0
- /kaa/sprites/{3a4ec054-2c48-4359-afb9-fa5ea8191d16.png → c944d298-a46b-4799-aea3-eec22fc7d4ac.png} +0 -0
- /kaa/sprites/{c9245201-4d29-4088-a5e0-f4e93d4494b5.png → c98ef89e-4a1c-40f0-a82e-6851f7b6bbc9.png} +0 -0
- /kaa/sprites/{cea8f98d-ba68-498f-bd3d-cc10f0d4575b.png → cb04d87c-f5a9-405c-92ac-b3603e482221.png} +0 -0
- /kaa/sprites/{f34e8026-bdfc-47e6-a0ed-49e587ef0f40.png → cb43f670-6623-4af9-ac1d-746372e40511.png} +0 -0
- /kaa/sprites/{c0801be3-f07a-4afc-ab0d-7f5d3c4afbd3.png → ce357023-436b-4a39-882f-8410acd8f0d7.png} +0 -0
- /kaa/sprites/{19513e9f-2cbb-4f66-84b7-2ad2faed252d.png → cea9f5ea-5923-4c6e-bd24-90d2e084112c.png} +0 -0
- /kaa/sprites/{1ef5fa52-b6e1-42d0-947a-ce970eba057d.png → cf62e2df-3be1-4d03-9f34-1518280abd90.png} +0 -0
- /kaa/sprites/{fda78372-04b4-4d55-92b1-aedec20d0913.png → d0a483a9-400f-4b6e-87a0-9781b4454da0.png} +0 -0
- /kaa/sprites/{7efce7bc-12a5-4a53-9a0a-9fa755649ebd.png → d10d480c-e96e-475e-815c-0969f37fe3bc.png} +0 -0
- /kaa/sprites/{5e2b4bb9-f200-4723-96ac-5f907e28eaaa.png → d1839450-8d60-41a4-b035-8e1acd0f1c7a.png} +0 -0
- /kaa/sprites/{3e669188-5933-4502-b039-38f4d4649664.png → d19859f3-f7cc-46ef-8bc6-86df7856fd53.png} +0 -0
- /kaa/sprites/{18b13508-c46f-4134-b991-975c0a1b9a74.png → d28a18db-0f66-45a6-b3cd-69173ecdd790.png} +0 -0
- /kaa/sprites/{6fadb00b-e32e-4c45-a738-f21b8f48c139.png → d2d3d77d-a06f-4167-b02b-5ca688c0c0c3.png} +0 -0
- /kaa/sprites/{c05a600a-d79e-432d-a49f-5b2443d67bd4.png → d38c5015-e461-4e09-8b56-731472bdf59e.png} +0 -0
- /kaa/sprites/{e388db01-0870-412d-b8bc-5a512ec997c8.png → d473b5bd-4be3-4f0f-bb92-b909050f273a.png} +0 -0
- /kaa/sprites/{aba47934-f264-49f9-a72c-6ed90b112701.png → d609a029-5407-43c2-a9a9-07bfd43fcbb8.png} +0 -0
- /kaa/sprites/{318abb8a-5950-4d22-ac42-77219b5bc1a0.png → d6491f82-9637-47eb-8f35-eb272b5ef8df.png} +0 -0
- /kaa/sprites/{41ff9641-d200-4caa-bcfa-d8389a3438eb.png → d8d5019c-52e6-4767-a9aa-d8da6ffcbd00.png} +0 -0
- /kaa/sprites/{8299e3e2-cfd5-4380-adce-a46c93b1be4d.png → d8dd8b59-c05c-4350-a15d-be75c94d46cc.png} +0 -0
- /kaa/sprites/{a7f25aeb-d91b-47e0-ba1a-0c6382380102.png → d98263bf-15fb-430e-ba39-2558fa99cac0.png} +0 -0
- /kaa/sprites/{f8d8c943-1b36-4391-a7fc-2a49f8966d53.png → d9bc9bbb-9a1a-4cbe-b6ed-24112d7c5ac7.png} +0 -0
- /kaa/sprites/{4729b509-0f4a-4e96-b186-ec56c680c9e6.png → d9cb2f43-2786-48d8-90f8-8cf1929f6172.png} +0 -0
- /kaa/sprites/{677933e9-1481-4f01-95b4-d55bea51db8c.png → da922566-97ba-4477-bcad-35ea02a3ee48.png} +0 -0
- /kaa/sprites/{abe2757f-84f3-4967-bd05-79c17cb1f32c.png → dac8d8fd-006c-4f50-a4e0-d79dbf3f5915.png} +0 -0
- /kaa/sprites/{9a9a1f40-d308-4aa5-8d91-60342bc6a4e0.png → db33ab8d-160d-48c7-b464-dfe194e762d4.png} +0 -0
- /kaa/sprites/{c6b6b77b-2ec7-4fb7-8033-f4d061f4e9c8.png → dbc5db78-81f5-41e6-bdc4-dafaa9173320.png} +0 -0
- /kaa/sprites/{4fb1d36c-5fb6-4fe5-9ba3-07e056eb1dfc.png → dcfdfab4-8dfb-4069-bf88-8e8401ef86f3.png} +0 -0
- /kaa/sprites/{ebe22aea-0318-49d8-ab07-ce2eef34265f.png → de354b53-2fd0-4039-87e2-fcad2e070579.png} +0 -0
- /kaa/sprites/{c6b0f9ba-a976-474b-b22d-6fe4391d9373.png → e28ea25e-0bcf-4d52-b501-9ef7a4863870.png} +0 -0
- /kaa/sprites/{a97e2840-1575-4f2c-97df-6a720c644969.png → e2ac106f-edeb-4375-af8c-45f33e9bfae6.png} +0 -0
- /kaa/sprites/{a9ba2741-38da-4448-ab80-f0e5b3c3847f.png → e2ac927f-257e-4537-995d-fbfbe4983b70.png} +0 -0
- /kaa/sprites/{83c27159-36d2-4ccf-ace7-e5d2169e7e52.png → e642b9ef-c8a7-41d5-8d71-5cfbaf3017a1.png} +0 -0
- /kaa/sprites/{719297ec-82be-4820-8ecf-8bf6322b81fe.png → e749feec-6bf2-4c24-bb12-948e696b8116.png} +0 -0
- /kaa/sprites/{94ed55fe-3ef8-46bc-855a-a7b1dedab801.png → e8a33d3f-a4fb-4851-b47a-b5f3d85e882f.png} +0 -0
- /kaa/sprites/{93e91dd0-0050-48b4-8bf8-c732cd76f0e3.png → ed3aa6e6-4256-416b-9d04-d57ca340e39d.png} +0 -0
- /kaa/sprites/{dc51eccf-9470-495a-9e38-59d4481adbd4.png → ed4c0554-84df-4c29-af18-7c38523cc59b.png} +0 -0
- /kaa/sprites/{8c3bc157-022a-4bb1-be74-af1ad254e67f.png → ef1bfd47-78e9-4cb7-a344-53d980fc3e5e.png} +0 -0
- /kaa/sprites/{f3a5992b-dabf-4c2b-83e9-4c91c3b7aac8.png → ef1ddc7d-75f9-4798-afa1-733e16794a81.png} +0 -0
- /kaa/sprites/{e6e66204-8a2f-4377-8674-b7d663ff0081.png → efb01328-b6e1-438e-9471-bef3ea77a22c.png} +0 -0
- /kaa/sprites/{d6dd92b3-310f-4f5d-a8ef-b941c3659c0c.png → f06b1a4f-eeb6-4dea-9543-5ec27640bdd9.png} +0 -0
- /kaa/sprites/{dcf465c6-ad64-48e7-9c3c-7bc7cfc13a44.png → f07bac27-9201-498f-9f26-a58291a70542.png} +0 -0
- /kaa/sprites/{f2f818c9-b0cf-436d-9d3e-6544c5399063.png → f0fd613b-d2f8-4b18-90d8-0b328373e715.png} +0 -0
- /kaa/sprites/{ae73d26b-2d47-4921-a6ec-5bbea32773a3.png → f1fbe46a-759d-467d-b8ca-2158f530f7c5.png} +0 -0
- /kaa/sprites/{ed854df1-878c-4e0b-8138-9b28d314ede6.png → f2314c76-3a2b-4644-831a-343a601145df.png} +0 -0
- /kaa/sprites/{993a33ac-994b-4eb0-9c1e-b9412d499d67.png → f329d4ba-e836-4be6-a05b-879b53667df3.png} +0 -0
- /kaa/sprites/{c91874f4-363f-4997-a38e-3e486dfd8043.png → f469d235-552f-4b07-9d03-9bcae425b6d8.png} +0 -0
- /kaa/sprites/{9f573ac2-9d28-4d92-8e3f-1b78031220dd.png → f5177258-a3cf-4d4f-9c69-0b49556f754f.png} +0 -0
- /kaa/sprites/{f9a353b2-958d-4aae-ade4-66bdc6481e35.png → f5dcac82-7c54-4020-84c5-b1334b595612.png} +0 -0
- /kaa/sprites/{d57f792a-f086-4fbe-b4d9-5db629a78d42.png → f6656842-1460-41ab-95ed-561aefaf08e2.png} +0 -0
- /kaa/sprites/{d9a636be-a017-4ef5-a70c-c374827008a0.png → f70e9455-7cc8-449c-8282-89a9e69f7ac3.png} +0 -0
- /kaa/sprites/{1b847790-90e2-44f8-b6d9-4814812006bd.png → f7facb3a-1b41-4409-b128-d4ad03245845.png} +0 -0
- /kaa/sprites/{b10281ae-cfaf-4400-b2fb-c8c2b432c8e7.png → f7fd469f-791e-4bf7-ae3f-b5aaed92f999.png} +0 -0
- /kaa/sprites/{ba8ee2cd-f662-440c-90b3-1e4bfe7bab6b.png → f873280f-bc68-40d1-8d8d-3d86964264f0.png} +0 -0
- /kaa/sprites/{bf3ff37e-d4fc-42ee-87d6-db1e2040aed5.png → f9da6eeb-ff9e-45b3-94b0-e7ba34938dec.png} +0 -0
- /kaa/sprites/{4370013d-f052-4314-94ff-a342d70754c3.png → fa24f5d5-d7e5-4421-8cbc-2ce3a0189654.png} +0 -0
- /kaa/sprites/{57741798-65dd-47eb-b4b1-b3f0e3c3e318.png → fb61dbf3-fbc1-400a-adde-83ea08b5027d.png} +0 -0
- /kaa/sprites/{f0ed1dd3-b227-48c1-8c8c-858dbd84fcc7.png → fc8457b6-f8a3-4b01-9864-0cd624c312b6.png} +0 -0
- /kaa/sprites/{f485db66-2159-4d31-ba53-0fbb726e7f64.png → fdbf6a89-b95a-481f-a269-be53e05b18de.png} +0 -0
- /kaa/sprites/{dae37bd7-6a34-4eb4-8cd0-3c0c03b4575a.png → fed11307-2186-4ede-875f-ffa0383f410c.png} +0 -0
- /kaa/sprites/{8fbee6fe-9409-407e-8f55-d2d36ab37f6a.png → ff0d3db2-c4e5-41e7-a85b-df4fd392924c.png} +0 -0
- /kaa/sprites/{d8967770-c64a-4609-a0a5-f46ba81edceb.png → ff40ff91-4e8c-46cb-a254-66cd5ffd363e.png} +0 -0
- /kaa/sprites/{62f93327-5946-4a48-aff8-a203483b0562.png → ff614071-c318-4263-af3e-01ea0ab45b73.png} +0 -0
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/WHEEL +0 -0
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/entry_points.txt +0 -0
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/licenses/LICENSE +0 -0
- {ksaa-2025.11b3.dist-info → ksaa-2025.11.post1.dist-info}/top_level.txt +0 -0
kaa/main/gr.py
CHANGED
|
@@ -1,2740 +1,78 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import traceback
|
|
3
|
-
import zipfile
|
|
4
1
|
import logging
|
|
5
|
-
import
|
|
6
|
-
import sys
|
|
7
|
-
import subprocess
|
|
8
|
-
import json
|
|
9
|
-
from functools import partial
|
|
10
|
-
from itertools import chain
|
|
11
|
-
from datetime import datetime, timedelta
|
|
12
|
-
from typing import List, Dict, Tuple, Literal, Generator, Callable, Any, get_args, cast
|
|
13
|
-
|
|
14
|
-
import cv2
|
|
2
|
+
import traceback
|
|
15
3
|
import gradio as gr
|
|
16
4
|
|
|
17
|
-
from kaa.
|
|
18
|
-
from kaa.
|
|
19
|
-
from kaa.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
# capsule toys
|
|
78
|
-
'capsule_toys_enabled', 'friend_capsule_toys_count',
|
|
79
|
-
'sense_capsule_toys_count', 'logic_capsule_toys_count',
|
|
80
|
-
'anomaly_capsule_toys_count',
|
|
81
|
-
|
|
82
|
-
# start game
|
|
83
|
-
'start_game_enabled', 'start_through_kuyo',
|
|
84
|
-
'game_package_name', 'kuyo_package_name',
|
|
85
|
-
'disable_gakumas_localify', 'dmm_game_path', 'dmm_bypass',
|
|
86
|
-
|
|
87
|
-
# end game
|
|
88
|
-
'exit_kaa', 'kill_game', 'kill_dmm',
|
|
89
|
-
'kill_emulator', 'shutdown', 'hibernate',
|
|
90
|
-
'restore_gakumas_localify',
|
|
91
|
-
|
|
92
|
-
'activity_funds',
|
|
93
|
-
'presents',
|
|
94
|
-
'mission_reward',
|
|
95
|
-
'activity_funds_enabled',
|
|
96
|
-
'presents_enabled',
|
|
97
|
-
'trace_recommend_card_detection',
|
|
98
|
-
|
|
99
|
-
# misc
|
|
100
|
-
'check_update', 'auto_install_update', 'expose_to_lan', 'update_channel', 'log_level',
|
|
101
|
-
|
|
102
|
-
# idle
|
|
103
|
-
'idle_enabled', 'idle_seconds', 'idle_minimize_on_pause',
|
|
104
|
-
|
|
105
|
-
'_selected_backend_index'
|
|
106
|
-
|
|
107
|
-
]
|
|
108
|
-
CONFIG_KEY_VALUE: tuple[str] = get_args(ConfigKey)
|
|
109
|
-
ConfigSetFunction = Callable[[BaseConfig, Dict[ConfigKey, Any]], None]
|
|
110
|
-
ConfigBuilderReturnValue = Tuple[ConfigSetFunction, Dict[ConfigKey, GradioInput]]
|
|
111
|
-
|
|
112
|
-
class KotoneBotUI:
|
|
113
|
-
def __init__(self, kaa: Kaa) -> None:
|
|
114
|
-
self.is_running: bool = False
|
|
115
|
-
self.single_task_running: bool = False
|
|
116
|
-
self.is_stopping: bool = False # 新增:标记是否正在停止过程中
|
|
117
|
-
self.is_single_task_stopping: bool = False # 新增:标记单个任务是否正在停止
|
|
118
|
-
self._kaa = kaa
|
|
119
|
-
self._load_config()
|
|
120
|
-
self.update_service = UpdateService()
|
|
121
|
-
self.feedback_service = FeedbackService()
|
|
122
|
-
# IdleModeManager 空闲检测
|
|
123
|
-
def safe_get_is_running():
|
|
124
|
-
try:
|
|
125
|
-
return (self.is_running or self.single_task_running) and not self.is_stopping and not self.is_single_task_stopping and not vars.flow.is_paused
|
|
126
|
-
except ContextNotInitializedError:
|
|
127
|
-
return False
|
|
128
|
-
|
|
129
|
-
def safe_get_is_paused():
|
|
130
|
-
try:
|
|
131
|
-
return vars.flow.is_paused
|
|
132
|
-
except ContextNotInitializedError:
|
|
133
|
-
return False
|
|
134
|
-
|
|
135
|
-
self.idle_mgr = IdleModeManager(
|
|
136
|
-
get_is_running=safe_get_is_running,
|
|
137
|
-
get_is_paused=safe_get_is_paused,
|
|
138
|
-
get_config=lambda: self.current_config.options.idle,
|
|
139
|
-
)
|
|
140
|
-
self._setup_kaa()
|
|
141
|
-
|
|
142
|
-
def _setup_kaa(self) -> None:
|
|
143
|
-
from kotonebot.backend.debug.vars import debug, clear_saved
|
|
144
|
-
|
|
145
|
-
self._kaa.initialize()
|
|
146
|
-
if self.current_config.keep_screenshots:
|
|
147
|
-
debug.auto_save_to_folder = 'dumps'
|
|
148
|
-
debug.enabled = True
|
|
149
|
-
clear_saved()
|
|
150
|
-
else:
|
|
151
|
-
debug.auto_save_to_folder = None
|
|
152
|
-
debug.enabled = False
|
|
153
|
-
|
|
154
|
-
def export_dumps(self) -> str:
|
|
155
|
-
"""导出 dumps 文件夹为 zip 文件"""
|
|
156
|
-
if not os.path.exists('dumps'):
|
|
157
|
-
return "dumps 文件夹不存在"
|
|
158
|
-
|
|
159
|
-
timestamp = datetime.now().strftime('%y-%m-%d-%H-%M-%S')
|
|
160
|
-
zip_filename = f'dumps-{timestamp}.zip'
|
|
161
|
-
|
|
162
|
-
with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
|
|
163
|
-
for root, dirs, files in os.walk('dumps'):
|
|
164
|
-
for file in files:
|
|
165
|
-
file_path = os.path.join(root, file)
|
|
166
|
-
arcname = os.path.relpath(file_path, 'dumps')
|
|
167
|
-
zipf.write(file_path, arcname)
|
|
168
|
-
|
|
169
|
-
return f"已导出到 {zip_filename}"
|
|
170
|
-
|
|
171
|
-
def export_logs(self) -> str:
|
|
172
|
-
"""导出 logs 文件夹为 zip 文件"""
|
|
173
|
-
if not os.path.exists('logs'):
|
|
174
|
-
return "logs 文件夹不存在"
|
|
175
|
-
|
|
176
|
-
timestamp = datetime.now().strftime('%y-%m-%d-%H-%M-%S')
|
|
177
|
-
zip_filename = f'logs-{timestamp}.zip'
|
|
178
|
-
|
|
179
|
-
with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
|
|
180
|
-
for root, dirs, files in os.walk('logs'):
|
|
181
|
-
for file in files:
|
|
182
|
-
file_path = os.path.join(root, file)
|
|
183
|
-
arcname = os.path.relpath(file_path, 'logs')
|
|
184
|
-
zipf.write(file_path, arcname)
|
|
185
|
-
|
|
186
|
-
return f"已导出到 {zip_filename}"
|
|
187
|
-
|
|
188
|
-
def get_button_status(self) -> Tuple[str, bool]:
|
|
189
|
-
"""获取按钮状态和交互性"""
|
|
190
|
-
if not hasattr(self, 'run_status'):
|
|
191
|
-
return "启动", True
|
|
192
|
-
|
|
193
|
-
if not self.run_status.running:
|
|
194
|
-
self.is_running = False
|
|
195
|
-
self.is_stopping = False # 重置停止状态
|
|
196
|
-
return "启动", True
|
|
197
|
-
|
|
198
|
-
if self.is_stopping:
|
|
199
|
-
return "停止中...", False # 停止中时禁用按钮
|
|
200
|
-
|
|
201
|
-
return "停止", True
|
|
202
|
-
|
|
203
|
-
def update_task_status(self) -> List[List[str]]:
|
|
204
|
-
status_list: List[List[str]] = []
|
|
205
|
-
if not hasattr(self, 'run_status'):
|
|
206
|
-
for task_name, task in task_registry.items():
|
|
207
|
-
status_list.append([task.name, "等待中"])
|
|
208
|
-
return status_list
|
|
209
|
-
|
|
210
|
-
for task_status in self.run_status.tasks:
|
|
211
|
-
status_text = {
|
|
212
|
-
'pending': '等待中',
|
|
213
|
-
'running': '运行中',
|
|
214
|
-
'finished': '已完成',
|
|
215
|
-
'error': '出错',
|
|
216
|
-
'cancelled': '已取消'
|
|
217
|
-
}.get(task_status.status, '未知')
|
|
218
|
-
status_list.append([task_status.task.name, status_text])
|
|
219
|
-
return status_list
|
|
220
|
-
|
|
221
|
-
def toggle_run(self) -> Tuple[str, List[List[str]]]:
|
|
222
|
-
if not self.is_running:
|
|
223
|
-
return self.start_run()
|
|
224
|
-
|
|
225
|
-
# 如果正在停止过程中,忽略重复点击
|
|
226
|
-
if self.is_stopping:
|
|
227
|
-
return "停止中...", self.update_task_status()
|
|
228
|
-
|
|
229
|
-
return self.stop_run()
|
|
230
|
-
|
|
231
|
-
def start_run(self) -> Tuple[str, List[List[str]]]:
|
|
232
|
-
self.is_running = True
|
|
233
|
-
self.run_status = self._kaa.start_all()
|
|
234
|
-
# 通知 Idle 管理器进入运行态
|
|
235
|
-
self.idle_mgr.notify_on_start()
|
|
236
|
-
return "停止", self.update_task_status()
|
|
237
|
-
|
|
238
|
-
def stop_run(self) -> Tuple[str, List[List[str]]]:
|
|
239
|
-
self.is_stopping = True # 设置停止状态
|
|
240
|
-
|
|
241
|
-
# 如果当前处于暂停状态,先恢复再停止
|
|
242
|
-
if vars.flow.is_paused:
|
|
243
|
-
gr.Info("检测到任务暂停,正在恢复后停止...")
|
|
244
|
-
vars.flow.request_resume()
|
|
245
|
-
|
|
246
|
-
self.is_running = False
|
|
247
|
-
if self._kaa:
|
|
248
|
-
self.run_status.interrupt()
|
|
249
|
-
gr.Info("正在停止任务...")
|
|
250
|
-
# 通知 Idle 管理器停止态
|
|
251
|
-
self.idle_mgr.notify_on_stop()
|
|
252
|
-
|
|
253
|
-
return "停止中...", self.update_task_status()
|
|
254
|
-
|
|
255
|
-
def start_single_task(self, task_name: str) -> Tuple[str, str]:
|
|
256
|
-
if not task_name:
|
|
257
|
-
gr.Warning("请先选择一个任务")
|
|
258
|
-
return "执行任务", ""
|
|
259
|
-
task = None
|
|
260
|
-
for name, t in task_registry.items():
|
|
261
|
-
if name == task_name:
|
|
262
|
-
task = t
|
|
263
|
-
break
|
|
264
|
-
if task is None:
|
|
265
|
-
gr.Warning(f"任务 {task_name} 未找到")
|
|
266
|
-
return "执行任务", ""
|
|
267
|
-
|
|
268
|
-
gr.Info(f"任务 {task_name} 开始执行")
|
|
269
|
-
self.single_task_running = True
|
|
270
|
-
self.run_status = self._kaa.start([task])
|
|
271
|
-
return "停止任务", f"正在执行任务: {task_name}"
|
|
272
|
-
|
|
273
|
-
def stop_single_task(self) -> Tuple[str, str]:
|
|
274
|
-
self.is_single_task_stopping = True # 设置单个任务停止状态
|
|
275
|
-
|
|
276
|
-
# 如果当前处于暂停状态,先恢复再停止
|
|
277
|
-
if vars.flow.is_paused:
|
|
278
|
-
gr.Info("检测到任务暂停,正在恢复后停止...")
|
|
279
|
-
vars.flow.request_resume()
|
|
280
|
-
|
|
281
|
-
self.single_task_running = False
|
|
282
|
-
if hasattr(self, 'run_status') and self._kaa:
|
|
283
|
-
self.run_status.interrupt()
|
|
284
|
-
gr.Info("正在停止任务...")
|
|
285
|
-
# 通知 Idle 管理器停止态
|
|
286
|
-
self.idle_mgr.notify_on_stop()
|
|
287
|
-
return "停止中...", "正在停止任务..."
|
|
288
|
-
|
|
289
|
-
def toggle_pause(self) -> str:
|
|
290
|
-
"""切换暂停/恢复状态"""
|
|
291
|
-
if vars.flow.is_paused:
|
|
292
|
-
vars.flow.request_resume()
|
|
293
|
-
gr.Info("任务已恢复")
|
|
294
|
-
return "暂停"
|
|
295
|
-
else:
|
|
296
|
-
vars.flow.request_pause()
|
|
297
|
-
gr.Info("任务已暂停")
|
|
298
|
-
return "恢复"
|
|
299
|
-
|
|
300
|
-
def get_pause_button_status(self) -> str:
|
|
301
|
-
"""获取暂停按钮的状态"""
|
|
302
|
-
if vars.flow.is_paused:
|
|
303
|
-
return "恢复"
|
|
304
|
-
else:
|
|
305
|
-
return "暂停"
|
|
306
|
-
|
|
307
|
-
def get_pause_button_with_interactive(self) -> gr.Button:
|
|
308
|
-
"""获取暂停按钮的状态和交互性"""
|
|
309
|
-
try:
|
|
310
|
-
text = "恢复" if vars.flow.is_paused else "暂停"
|
|
311
|
-
except ContextNotInitializedError:
|
|
312
|
-
# ContextNotInitializedError: Forwarded object vars called before initialization.
|
|
313
|
-
# TODO: vars.flow.is_paused 应该要可以在脚本正式启动前就能访问
|
|
314
|
-
text = '未启动'
|
|
315
|
-
# 如果正在停止过程中,禁用暂停按钮
|
|
316
|
-
interactive = not (self.is_stopping or self.is_single_task_stopping)
|
|
317
|
-
return gr.Button(value=text, interactive=interactive)
|
|
318
|
-
|
|
319
|
-
def reload_config(self) -> bool:
|
|
320
|
-
"""
|
|
321
|
-
重新加载配置并重新初始化相关组件
|
|
322
|
-
|
|
323
|
-
:return: 是否成功重新加载
|
|
324
|
-
"""
|
|
325
|
-
try:
|
|
326
|
-
# 重新加载配置文件
|
|
327
|
-
self._load_config()
|
|
328
|
-
|
|
329
|
-
# 重新设置 kaa 的配置
|
|
330
|
-
self._kaa.config_path = "config.json"
|
|
331
|
-
self._kaa.config_type = BaseConfig
|
|
332
|
-
|
|
333
|
-
# 重新初始化 kaa(这会重新创建设备和 Context)
|
|
334
|
-
self._setup_kaa()
|
|
335
|
-
|
|
336
|
-
# 重新加载 Context 中的配置数据
|
|
337
|
-
from kotonebot.backend.context.context import config
|
|
338
|
-
try:
|
|
339
|
-
config.load()
|
|
340
|
-
except ContextNotInitializedError:
|
|
341
|
-
pass
|
|
342
|
-
|
|
343
|
-
logger.info("配置已成功重新加载")
|
|
344
|
-
return True
|
|
345
|
-
except Exception as e:
|
|
346
|
-
logger.error(f"重新加载配置失败:{str(e)}")
|
|
347
|
-
return False
|
|
348
|
-
|
|
349
|
-
def save_settings2(self, return_values: list[ConfigBuilderReturnValue], *args) -> str:
|
|
350
|
-
options = BaseConfig()
|
|
351
|
-
# return_values: (set_func, { 'key': component })
|
|
352
|
-
keys = list(chain.from_iterable([list(data.keys()) for _, data in return_values]))
|
|
353
|
-
# 根据 keys 与 *args 构建 data 字典
|
|
354
|
-
data = dict[ConfigKey, Any]()
|
|
355
|
-
assert len(keys) == len(args), "keys 与 args 长度不一致"
|
|
356
|
-
for key, value in zip(keys, args):
|
|
357
|
-
assert key in CONFIG_KEY_VALUE, f"未知的配置项:{key}"
|
|
358
|
-
key = cast(ConfigKey, key)
|
|
359
|
-
data[key] = value
|
|
360
|
-
|
|
361
|
-
# 先设置options
|
|
362
|
-
for (set_func, _) in return_values:
|
|
363
|
-
set_func(options, data)
|
|
364
|
-
|
|
365
|
-
# 验证规则1:截图方法验证
|
|
366
|
-
screenshot_method = self.current_config.backend.screenshot_impl
|
|
367
|
-
backend_type = self.current_config.backend.type
|
|
368
|
-
|
|
369
|
-
valid_screenshot_methods = {
|
|
370
|
-
'mumu12': ['adb', 'adb_raw', 'uiautomator2', 'nemu_ipc'],
|
|
371
|
-
'mumu12v5': ['adb', 'adb_raw', 'uiautomator2', 'nemu_ipc'],
|
|
372
|
-
'leidian': ['adb', 'adb_raw', 'uiautomator2'],
|
|
373
|
-
'custom': ['adb', 'adb_raw', 'uiautomator2'],
|
|
374
|
-
'dmm': ['remote_windows', 'windows']
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if screenshot_method not in valid_screenshot_methods.get(backend_type, []):
|
|
378
|
-
gr.Warning(f"截图方法 '{screenshot_method}' 不适用于当前选择的模拟器类型,配置未保存。")
|
|
379
|
-
return ""
|
|
380
|
-
|
|
381
|
-
# 验证规则2:若启用培育,那么必须选择培育方案
|
|
382
|
-
if options.produce.enabled and not options.produce.selected_solution_id:
|
|
383
|
-
gr.Warning("启用培育时,必须选择培育方案,配置未保存。")
|
|
384
|
-
return ""
|
|
385
|
-
|
|
386
|
-
# 验证规则3:若启用AP/金币购买,对应的商品不能为空
|
|
387
|
-
if options.purchase.ap_enabled and not options.purchase.ap_items:
|
|
388
|
-
gr.Warning("启用AP购买时,AP商店购买物品不能为空,配置未保存。")
|
|
389
|
-
return ""
|
|
390
|
-
|
|
391
|
-
if options.purchase.money_enabled and not options.purchase.money_items:
|
|
392
|
-
gr.Warning("启用金币购买时,金币商店购买物品不能为空,配置未保存。")
|
|
393
|
-
return ""
|
|
394
|
-
|
|
395
|
-
# 验证通过,保存配置
|
|
396
|
-
self.current_config.options = options
|
|
397
|
-
try:
|
|
398
|
-
save_config(self.config, "config.json")
|
|
399
|
-
|
|
400
|
-
# 尝试热重载配置
|
|
401
|
-
if self.reload_config():
|
|
402
|
-
gr.Success("设置已保存并应用!")
|
|
403
|
-
else:
|
|
404
|
-
gr.Warning("设置已保存,但重新加载失败,请重启程序。")
|
|
405
|
-
return ""
|
|
406
|
-
except Exception as e:
|
|
407
|
-
gr.Warning(f"保存设置失败:{str(e)}")
|
|
408
|
-
return ""
|
|
409
|
-
|
|
410
|
-
def _create_status_tab(self) -> None:
|
|
411
|
-
with gr.Tab("状态"):
|
|
412
|
-
gr.Markdown("## 状态")
|
|
413
|
-
|
|
414
|
-
with gr.Row():
|
|
415
|
-
run_btn = gr.Button("启动", scale=2)
|
|
416
|
-
pause_btn = gr.Button("暂停", scale=1)
|
|
417
|
-
|
|
418
|
-
# 快速设置控制区域
|
|
419
|
-
gr.Markdown("### 快速设置")
|
|
420
|
-
|
|
421
|
-
with gr.Row():
|
|
422
|
-
select_all_btn = gr.Button("全选", scale=1)
|
|
423
|
-
unselect_all_btn = gr.Button("清空", scale=1)
|
|
424
|
-
select_produce_only_btn = gr.Button("只选培育", scale=1)
|
|
425
|
-
unselect_produce_only_btn = gr.Button("只不选培育", scale=1)
|
|
426
|
-
|
|
427
|
-
with gr.Row(elem_classes=["quick-controls-row"]):
|
|
428
|
-
purchase_quick = gr.Checkbox(
|
|
429
|
-
label="商店",
|
|
430
|
-
value=self.current_config.options.purchase.enabled,
|
|
431
|
-
interactive=True,
|
|
432
|
-
elem_classes=["quick-checkbox"]
|
|
433
|
-
)
|
|
434
|
-
assignment_quick = gr.Checkbox(
|
|
435
|
-
label="工作",
|
|
436
|
-
value=self.current_config.options.assignment.enabled,
|
|
437
|
-
interactive=True,
|
|
438
|
-
elem_classes=["quick-checkbox"]
|
|
439
|
-
)
|
|
440
|
-
contest_quick = gr.Checkbox(
|
|
441
|
-
label="竞赛",
|
|
442
|
-
value=self.current_config.options.contest.enabled,
|
|
443
|
-
interactive=True,
|
|
444
|
-
elem_classes=["quick-checkbox"]
|
|
445
|
-
)
|
|
446
|
-
produce_quick = gr.Checkbox(
|
|
447
|
-
label="培育",
|
|
448
|
-
value=self.current_config.options.produce.enabled,
|
|
449
|
-
interactive=True,
|
|
450
|
-
elem_classes=["quick-checkbox"]
|
|
451
|
-
)
|
|
452
|
-
mission_reward_quick = gr.Checkbox(
|
|
453
|
-
label="任务",
|
|
454
|
-
value=self.current_config.options.mission_reward.enabled,
|
|
455
|
-
interactive=True,
|
|
456
|
-
elem_classes=["quick-checkbox"]
|
|
457
|
-
)
|
|
458
|
-
club_reward_quick = gr.Checkbox(
|
|
459
|
-
label="社团",
|
|
460
|
-
value=self.current_config.options.club_reward.enabled,
|
|
461
|
-
interactive=True,
|
|
462
|
-
elem_classes=["quick-checkbox"]
|
|
463
|
-
)
|
|
464
|
-
activity_funds_quick = gr.Checkbox(
|
|
465
|
-
label="活动费",
|
|
466
|
-
value=self.current_config.options.activity_funds.enabled,
|
|
467
|
-
interactive=True,
|
|
468
|
-
elem_classes=["quick-checkbox"]
|
|
469
|
-
)
|
|
470
|
-
presents_quick = gr.Checkbox(
|
|
471
|
-
label="礼物",
|
|
472
|
-
value=self.current_config.options.presents.enabled,
|
|
473
|
-
interactive=True,
|
|
474
|
-
elem_classes=["quick-checkbox"]
|
|
475
|
-
)
|
|
476
|
-
capsule_toys_quick = gr.Checkbox(
|
|
477
|
-
label="扭蛋",
|
|
478
|
-
value=self.current_config.options.capsule_toys.enabled,
|
|
479
|
-
interactive=True,
|
|
480
|
-
elem_classes=["quick-checkbox"]
|
|
481
|
-
)
|
|
482
|
-
upgrade_support_card_quick = gr.Checkbox(
|
|
483
|
-
label="支援卡",
|
|
484
|
-
value=self.current_config.options.upgrade_support_card.enabled,
|
|
485
|
-
interactive=True,
|
|
486
|
-
elem_classes=["quick-checkbox"]
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
def _get_end_action_value() -> str:
|
|
490
|
-
if self.current_config.options.end_game.shutdown:
|
|
491
|
-
return "关机"
|
|
492
|
-
if self.current_config.options.end_game.hibernate:
|
|
493
|
-
return "休眠"
|
|
494
|
-
return "什么都不做"
|
|
495
|
-
|
|
496
|
-
end_action_dropdown = gr.Dropdown(
|
|
497
|
-
label="完成后:",
|
|
498
|
-
choices=["什么都不做", "关机", "休眠"],
|
|
499
|
-
value=_get_end_action_value(),
|
|
500
|
-
interactive=True
|
|
501
|
-
)
|
|
502
|
-
|
|
503
|
-
if self._kaa.upgrade_msg:
|
|
504
|
-
gr.Markdown('### 配置升级报告')
|
|
505
|
-
gr.Markdown(self._kaa.upgrade_msg)
|
|
506
|
-
gr.Markdown('脚本报错或者卡住?前往"反馈"选项卡可以快速导出报告!')
|
|
507
|
-
|
|
508
|
-
# 添加调试模式警告
|
|
509
|
-
if self.current_config.keep_screenshots:
|
|
510
|
-
gr.Markdown(
|
|
511
|
-
'<div style="color: red; font-size: larger;">当前启用了调试功能「保留截图数据」,调试结束后正常使用时建议关闭此选项!</div>',
|
|
512
|
-
elem_classes=["debug-warning"]
|
|
513
|
-
)
|
|
514
|
-
|
|
515
|
-
task_status = gr.Dataframe(
|
|
516
|
-
headers=["任务", "状态"],
|
|
517
|
-
value=self.update_task_status(),
|
|
518
|
-
label="任务状态"
|
|
519
|
-
)
|
|
520
|
-
|
|
521
|
-
# MARK: 状态 - 监听函数
|
|
522
|
-
|
|
523
|
-
def on_run_click(evt: gr.EventData) -> Tuple[gr.Button, List[List[str]]]:
|
|
524
|
-
result = self.toggle_run()
|
|
525
|
-
# 如果正在停止,禁用按钮
|
|
526
|
-
interactive = not self.is_stopping
|
|
527
|
-
button = gr.Button(value=result[0], interactive=interactive)
|
|
528
|
-
return button, result[1]
|
|
529
|
-
|
|
530
|
-
def on_pause_click(evt: gr.EventData) -> str:
|
|
531
|
-
return self.toggle_pause()
|
|
532
|
-
|
|
533
|
-
# 快速设置控制的事件处理函数
|
|
534
|
-
def save_quick_setting(success_msg: str, failed_msg: str):
|
|
535
|
-
"""保存快速设置并立即应用"""
|
|
536
|
-
try:
|
|
537
|
-
# 保存配置
|
|
538
|
-
save_config(self.config, "config.json")
|
|
539
|
-
|
|
540
|
-
# 尝试热重载配置
|
|
541
|
-
if self.reload_config():
|
|
542
|
-
gr.Success(success_msg)
|
|
543
|
-
else:
|
|
544
|
-
gr.Warning(failed_msg)
|
|
545
|
-
except Exception as e:
|
|
546
|
-
gr.Error(f"✗ 保存失败:{str(e)}")
|
|
547
|
-
|
|
548
|
-
def update_and_save_quick_setting(field_name: str, value: bool, display_name: str):
|
|
549
|
-
"""更新字段,并保存快速设置并立即应用"""
|
|
550
|
-
|
|
551
|
-
# 更新配置
|
|
552
|
-
if field_name == 'purchase':
|
|
553
|
-
self.current_config.options.purchase.enabled = value
|
|
554
|
-
elif field_name == 'assignment':
|
|
555
|
-
self.current_config.options.assignment.enabled = value
|
|
556
|
-
elif field_name == 'contest':
|
|
557
|
-
self.current_config.options.contest.enabled = value
|
|
558
|
-
elif field_name == 'produce':
|
|
559
|
-
self.current_config.options.produce.enabled = value
|
|
560
|
-
elif field_name == 'mission_reward':
|
|
561
|
-
self.current_config.options.mission_reward.enabled = value
|
|
562
|
-
elif field_name == 'club_reward':
|
|
563
|
-
self.current_config.options.club_reward.enabled = value
|
|
564
|
-
elif field_name == 'activity_funds':
|
|
565
|
-
self.current_config.options.activity_funds.enabled = value
|
|
566
|
-
elif field_name == 'presents':
|
|
567
|
-
self.current_config.options.presents.enabled = value
|
|
568
|
-
elif field_name == 'capsule_toys':
|
|
569
|
-
self.current_config.options.capsule_toys.enabled = value
|
|
570
|
-
elif field_name == 'upgrade_support_card':
|
|
571
|
-
self.current_config.options.upgrade_support_card.enabled = value
|
|
572
|
-
|
|
573
|
-
# 保存并重载配置
|
|
574
|
-
save_quick_setting(
|
|
575
|
-
f"✓ {display_name} 已{'启用' if value else '禁用'}",
|
|
576
|
-
f"⚠ {display_name} 已保存,但重新加载失败"
|
|
577
|
-
)
|
|
578
|
-
|
|
579
|
-
def batch_select(default: bool, produce_only: bool, success_msg: str) -> None:
|
|
580
|
-
self.current_config.options.purchase.enabled = default
|
|
581
|
-
self.current_config.options.assignment.enabled = default
|
|
582
|
-
self.current_config.options.contest.enabled = default
|
|
583
|
-
self.current_config.options.produce.enabled = produce_only
|
|
584
|
-
self.current_config.options.mission_reward.enabled = default
|
|
585
|
-
self.current_config.options.club_reward.enabled = default
|
|
586
|
-
self.current_config.options.activity_funds.enabled = default
|
|
587
|
-
self.current_config.options.presents.enabled = default
|
|
588
|
-
self.current_config.options.capsule_toys.enabled = default
|
|
589
|
-
self.current_config.options.upgrade_support_card.enabled = default
|
|
590
|
-
|
|
591
|
-
save_quick_setting(success_msg, f"⚠ 数据已保存,但重新加载失败")
|
|
592
|
-
|
|
593
|
-
# MARK: 状态 - UI回调函数
|
|
594
|
-
|
|
595
|
-
run_btn.click(
|
|
596
|
-
fn=on_run_click,
|
|
597
|
-
outputs=[run_btn, task_status]
|
|
598
|
-
)
|
|
599
|
-
|
|
600
|
-
pause_btn.click(
|
|
601
|
-
fn=on_pause_click,
|
|
602
|
-
outputs=[pause_btn]
|
|
603
|
-
)
|
|
604
|
-
|
|
605
|
-
select_all_btn.click(
|
|
606
|
-
fn=lambda: batch_select(True, True, f"✓ 全选成功"),
|
|
607
|
-
outputs=[]
|
|
608
|
-
)
|
|
609
|
-
|
|
610
|
-
unselect_all_btn.click(
|
|
611
|
-
fn=lambda: batch_select(False, False, f"✓ 清空成功"),
|
|
612
|
-
outputs=[]
|
|
613
|
-
)
|
|
614
|
-
|
|
615
|
-
select_produce_only_btn.click(
|
|
616
|
-
fn=lambda: batch_select(False, True, f"✓ 只选培育成功"),
|
|
617
|
-
outputs=[]
|
|
618
|
-
)
|
|
619
|
-
|
|
620
|
-
unselect_produce_only_btn.click(
|
|
621
|
-
fn=lambda: batch_select(True, False, f"✓ 只不选培育成功"),
|
|
622
|
-
outputs=[]
|
|
623
|
-
)
|
|
624
|
-
|
|
625
|
-
# 绑定快速设置控制的事件
|
|
626
|
-
|
|
627
|
-
# 以下回调函数均由.change修改为.input,这样回调函数就只会在用户操作时触发,避免全选功能导致反复触发
|
|
628
|
-
purchase_quick.input(
|
|
629
|
-
fn=lambda x: update_and_save_quick_setting('purchase', x, '商店'),
|
|
630
|
-
inputs=[purchase_quick]
|
|
631
|
-
)
|
|
632
|
-
assignment_quick.input(
|
|
633
|
-
fn=lambda x: update_and_save_quick_setting('assignment', x, '工作'),
|
|
634
|
-
inputs=[assignment_quick]
|
|
635
|
-
)
|
|
636
|
-
contest_quick.input(
|
|
637
|
-
fn=lambda x: update_and_save_quick_setting('contest', x, '竞赛'),
|
|
638
|
-
inputs=[contest_quick]
|
|
639
|
-
)
|
|
640
|
-
produce_quick.input(
|
|
641
|
-
fn=lambda x: update_and_save_quick_setting('produce', x, '培育'),
|
|
642
|
-
inputs=[produce_quick]
|
|
643
|
-
)
|
|
644
|
-
mission_reward_quick.input(
|
|
645
|
-
fn=lambda x: update_and_save_quick_setting('mission_reward', x, '任务奖励'),
|
|
646
|
-
inputs=[mission_reward_quick]
|
|
647
|
-
)
|
|
648
|
-
club_reward_quick.input(
|
|
649
|
-
fn=lambda x: update_and_save_quick_setting('club_reward', x, '社团奖励'),
|
|
650
|
-
inputs=[club_reward_quick]
|
|
651
|
-
)
|
|
652
|
-
activity_funds_quick.input(
|
|
653
|
-
fn=lambda x: update_and_save_quick_setting('activity_funds', x, '活动费'),
|
|
654
|
-
inputs=[activity_funds_quick]
|
|
655
|
-
)
|
|
656
|
-
presents_quick.input(
|
|
657
|
-
fn=lambda x: update_and_save_quick_setting('presents', x, '礼物'),
|
|
658
|
-
inputs=[presents_quick]
|
|
659
|
-
)
|
|
660
|
-
capsule_toys_quick.input(
|
|
661
|
-
fn=lambda x: update_and_save_quick_setting('capsule_toys', x, '扭蛋'),
|
|
662
|
-
inputs=[capsule_toys_quick]
|
|
663
|
-
)
|
|
664
|
-
upgrade_support_card_quick.input(
|
|
665
|
-
fn=lambda x: update_and_save_quick_setting('upgrade_support_card', x, '支援卡升级'),
|
|
666
|
-
inputs=[upgrade_support_card_quick]
|
|
667
|
-
)
|
|
668
|
-
|
|
669
|
-
# 处理完成后操作下拉框
|
|
670
|
-
def save_quick_end_action(action: str):
|
|
671
|
-
try:
|
|
672
|
-
if action == "关机":
|
|
673
|
-
self.current_config.options.end_game.shutdown = True
|
|
674
|
-
self.current_config.options.end_game.hibernate = False
|
|
675
|
-
elif action == "休眠":
|
|
676
|
-
self.current_config.options.end_game.shutdown = False
|
|
677
|
-
self.current_config.options.end_game.hibernate = True
|
|
678
|
-
else: # 什么都不做
|
|
679
|
-
self.current_config.options.end_game.shutdown = False
|
|
680
|
-
self.current_config.options.end_game.hibernate = False
|
|
681
|
-
|
|
682
|
-
save_config(self.config, "config.json")
|
|
683
|
-
|
|
684
|
-
# 尝试热重载配置
|
|
685
|
-
if self.reload_config():
|
|
686
|
-
gr.Success(f"✓ 完成后操作已设置为 {action}")
|
|
687
|
-
else:
|
|
688
|
-
gr.Warning("⚠ 设置已保存,但重新加载失败")
|
|
689
|
-
except Exception as e:
|
|
690
|
-
gr.Error(f"✗ 保存失败:{str(e)}")
|
|
691
|
-
|
|
692
|
-
end_action_dropdown.change(
|
|
693
|
-
fn=save_quick_end_action,
|
|
694
|
-
inputs=[end_action_dropdown]
|
|
695
|
-
)
|
|
696
|
-
|
|
697
|
-
# 添加定时器,分别更新按钮状态和任务状态
|
|
698
|
-
def update_run_button_status():
|
|
699
|
-
text, interactive = self.get_button_status()
|
|
700
|
-
return gr.Button(value=text, interactive=interactive)
|
|
701
|
-
|
|
702
|
-
def update_quick_checkboxes():
|
|
703
|
-
"""更新快速设置区域控件的状态,确保与设置同步"""
|
|
704
|
-
end_action_val = _get_end_action_value()
|
|
705
|
-
return [
|
|
706
|
-
gr.Checkbox(value=self.current_config.options.purchase.enabled),
|
|
707
|
-
gr.Checkbox(value=self.current_config.options.assignment.enabled),
|
|
708
|
-
gr.Checkbox(value=self.current_config.options.contest.enabled),
|
|
709
|
-
gr.Checkbox(value=self.current_config.options.produce.enabled),
|
|
710
|
-
gr.Checkbox(value=self.current_config.options.mission_reward.enabled),
|
|
711
|
-
gr.Checkbox(value=self.current_config.options.club_reward.enabled),
|
|
712
|
-
gr.Checkbox(value=self.current_config.options.activity_funds.enabled),
|
|
713
|
-
gr.Checkbox(value=self.current_config.options.presents.enabled),
|
|
714
|
-
gr.Checkbox(value=self.current_config.options.capsule_toys.enabled),
|
|
715
|
-
gr.Checkbox(value=self.current_config.options.upgrade_support_card.enabled),
|
|
716
|
-
gr.Dropdown(value=end_action_val),
|
|
717
|
-
]
|
|
718
|
-
|
|
719
|
-
gr.Timer(1.0).tick(
|
|
720
|
-
fn=update_run_button_status,
|
|
721
|
-
outputs=[run_btn]
|
|
722
|
-
)
|
|
723
|
-
gr.Timer(1.0).tick(
|
|
724
|
-
fn=self.get_pause_button_with_interactive,
|
|
725
|
-
outputs=[pause_btn]
|
|
726
|
-
)
|
|
727
|
-
gr.Timer(2.0).tick(
|
|
728
|
-
fn=update_quick_checkboxes,
|
|
729
|
-
outputs=[
|
|
730
|
-
purchase_quick, assignment_quick, contest_quick, produce_quick,
|
|
731
|
-
mission_reward_quick, club_reward_quick, activity_funds_quick, presents_quick,
|
|
732
|
-
capsule_toys_quick, upgrade_support_card_quick, end_action_dropdown
|
|
733
|
-
]
|
|
734
|
-
)
|
|
735
|
-
gr.Timer(1.0).tick(
|
|
736
|
-
fn=self.update_task_status,
|
|
737
|
-
outputs=[task_status]
|
|
738
|
-
)
|
|
739
|
-
|
|
740
|
-
def _create_task_tab(self) -> None:
|
|
741
|
-
with gr.Tab("任务"):
|
|
742
|
-
gr.Markdown("## 执行任务")
|
|
743
|
-
|
|
744
|
-
# 第一行:统一的停止和暂停按钮
|
|
745
|
-
with gr.Row():
|
|
746
|
-
stop_all_btn = gr.Button("停止任务", variant="stop", scale=1)
|
|
747
|
-
pause_btn = gr.Button("暂停", scale=1)
|
|
748
|
-
|
|
749
|
-
task_result = gr.Markdown("")
|
|
750
|
-
|
|
751
|
-
# 获取所有任务并创建列表布局
|
|
752
|
-
tasks = list(task_registry.values())
|
|
753
|
-
task_buttons = [] # 存储所有任务按钮的引用
|
|
754
|
-
|
|
755
|
-
# 为每个任务创建一行:左侧启动按钮,右侧任务名
|
|
756
|
-
for task in tasks:
|
|
757
|
-
with gr.Row():
|
|
758
|
-
with gr.Column(scale=1, min_width=50):
|
|
759
|
-
task_btn = gr.Button("启动", variant="primary", size="sm")
|
|
760
|
-
task_buttons.append((task_btn, task.name))
|
|
761
|
-
with gr.Column(scale=7):
|
|
762
|
-
gr.Markdown(f"{task.name}")
|
|
763
|
-
|
|
764
|
-
# 事件处理函数
|
|
765
|
-
def start_single_task_by_name(task_name: str):
|
|
766
|
-
"""启动指定任务并返回状态信息及所有按钮的更新状态"""
|
|
767
|
-
if self.single_task_running:
|
|
768
|
-
return ["已有任务正在运行"] + [gr.Button(interactive=False) for _ in task_buttons]
|
|
769
|
-
|
|
770
|
-
# 启动任务
|
|
771
|
-
result = self.start_single_task(task_name)
|
|
772
|
-
status_msg = result[1]
|
|
773
|
-
|
|
774
|
-
# 如果成功启动,禁用所有任务按钮
|
|
775
|
-
if self.single_task_running:
|
|
776
|
-
disabled_buttons = [gr.Button(value="运行中", interactive=False) for _ in task_buttons]
|
|
777
|
-
else:
|
|
778
|
-
disabled_buttons = [gr.Button(value="启动", interactive=True) for _ in task_buttons]
|
|
779
|
-
|
|
780
|
-
return [status_msg] + disabled_buttons
|
|
781
|
-
|
|
782
|
-
def stop_all_tasks():
|
|
783
|
-
"""停止所有任务并重置按钮状态"""
|
|
784
|
-
if not self.single_task_running:
|
|
785
|
-
return ["没有正在运行的任务"] + [gr.Button(value="启动", interactive=True) for _ in task_buttons]
|
|
786
|
-
|
|
787
|
-
# 停止任务
|
|
788
|
-
result = self.stop_single_task()
|
|
789
|
-
status_msg = result[1]
|
|
790
|
-
|
|
791
|
-
# 如果正在停止中,显示停止中状态
|
|
792
|
-
if self.is_single_task_stopping:
|
|
793
|
-
disabled_buttons = [gr.Button(value="停止中", interactive=False) for _ in task_buttons]
|
|
794
|
-
else:
|
|
795
|
-
disabled_buttons = [gr.Button(value="启动", interactive=True) for _ in task_buttons]
|
|
796
|
-
|
|
797
|
-
return [status_msg] + disabled_buttons
|
|
798
|
-
|
|
799
|
-
def get_task_buttons_status() -> List[gr.Button]:
|
|
800
|
-
"""获取所有任务按钮的状态"""
|
|
801
|
-
if not hasattr(self, 'run_status') or not self.run_status.running:
|
|
802
|
-
self.single_task_running = False
|
|
803
|
-
self.is_single_task_stopping = False
|
|
804
|
-
return [gr.Button(value="启动", interactive=True) for _ in task_buttons]
|
|
805
|
-
|
|
806
|
-
if self.is_single_task_stopping:
|
|
807
|
-
return [gr.Button(value="停止中", interactive=False) for _ in task_buttons]
|
|
808
|
-
|
|
809
|
-
if self.single_task_running:
|
|
810
|
-
return [gr.Button(value="运行中", interactive=False) for _ in task_buttons]
|
|
811
|
-
|
|
812
|
-
return [gr.Button(value="启动", interactive=True) for _ in task_buttons]
|
|
813
|
-
|
|
814
|
-
def get_single_task_status() -> str:
|
|
815
|
-
"""获取任务状态信息"""
|
|
816
|
-
if not hasattr(self, 'run_status'):
|
|
817
|
-
return ""
|
|
818
|
-
|
|
819
|
-
if not self.run_status.running and self.single_task_running:
|
|
820
|
-
# 任务已结束但状态未更新
|
|
821
|
-
self.single_task_running = False
|
|
822
|
-
|
|
823
|
-
# 检查任务状态
|
|
824
|
-
for task_status in self.run_status.tasks:
|
|
825
|
-
status = task_status.status
|
|
826
|
-
task_name = task_status.task.name
|
|
827
|
-
|
|
828
|
-
if status == 'finished':
|
|
829
|
-
return f"任务 {task_name} 已完成"
|
|
830
|
-
elif status == 'error':
|
|
831
|
-
return f"任务 {task_name} 出错"
|
|
832
|
-
elif status == 'cancelled':
|
|
833
|
-
return f"任务 {task_name} 已取消"
|
|
834
|
-
|
|
835
|
-
return "任务已结束"
|
|
836
|
-
|
|
837
|
-
if self.single_task_running:
|
|
838
|
-
for task_status in self.run_status.tasks:
|
|
839
|
-
if task_status.status == 'running':
|
|
840
|
-
return f"正在执行任务: {task_status.task.name}"
|
|
841
|
-
|
|
842
|
-
return "正在准备执行任务..."
|
|
843
|
-
|
|
844
|
-
return ""
|
|
845
|
-
|
|
846
|
-
def on_pause_click() -> str:
|
|
847
|
-
return self.toggle_pause()
|
|
848
|
-
|
|
849
|
-
# 绑定事件 - 为每个任务按钮绑定点击事件
|
|
850
|
-
def create_task_handler(task_name: str):
|
|
851
|
-
"""创建任务处理函数,避免闭包问题"""
|
|
852
|
-
def handler():
|
|
853
|
-
return start_single_task_by_name(task_name)
|
|
854
|
-
return handler
|
|
855
|
-
|
|
856
|
-
for task_btn, task_name in task_buttons:
|
|
857
|
-
task_btn.click(
|
|
858
|
-
fn=create_task_handler(task_name),
|
|
859
|
-
outputs=[task_result] + [btn for btn, _ in task_buttons]
|
|
860
|
-
)
|
|
861
|
-
|
|
862
|
-
# 绑定停止按钮事件
|
|
863
|
-
stop_all_btn.click(
|
|
864
|
-
fn=stop_all_tasks,
|
|
865
|
-
outputs=[task_result] + [btn for btn, _ in task_buttons]
|
|
866
|
-
)
|
|
867
|
-
|
|
868
|
-
# 绑定暂停按钮事件
|
|
869
|
-
pause_btn.click(
|
|
870
|
-
fn=on_pause_click,
|
|
871
|
-
outputs=[pause_btn]
|
|
872
|
-
)
|
|
873
|
-
|
|
874
|
-
# 添加定时器更新按钮状态和任务状态
|
|
875
|
-
gr.Timer(1.0).tick(
|
|
876
|
-
fn=get_task_buttons_status,
|
|
877
|
-
outputs=[btn for btn, _ in task_buttons]
|
|
878
|
-
)
|
|
879
|
-
gr.Timer(1.0).tick(
|
|
880
|
-
fn=self.get_pause_button_with_interactive,
|
|
881
|
-
outputs=[pause_btn]
|
|
882
|
-
)
|
|
883
|
-
gr.Timer(1.0).tick(
|
|
884
|
-
fn=get_single_task_status,
|
|
885
|
-
outputs=[task_result]
|
|
886
|
-
)
|
|
887
|
-
|
|
888
|
-
def _create_emulator_settings(self) -> ConfigBuilderReturnValue:
|
|
889
|
-
gr.Markdown("### 模拟器设置")
|
|
890
|
-
current_tab = 0
|
|
891
|
-
|
|
892
|
-
def _update_emulator_tab_options(impl_value: str, selected_index: int):
|
|
893
|
-
nonlocal current_tab
|
|
894
|
-
current_tab = selected_index
|
|
895
|
-
choices = ['adb', 'adb_raw', 'uiautomator2', 'windows', 'remote_windows', 'nemu_ipc']
|
|
896
|
-
if impl_value not in choices:
|
|
897
|
-
new_value = choices[0]
|
|
898
|
-
else:
|
|
899
|
-
new_value = impl_value
|
|
900
|
-
return new_value
|
|
901
|
-
|
|
902
|
-
with gr.Tabs(selected=self.current_config.backend.type):
|
|
903
|
-
with gr.Tab("MuMu 12 v4.x", id="mumu12") as tab_mumu12:
|
|
904
|
-
gr.Markdown("已选中 MuMu 12 v4.x 模拟器")
|
|
905
|
-
mumu_refresh_message = gr.Markdown("<div style='color: red;'>点击下方「刷新」按钮载入信息</div>", visible=True)
|
|
906
|
-
mumu_instance = gr.Dropdown(
|
|
907
|
-
label="选择多开实例",
|
|
908
|
-
choices=[],
|
|
909
|
-
interactive=True
|
|
910
|
-
)
|
|
911
|
-
mumu_refresh_btn = gr.Button("刷新")
|
|
912
|
-
|
|
913
|
-
def refresh_mumu_instances():
|
|
914
|
-
try:
|
|
915
|
-
instances = Mumu12Host.list()
|
|
916
|
-
is_mumu12 = self.current_config.backend.type == 'mumu12'
|
|
917
|
-
current_id = self.current_config.backend.instance_id if is_mumu12 else None
|
|
918
|
-
choices = [(i.name, i.id) for i in instances]
|
|
919
|
-
return gr.Dropdown(choices=choices, value=current_id, interactive=True), gr.Markdown(visible=False)
|
|
920
|
-
except Exception as e:
|
|
921
|
-
logger.exception('Failed to list installed MuMu12')
|
|
922
|
-
gr.Error("获取 MuMu12 模拟器列表失败,请升级模拟器到最新版本。若问题依旧,前往 QQ 群、QQ 频道或 Github 反馈 bug。")
|
|
923
|
-
return gr.Dropdown(choices=[], interactive=True), gr.Markdown(visible=True)
|
|
924
|
-
|
|
925
|
-
mumu_refresh_btn.click(
|
|
926
|
-
fn=refresh_mumu_instances,
|
|
927
|
-
outputs=[mumu_instance, mumu_refresh_message]
|
|
928
|
-
)
|
|
929
|
-
|
|
930
|
-
# 如果当前是 MuMu 模拟器且有配置的 instance_id,立即加载实例列表
|
|
931
|
-
if self.current_config.backend.type == 'mumu12' and self.current_config.backend.instance_id:
|
|
932
|
-
try:
|
|
933
|
-
instances = Mumu12Host.list()
|
|
934
|
-
choices = [(i.name, i.id) for i in instances]
|
|
935
|
-
mumu_instance.choices = choices
|
|
936
|
-
mumu_instance.value = self.current_config.backend.instance_id
|
|
937
|
-
mumu_refresh_message.visible = False
|
|
938
|
-
except Exception as e:
|
|
939
|
-
logger.exception('Failed to auto-load MuMu12 instances')
|
|
940
|
-
|
|
941
|
-
mumu_background_mode = gr.Checkbox(
|
|
942
|
-
label="MuMu12 模拟器后台保活模式",
|
|
943
|
-
value=self.current_config.backend.mumu_background_mode,
|
|
944
|
-
info=BackendConfig.model_fields['mumu_background_mode'].description,
|
|
945
|
-
interactive=True
|
|
946
|
-
)
|
|
947
|
-
|
|
948
|
-
with gr.Tab("MuMu 12 v5.x", id="mumu12v5") as tab_mumu12v5:
|
|
949
|
-
gr.Markdown("已选中 MuMu 12 v5.x 模拟器")
|
|
950
|
-
mumu_refresh_message = gr.Markdown("<div style='color: red;'>点击下方「刷新」按钮载入信息</div>", visible=True)
|
|
951
|
-
mumu_instance12v5 = gr.Dropdown(
|
|
952
|
-
label="选择多开实例",
|
|
953
|
-
choices=[],
|
|
954
|
-
interactive=True
|
|
955
|
-
)
|
|
956
|
-
mumu_refresh_btn = gr.Button("刷新")
|
|
957
|
-
|
|
958
|
-
def refresh_mumu12v5_instances():
|
|
959
|
-
try:
|
|
960
|
-
instances = Mumu12V5Host.list()
|
|
961
|
-
is_mumu12v5 = self.current_config.backend.type == 'mumu12v5'
|
|
962
|
-
current_id = self.current_config.backend.instance_id if is_mumu12v5 else None
|
|
963
|
-
choices = [(i.name, i.id) for i in instances]
|
|
964
|
-
return gr.Dropdown(choices=choices, value=current_id, interactive=True), gr.Markdown(visible=False)
|
|
965
|
-
except Exception as e:
|
|
966
|
-
logger.exception('Failed to list installed MuMu12v5')
|
|
967
|
-
gr.Error("获取 MuMu12 模拟器列表失败,请升级模拟器到最新版本。若问题依旧,前往 QQ 群、QQ 频道或 Github 反馈 bug。")
|
|
968
|
-
return gr.Dropdown(choices=[], interactive=True), gr.Markdown(visible=True)
|
|
969
|
-
|
|
970
|
-
mumu_refresh_btn.click(
|
|
971
|
-
fn=refresh_mumu12v5_instances,
|
|
972
|
-
outputs=[mumu_instance12v5, mumu_refresh_message]
|
|
973
|
-
)
|
|
974
|
-
|
|
975
|
-
# 如果当前是 MuMu 模拟器且有配置的 instance_id,立即加载实例列表
|
|
976
|
-
if self.current_config.backend.type == 'mumu12v5' and self.current_config.backend.instance_id:
|
|
977
|
-
try:
|
|
978
|
-
instances = Mumu12V5Host.list()
|
|
979
|
-
choices = [(i.name, i.id) for i in instances]
|
|
980
|
-
mumu_instance12v5.choices = choices
|
|
981
|
-
mumu_instance12v5.value = self.current_config.backend.instance_id
|
|
982
|
-
mumu_refresh_message.visible = False
|
|
983
|
-
except Exception as e:
|
|
984
|
-
logger.exception('Failed to auto-load MuMu12v5 instances')
|
|
985
|
-
|
|
986
|
-
mumu_background_mode = gr.Checkbox(
|
|
987
|
-
label="MuMu12v5 模拟器后台保活模式",
|
|
988
|
-
value=self.current_config.backend.mumu_background_mode,
|
|
989
|
-
info=BackendConfig.model_fields['mumu_background_mode'].description,
|
|
990
|
-
interactive=True
|
|
991
|
-
)
|
|
992
|
-
|
|
993
|
-
with gr.Tab("雷电", id="leidian") as tab_leidian:
|
|
994
|
-
gr.Markdown("已选中雷电模拟器")
|
|
995
|
-
leidian_refresh_message = gr.Markdown("<div style='color: red;'>点击下方「刷新」按钮载入信息</div>", visible=True)
|
|
996
|
-
leidian_instance = gr.Dropdown(
|
|
997
|
-
label="选择多开实例",
|
|
998
|
-
choices=[],
|
|
999
|
-
interactive=True
|
|
1000
|
-
)
|
|
1001
|
-
leidian_refresh_btn = gr.Button("刷新")
|
|
1002
|
-
|
|
1003
|
-
def refresh_leidian_instances():
|
|
1004
|
-
try:
|
|
1005
|
-
instances = LeidianHost.list()
|
|
1006
|
-
is_leidian = self.current_config.backend.type == 'leidian'
|
|
1007
|
-
current_id = self.current_config.backend.instance_id if is_leidian else None
|
|
1008
|
-
choices = [(i.name, i.id) for i in instances]
|
|
1009
|
-
return gr.Dropdown(choices=choices, value=current_id, interactive=True), gr.Markdown(visible=False)
|
|
1010
|
-
except Exception as e:
|
|
1011
|
-
logger.exception('Failed to list installed Leidian')
|
|
1012
|
-
gr.Error("获取雷电模拟器列表失败,请前往 QQ 群、QQ 频道或 Github 反馈 bug。")
|
|
1013
|
-
return gr.Dropdown(choices=[], interactive=True), gr.Markdown(visible=True)
|
|
1014
|
-
|
|
1015
|
-
leidian_refresh_btn.click(
|
|
1016
|
-
fn=refresh_leidian_instances,
|
|
1017
|
-
outputs=[leidian_instance, leidian_refresh_message]
|
|
1018
|
-
)
|
|
1019
|
-
|
|
1020
|
-
# 如果当前是雷电模拟器且有配置的 instance_id,立即加载实例列表
|
|
1021
|
-
if self.current_config.backend.type == 'leidian' and self.current_config.backend.instance_id:
|
|
1022
|
-
try:
|
|
1023
|
-
instances = LeidianHost.list()
|
|
1024
|
-
choices = [(i.name, i.id) for i in instances]
|
|
1025
|
-
leidian_instance.choices = choices
|
|
1026
|
-
leidian_instance.value = self.current_config.backend.instance_id
|
|
1027
|
-
leidian_refresh_message.visible = False
|
|
1028
|
-
except Exception as e:
|
|
1029
|
-
logger.exception('Failed to auto-load Leidian instances')
|
|
1030
|
-
# 保持显示刷新提示
|
|
1031
|
-
|
|
1032
|
-
with gr.Tab("自定义", id="custom") as tab_custom:
|
|
1033
|
-
gr.Markdown("已选中自定义模拟器")
|
|
1034
|
-
adb_ip = gr.Textbox(
|
|
1035
|
-
value=self.current_config.backend.adb_ip,
|
|
1036
|
-
label="ADB IP 地址",
|
|
1037
|
-
info=BackendConfig.model_fields['adb_ip'].description,
|
|
1038
|
-
interactive=True
|
|
1039
|
-
)
|
|
1040
|
-
adb_port = gr.Number(
|
|
1041
|
-
value=self.current_config.backend.adb_port,
|
|
1042
|
-
label="ADB 端口",
|
|
1043
|
-
info=BackendConfig.model_fields['adb_port'].description,
|
|
1044
|
-
minimum=1,
|
|
1045
|
-
maximum=65535,
|
|
1046
|
-
step=1,
|
|
1047
|
-
interactive=True
|
|
1048
|
-
)
|
|
1049
|
-
check_emulator = gr.Checkbox(
|
|
1050
|
-
label="检查并启动模拟器",
|
|
1051
|
-
value=self.current_config.backend.check_emulator,
|
|
1052
|
-
info=BackendConfig.model_fields['check_emulator'].description,
|
|
1053
|
-
interactive=True
|
|
1054
|
-
)
|
|
1055
|
-
with gr.Group(visible=self.current_config.backend.check_emulator) as check_emulator_group:
|
|
1056
|
-
emulator_path = gr.Textbox(
|
|
1057
|
-
value=self.current_config.backend.emulator_path,
|
|
1058
|
-
label="模拟器 exe 文件路径",
|
|
1059
|
-
info=BackendConfig.model_fields['emulator_path'].description,
|
|
1060
|
-
interactive=True
|
|
1061
|
-
)
|
|
1062
|
-
adb_emulator_name = gr.Textbox(
|
|
1063
|
-
value=self.current_config.backend.adb_emulator_name,
|
|
1064
|
-
label="ADB 模拟器名称",
|
|
1065
|
-
info=BackendConfig.model_fields['adb_emulator_name'].description,
|
|
1066
|
-
interactive=True
|
|
1067
|
-
)
|
|
1068
|
-
emulator_args = gr.Textbox(
|
|
1069
|
-
value=self.current_config.backend.emulator_args,
|
|
1070
|
-
label="模拟器启动参数",
|
|
1071
|
-
info=BackendConfig.model_fields['emulator_args'].description,
|
|
1072
|
-
interactive=True
|
|
1073
|
-
)
|
|
1074
|
-
check_emulator.change(
|
|
1075
|
-
fn=lambda x: gr.Group(visible=x),
|
|
1076
|
-
inputs=[check_emulator],
|
|
1077
|
-
outputs=[check_emulator_group]
|
|
1078
|
-
)
|
|
1079
|
-
|
|
1080
|
-
with gr.Tab("DMM", id="dmm") as tab_dmm:
|
|
1081
|
-
gr.Markdown("已选中 DMM")
|
|
1082
|
-
gr.Markdown("**暂停快捷键 <kbd>Ctrl</kbd> + <kbd>F4</kbd>,停止快捷键 <kbd>Ctrl</kbd> + <kbd>F3</kbd>**")
|
|
1083
|
-
|
|
1084
|
-
choices = ['adb', 'adb_raw', 'uiautomator2', 'windows', 'remote_windows', 'nemu_ipc']
|
|
1085
|
-
screenshot_impl = gr.Dropdown(
|
|
1086
|
-
choices=choices,
|
|
1087
|
-
value=self.current_config.backend.screenshot_impl,
|
|
1088
|
-
label="截图方法",
|
|
1089
|
-
info=BackendConfig.model_fields['screenshot_impl'].description,
|
|
1090
|
-
interactive=True
|
|
1091
|
-
)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
target_screenshot_interval = gr.Number(
|
|
1095
|
-
label="最小截图间隔(秒)",
|
|
1096
|
-
value=self.current_config.backend.target_screenshot_interval,
|
|
1097
|
-
info=BackendConfig.model_fields['target_screenshot_interval'].description,
|
|
1098
|
-
minimum=0,
|
|
1099
|
-
step=0.1,
|
|
1100
|
-
interactive=True
|
|
5
|
+
from kaa.main.kaa import Kaa
|
|
6
|
+
from kaa.application.ui.facade import KaaFacade
|
|
7
|
+
from kaa.application.ui.gradio_view import KaaGradioView
|
|
8
|
+
|
|
9
|
+
custom_css = """
|
|
10
|
+
.no-padding-dropdown {
|
|
11
|
+
padding: 0 !important;
|
|
12
|
+
}
|
|
13
|
+
.no-padding-dropdown > label {
|
|
14
|
+
padding: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
.no-padding-dropdown > div {
|
|
17
|
+
padding: 0 !important;
|
|
18
|
+
}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def main(kaa_ins: Kaa, start_immediately: bool = False):
|
|
22
|
+
"""
|
|
23
|
+
Main entry point for the KAA Gradio application.
|
|
24
|
+
Initializes the core application, facade, and UI view, then launches the UI.
|
|
25
|
+
"""
|
|
26
|
+
# Configure basic logging
|
|
27
|
+
logging.basicConfig(level=logging.INFO, format='[%(asctime)s][%(levelname)s][%(name)s] %(message)s')
|
|
28
|
+
logger = logging.getLogger(__name__)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
# 1. Initialize Model/Core Application
|
|
32
|
+
# The Kaa instance holds the core application logic and state.
|
|
33
|
+
kaa_instance = kaa_ins
|
|
34
|
+
|
|
35
|
+
# 2. Initialize Facade
|
|
36
|
+
# The Facade is the single point of entry for the UI to interact with the backend.
|
|
37
|
+
# It orchestrates the various services.
|
|
38
|
+
facade = KaaFacade(kaa_instance)
|
|
39
|
+
|
|
40
|
+
# Set log level from config
|
|
41
|
+
log_level_str = facade.config_service.get_options().misc.log_level
|
|
42
|
+
log_level = logging.DEBUG if log_level_str == 'verbose' else logging.INFO
|
|
43
|
+
logging.getLogger().setLevel(log_level)
|
|
44
|
+
logger.info(f"Log level set to {log_level_str.upper()}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# 3. Initialize View
|
|
48
|
+
# The View is responsible for building and rendering the UI.
|
|
49
|
+
# It only interacts with the Facade.
|
|
50
|
+
view = KaaGradioView(facade)
|
|
51
|
+
|
|
52
|
+
# 4. Create and launch the Gradio UI
|
|
53
|
+
blocks = view.create_ui()
|
|
54
|
+
|
|
55
|
+
if start_immediately:
|
|
56
|
+
facade.start_all_tasks()
|
|
57
|
+
|
|
58
|
+
misc_opts = facade.config_service.get_options().misc
|
|
59
|
+
logger.info(f"Launching Gradio UI... LAN exposure: {misc_opts.expose_to_lan}")
|
|
60
|
+
|
|
61
|
+
blocks.launch(
|
|
62
|
+
share=misc_opts.expose_to_lan,
|
|
63
|
+
inbrowser=True,
|
|
64
|
+
css=custom_css
|
|
1101
65
|
)
|
|
1102
66
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
_update_emulator_tab_options(
|
|
1112
|
-
impl_value=self.current_config.backend.screenshot_impl,
|
|
1113
|
-
selected_index=0
|
|
67
|
+
except Exception:
|
|
68
|
+
logger.exception("A critical error occurred during application startup.")
|
|
69
|
+
# If startup fails, display a minimal error UI to the user.
|
|
70
|
+
with gr.Blocks() as error_blocks:
|
|
71
|
+
gr.Markdown("# 琴音小助手 启动失败")
|
|
72
|
+
gr.Markdown(
|
|
73
|
+
"kaa 在启动时遇到严重错误。\n\n"
|
|
74
|
+
"请前往 [QQ 群](https://qm.qq.com/q/DFglKikW2s)或 [Github Issues](https://github.com/a-date-na/kotone-auto-assistant/issues) 寻求帮助。"
|
|
1114
75
|
)
|
|
1115
|
-
|
|
1116
|
-
_update_emulator_tab_options(
|
|
1117
|
-
impl_value=self.current_config.backend.screenshot_impl,
|
|
1118
|
-
selected_index=1
|
|
1119
|
-
)
|
|
1120
|
-
elif self.current_config.backend.type == 'leidian':
|
|
1121
|
-
_update_emulator_tab_options(
|
|
1122
|
-
impl_value=self.current_config.backend.screenshot_impl,
|
|
1123
|
-
selected_index=2
|
|
1124
|
-
)
|
|
1125
|
-
elif self.current_config.backend.type == 'custom':
|
|
1126
|
-
_update_emulator_tab_options(
|
|
1127
|
-
impl_value=self.current_config.backend.screenshot_impl,
|
|
1128
|
-
selected_index=3
|
|
1129
|
-
)
|
|
1130
|
-
elif self.current_config.backend.type == 'dmm':
|
|
1131
|
-
_update_emulator_tab_options(
|
|
1132
|
-
impl_value=self.current_config.backend.screenshot_impl,
|
|
1133
|
-
selected_index=4
|
|
1134
|
-
)
|
|
1135
|
-
else:
|
|
1136
|
-
gr.Warning(f"未知的模拟器类型:{self.current_config.backend.type}")
|
|
1137
|
-
|
|
1138
|
-
def set_config(_: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
1139
|
-
# current_tab is updated by _update_emulator_tab_options
|
|
1140
|
-
if current_tab == 0: # Mumu
|
|
1141
|
-
self.current_config.backend.type = 'mumu12'
|
|
1142
|
-
self.current_config.backend.instance_id = data['_mumu_index']
|
|
1143
|
-
self.current_config.backend.mumu_background_mode = data['mumu_background_mode']
|
|
1144
|
-
elif current_tab == 1: # Mumu12v5
|
|
1145
|
-
self.current_config.backend.type = 'mumu12v5'
|
|
1146
|
-
self.current_config.backend.instance_id = data['_mumu12v5_index']
|
|
1147
|
-
self.current_config.backend.mumu_background_mode = data['mumu_background_mode']
|
|
1148
|
-
elif current_tab == 2: # Leidian
|
|
1149
|
-
self.current_config.backend.type = 'leidian'
|
|
1150
|
-
self.current_config.backend.instance_id = data['_leidian_index']
|
|
1151
|
-
elif current_tab == 3: # Custom
|
|
1152
|
-
self.current_config.backend.type = 'custom'
|
|
1153
|
-
self.current_config.backend.instance_id = None
|
|
1154
|
-
self.current_config.backend.adb_ip = data['adb_ip']
|
|
1155
|
-
self.current_config.backend.adb_port = data['adb_port']
|
|
1156
|
-
self.current_config.backend.adb_emulator_name = data['adb_emulator_name']
|
|
1157
|
-
self.current_config.backend.check_emulator = data['check_emulator']
|
|
1158
|
-
self.current_config.backend.emulator_path = data['emulator_path']
|
|
1159
|
-
self.current_config.backend.emulator_args = data['emulator_args']
|
|
1160
|
-
elif current_tab == 4: # DMM
|
|
1161
|
-
self.current_config.backend.type = 'dmm'
|
|
1162
|
-
self.current_config.backend.instance_id = None # DMM doesn't use instance_id here
|
|
1163
|
-
|
|
1164
|
-
# Common settings for all backend types
|
|
1165
|
-
self.current_config.backend.screenshot_impl = data['screenshot_method']
|
|
1166
|
-
self.current_config.backend.target_screenshot_interval = data['target_screenshot_interval']
|
|
1167
|
-
|
|
1168
|
-
return set_config, {
|
|
1169
|
-
'adb_ip': adb_ip,
|
|
1170
|
-
'adb_port': adb_port,
|
|
1171
|
-
'screenshot_method': screenshot_impl,
|
|
1172
|
-
'target_screenshot_interval': target_screenshot_interval,
|
|
1173
|
-
'check_emulator': check_emulator,
|
|
1174
|
-
'emulator_path': emulator_path,
|
|
1175
|
-
'adb_emulator_name': adb_emulator_name,
|
|
1176
|
-
'emulator_args': emulator_args,
|
|
1177
|
-
'_mumu_index': mumu_instance,
|
|
1178
|
-
'_leidian_index': leidian_instance,
|
|
1179
|
-
'_mumu12v5_index': mumu_instance12v5,
|
|
1180
|
-
'mumu_background_mode': mumu_background_mode
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
def _create_purchase_settings(self) -> ConfigBuilderReturnValue:
|
|
1184
|
-
with gr.Column():
|
|
1185
|
-
gr.Markdown("### 商店购买设置")
|
|
1186
|
-
purchase_enabled = gr.Checkbox(
|
|
1187
|
-
label="启用商店购买",
|
|
1188
|
-
value=self.current_config.options.purchase.enabled,
|
|
1189
|
-
info=PurchaseConfig.model_fields['enabled'].description
|
|
1190
|
-
)
|
|
1191
|
-
with gr.Group(visible=self.current_config.options.purchase.enabled) as purchase_group:
|
|
1192
|
-
money_enabled = gr.Checkbox(
|
|
1193
|
-
label="启用金币购买",
|
|
1194
|
-
value=self.current_config.options.purchase.money_enabled,
|
|
1195
|
-
info=PurchaseConfig.model_fields['money_enabled'].description
|
|
1196
|
-
)
|
|
1197
|
-
|
|
1198
|
-
# 添加金币商店商品选择
|
|
1199
|
-
money_items = gr.Dropdown(
|
|
1200
|
-
multiselect=True,
|
|
1201
|
-
choices=list(DailyMoneyShopItems.all()),
|
|
1202
|
-
value=self.current_config.options.purchase.money_items,
|
|
1203
|
-
label="金币商店购买物品",
|
|
1204
|
-
info=PurchaseConfig.model_fields['money_items'].description
|
|
1205
|
-
)
|
|
1206
|
-
|
|
1207
|
-
money_refresh = gr.Checkbox(
|
|
1208
|
-
label="每日一次免费刷新金币商店",
|
|
1209
|
-
value=self.current_config.options.purchase.money_refresh,
|
|
1210
|
-
info=PurchaseConfig.model_fields['money_refresh'].description
|
|
1211
|
-
)
|
|
1212
|
-
|
|
1213
|
-
ap_enabled = gr.Checkbox(
|
|
1214
|
-
label="启用AP购买",
|
|
1215
|
-
value=self.current_config.options.purchase.ap_enabled,
|
|
1216
|
-
info=PurchaseConfig.model_fields['ap_enabled'].description
|
|
1217
|
-
)
|
|
1218
|
-
|
|
1219
|
-
# 转换枚举值为显示文本
|
|
1220
|
-
selected_items: List[str] = []
|
|
1221
|
-
ap_items_map = {
|
|
1222
|
-
APShopItems.PRODUCE_PT_UP: "支援强化点数提升",
|
|
1223
|
-
APShopItems.PRODUCE_NOTE_UP: "笔记数提升",
|
|
1224
|
-
APShopItems.RECHALLENGE: "重新挑战券",
|
|
1225
|
-
APShopItems.REGENERATE_MEMORY: "回忆再生成券"
|
|
1226
|
-
}
|
|
1227
|
-
for item_value in self.current_config.options.purchase.ap_items:
|
|
1228
|
-
item_enum = APShopItems(item_value)
|
|
1229
|
-
if item_enum in ap_items_map:
|
|
1230
|
-
selected_items.append(ap_items_map[item_enum])
|
|
1231
|
-
|
|
1232
|
-
ap_items = gr.Dropdown(
|
|
1233
|
-
multiselect=True,
|
|
1234
|
-
choices=list(ap_items_map.values()),
|
|
1235
|
-
value=selected_items,
|
|
1236
|
-
label="AP商店购买物品",
|
|
1237
|
-
info=PurchaseConfig.model_fields['ap_items'].description
|
|
1238
|
-
)
|
|
1239
|
-
|
|
1240
|
-
purchase_enabled.change(
|
|
1241
|
-
fn=lambda x: gr.Group(visible=x),
|
|
1242
|
-
inputs=[purchase_enabled],
|
|
1243
|
-
outputs=[purchase_group]
|
|
1244
|
-
)
|
|
1245
|
-
|
|
1246
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
1247
|
-
config.purchase.enabled = data['purchase_enabled']
|
|
1248
|
-
config.purchase.money_enabled = data['money_enabled']
|
|
1249
|
-
config.purchase.money_items = [DailyMoneyShopItems(x) for x in data['money_items']]
|
|
1250
|
-
config.purchase.money_refresh = data['money_refresh']
|
|
1251
|
-
config.purchase.ap_enabled = data['ap_enabled']
|
|
1252
|
-
ap_items_enum: List[Literal[0, 1, 2, 3]] = []
|
|
1253
|
-
ap_items_map: Dict[str, APShopItems] = {
|
|
1254
|
-
"支援强化点数提升": APShopItems.PRODUCE_PT_UP,
|
|
1255
|
-
"笔记数提升": APShopItems.PRODUCE_NOTE_UP,
|
|
1256
|
-
"重新挑战券": APShopItems.RECHALLENGE,
|
|
1257
|
-
"回忆再生成券": APShopItems.REGENERATE_MEMORY
|
|
1258
|
-
}
|
|
1259
|
-
for item in data['ap_items']:
|
|
1260
|
-
if item in ap_items_map:
|
|
1261
|
-
ap_items_enum.append(ap_items_map[item].value) # type: ignore
|
|
1262
|
-
config.purchase.ap_items = ap_items_enum
|
|
1263
|
-
|
|
1264
|
-
return set_config, {
|
|
1265
|
-
'purchase_enabled': purchase_enabled,
|
|
1266
|
-
'money_enabled': money_enabled,
|
|
1267
|
-
'ap_enabled': ap_enabled,
|
|
1268
|
-
'ap_items': ap_items,
|
|
1269
|
-
'money_items': money_items,
|
|
1270
|
-
'money_refresh': money_refresh
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
def _create_work_settings(self) -> ConfigBuilderReturnValue:
|
|
1274
|
-
with gr.Column():
|
|
1275
|
-
gr.Markdown("### 工作设置")
|
|
1276
|
-
assignment_enabled = gr.Checkbox(
|
|
1277
|
-
label="启用工作",
|
|
1278
|
-
value=self.current_config.options.assignment.enabled,
|
|
1279
|
-
info=AssignmentConfig.model_fields['enabled'].description
|
|
1280
|
-
)
|
|
1281
|
-
with gr.Group(visible=self.current_config.options.assignment.enabled) as work_group:
|
|
1282
|
-
with gr.Row():
|
|
1283
|
-
with gr.Column():
|
|
1284
|
-
mini_live_reassign = gr.Checkbox(
|
|
1285
|
-
label="启用重新分配 MiniLive",
|
|
1286
|
-
value=self.current_config.options.assignment.mini_live_reassign_enabled,
|
|
1287
|
-
info=AssignmentConfig.model_fields['mini_live_reassign_enabled'].description
|
|
1288
|
-
)
|
|
1289
|
-
mini_live_duration = gr.Dropdown(
|
|
1290
|
-
choices=[4, 6, 12],
|
|
1291
|
-
value=self.current_config.options.assignment.mini_live_duration,
|
|
1292
|
-
label="MiniLive 工作时长",
|
|
1293
|
-
interactive=True,
|
|
1294
|
-
info=AssignmentConfig.model_fields['mini_live_duration'].description
|
|
1295
|
-
)
|
|
1296
|
-
with gr.Column():
|
|
1297
|
-
online_live_reassign = gr.Checkbox(
|
|
1298
|
-
label="启用重新分配 OnlineLive",
|
|
1299
|
-
value=self.current_config.options.assignment.online_live_reassign_enabled,
|
|
1300
|
-
info=AssignmentConfig.model_fields['online_live_reassign_enabled'].description
|
|
1301
|
-
)
|
|
1302
|
-
online_live_duration = gr.Dropdown(
|
|
1303
|
-
choices=[4, 6, 12],
|
|
1304
|
-
value=self.current_config.options.assignment.online_live_duration,
|
|
1305
|
-
label="OnlineLive 工作时长",
|
|
1306
|
-
interactive=True,
|
|
1307
|
-
info=AssignmentConfig.model_fields['online_live_duration'].description
|
|
1308
|
-
)
|
|
1309
|
-
|
|
1310
|
-
assignment_enabled.change(
|
|
1311
|
-
fn=lambda x: gr.Group(visible=x),
|
|
1312
|
-
inputs=[assignment_enabled],
|
|
1313
|
-
outputs=[work_group]
|
|
1314
|
-
)
|
|
1315
|
-
# return assignment_enabled, mini_live_reassign, mini_live_duration, online_live_reassign, online_live_duration
|
|
1316
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
1317
|
-
config.assignment.enabled = data['assignment_enabled']
|
|
1318
|
-
config.assignment.mini_live_reassign_enabled = data['mini_live_reassign']
|
|
1319
|
-
config.assignment.mini_live_duration = data['mini_live_duration']
|
|
1320
|
-
config.assignment.online_live_reassign_enabled = data['online_live_reassign']
|
|
1321
|
-
config.assignment.online_live_duration = data['online_live_duration']
|
|
1322
|
-
|
|
1323
|
-
return set_config, {
|
|
1324
|
-
'assignment_enabled': assignment_enabled,
|
|
1325
|
-
'mini_live_reassign': mini_live_reassign,
|
|
1326
|
-
'mini_live_duration': mini_live_duration,
|
|
1327
|
-
'online_live_reassign': online_live_reassign,
|
|
1328
|
-
'online_live_duration': online_live_duration
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
def _create_contest_settings(self) -> ConfigBuilderReturnValue:
|
|
1333
|
-
with gr.Column():
|
|
1334
|
-
gr.Markdown("### 竞赛设置")
|
|
1335
|
-
contest_enabled = gr.Checkbox(
|
|
1336
|
-
label="启用竞赛",
|
|
1337
|
-
value=self.current_config.options.contest.enabled,
|
|
1338
|
-
info=ContestConfig.model_fields['enabled'].description
|
|
1339
|
-
)
|
|
1340
|
-
with gr.Group(visible=self.current_config.options.contest.enabled) as contest_group:
|
|
1341
|
-
select_which_contestant = gr.Dropdown(
|
|
1342
|
-
choices=[1, 2, 3],
|
|
1343
|
-
value=self.current_config.options.contest.select_which_contestant,
|
|
1344
|
-
label="选择第几位竞赛目标",
|
|
1345
|
-
interactive=True,
|
|
1346
|
-
info=ContestConfig.model_fields['select_which_contestant'].description
|
|
1347
|
-
)
|
|
1348
|
-
|
|
1349
|
-
when_no_set_choices = [
|
|
1350
|
-
("通知我并跳过竞赛", "remind"),
|
|
1351
|
-
("提醒我并等待手动编成", "wait"),
|
|
1352
|
-
("使用自动编成并提醒我", "auto_set"),
|
|
1353
|
-
("使用自动编成", "auto_set_silent")
|
|
1354
|
-
]
|
|
1355
|
-
when_no_set = gr.Dropdown(
|
|
1356
|
-
choices=when_no_set_choices,
|
|
1357
|
-
value=self.current_config.options.contest.when_no_set,
|
|
1358
|
-
label="竞赛队伍未编成时",
|
|
1359
|
-
interactive=True,
|
|
1360
|
-
info=ContestConfig.model_fields['when_no_set'].description
|
|
1361
|
-
)
|
|
1362
|
-
contest_enabled.change(
|
|
1363
|
-
fn=lambda x: gr.Group(visible=x),
|
|
1364
|
-
inputs=[contest_enabled],
|
|
1365
|
-
outputs=[contest_group]
|
|
1366
|
-
)
|
|
1367
|
-
|
|
1368
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
1369
|
-
config.contest.enabled = data['contest_enabled']
|
|
1370
|
-
config.contest.select_which_contestant = data['select_which_contestant']
|
|
1371
|
-
config.contest.when_no_set = data['when_no_set']
|
|
1372
|
-
|
|
1373
|
-
return set_config, {
|
|
1374
|
-
'contest_enabled': contest_enabled,
|
|
1375
|
-
'select_which_contestant': select_which_contestant,
|
|
1376
|
-
'when_no_set': when_no_set
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
def _create_produce_settings(self) -> ConfigBuilderReturnValue:
|
|
1380
|
-
with gr.Column():
|
|
1381
|
-
gr.Markdown("### 培育设置")
|
|
1382
|
-
produce_enabled = gr.Checkbox(
|
|
1383
|
-
label="启用培育",
|
|
1384
|
-
value=self.current_config.options.produce.enabled,
|
|
1385
|
-
info=ProduceConfig.model_fields['enabled'].description
|
|
1386
|
-
)
|
|
1387
|
-
|
|
1388
|
-
with gr.Group(visible=self.current_config.options.produce.enabled) as produce_group:
|
|
1389
|
-
# 培育方案管理区域
|
|
1390
|
-
solution_manager = ProduceSolutionManager()
|
|
1391
|
-
solutions = solution_manager.list()
|
|
1392
|
-
solution_choices = [(f"{sol.name} - {sol.description or '无描述'}", sol.id) for sol in solutions]
|
|
1393
|
-
|
|
1394
|
-
selected_solution_id = self.current_config.options.produce.selected_solution_id
|
|
1395
|
-
solution_dropdown = gr.Dropdown(
|
|
1396
|
-
choices=solution_choices,
|
|
1397
|
-
value=selected_solution_id,
|
|
1398
|
-
label="当前使用的培育方案",
|
|
1399
|
-
interactive=True
|
|
1400
|
-
)
|
|
1401
|
-
|
|
1402
|
-
produce_count = gr.Number(
|
|
1403
|
-
minimum=1,
|
|
1404
|
-
value=self.current_config.options.produce.produce_count,
|
|
1405
|
-
label="培育次数",
|
|
1406
|
-
interactive=True,
|
|
1407
|
-
info=ProduceConfig.model_fields['produce_count'].description
|
|
1408
|
-
)
|
|
1409
|
-
|
|
1410
|
-
produce_timeout_cd = gr.Number(
|
|
1411
|
-
minimum=20,
|
|
1412
|
-
value=self.current_config.options.produce.produce_timeout_cd,
|
|
1413
|
-
label="推荐卡检测用时上限",
|
|
1414
|
-
interactive=True,
|
|
1415
|
-
info=ProduceConfig.model_fields['produce_timeout_cd'].description
|
|
1416
|
-
)
|
|
1417
|
-
|
|
1418
|
-
interrupt_timeout = gr.Number(
|
|
1419
|
-
minimum=20,
|
|
1420
|
-
value=self.current_config.options.produce.interrupt_timeout,
|
|
1421
|
-
label="检测超时时间",
|
|
1422
|
-
interactive=True,
|
|
1423
|
-
info=ProduceConfig.model_fields['interrupt_timeout'].description
|
|
1424
|
-
)
|
|
1425
|
-
|
|
1426
|
-
enable_fever_month = gr.Radio(
|
|
1427
|
-
label="自动启用强化月间",
|
|
1428
|
-
choices=[("不操作", "ignore"), ("自动启用", "on"), ("自动禁用", "off")],
|
|
1429
|
-
value=self.current_config.options.produce.enable_fever_month,
|
|
1430
|
-
info=ProduceConfig.model_fields['enable_fever_month'].description,
|
|
1431
|
-
interactive=True
|
|
1432
|
-
)
|
|
1433
|
-
|
|
1434
|
-
# 绑定启用状态变化事件
|
|
1435
|
-
def on_produce_enabled_change(enabled):
|
|
1436
|
-
return gr.Group(visible=enabled)
|
|
1437
|
-
|
|
1438
|
-
produce_enabled.change(
|
|
1439
|
-
fn=on_produce_enabled_change,
|
|
1440
|
-
inputs=[produce_enabled],
|
|
1441
|
-
outputs=[produce_group]
|
|
1442
|
-
)
|
|
1443
|
-
|
|
1444
|
-
# 存储设置Tab中的下拉框引用,供培育Tab使用
|
|
1445
|
-
self._settings_solution_dropdown = solution_dropdown
|
|
1446
|
-
|
|
1447
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
1448
|
-
config.produce.enabled = data['produce_enabled']
|
|
1449
|
-
config.produce.selected_solution_id = data.get('selected_solution_id')
|
|
1450
|
-
config.produce.produce_count = data.get('produce_count', 1)
|
|
1451
|
-
config.produce.produce_timeout_cd = data.get('produce_timeout_cd', 60)
|
|
1452
|
-
config.produce.interrupt_timeout = data.get('interrupt_timeout', 180)
|
|
1453
|
-
config.produce.enable_fever_month = data.get('enable_fever_month', 'ignore')
|
|
1454
|
-
|
|
1455
|
-
return set_config, {
|
|
1456
|
-
'produce_enabled': produce_enabled,
|
|
1457
|
-
'selected_solution_id': solution_dropdown,
|
|
1458
|
-
'produce_count': produce_count,
|
|
1459
|
-
'produce_timeout_cd': produce_timeout_cd,
|
|
1460
|
-
'interrupt_timeout': interrupt_timeout,
|
|
1461
|
-
'enable_fever_month': enable_fever_month
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
def _create_produce_tab(self) -> None:
|
|
1466
|
-
"""创建培育Tab"""
|
|
1467
|
-
with gr.Tab("培育"):
|
|
1468
|
-
gr.Markdown("## 培育管理")
|
|
1469
|
-
|
|
1470
|
-
# 培育方案管理区域
|
|
1471
|
-
solution_manager = ProduceSolutionManager()
|
|
1472
|
-
solutions = solution_manager.list()
|
|
1473
|
-
solution_choices = [(f"{sol.name} - {sol.description or '无描述'}", sol.id) for sol in solutions]
|
|
1474
|
-
|
|
1475
|
-
selected_solution_id = self.current_config.options.produce.selected_solution_id
|
|
1476
|
-
solution_dropdown = gr.Dropdown(
|
|
1477
|
-
choices=solution_choices,
|
|
1478
|
-
value=selected_solution_id,
|
|
1479
|
-
label="选择培育方案",
|
|
1480
|
-
interactive=True
|
|
1481
|
-
)
|
|
1482
|
-
|
|
1483
|
-
# 获取设置Tab中的下拉框引用
|
|
1484
|
-
settings_dropdown = getattr(self, '_settings_solution_dropdown', None)
|
|
1485
|
-
|
|
1486
|
-
with gr.Row():
|
|
1487
|
-
new_solution_btn = gr.Button("新建培育", scale=1)
|
|
1488
|
-
delete_solution_btn = gr.Button("删除当前培育", scale=1)
|
|
1489
|
-
|
|
1490
|
-
# 培育方案详细设置区域
|
|
1491
|
-
with gr.Group() as solution_settings_group:
|
|
1492
|
-
# 获取当前选中的方案数据
|
|
1493
|
-
current_solution = None
|
|
1494
|
-
if selected_solution_id:
|
|
1495
|
-
try:
|
|
1496
|
-
current_solution = solution_manager.read(selected_solution_id)
|
|
1497
|
-
except ProduceSolutionNotFoundError:
|
|
1498
|
-
pass
|
|
1499
|
-
|
|
1500
|
-
if current_solution is None:
|
|
1501
|
-
# 如果没有选中方案,隐藏所有设置组件
|
|
1502
|
-
solution_name = gr.Textbox(label="方案名称", value="", visible=False)
|
|
1503
|
-
solution_description = gr.Textbox(label="方案描述", value="", visible=False)
|
|
1504
|
-
# 其他设置组件都设为不可见
|
|
1505
|
-
produce_mode = gr.Dropdown(
|
|
1506
|
-
choices=["regular", "pro", "master"],
|
|
1507
|
-
label="培育模式",
|
|
1508
|
-
info="进行一次 REGULAR 培育需要 ~30min,进行一次 PRO 培育需要 ~1h(具体视设备性能而定)。",
|
|
1509
|
-
visible=False
|
|
1510
|
-
)
|
|
1511
|
-
|
|
1512
|
-
# 添加偶像选择
|
|
1513
|
-
idol_choices = []
|
|
1514
|
-
for idol in IdolCard.all():
|
|
1515
|
-
if idol.is_another:
|
|
1516
|
-
idol_choices.append((f'{idol.name} 「{idol.another_name}」', idol.skin_id))
|
|
1517
|
-
else:
|
|
1518
|
-
idol_choices.append((f'{idol.name}', idol.skin_id))
|
|
1519
|
-
|
|
1520
|
-
produce_idols = gr.Dropdown(
|
|
1521
|
-
choices=idol_choices,
|
|
1522
|
-
label="选择要培育的偶像",
|
|
1523
|
-
multiselect=False,
|
|
1524
|
-
info="要培育偶像的 IdolCardSkin.id。",
|
|
1525
|
-
visible=False
|
|
1526
|
-
)
|
|
1527
|
-
kotone_warning = gr.Markdown(visible=False)
|
|
1528
|
-
auto_set_memory = gr.Checkbox(
|
|
1529
|
-
label="自动编成回忆",
|
|
1530
|
-
info="是否自动编成回忆。此选项优先级高于回忆编成编号。",
|
|
1531
|
-
visible=False
|
|
1532
|
-
)
|
|
1533
|
-
with gr.Group(visible=False) as memory_sets_group:
|
|
1534
|
-
memory_sets = gr.Dropdown(
|
|
1535
|
-
choices=[str(i) for i in range(1, 11)],
|
|
1536
|
-
label="回忆编成编号",
|
|
1537
|
-
multiselect=False,
|
|
1538
|
-
info="要使用的回忆编成编号,从 1 开始。",
|
|
1539
|
-
visible=False
|
|
1540
|
-
)
|
|
1541
|
-
auto_set_support = gr.Checkbox(
|
|
1542
|
-
label="自动编成支援卡",
|
|
1543
|
-
info="是否自动编成支援卡。此选项优先级高于支援卡编成编号。",
|
|
1544
|
-
visible=False
|
|
1545
|
-
)
|
|
1546
|
-
with gr.Group(visible=False) as support_card_sets_group:
|
|
1547
|
-
support_card_sets = gr.Dropdown(
|
|
1548
|
-
choices=[str(i) for i in range(1, 11)],
|
|
1549
|
-
label="支援卡编成编号",
|
|
1550
|
-
multiselect=False,
|
|
1551
|
-
info="要使用的支援卡编成编号,从 1 开始。",
|
|
1552
|
-
visible=False
|
|
1553
|
-
)
|
|
1554
|
-
use_pt_boost = gr.Checkbox(
|
|
1555
|
-
label="使用支援强化 Pt 提升",
|
|
1556
|
-
info="是否使用支援强化 Pt 提升。",
|
|
1557
|
-
visible=False
|
|
1558
|
-
)
|
|
1559
|
-
use_note_boost = gr.Checkbox(
|
|
1560
|
-
label="使用笔记数提升",
|
|
1561
|
-
info="是否使用笔记数提升。",
|
|
1562
|
-
visible=False
|
|
1563
|
-
)
|
|
1564
|
-
follow_producer = gr.Checkbox(
|
|
1565
|
-
label="关注租借了支援卡的制作人",
|
|
1566
|
-
info="是否关注租借了支援卡的制作人。",
|
|
1567
|
-
visible=False
|
|
1568
|
-
)
|
|
1569
|
-
self_study_lesson = gr.Dropdown(
|
|
1570
|
-
choices=['dance', 'visual', 'vocal'],
|
|
1571
|
-
label='文化课自习时选项',
|
|
1572
|
-
info='自习课类型。',
|
|
1573
|
-
visible=False
|
|
1574
|
-
)
|
|
1575
|
-
prefer_lesson_ap = gr.Checkbox(
|
|
1576
|
-
label="SP 课程优先",
|
|
1577
|
-
info="优先 SP 课程。启用后,若出现 SP 课程,则会优先执行 SP 课程,而不是推荐课程。若出现多个 SP 课程,随机选择一个。",
|
|
1578
|
-
visible=False
|
|
1579
|
-
)
|
|
1580
|
-
actions_order = gr.Dropdown(
|
|
1581
|
-
choices=[(action.display_name, action.value) for action in ProduceAction],
|
|
1582
|
-
label="行动优先级",
|
|
1583
|
-
info="每一周的行动将会按这里设置的优先级执行。",
|
|
1584
|
-
multiselect=True,
|
|
1585
|
-
visible=False
|
|
1586
|
-
)
|
|
1587
|
-
recommend_card_detection_mode = gr.Dropdown(
|
|
1588
|
-
choices=[
|
|
1589
|
-
(RecommendCardDetectionMode.NORMAL.display_name, RecommendCardDetectionMode.NORMAL.value),
|
|
1590
|
-
(RecommendCardDetectionMode.STRICT.display_name, RecommendCardDetectionMode.STRICT.value)
|
|
1591
|
-
],
|
|
1592
|
-
label="推荐卡检测模式",
|
|
1593
|
-
info="推荐卡检测模式。严格模式下,识别速度会降低,但识别准确率会提高。推荐Kotone使用严格模式,其他角色使用正常模式。",
|
|
1594
|
-
visible=False
|
|
1595
|
-
)
|
|
1596
|
-
use_ap_drink = gr.Checkbox(
|
|
1597
|
-
label="AP 不足时自动使用 AP 饮料",
|
|
1598
|
-
info="AP 不足时自动使用 AP 饮料",
|
|
1599
|
-
visible=False
|
|
1600
|
-
)
|
|
1601
|
-
skip_commu = gr.Checkbox(
|
|
1602
|
-
label="检测并跳过交流",
|
|
1603
|
-
info="检测并跳过交流",
|
|
1604
|
-
visible=False
|
|
1605
|
-
)
|
|
1606
|
-
save_solution_btn = gr.Button("保存培育方案", variant="primary", visible=False)
|
|
1607
|
-
else:
|
|
1608
|
-
# 显示选中方案的设置
|
|
1609
|
-
solution_name = gr.Textbox(
|
|
1610
|
-
label="方案名称",
|
|
1611
|
-
value=current_solution.name,
|
|
1612
|
-
interactive=True
|
|
1613
|
-
)
|
|
1614
|
-
solution_description = gr.Textbox(
|
|
1615
|
-
label="方案描述",
|
|
1616
|
-
value=current_solution.description or "",
|
|
1617
|
-
interactive=True
|
|
1618
|
-
)
|
|
1619
|
-
|
|
1620
|
-
produce_mode = gr.Dropdown(
|
|
1621
|
-
choices=["regular", "pro", "master"],
|
|
1622
|
-
value=current_solution.data.mode,
|
|
1623
|
-
label="培育模式",
|
|
1624
|
-
info="进行一次 REGULAR 培育需要 ~30min,进行一次 PRO 培育需要 ~1h(具体视设备性能而定)。"
|
|
1625
|
-
)
|
|
1626
|
-
|
|
1627
|
-
# 添加偶像选择
|
|
1628
|
-
idol_choices = []
|
|
1629
|
-
for idol in IdolCard.all():
|
|
1630
|
-
if idol.is_another:
|
|
1631
|
-
idol_choices.append((f'{idol.name} 「{idol.another_name}」', idol.skin_id))
|
|
1632
|
-
else:
|
|
1633
|
-
idol_choices.append((f'{idol.name}', idol.skin_id))
|
|
1634
|
-
|
|
1635
|
-
produce_idols = gr.Dropdown(
|
|
1636
|
-
choices=idol_choices,
|
|
1637
|
-
value=current_solution.data.idol,
|
|
1638
|
-
label="选择要培育的偶像",
|
|
1639
|
-
multiselect=False,
|
|
1640
|
-
interactive=True,
|
|
1641
|
-
info="要培育偶像的 IdolCardSkin.id。"
|
|
1642
|
-
)
|
|
1643
|
-
|
|
1644
|
-
has_kotone = bool(current_solution.data.idol and "藤田ことね" in current_solution.data.idol)
|
|
1645
|
-
is_strict_mode = current_solution.data.recommend_card_detection_mode == RecommendCardDetectionMode.STRICT
|
|
1646
|
-
kotone_warning = gr.Markdown(
|
|
1647
|
-
visible=has_kotone and not is_strict_mode,
|
|
1648
|
-
value="使用「藤田ことね」进行培育时,确保将「推荐卡检测模式」设置为「严格模式」"
|
|
1649
|
-
)
|
|
1650
|
-
|
|
1651
|
-
auto_set_memory = gr.Checkbox(
|
|
1652
|
-
label="自动编成回忆",
|
|
1653
|
-
value=current_solution.data.auto_set_memory,
|
|
1654
|
-
info="是否自动编成回忆。此选项优先级高于回忆编成编号。"
|
|
1655
|
-
)
|
|
1656
|
-
|
|
1657
|
-
with gr.Group(visible=not current_solution.data.auto_set_memory) as memory_sets_group:
|
|
1658
|
-
memory_sets = gr.Dropdown(
|
|
1659
|
-
choices=[str(i) for i in range(1, 21)], # 最多20个编成位
|
|
1660
|
-
value=str(current_solution.data.memory_set) if current_solution.data.memory_set else None,
|
|
1661
|
-
label="回忆编成编号",
|
|
1662
|
-
multiselect=False,
|
|
1663
|
-
interactive=True,
|
|
1664
|
-
info="要使用的回忆编成编号,从 1 开始。"
|
|
1665
|
-
)
|
|
1666
|
-
|
|
1667
|
-
auto_set_support = gr.Checkbox(
|
|
1668
|
-
label="自动编成支援卡",
|
|
1669
|
-
value=current_solution.data.auto_set_support_card,
|
|
1670
|
-
info="是否自动编成支援卡。此选项优先级高于支援卡编成编号。"
|
|
1671
|
-
)
|
|
1672
|
-
|
|
1673
|
-
with gr.Group(visible=not current_solution.data.auto_set_support_card) as support_card_sets_group:
|
|
1674
|
-
support_card_sets = gr.Dropdown(
|
|
1675
|
-
choices=[str(i) for i in range(1, 21)], # 最多20个编成位
|
|
1676
|
-
value=str(current_solution.data.support_card_set) if current_solution.data.support_card_set else None,
|
|
1677
|
-
label="支援卡编成编号",
|
|
1678
|
-
multiselect=False,
|
|
1679
|
-
interactive=True,
|
|
1680
|
-
info="要使用的支援卡编成编号,从 1 开始。"
|
|
1681
|
-
)
|
|
1682
|
-
use_pt_boost = gr.Checkbox(
|
|
1683
|
-
label="使用支援强化 Pt 提升",
|
|
1684
|
-
value=current_solution.data.use_pt_boost,
|
|
1685
|
-
info="是否使用支援强化 Pt 提升。"
|
|
1686
|
-
)
|
|
1687
|
-
use_note_boost = gr.Checkbox(
|
|
1688
|
-
label="使用笔记数提升",
|
|
1689
|
-
value=current_solution.data.use_note_boost,
|
|
1690
|
-
info="是否使用笔记数提升。"
|
|
1691
|
-
)
|
|
1692
|
-
follow_producer = gr.Checkbox(
|
|
1693
|
-
label="关注租借了支援卡的制作人",
|
|
1694
|
-
value=current_solution.data.follow_producer,
|
|
1695
|
-
info="是否关注租借了支援卡的制作人。"
|
|
1696
|
-
)
|
|
1697
|
-
self_study_lesson = gr.Dropdown(
|
|
1698
|
-
choices=['dance', 'visual', 'vocal'],
|
|
1699
|
-
value=current_solution.data.self_study_lesson,
|
|
1700
|
-
label='文化课自习时选项',
|
|
1701
|
-
info='自习课类型。'
|
|
1702
|
-
)
|
|
1703
|
-
prefer_lesson_ap = gr.Checkbox(
|
|
1704
|
-
label="SP 课程优先",
|
|
1705
|
-
value=current_solution.data.prefer_lesson_ap,
|
|
1706
|
-
info="优先 SP 课程。启用后,若出现 SP 课程,则会优先执行 SP 课程,而不是推荐课程。若出现多个 SP 课程,随机选择一个。"
|
|
1707
|
-
)
|
|
1708
|
-
actions_order = gr.Dropdown(
|
|
1709
|
-
choices=[(action.display_name, action.value) for action in ProduceAction],
|
|
1710
|
-
value=[action.value for action in current_solution.data.actions_order],
|
|
1711
|
-
label="行动优先级",
|
|
1712
|
-
info="每一周的行动将会按这里设置的优先级执行。",
|
|
1713
|
-
multiselect=True
|
|
1714
|
-
)
|
|
1715
|
-
recommend_card_detection_mode = gr.Dropdown(
|
|
1716
|
-
choices=[
|
|
1717
|
-
(RecommendCardDetectionMode.NORMAL.display_name, RecommendCardDetectionMode.NORMAL.value),
|
|
1718
|
-
(RecommendCardDetectionMode.STRICT.display_name, RecommendCardDetectionMode.STRICT.value)
|
|
1719
|
-
],
|
|
1720
|
-
value=current_solution.data.recommend_card_detection_mode.value,
|
|
1721
|
-
label="推荐卡检测模式",
|
|
1722
|
-
info="推荐卡检测模式。严格模式下,识别速度会降低,但识别准确率会提高。推荐Kotone使用严格模式,其他角色使用正常模式。"
|
|
1723
|
-
)
|
|
1724
|
-
use_ap_drink = gr.Checkbox(
|
|
1725
|
-
label="AP 不足时自动使用 AP 饮料",
|
|
1726
|
-
value=current_solution.data.use_ap_drink,
|
|
1727
|
-
info="AP 不足时自动使用 AP 饮料"
|
|
1728
|
-
)
|
|
1729
|
-
skip_commu = gr.Checkbox(
|
|
1730
|
-
label="检测并跳过交流",
|
|
1731
|
-
value=current_solution.data.skip_commu,
|
|
1732
|
-
info="检测并跳过交流"
|
|
1733
|
-
)
|
|
1734
|
-
|
|
1735
|
-
# 添加保存按钮
|
|
1736
|
-
save_solution_btn = gr.Button("保存培育方案", variant="primary")
|
|
1737
|
-
|
|
1738
|
-
# 添加事件处理
|
|
1739
|
-
def update_kotone_warning(selected_idol, recommend_card_detection_mode):
|
|
1740
|
-
# Handle case where selected_idol is None (no selection)
|
|
1741
|
-
# selected_idol is a single string (skin_id), not a list
|
|
1742
|
-
if selected_idol is None:
|
|
1743
|
-
has_kotone = False
|
|
1744
|
-
else:
|
|
1745
|
-
has_kotone = "藤田ことね" in selected_idol
|
|
1746
|
-
is_strict_mode = recommend_card_detection_mode == RecommendCardDetectionMode.STRICT.value
|
|
1747
|
-
return gr.Markdown(visible=has_kotone and not is_strict_mode)
|
|
1748
|
-
|
|
1749
|
-
def on_solution_change(solution_id):
|
|
1750
|
-
"""当选择的培育方案改变时,更新所有设置组件"""
|
|
1751
|
-
if not solution_id:
|
|
1752
|
-
return [
|
|
1753
|
-
gr.Textbox(value="", visible=False), # solution_name
|
|
1754
|
-
gr.Textbox(value="", visible=False), # solution_description
|
|
1755
|
-
gr.Dropdown(visible=False), # produce_mode
|
|
1756
|
-
gr.Dropdown(visible=False), # produce_idols
|
|
1757
|
-
gr.Markdown(visible=False), # kotone_warning
|
|
1758
|
-
gr.Checkbox(visible=False), # auto_set_memory
|
|
1759
|
-
gr.Group(visible=False), # memory_sets_group
|
|
1760
|
-
gr.Dropdown(visible=False), # memory_sets
|
|
1761
|
-
gr.Checkbox(visible=False), # auto_set_support
|
|
1762
|
-
gr.Group(visible=False), # support_card_sets_group
|
|
1763
|
-
gr.Dropdown(visible=False), # support_card_sets
|
|
1764
|
-
gr.Checkbox(visible=False), # use_pt_boost
|
|
1765
|
-
gr.Checkbox(visible=False), # use_note_boost
|
|
1766
|
-
gr.Checkbox(visible=False), # follow_producer
|
|
1767
|
-
gr.Dropdown(visible=False), # self_study_lesson
|
|
1768
|
-
gr.Checkbox(visible=False), # prefer_lesson_ap
|
|
1769
|
-
gr.Dropdown(visible=False), # actions_order
|
|
1770
|
-
gr.Dropdown(visible=False), # recommend_card_detection_mode
|
|
1771
|
-
gr.Checkbox(visible=False), # use_ap_drink
|
|
1772
|
-
gr.Checkbox(visible=False), # skip_commu
|
|
1773
|
-
gr.Button(visible=False), # save_solution_btn
|
|
1774
|
-
]
|
|
1775
|
-
|
|
1776
|
-
try:
|
|
1777
|
-
solution = solution_manager.read(solution_id)
|
|
1778
|
-
has_kotone = bool(solution.data.idol and "藤田ことね" in solution.data.idol)
|
|
1779
|
-
is_strict_mode = solution.data.recommend_card_detection_mode == RecommendCardDetectionMode.STRICT
|
|
1780
|
-
|
|
1781
|
-
return [
|
|
1782
|
-
gr.Textbox(value=solution.name, visible=True),
|
|
1783
|
-
gr.Textbox(value=solution.description or "", visible=True),
|
|
1784
|
-
gr.Dropdown(value=solution.data.mode, visible=True),
|
|
1785
|
-
gr.Dropdown(value=solution.data.idol, visible=True),
|
|
1786
|
-
gr.Markdown(visible=has_kotone and not is_strict_mode),
|
|
1787
|
-
gr.Checkbox(value=solution.data.auto_set_memory, visible=True),
|
|
1788
|
-
gr.Group(visible=not solution.data.auto_set_memory),
|
|
1789
|
-
gr.Dropdown(value=str(solution.data.memory_set) if solution.data.memory_set else None, visible=True),
|
|
1790
|
-
gr.Checkbox(value=solution.data.auto_set_support_card, visible=True),
|
|
1791
|
-
gr.Group(visible=not solution.data.auto_set_support_card),
|
|
1792
|
-
gr.Dropdown(value=str(solution.data.support_card_set) if solution.data.support_card_set else None, visible=True),
|
|
1793
|
-
gr.Checkbox(value=solution.data.use_pt_boost, visible=True),
|
|
1794
|
-
gr.Checkbox(value=solution.data.use_note_boost, visible=True),
|
|
1795
|
-
gr.Checkbox(value=solution.data.follow_producer, visible=True),
|
|
1796
|
-
gr.Dropdown(value=solution.data.self_study_lesson, visible=True),
|
|
1797
|
-
gr.Checkbox(value=solution.data.prefer_lesson_ap, visible=True),
|
|
1798
|
-
gr.Dropdown(value=[action.value for action in solution.data.actions_order], visible=True),
|
|
1799
|
-
gr.Dropdown(value=solution.data.recommend_card_detection_mode.value, visible=True),
|
|
1800
|
-
gr.Checkbox(value=solution.data.use_ap_drink, visible=True),
|
|
1801
|
-
gr.Checkbox(value=solution.data.skip_commu, visible=True),
|
|
1802
|
-
gr.Button(visible=True), # save_solution_btn
|
|
1803
|
-
]
|
|
1804
|
-
except ProduceSolutionNotFoundError:
|
|
1805
|
-
gr.Warning(f"培育方案 {solution_id} 不存在")
|
|
1806
|
-
return on_solution_change(None)
|
|
1807
|
-
except Exception as e:
|
|
1808
|
-
gr.Error(f"加载培育方案失败:{str(e)}")
|
|
1809
|
-
return on_solution_change(None)
|
|
1810
|
-
|
|
1811
|
-
def on_new_solution():
|
|
1812
|
-
"""创建新的培育方案"""
|
|
1813
|
-
try:
|
|
1814
|
-
new_solution = solution_manager.new("新培育方案")
|
|
1815
|
-
solution_manager.save(new_solution.id, new_solution)
|
|
1816
|
-
|
|
1817
|
-
# 重新列出所有方案
|
|
1818
|
-
solutions = solution_manager.list()
|
|
1819
|
-
solution_choices = [(f"{sol.name} - {sol.description or '无描述'}", sol.id) for sol in solutions]
|
|
1820
|
-
|
|
1821
|
-
gr.Success("新培育方案创建成功")
|
|
1822
|
-
|
|
1823
|
-
# 更新培育 Tab 下拉框并保持设置 Tab 当前选中值
|
|
1824
|
-
updated_dropdown_produce = gr.Dropdown(choices=solution_choices, value=new_solution.id)
|
|
1825
|
-
if settings_dropdown is not None:
|
|
1826
|
-
current_selected = self.current_config.options.produce.selected_solution_id
|
|
1827
|
-
updated_dropdown_settings = gr.Dropdown(choices=solution_choices, value=current_selected)
|
|
1828
|
-
return [updated_dropdown_produce, updated_dropdown_settings]
|
|
1829
|
-
else:
|
|
1830
|
-
return updated_dropdown_produce
|
|
1831
|
-
except Exception as e:
|
|
1832
|
-
gr.Error(f"创建培育方案失败:{str(e)}")
|
|
1833
|
-
if settings_dropdown is not None:
|
|
1834
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1835
|
-
else:
|
|
1836
|
-
return gr.Dropdown()
|
|
1837
|
-
|
|
1838
|
-
def on_delete_solution(solution_id):
|
|
1839
|
-
"""删除当前培育方案"""
|
|
1840
|
-
if not solution_id:
|
|
1841
|
-
gr.Warning("请先选择要删除的培育方案")
|
|
1842
|
-
if settings_dropdown is not None:
|
|
1843
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1844
|
-
else:
|
|
1845
|
-
return gr.Dropdown()
|
|
1846
|
-
|
|
1847
|
-
# 若尝试删除当前正在使用的培育方案,则拒绝并提示
|
|
1848
|
-
if solution_id == self.current_config.options.produce.selected_solution_id:
|
|
1849
|
-
gr.Warning("不可删除选中方案。请先在设置中选择其他方案,保存后再删除此方案。")
|
|
1850
|
-
if settings_dropdown is not None:
|
|
1851
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1852
|
-
else:
|
|
1853
|
-
return gr.Dropdown()
|
|
1854
|
-
|
|
1855
|
-
try:
|
|
1856
|
-
solution_manager.delete(solution_id)
|
|
1857
|
-
|
|
1858
|
-
# 重新列出所有方案
|
|
1859
|
-
solutions = solution_manager.list()
|
|
1860
|
-
solution_choices = [(f"{sol.name} - {sol.description or '无描述'}", sol.id) for sol in solutions]
|
|
1861
|
-
|
|
1862
|
-
gr.Success("培育方案删除成功")
|
|
1863
|
-
# 删除方案后,保持当前培育方案的选择不变
|
|
1864
|
-
current_selected = self.current_config.options.produce.selected_solution_id
|
|
1865
|
-
if current_selected not in [sol.id for sol in solutions]:
|
|
1866
|
-
current_selected = None # 已不存在
|
|
1867
|
-
|
|
1868
|
-
updated_dropdown = gr.Dropdown(choices=solution_choices, value=current_selected)
|
|
1869
|
-
if settings_dropdown is not None:
|
|
1870
|
-
return [updated_dropdown, updated_dropdown]
|
|
1871
|
-
else:
|
|
1872
|
-
return updated_dropdown
|
|
1873
|
-
except Exception as e:
|
|
1874
|
-
gr.Error(f"删除培育方案失败:{str(e)}")
|
|
1875
|
-
if settings_dropdown is not None:
|
|
1876
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1877
|
-
else:
|
|
1878
|
-
return gr.Dropdown()
|
|
1879
|
-
|
|
1880
|
-
def on_save_solution(solution_id, name, description, mode, idols, auto_memory, memory_sets,
|
|
1881
|
-
auto_support, support_card_sets, pt_boost, note_boost, follow_producer, study_lesson, prefer_ap,
|
|
1882
|
-
actions, detection_mode, ap_drink, skip_commu_val):
|
|
1883
|
-
"""保存培育方案"""
|
|
1884
|
-
if not solution_id:
|
|
1885
|
-
gr.Warning("请先选择要保存的培育方案")
|
|
1886
|
-
if settings_dropdown is not None:
|
|
1887
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1888
|
-
else:
|
|
1889
|
-
return gr.Dropdown()
|
|
1890
|
-
|
|
1891
|
-
try:
|
|
1892
|
-
# 构建培育数据
|
|
1893
|
-
produce_data = ProduceData(
|
|
1894
|
-
mode=mode,
|
|
1895
|
-
idol=idols if idols else None,
|
|
1896
|
-
memory_set=int(memory_sets) if memory_sets else None,
|
|
1897
|
-
support_card_set=int(support_card_sets) if support_card_sets else None,
|
|
1898
|
-
auto_set_memory=auto_memory,
|
|
1899
|
-
auto_set_support_card=auto_support,
|
|
1900
|
-
use_pt_boost=pt_boost,
|
|
1901
|
-
use_note_boost=note_boost,
|
|
1902
|
-
follow_producer=follow_producer,
|
|
1903
|
-
self_study_lesson=study_lesson,
|
|
1904
|
-
prefer_lesson_ap=prefer_ap,
|
|
1905
|
-
actions_order=[ProduceAction(action) for action in actions] if actions else [],
|
|
1906
|
-
recommend_card_detection_mode=RecommendCardDetectionMode(detection_mode),
|
|
1907
|
-
use_ap_drink=ap_drink,
|
|
1908
|
-
skip_commu=skip_commu_val
|
|
1909
|
-
)
|
|
1910
|
-
|
|
1911
|
-
# 构建方案对象
|
|
1912
|
-
solution = ProduceSolution(
|
|
1913
|
-
id=solution_id,
|
|
1914
|
-
name=name or "未命名方案",
|
|
1915
|
-
description=description,
|
|
1916
|
-
data=produce_data
|
|
1917
|
-
)
|
|
1918
|
-
|
|
1919
|
-
# 保存方案
|
|
1920
|
-
solution_manager.save(solution_id, solution)
|
|
1921
|
-
|
|
1922
|
-
# 重新列出所有方案(确保没有重复项)
|
|
1923
|
-
solutions = solution_manager.list()
|
|
1924
|
-
solution_choices = [(f"{sol.name} - {sol.description or '无描述'}", sol.id) for sol in solutions]
|
|
1925
|
-
|
|
1926
|
-
gr.Success("培育方案保存成功")
|
|
1927
|
-
# 根据是否有设置Tab的下拉框来决定返回值
|
|
1928
|
-
updated_dropdown = gr.Dropdown(choices=solution_choices, value=solution_id)
|
|
1929
|
-
if settings_dropdown is not None:
|
|
1930
|
-
return [updated_dropdown, updated_dropdown]
|
|
1931
|
-
else:
|
|
1932
|
-
return updated_dropdown
|
|
1933
|
-
except Exception as e:
|
|
1934
|
-
gr.Error(f"保存培育方案失败:{str(e)}")
|
|
1935
|
-
if settings_dropdown is not None:
|
|
1936
|
-
return [gr.Dropdown(), gr.Dropdown()]
|
|
1937
|
-
else:
|
|
1938
|
-
return gr.Dropdown()
|
|
1939
|
-
|
|
1940
|
-
# 绑定事件
|
|
1941
|
-
# 为所有控件绑定change事件,无论是否有选中方案
|
|
1942
|
-
auto_set_memory.change(
|
|
1943
|
-
fn=lambda x: gr.Group(visible=not x),
|
|
1944
|
-
inputs=[auto_set_memory],
|
|
1945
|
-
outputs=[memory_sets_group]
|
|
1946
|
-
)
|
|
1947
|
-
|
|
1948
|
-
auto_set_support.change(
|
|
1949
|
-
fn=lambda x: gr.Group(visible=not x),
|
|
1950
|
-
inputs=[auto_set_support],
|
|
1951
|
-
outputs=[support_card_sets_group]
|
|
1952
|
-
)
|
|
1953
|
-
|
|
1954
|
-
if current_solution is not None:
|
|
1955
|
-
recommend_card_detection_mode.change(
|
|
1956
|
-
fn=update_kotone_warning,
|
|
1957
|
-
inputs=[produce_idols, recommend_card_detection_mode],
|
|
1958
|
-
outputs=kotone_warning
|
|
1959
|
-
)
|
|
1960
|
-
produce_idols.change(
|
|
1961
|
-
fn=update_kotone_warning,
|
|
1962
|
-
inputs=[produce_idols, recommend_card_detection_mode],
|
|
1963
|
-
outputs=kotone_warning
|
|
1964
|
-
)
|
|
1965
|
-
|
|
1966
|
-
# 绑定方案管理事件
|
|
1967
|
-
solution_dropdown.change(
|
|
1968
|
-
fn=on_solution_change,
|
|
1969
|
-
inputs=[solution_dropdown],
|
|
1970
|
-
outputs=[
|
|
1971
|
-
solution_name, solution_description,
|
|
1972
|
-
produce_mode, produce_idols, kotone_warning,
|
|
1973
|
-
auto_set_memory, memory_sets_group, memory_sets,
|
|
1974
|
-
auto_set_support, support_card_sets_group, support_card_sets,
|
|
1975
|
-
use_pt_boost, use_note_boost, follow_producer,
|
|
1976
|
-
self_study_lesson, prefer_lesson_ap, actions_order,
|
|
1977
|
-
recommend_card_detection_mode, use_ap_drink, skip_commu,
|
|
1978
|
-
save_solution_btn
|
|
1979
|
-
]
|
|
1980
|
-
)
|
|
1981
|
-
|
|
1982
|
-
# 准备输出列表,如果设置Tab的下拉框存在,则同时更新
|
|
1983
|
-
outputs_for_new = [solution_dropdown]
|
|
1984
|
-
outputs_for_delete = [solution_dropdown]
|
|
1985
|
-
outputs_for_save = [solution_dropdown]
|
|
1986
|
-
|
|
1987
|
-
if settings_dropdown is not None:
|
|
1988
|
-
outputs_for_new.append(settings_dropdown)
|
|
1989
|
-
outputs_for_delete.append(settings_dropdown)
|
|
1990
|
-
outputs_for_save.append(settings_dropdown)
|
|
1991
|
-
|
|
1992
|
-
new_solution_btn.click(
|
|
1993
|
-
fn=on_new_solution,
|
|
1994
|
-
outputs=outputs_for_new
|
|
1995
|
-
)
|
|
1996
|
-
|
|
1997
|
-
delete_solution_btn.click(
|
|
1998
|
-
fn=on_delete_solution,
|
|
1999
|
-
inputs=[solution_dropdown],
|
|
2000
|
-
outputs=outputs_for_delete
|
|
2001
|
-
)
|
|
2002
|
-
|
|
2003
|
-
# 绑定保存按钮事件
|
|
2004
|
-
save_solution_btn.click(
|
|
2005
|
-
fn=on_save_solution,
|
|
2006
|
-
inputs=[
|
|
2007
|
-
solution_dropdown, solution_name, solution_description,
|
|
2008
|
-
produce_mode, produce_idols,
|
|
2009
|
-
auto_set_memory, memory_sets, auto_set_support, support_card_sets,
|
|
2010
|
-
use_pt_boost, use_note_boost, follow_producer,
|
|
2011
|
-
self_study_lesson, prefer_lesson_ap, actions_order,
|
|
2012
|
-
recommend_card_detection_mode, use_ap_drink, skip_commu
|
|
2013
|
-
],
|
|
2014
|
-
outputs=outputs_for_save
|
|
2015
|
-
)
|
|
2016
|
-
|
|
2017
|
-
def _create_club_reward_settings(self) -> ConfigBuilderReturnValue:
|
|
2018
|
-
with gr.Column():
|
|
2019
|
-
gr.Markdown("### 社团奖励设置")
|
|
2020
|
-
club_reward_enabled = gr.Checkbox(
|
|
2021
|
-
label="启用社团奖励",
|
|
2022
|
-
value=self.current_config.options.club_reward.enabled,
|
|
2023
|
-
info=ClubRewardConfig.model_fields['enabled'].description
|
|
2024
|
-
)
|
|
2025
|
-
with gr.Group(visible=self.current_config.options.club_reward.enabled) as club_reward_group:
|
|
2026
|
-
selected_note = gr.Dropdown(
|
|
2027
|
-
choices=list(DailyMoneyShopItems.note_items()),
|
|
2028
|
-
value=self.current_config.options.club_reward.selected_note,
|
|
2029
|
-
label="想在社团奖励中获取到的笔记",
|
|
2030
|
-
interactive=True,
|
|
2031
|
-
info=ClubRewardConfig.model_fields['selected_note'].description
|
|
2032
|
-
)
|
|
2033
|
-
club_reward_enabled.change(
|
|
2034
|
-
fn=lambda x: gr.Group(visible=x),
|
|
2035
|
-
inputs=[club_reward_enabled],
|
|
2036
|
-
outputs=[club_reward_group]
|
|
2037
|
-
)
|
|
2038
|
-
|
|
2039
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2040
|
-
config.club_reward.enabled = data['club_reward_enabled']
|
|
2041
|
-
config.club_reward.selected_note = DailyMoneyShopItems(data['selected_note'])
|
|
2042
|
-
|
|
2043
|
-
return set_config, {
|
|
2044
|
-
'club_reward_enabled': club_reward_enabled,
|
|
2045
|
-
'selected_note': selected_note
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
def _create_capsule_toys_settings(self) -> ConfigBuilderReturnValue:
|
|
2049
|
-
with gr.Column():
|
|
2050
|
-
gr.Markdown("### 扭蛋设置")
|
|
2051
|
-
capsule_toys_enabled = gr.Checkbox(
|
|
2052
|
-
label="是否启用自动扭蛋机",
|
|
2053
|
-
value=self.current_config.options.capsule_toys.enabled,
|
|
2054
|
-
info=CapsuleToysConfig.model_fields['enabled'].description
|
|
2055
|
-
)
|
|
2056
|
-
min_value = 0
|
|
2057
|
-
max_value = 10
|
|
2058
|
-
with gr.Group(visible=self.current_config.options.capsule_toys.enabled) as capsule_toys_group:
|
|
2059
|
-
friend_capsule_toys_count = gr.Number(
|
|
2060
|
-
value=self.current_config.options.capsule_toys.friend_capsule_toys_count,
|
|
2061
|
-
label="好友扭蛋机的扭蛋次数",
|
|
2062
|
-
info=CapsuleToysConfig.model_fields['friend_capsule_toys_count'].description,
|
|
2063
|
-
minimum=0,
|
|
2064
|
-
maximum=5
|
|
2065
|
-
)
|
|
2066
|
-
sense_capsule_toys_count = gr.Number(
|
|
2067
|
-
value=self.current_config.options.capsule_toys.sense_capsule_toys_count,
|
|
2068
|
-
label="感性扭蛋机的扭蛋次数",
|
|
2069
|
-
info=CapsuleToysConfig.model_fields['sense_capsule_toys_count'].description,
|
|
2070
|
-
minimum=0,
|
|
2071
|
-
maximum=5
|
|
2072
|
-
)
|
|
2073
|
-
logic_capsule_toys_count = gr.Number(
|
|
2074
|
-
value=self.current_config.options.capsule_toys.logic_capsule_toys_count,
|
|
2075
|
-
label="逻辑扭蛋机的扭蛋次数",
|
|
2076
|
-
info=CapsuleToysConfig.model_fields['logic_capsule_toys_count'].description,
|
|
2077
|
-
minimum=0,
|
|
2078
|
-
maximum=5
|
|
2079
|
-
)
|
|
2080
|
-
anomaly_capsule_toys_count = gr.Number(
|
|
2081
|
-
value=self.current_config.options.capsule_toys.anomaly_capsule_toys_count,
|
|
2082
|
-
label="非凡扭蛋机的扭蛋次数",
|
|
2083
|
-
info=CapsuleToysConfig.model_fields['anomaly_capsule_toys_count'].description,
|
|
2084
|
-
minimum=0,
|
|
2085
|
-
maximum=5
|
|
2086
|
-
)
|
|
2087
|
-
capsule_toys_enabled.change(
|
|
2088
|
-
fn=lambda x: gr.Group(visible=x),
|
|
2089
|
-
inputs=[capsule_toys_enabled],
|
|
2090
|
-
outputs=[capsule_toys_group]
|
|
2091
|
-
)
|
|
2092
|
-
|
|
2093
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2094
|
-
config.capsule_toys.enabled = data['capsule_toys_enabled']
|
|
2095
|
-
config.capsule_toys.friend_capsule_toys_count = data['friend_capsule_toys_count']
|
|
2096
|
-
config.capsule_toys.sense_capsule_toys_count = data['sense_capsule_toys_count']
|
|
2097
|
-
config.capsule_toys.logic_capsule_toys_count = data['logic_capsule_toys_count']
|
|
2098
|
-
config.capsule_toys.anomaly_capsule_toys_count = data['anomaly_capsule_toys_count']
|
|
2099
|
-
|
|
2100
|
-
return set_config, {
|
|
2101
|
-
'capsule_toys_enabled': capsule_toys_enabled,
|
|
2102
|
-
'friend_capsule_toys_count': friend_capsule_toys_count,
|
|
2103
|
-
'sense_capsule_toys_count': sense_capsule_toys_count,
|
|
2104
|
-
'logic_capsule_toys_count': logic_capsule_toys_count,
|
|
2105
|
-
'anomaly_capsule_toys_count': anomaly_capsule_toys_count
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
def _create_start_game_settings(self) -> ConfigBuilderReturnValue:
|
|
2110
|
-
with gr.Column():
|
|
2111
|
-
gr.Markdown("### 启动游戏设置")
|
|
2112
|
-
start_game_enabled = gr.Checkbox(
|
|
2113
|
-
label="是否启用 自动启动游戏",
|
|
2114
|
-
value=self.current_config.options.start_game.enabled,
|
|
2115
|
-
info=StartGameConfig.model_fields['enabled'].description
|
|
2116
|
-
)
|
|
2117
|
-
with gr.Group(visible=self.current_config.options.start_game.enabled) as start_game_group:
|
|
2118
|
-
start_through_kuyo = gr.Checkbox(
|
|
2119
|
-
label="是否通过Kuyo启动游戏",
|
|
2120
|
-
value=self.current_config.options.start_game.start_through_kuyo,
|
|
2121
|
-
info=StartGameConfig.model_fields['start_through_kuyo'].description
|
|
2122
|
-
)
|
|
2123
|
-
game_package_name = gr.Textbox(
|
|
2124
|
-
value=self.current_config.options.start_game.game_package_name,
|
|
2125
|
-
label="游戏包名",
|
|
2126
|
-
info=StartGameConfig.model_fields['game_package_name'].description
|
|
2127
|
-
)
|
|
2128
|
-
kuyo_package_name = gr.Textbox(
|
|
2129
|
-
value=self.current_config.options.start_game.kuyo_package_name,
|
|
2130
|
-
label="Kuyo包名",
|
|
2131
|
-
info=StartGameConfig.model_fields['kuyo_package_name'].description
|
|
2132
|
-
)
|
|
2133
|
-
disable_gakumas_localify = gr.Checkbox(
|
|
2134
|
-
label="禁用 Gakumas Localify 汉化插件",
|
|
2135
|
-
value=self.current_config.options.start_game.disable_gakumas_localify,
|
|
2136
|
-
info=StartGameConfig.model_fields['disable_gakumas_localify'].description
|
|
2137
|
-
)
|
|
2138
|
-
dmm_game_path = gr.Textbox(
|
|
2139
|
-
value=self.current_config.options.start_game.dmm_game_path or "",
|
|
2140
|
-
label="DMM 版游戏路径",
|
|
2141
|
-
info=StartGameConfig.model_fields['dmm_game_path'].description,
|
|
2142
|
-
placeholder="例:F:\\Games\\gakumas\\gakumas.exe"
|
|
2143
|
-
)
|
|
2144
|
-
dmm_bypass = gr.Checkbox(
|
|
2145
|
-
label="绕过 DMM 启动器直接启动游戏(实验性)",
|
|
2146
|
-
value=self.current_config.options.start_game.dmm_bypass,
|
|
2147
|
-
info=StartGameConfig.model_fields['dmm_bypass'].description
|
|
2148
|
-
)
|
|
2149
|
-
start_game_enabled.change(
|
|
2150
|
-
fn=lambda x: gr.Group(visible=x),
|
|
2151
|
-
inputs=[start_game_enabled],
|
|
2152
|
-
outputs=[start_game_group]
|
|
2153
|
-
)
|
|
2154
|
-
|
|
2155
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2156
|
-
config.start_game.enabled = data['start_game_enabled']
|
|
2157
|
-
config.start_game.start_through_kuyo = data['start_through_kuyo']
|
|
2158
|
-
config.start_game.game_package_name = data['game_package_name']
|
|
2159
|
-
config.start_game.kuyo_package_name = data['kuyo_package_name']
|
|
2160
|
-
config.start_game.disable_gakumas_localify = data['disable_gakumas_localify']
|
|
2161
|
-
config.start_game.dmm_game_path = data['dmm_game_path'] if data['dmm_game_path'] else None
|
|
2162
|
-
config.start_game.dmm_bypass = data['dmm_bypass']
|
|
2163
|
-
|
|
2164
|
-
return set_config, {
|
|
2165
|
-
'start_game_enabled': start_game_enabled,
|
|
2166
|
-
'start_through_kuyo': start_through_kuyo,
|
|
2167
|
-
'game_package_name': game_package_name,
|
|
2168
|
-
'kuyo_package_name': kuyo_package_name,
|
|
2169
|
-
'disable_gakumas_localify': disable_gakumas_localify,
|
|
2170
|
-
'dmm_game_path': dmm_game_path,
|
|
2171
|
-
'dmm_bypass': dmm_bypass
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
def _create_end_game_settings(self) -> ConfigBuilderReturnValue:
|
|
2176
|
-
with gr.Column():
|
|
2177
|
-
gr.Markdown("### 关闭游戏设置")
|
|
2178
|
-
gr.Markdown("在所有任务执行完毕后执行下面这些操作:\n(执行单个任务时不会触发)")
|
|
2179
|
-
exit_kaa = gr.Checkbox(
|
|
2180
|
-
label="退出 kaa",
|
|
2181
|
-
value=self.current_config.options.end_game.exit_kaa,
|
|
2182
|
-
info=EndGameConfig.model_fields['exit_kaa'].description
|
|
2183
|
-
)
|
|
2184
|
-
kill_game = gr.Checkbox(
|
|
2185
|
-
label="关闭游戏",
|
|
2186
|
-
value=self.current_config.options.end_game.kill_game,
|
|
2187
|
-
info=EndGameConfig.model_fields['kill_game'].description
|
|
2188
|
-
)
|
|
2189
|
-
kill_dmm = gr.Checkbox(
|
|
2190
|
-
label="关闭 DMM",
|
|
2191
|
-
value=self.current_config.options.end_game.kill_dmm,
|
|
2192
|
-
info=EndGameConfig.model_fields['kill_dmm'].description
|
|
2193
|
-
)
|
|
2194
|
-
kill_emulator = gr.Checkbox(
|
|
2195
|
-
label="关闭模拟器",
|
|
2196
|
-
value=self.current_config.options.end_game.kill_emulator,
|
|
2197
|
-
info=EndGameConfig.model_fields['kill_emulator'].description
|
|
2198
|
-
)
|
|
2199
|
-
shutdown = gr.Checkbox(
|
|
2200
|
-
label="关闭系统",
|
|
2201
|
-
value=self.current_config.options.end_game.shutdown,
|
|
2202
|
-
info=EndGameConfig.model_fields['shutdown'].description
|
|
2203
|
-
)
|
|
2204
|
-
hibernate = gr.Checkbox(
|
|
2205
|
-
label="休眠系统",
|
|
2206
|
-
value=self.current_config.options.end_game.hibernate,
|
|
2207
|
-
info=EndGameConfig.model_fields['hibernate'].description
|
|
2208
|
-
)
|
|
2209
|
-
restore_gakumas_localify = gr.Checkbox(
|
|
2210
|
-
label="恢复 Gakumas Localify 汉化插件状态",
|
|
2211
|
-
value=self.current_config.options.end_game.restore_gakumas_localify,
|
|
2212
|
-
info=EndGameConfig.model_fields['restore_gakumas_localify'].description
|
|
2213
|
-
)
|
|
2214
|
-
|
|
2215
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2216
|
-
config.end_game.exit_kaa = data['exit_kaa']
|
|
2217
|
-
config.end_game.kill_game = data['kill_game']
|
|
2218
|
-
config.end_game.kill_dmm = data['kill_dmm']
|
|
2219
|
-
config.end_game.kill_emulator = data['kill_emulator']
|
|
2220
|
-
config.end_game.shutdown = data['shutdown']
|
|
2221
|
-
config.end_game.hibernate = data['hibernate']
|
|
2222
|
-
config.end_game.restore_gakumas_localify = data['restore_gakumas_localify']
|
|
2223
|
-
|
|
2224
|
-
return set_config, {
|
|
2225
|
-
'exit_kaa': exit_kaa,
|
|
2226
|
-
'kill_game': kill_game,
|
|
2227
|
-
'kill_dmm': kill_dmm,
|
|
2228
|
-
'kill_emulator': kill_emulator,
|
|
2229
|
-
'shutdown': shutdown,
|
|
2230
|
-
'hibernate': hibernate,
|
|
2231
|
-
'restore_gakumas_localify': restore_gakumas_localify
|
|
2232
|
-
}
|
|
2233
|
-
|
|
2234
|
-
def _create_activity_funds_settings(self) -> ConfigBuilderReturnValue:
|
|
2235
|
-
with gr.Column():
|
|
2236
|
-
gr.Markdown("### 活动费设置")
|
|
2237
|
-
activity_funds = gr.Checkbox(
|
|
2238
|
-
label="启用收取活动费",
|
|
2239
|
-
value=self.current_config.options.activity_funds.enabled,
|
|
2240
|
-
info=ActivityFundsConfig.model_fields['enabled'].description
|
|
2241
|
-
)
|
|
2242
|
-
|
|
2243
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2244
|
-
config.activity_funds.enabled = data['activity_funds']
|
|
2245
|
-
|
|
2246
|
-
return set_config, {
|
|
2247
|
-
'activity_funds': activity_funds
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
def _create_presents_settings(self) -> ConfigBuilderReturnValue:
|
|
2251
|
-
with gr.Column():
|
|
2252
|
-
gr.Markdown("### 礼物设置")
|
|
2253
|
-
presents = gr.Checkbox(
|
|
2254
|
-
label="启用收取礼物",
|
|
2255
|
-
value=self.current_config.options.presents.enabled,
|
|
2256
|
-
info=PresentsConfig.model_fields['enabled'].description
|
|
2257
|
-
)
|
|
2258
|
-
|
|
2259
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2260
|
-
config.presents.enabled = data['presents']
|
|
2261
|
-
|
|
2262
|
-
return set_config, {
|
|
2263
|
-
'presents': presents
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
def _create_mission_reward_settings(self) -> ConfigBuilderReturnValue:
|
|
2267
|
-
with gr.Column():
|
|
2268
|
-
gr.Markdown("### 任务奖励设置")
|
|
2269
|
-
mission_reward = gr.Checkbox(
|
|
2270
|
-
label="启用领取任务奖励",
|
|
2271
|
-
value=self.current_config.options.mission_reward.enabled,
|
|
2272
|
-
info=MissionRewardConfig.model_fields['enabled'].description
|
|
2273
|
-
)
|
|
2274
|
-
|
|
2275
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2276
|
-
config.mission_reward.enabled = data['mission_reward']
|
|
2277
|
-
|
|
2278
|
-
return set_config, {
|
|
2279
|
-
'mission_reward': mission_reward
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
def _create_upgrade_support_card_settings(self) -> ConfigBuilderReturnValue:
|
|
2283
|
-
with gr.Column():
|
|
2284
|
-
gr.Markdown("### 升级支援卡设置")
|
|
2285
|
-
upgrade_support_card_enabled = gr.Checkbox(
|
|
2286
|
-
label="启用升级支援卡",
|
|
2287
|
-
value=self.current_config.options.upgrade_support_card.enabled,
|
|
2288
|
-
info=UpgradeSupportCardConfig.model_fields['enabled'].description
|
|
2289
|
-
)
|
|
2290
|
-
|
|
2291
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2292
|
-
config.upgrade_support_card.enabled = data['upgrade_support_card_enabled']
|
|
2293
|
-
|
|
2294
|
-
return set_config, {
|
|
2295
|
-
'upgrade_support_card_enabled': upgrade_support_card_enabled
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
def _create_trace_settings(self) -> ConfigBuilderReturnValue:
|
|
2299
|
-
with gr.Column():
|
|
2300
|
-
gr.Markdown("### 跟踪设置")
|
|
2301
|
-
trace_recommend_card_detection = gr.Checkbox(
|
|
2302
|
-
label="跟踪推荐卡检测",
|
|
2303
|
-
value=self.current_config.options.trace.recommend_card_detection,
|
|
2304
|
-
info=TraceConfig.model_fields['recommend_card_detection'].description,
|
|
2305
|
-
interactive=True
|
|
2306
|
-
)
|
|
2307
|
-
|
|
2308
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2309
|
-
config.trace.recommend_card_detection = data['trace_recommend_card_detection']
|
|
2310
|
-
|
|
2311
|
-
return set_config, {
|
|
2312
|
-
'trace_recommend_card_detection': trace_recommend_card_detection
|
|
2313
|
-
}
|
|
2314
|
-
|
|
2315
|
-
def _create_misc_settings(self) -> ConfigBuilderReturnValue:
|
|
2316
|
-
with gr.Column():
|
|
2317
|
-
gr.Markdown("### 杂项设置")
|
|
2318
|
-
check_update = gr.Dropdown(
|
|
2319
|
-
choices=[
|
|
2320
|
-
("启动时检查更新", "startup"),
|
|
2321
|
-
("从不检查更新", "never")
|
|
2322
|
-
],
|
|
2323
|
-
value=self.current_config.options.misc.check_update,
|
|
2324
|
-
label="检查更新时机",
|
|
2325
|
-
info=MiscConfig.model_fields['check_update'].description,
|
|
2326
|
-
interactive=True
|
|
2327
|
-
)
|
|
2328
|
-
auto_install_update = gr.Checkbox(
|
|
2329
|
-
label="自动安装更新",
|
|
2330
|
-
value=self.current_config.options.misc.auto_install_update,
|
|
2331
|
-
info=MiscConfig.model_fields['auto_install_update'].description,
|
|
2332
|
-
interactive=True
|
|
2333
|
-
)
|
|
2334
|
-
expose_to_lan = gr.Checkbox(
|
|
2335
|
-
label="允许局域网访问",
|
|
2336
|
-
value=self.current_config.options.misc.expose_to_lan,
|
|
2337
|
-
info=MiscConfig.model_fields['expose_to_lan'].description,
|
|
2338
|
-
interactive=True
|
|
2339
|
-
)
|
|
2340
|
-
update_channel = gr.Dropdown(
|
|
2341
|
-
choices=[
|
|
2342
|
-
("正式版", "release"),
|
|
2343
|
-
("测试版", "beta")
|
|
2344
|
-
],
|
|
2345
|
-
value=self.current_config.options.misc.update_channel,
|
|
2346
|
-
label="更新渠道",
|
|
2347
|
-
info=MiscConfig.model_fields['update_channel'].description,
|
|
2348
|
-
interactive=True
|
|
2349
|
-
)
|
|
2350
|
-
log_level = gr.Dropdown(
|
|
2351
|
-
choices=[
|
|
2352
|
-
("调试", "debug"),
|
|
2353
|
-
("详细", "verbose")
|
|
2354
|
-
],
|
|
2355
|
-
value=self.current_config.options.misc.log_level,
|
|
2356
|
-
label="日志等级",
|
|
2357
|
-
info=MiscConfig.model_fields['log_level'].description,
|
|
2358
|
-
interactive=True
|
|
2359
|
-
)
|
|
2360
|
-
with gr.Row():
|
|
2361
|
-
gr.Button("创建桌面快捷方式").click(
|
|
2362
|
-
fn=self._create_shortcut_button_click(False),
|
|
2363
|
-
outputs=[]
|
|
2364
|
-
)
|
|
2365
|
-
gr.Button("创建一键启动快捷方式").click(
|
|
2366
|
-
fn=self._create_shortcut_button_click(True),
|
|
2367
|
-
outputs=[]
|
|
2368
|
-
)
|
|
2369
|
-
|
|
2370
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2371
|
-
config.misc.check_update = data['check_update']
|
|
2372
|
-
config.misc.auto_install_update = data['auto_install_update']
|
|
2373
|
-
config.misc.expose_to_lan = data['expose_to_lan']
|
|
2374
|
-
config.misc.update_channel = data['update_channel']
|
|
2375
|
-
config.misc.log_level = data['log_level']
|
|
2376
|
-
|
|
2377
|
-
return set_config, {
|
|
2378
|
-
'check_update': check_update,
|
|
2379
|
-
'auto_install_update': auto_install_update,
|
|
2380
|
-
'expose_to_lan': expose_to_lan,
|
|
2381
|
-
'update_channel': update_channel,
|
|
2382
|
-
'log_level': log_level
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
def _create_shortcut_button_click(self, start_immediately: bool) -> Callable[[], None]:
|
|
2386
|
-
def _inner():
|
|
2387
|
-
create_desktop_shortcut(start_immediately)
|
|
2388
|
-
gr.Success("快捷方式创建成功")
|
|
2389
|
-
return _inner
|
|
2390
|
-
|
|
2391
|
-
def _create_idle_settings(self) -> ConfigBuilderReturnValue:
|
|
2392
|
-
with gr.Column():
|
|
2393
|
-
gr.Markdown("### 闲置挂机")
|
|
2394
|
-
idle_enabled = gr.Checkbox(
|
|
2395
|
-
label="启用闲置挂机(任意键暂停、闲置自动恢复)",
|
|
2396
|
-
value=self.current_config.options.idle.enabled,
|
|
2397
|
-
info=IdleModeConfig.model_fields['enabled'].description,
|
|
2398
|
-
interactive=True
|
|
2399
|
-
)
|
|
2400
|
-
idle_seconds = gr.Slider(
|
|
2401
|
-
label="自动恢复触发时间(秒)",
|
|
2402
|
-
minimum=30,
|
|
2403
|
-
maximum=3600,
|
|
2404
|
-
step=10,
|
|
2405
|
-
value=self.current_config.options.idle.idle_seconds,
|
|
2406
|
-
info=IdleModeConfig.model_fields['idle_seconds'].description,
|
|
2407
|
-
interactive=True
|
|
2408
|
-
)
|
|
2409
|
-
idle_minimize_on_pause = gr.Checkbox(
|
|
2410
|
-
label="暂停时最小化游戏窗口",
|
|
2411
|
-
value=self.current_config.options.idle.minimize_on_pause,
|
|
2412
|
-
info=IdleModeConfig.model_fields['minimize_on_pause'].description,
|
|
2413
|
-
interactive=True
|
|
2414
|
-
)
|
|
2415
|
-
|
|
2416
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2417
|
-
config.idle.enabled = data['idle_enabled']
|
|
2418
|
-
config.idle.idle_seconds = int(data['idle_seconds'])
|
|
2419
|
-
config.idle.minimize_on_pause = data['idle_minimize_on_pause']
|
|
2420
|
-
|
|
2421
|
-
return set_config, {
|
|
2422
|
-
'idle_enabled': idle_enabled,
|
|
2423
|
-
'idle_seconds': idle_seconds,
|
|
2424
|
-
'idle_minimize_on_pause': idle_minimize_on_pause,
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
def _create_debug_settings(self) -> ConfigBuilderReturnValue:
|
|
2428
|
-
"""调试设置:仅在调试时使用"""
|
|
2429
|
-
with gr.Column():
|
|
2430
|
-
gr.Markdown("### 调试设置")
|
|
2431
|
-
gr.Markdown('<div style="color: red;">仅供调试使用。正常运行时务必关闭下面所有的选项。</div>')
|
|
2432
|
-
|
|
2433
|
-
keep_screenshots = gr.Checkbox(
|
|
2434
|
-
label="保留截图数据",
|
|
2435
|
-
value=self.current_config.keep_screenshots,
|
|
2436
|
-
info=UserConfig.model_fields['keep_screenshots'].description,
|
|
2437
|
-
interactive=True
|
|
2438
|
-
)
|
|
2439
|
-
|
|
2440
|
-
trace_recommend_card_detection = gr.Checkbox(
|
|
2441
|
-
label="跟踪推荐卡检测",
|
|
2442
|
-
value=self.current_config.options.trace.recommend_card_detection,
|
|
2443
|
-
info=TraceConfig.model_fields['recommend_card_detection'].description,
|
|
2444
|
-
interactive=True
|
|
2445
|
-
)
|
|
2446
|
-
|
|
2447
|
-
def set_config(config: BaseConfig, data: dict[ConfigKey, Any]) -> None:
|
|
2448
|
-
# 保留截图数据属于 UserConfig
|
|
2449
|
-
self.current_config.keep_screenshots = data['keep_screenshots']
|
|
2450
|
-
# 跟踪推荐卡检测属于 BaseConfig.trace
|
|
2451
|
-
config.trace.recommend_card_detection = data['trace_recommend_card_detection']
|
|
2452
|
-
|
|
2453
|
-
return set_config, {
|
|
2454
|
-
'keep_screenshots': keep_screenshots,
|
|
2455
|
-
'trace_recommend_card_detection': trace_recommend_card_detection
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
def _create_settings_tab(self) -> None:
|
|
2459
|
-
with gr.Tab("设置"):
|
|
2460
|
-
gr.Markdown("## 设置 <span style='color: red; font-size: 0.8rem; font-weight: normal;'>设置修改后需要保存(网页底部)才会生效!</span>")
|
|
2461
|
-
|
|
2462
|
-
# 模拟器设置
|
|
2463
|
-
emulator_settings = self._create_emulator_settings()
|
|
2464
|
-
|
|
2465
|
-
# 商店购买设置
|
|
2466
|
-
purchase_settings = self._create_purchase_settings()
|
|
2467
|
-
|
|
2468
|
-
# 活动费设置
|
|
2469
|
-
activity_funds_settings = self._create_activity_funds_settings()
|
|
2470
|
-
|
|
2471
|
-
# 礼物设置
|
|
2472
|
-
presents_settings = self._create_presents_settings()
|
|
2473
|
-
|
|
2474
|
-
# 工作设置
|
|
2475
|
-
work_settings = self._create_work_settings()
|
|
2476
|
-
|
|
2477
|
-
# 竞赛设置
|
|
2478
|
-
contest_settings = self._create_contest_settings()
|
|
2479
|
-
|
|
2480
|
-
# 培育设置
|
|
2481
|
-
produce_settings = self._create_produce_settings()
|
|
2482
|
-
|
|
2483
|
-
# 任务奖励设置
|
|
2484
|
-
mission_reward_settings = self._create_mission_reward_settings()
|
|
2485
|
-
|
|
2486
|
-
# 社团奖励设置
|
|
2487
|
-
club_reward_settings = self._create_club_reward_settings()
|
|
2488
|
-
|
|
2489
|
-
# 扭蛋设置
|
|
2490
|
-
capsule_toys_settings = self._create_capsule_toys_settings()
|
|
2491
|
-
|
|
2492
|
-
# 升级支援卡设置
|
|
2493
|
-
upgrade_support_card_settings = self._create_upgrade_support_card_settings()
|
|
2494
|
-
|
|
2495
|
-
# 启动游戏设置
|
|
2496
|
-
start_game_settings = self._create_start_game_settings()
|
|
2497
|
-
|
|
2498
|
-
# 关闭游戏设置
|
|
2499
|
-
end_game_settings = self._create_end_game_settings()
|
|
2500
|
-
|
|
2501
|
-
# 杂项设置
|
|
2502
|
-
misc_settings = self._create_misc_settings()
|
|
2503
|
-
|
|
2504
|
-
# 闲置挂机设置
|
|
2505
|
-
idle_settings = self._create_idle_settings()
|
|
2506
|
-
|
|
2507
|
-
# 调试设置(放在最后)
|
|
2508
|
-
debug_settings = self._create_debug_settings()
|
|
2509
|
-
|
|
2510
|
-
save_btn = gr.Button("保存设置")
|
|
2511
|
-
result = gr.Markdown()
|
|
2512
|
-
|
|
2513
|
-
# 收集所有设置组件
|
|
2514
|
-
all_return_values = [
|
|
2515
|
-
emulator_settings,
|
|
2516
|
-
purchase_settings,
|
|
2517
|
-
activity_funds_settings,
|
|
2518
|
-
presents_settings,
|
|
2519
|
-
work_settings,
|
|
2520
|
-
contest_settings,
|
|
2521
|
-
produce_settings,
|
|
2522
|
-
mission_reward_settings,
|
|
2523
|
-
club_reward_settings,
|
|
2524
|
-
capsule_toys_settings,
|
|
2525
|
-
upgrade_support_card_settings,
|
|
2526
|
-
start_game_settings,
|
|
2527
|
-
end_game_settings,
|
|
2528
|
-
misc_settings,
|
|
2529
|
-
idle_settings,
|
|
2530
|
-
debug_settings
|
|
2531
|
-
] # list of (set_func, { 'key': component, ... })
|
|
2532
|
-
all_components = [list(ret[1].values()) for ret in all_return_values] # [[c1, c2], [c3], ...]
|
|
2533
|
-
all_components = list(chain(*all_components)) # [c1, c2, c3, ...]
|
|
2534
|
-
save_btn.click(
|
|
2535
|
-
fn=partial(self.save_settings2, all_return_values),
|
|
2536
|
-
inputs=all_components,
|
|
2537
|
-
outputs=result
|
|
2538
|
-
)
|
|
2539
|
-
|
|
2540
|
-
def _create_log_tab(self) -> None:
|
|
2541
|
-
with gr.Tab("反馈"):
|
|
2542
|
-
gr.Markdown("## 反馈")
|
|
2543
|
-
gr.Markdown('脚本报错或者卡住?在这里填写信息可以快速反馈!')
|
|
2544
|
-
with gr.Column():
|
|
2545
|
-
report_title = gr.Textbox(label="标题", placeholder="用一句话概括问题")
|
|
2546
|
-
report_type = gr.Dropdown(label="反馈类型", choices=["bug"], value="bug", interactive=False)
|
|
2547
|
-
report_description = gr.Textbox(label="描述", lines=5, placeholder="详细描述问题。例如:什么时候出错、是否每次都出错、出错时的步骤是什么")
|
|
2548
|
-
with gr.Row():
|
|
2549
|
-
upload_report_btn = gr.Button("上传")
|
|
2550
|
-
save_local_report_btn = gr.Button("保存至本地")
|
|
2551
|
-
|
|
2552
|
-
result_text = gr.Markdown("等待操作\n\n\n")
|
|
2553
|
-
|
|
2554
|
-
def create_report(title: str, description: str, upload: bool, progress=gr.Progress()):
|
|
2555
|
-
|
|
2556
|
-
def on_progress(data: Dict[str, Any]):
|
|
2557
|
-
progress_val = data['step'] / data['total_steps']
|
|
2558
|
-
if data['type'] == 'packing':
|
|
2559
|
-
desc = f"({data['step']}/{data['total_steps']}) 正在打包 {data['item']}"
|
|
2560
|
-
elif data['type'] == 'uploading':
|
|
2561
|
-
desc = f"({data['step']}/{data['total_steps']}) 正在上传 {data['item']}"
|
|
2562
|
-
elif data['type'] == 'done':
|
|
2563
|
-
if 'url' in data:
|
|
2564
|
-
desc = "上传完成"
|
|
2565
|
-
else:
|
|
2566
|
-
desc = "已保存至本地"
|
|
2567
|
-
else:
|
|
2568
|
-
desc = "正在处理..."
|
|
2569
|
-
progress(progress_val, desc=desc)
|
|
2570
|
-
|
|
2571
|
-
try:
|
|
2572
|
-
result = self.feedback_service.report(
|
|
2573
|
-
title=title,
|
|
2574
|
-
description=description,
|
|
2575
|
-
version=self._kaa.version,
|
|
2576
|
-
upload=upload,
|
|
2577
|
-
on_progress=on_progress
|
|
2578
|
-
)
|
|
2579
|
-
return result.message
|
|
2580
|
-
except FeedbackServiceError as e:
|
|
2581
|
-
gr.Error(str(e))
|
|
2582
|
-
return f"### 操作失败\n\n{e}"
|
|
2583
|
-
|
|
2584
|
-
upload_report_btn.click(
|
|
2585
|
-
fn=partial(create_report, upload=True),
|
|
2586
|
-
inputs=[report_title, report_description],
|
|
2587
|
-
outputs=[result_text]
|
|
2588
|
-
)
|
|
2589
|
-
save_local_report_btn.click(
|
|
2590
|
-
fn=partial(create_report, upload=False),
|
|
2591
|
-
inputs=[report_title, report_description],
|
|
2592
|
-
outputs=[result_text]
|
|
2593
|
-
)
|
|
2594
|
-
|
|
2595
|
-
def _create_whats_new_tab(self) -> None:
|
|
2596
|
-
"""创建更新标签页"""
|
|
2597
|
-
with gr.Tab("更新"):
|
|
2598
|
-
gr.Markdown("## 版本管理")
|
|
2599
|
-
|
|
2600
|
-
with gr.Accordion("更新日志", open=False):
|
|
2601
|
-
from kaa.metadata import WHATS_NEW
|
|
2602
|
-
gr.Markdown(WHATS_NEW)
|
|
2603
|
-
|
|
2604
|
-
load_info_btn = gr.Button("载入信息", variant="primary")
|
|
2605
|
-
status_text = gr.Markdown("")
|
|
2606
|
-
version_dropdown = gr.Dropdown(
|
|
2607
|
-
label="选择要安装的版本",
|
|
2608
|
-
choices=[],
|
|
2609
|
-
value=None,
|
|
2610
|
-
visible=False,
|
|
2611
|
-
interactive=True
|
|
2612
|
-
)
|
|
2613
|
-
install_selected_btn = gr.Button("安装选定版本", visible=False)
|
|
2614
|
-
|
|
2615
|
-
def on_load_info():
|
|
2616
|
-
"""使用 UpdateService 加载版本信息。"""
|
|
2617
|
-
yield (
|
|
2618
|
-
"正在载入版本信息...",
|
|
2619
|
-
gr.Button(value="载入中...", interactive=False),
|
|
2620
|
-
gr.Dropdown(visible=False),
|
|
2621
|
-
gr.Button(visible=False)
|
|
2622
|
-
)
|
|
2623
|
-
try:
|
|
2624
|
-
versions_data = self.update_service.list_remote_versions()
|
|
2625
|
-
except UpdateFetchListError as e:
|
|
2626
|
-
gr.Error(str(e))
|
|
2627
|
-
yield (
|
|
2628
|
-
str(e),
|
|
2629
|
-
gr.Button(value="载入信息", interactive=True),
|
|
2630
|
-
gr.Dropdown(visible=False),
|
|
2631
|
-
gr.Button(visible=False)
|
|
2632
|
-
)
|
|
2633
|
-
return
|
|
2634
|
-
|
|
2635
|
-
status_info = [
|
|
2636
|
-
f"**当前安装版本:** {versions_data.installed_version or '未知'}",
|
|
2637
|
-
f"**最新版本:** {versions_data.latest or '未知'}",
|
|
2638
|
-
]
|
|
2639
|
-
if versions_data.launcher_version:
|
|
2640
|
-
if versions_data.launcher_version == "0.4.x":
|
|
2641
|
-
status_info.append("**启动器版本:** < v0.5.0 (旧版本)")
|
|
2642
|
-
else:
|
|
2643
|
-
status_info.append(f"**启动器版本:** v{versions_data.launcher_version}")
|
|
2644
|
-
else:
|
|
2645
|
-
status_info.append("**启动器版本:** 未知")
|
|
2646
|
-
|
|
2647
|
-
status_info.append(f"**找到 {len(versions_data.versions)} 个可用版本**")
|
|
2648
|
-
status_message = "\n\n".join(status_info)
|
|
2649
|
-
|
|
2650
|
-
yield (
|
|
2651
|
-
status_message,
|
|
2652
|
-
gr.Button(value="载入信息", interactive=True),
|
|
2653
|
-
gr.Dropdown(choices=versions_data.versions, value=versions_data.versions[0] if versions_data.versions else None, visible=True),
|
|
2654
|
-
gr.Button(visible=True)
|
|
2655
|
-
)
|
|
2656
|
-
|
|
2657
|
-
def on_install_selected(selected_version: str):
|
|
2658
|
-
"""使用 UpdateService 安装所选版本。"""
|
|
2659
|
-
if not selected_version:
|
|
2660
|
-
gr.Warning("请先选择一个版本。")
|
|
2661
|
-
return
|
|
2662
|
-
|
|
2663
|
-
try:
|
|
2664
|
-
self.update_service.install_version(selected_version)
|
|
2665
|
-
gr.Info(f"正在启动器中安装版本 {selected_version},程序将自动重启...")
|
|
2666
|
-
except UpdateServiceError as e:
|
|
2667
|
-
gr.Error(str(e))
|
|
2668
|
-
|
|
2669
|
-
load_info_btn.click(
|
|
2670
|
-
fn=on_load_info,
|
|
2671
|
-
outputs=[status_text, load_info_btn, version_dropdown, install_selected_btn]
|
|
2672
|
-
)
|
|
2673
|
-
|
|
2674
|
-
install_selected_btn.click(
|
|
2675
|
-
fn=on_install_selected,
|
|
2676
|
-
inputs=[version_dropdown],
|
|
2677
|
-
outputs=[]
|
|
2678
|
-
)
|
|
2679
|
-
|
|
2680
|
-
def _load_config(self) -> None:
|
|
2681
|
-
# 加载配置文件
|
|
2682
|
-
config_path = "config.json"
|
|
2683
|
-
self.config = load_config(config_path, type=BaseConfig, use_default_if_not_found=True)
|
|
2684
|
-
if not self.config.user_configs:
|
|
2685
|
-
# 如果没有用户配置,创建一个默认配置
|
|
2686
|
-
default_config = UserConfig[BaseConfig](
|
|
2687
|
-
name="默认配置",
|
|
2688
|
-
category="default",
|
|
2689
|
-
description="默认配置",
|
|
2690
|
-
backend=BackendConfig(),
|
|
2691
|
-
options=BaseConfig()
|
|
2692
|
-
)
|
|
2693
|
-
self.config.user_configs.append(default_config)
|
|
2694
|
-
self.current_config = self.config.user_configs[0]
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
def create_ui(self) -> gr.Blocks:
|
|
2698
|
-
custom_css = """
|
|
2699
|
-
#container { max-width: 800px; margin: auto; padding: 20px; }
|
|
2700
|
-
.quick-controls-row > div {
|
|
2701
|
-
display: flex !important;
|
|
2702
|
-
flex-wrap: nowrap !important;
|
|
2703
|
-
gap: 0 !important;
|
|
2704
|
-
overflow-x: auto !important;
|
|
2705
|
-
}
|
|
2706
|
-
.quick-controls-row > div > div {
|
|
2707
|
-
min-width: auto !important;
|
|
2708
|
-
padding: 0;
|
|
2709
|
-
}
|
|
2710
|
-
"""
|
|
2711
|
-
with gr.Blocks(title="琴音小助手", css=custom_css) as app:
|
|
2712
|
-
with gr.Column(elem_id="container"):
|
|
2713
|
-
gr.Markdown(f"# 琴音小助手 v{self._kaa.version}")
|
|
2714
|
-
|
|
2715
|
-
with gr.Tabs():
|
|
2716
|
-
self._create_status_tab()
|
|
2717
|
-
self._create_task_tab()
|
|
2718
|
-
self._create_settings_tab()
|
|
2719
|
-
self._create_produce_tab()
|
|
2720
|
-
self._create_log_tab()
|
|
2721
|
-
self._create_whats_new_tab()
|
|
2722
|
-
|
|
2723
|
-
# 启动 IdleModeManager 后台线程
|
|
2724
|
-
self.idle_mgr.start()
|
|
2725
|
-
|
|
2726
|
-
return app
|
|
2727
|
-
|
|
2728
|
-
def main(kaa: Kaa | None = None, start_immidiately: bool = False) -> None:
|
|
2729
|
-
kaa = kaa or Kaa('./config.json')
|
|
2730
|
-
ui = KotoneBotUI(kaa)
|
|
2731
|
-
app = ui.create_ui()
|
|
2732
|
-
|
|
2733
|
-
if start_immidiately:
|
|
2734
|
-
ui.start_run()
|
|
2735
|
-
|
|
2736
|
-
server_name = "0.0.0.0" if ui.current_config.options.misc.expose_to_lan else "127.0.0.1"
|
|
2737
|
-
app.launch(inbrowser=True, show_error=True, server_name=server_name)
|
|
76
|
+
gr.Code(traceback.format_exc(), label="Traceback")
|
|
2738
77
|
|
|
2739
|
-
|
|
2740
|
-
main()
|
|
78
|
+
error_blocks.launch(inbrowser=True)
|