Skip to content

Commit

Permalink
Config asu level
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Apr 10, 2024
1 parent df080b3 commit d532fe1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/setting_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions assets/config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 关闭。
Expand Down
3 changes: 2 additions & 1 deletion module/config/asu_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d532fe1

Please sign in to comment.