From d532fe13c1cfd2cca12c7e9520f392c673e813c9 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Wed, 10 Apr 2024 22:13:55 +0800 Subject: [PATCH] Config asu level --- app/setting_interface.py | 8 ++++++++ assets/config/config.example.yaml | 1 + module/config/asu_config.py | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/setting_interface.py b/app/setting_interface.py index 7fb619e7..24b64380 100644 --- a/app/setting_interface.py +++ b/app/setting_interface.py @@ -290,6 +290,13 @@ def __initCard(self): '', texts=fates ) + self.universeDifficultyCard = RangeSettingCard1( + "universe_difficulty", + [1, 5], + FIF.HISTORY, + self.tr("难度"), + self.tr(""), + ) self.universeOperationModeCard = ComboBoxSettingCard2( "universe_operation_mode", FIF.COMMAND_PROMPT, @@ -590,6 +597,7 @@ def __initLayout(self): self.UniverseGroup.addSettingCard(self.universeEnableCard) self.UniverseGroup.addSettingCard(self.universeFateCard) + self.UniverseGroup.addSettingCard(self.universeDifficultyCard) self.UniverseGroup.addSettingCard(self.universeOperationModeCard) self.UniverseGroup.addSettingCard(self.universeTimeoutCard) self.UniverseGroup.addSettingCard(self.universeBonusEnableCard) diff --git a/assets/config/config.example.yaml b/assets/config/config.example.yaml index 5600bdc1..14cced4f 100644 --- a/assets/config/config.example.yaml +++ b/assets/config/config.example.yaml @@ -128,6 +128,7 @@ universe_timeout: 20 # 模拟宇宙超时时间(单位:小时),设置脚 universe_requirements: false # 是否已安装模拟宇宙依赖。true 表示已安装,false 表示未安装或需要重新安装。 universe_timestamp: 0 # 上次运行模拟宇宙的时间戳,用于记录和控制运行频率。 universe_fate: '巡猎' # 模拟宇宙使用的命途 +universe_difficulty: 4 # 模拟宇宙使用的难度 # 忘却之庭配置 forgottenhall_enable: false # 是否启用混沌回忆功能。true 开启,false 关闭。 diff --git a/module/config/asu_config.py b/module/config/asu_config.py index 9d563bc6..52d878ce 100644 --- a/module/config/asu_config.py +++ b/module/config/asu_config.py @@ -11,8 +11,9 @@ def auto_config(): cfg.universe_path, "info.yml")) with open(os.path.join(cfg.universe_path, "info.yml"), 'r', encoding='utf-8') as f: info = yaml.safe_load(f) - if info['config']['fate'] != cfg.universe_fate: + if info['config']['fate'] != cfg.universe_fate or info['config']['difficulty'] != cfg.universe_difficulty: info['config']['fate'] = cfg.universe_fate + info['config']['difficulty'] = cfg.universe_difficulty with open(os.path.join(cfg.universe_path, "info.yml"), 'w', encoding='utf-8') as f: yaml.dump(info, f, default_flow_style=False, allow_unicode=True)