refactor: 重组参数配置界面布局,上下分组基础参数与游戏参数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
王鹏
2026-04-11 23:11:44 +08:00
parent d0df69184d
commit b4de5278ed

View File

@@ -870,13 +870,15 @@ class WoWMultiKeyGUI(QMainWindow):
loops_layout.addWidget(loop_editor) loops_layout.addWidget(loop_editor)
tabs.addTab(tab_combat_loops, "攻击循环") tabs.addTab(tab_combat_loops, "攻击循环")
# Tab: 参数配置(多分辨率,两列布局 # Tab: 参数配置(上下两个分组
tab_params = QWidget() tab_params = QWidget()
params_layout = QVBoxLayout(tab_params) params_layout = QVBoxLayout(tab_params)
params_content = QWidget()
params_row = QHBoxLayout(params_content) # 基础参数(截图/窗口配置)
params_left = QFormLayout() basic_group = QGroupBox("基础参数")
params_right = QFormLayout() basic_layout = QHBoxLayout(basic_group)
basic_left = QFormLayout()
basic_right = QFormLayout()
self.gs_pixel_size = QSpinBox() self.gs_pixel_size = QSpinBox()
self.gs_pixel_size.setRange(8, 32) self.gs_pixel_size.setRange(8, 32)
self.gs_pixel_size.setValue(17) self.gs_pixel_size.setValue(17)
@@ -895,21 +897,26 @@ class WoWMultiKeyGUI(QMainWindow):
self.gs_offset_top = QSpinBox() self.gs_offset_top = QSpinBox()
self.gs_offset_top.setRange(0, 100) self.gs_offset_top.setRange(0, 100)
self.gs_offset_top.setValue(45) self.gs_offset_top.setValue(45)
params_left.addRow("每格像素 (pixel_size):", self.gs_pixel_size) basic_left.addRow("每格像素 (pixel_size):", self.gs_pixel_size)
params_left.addRow("起始 X (block_start_x):", self.gs_block_start_x) basic_left.addRow("起始 X (block_start_x):", self.gs_block_start_x)
params_left.addRow("截图宽度 (scan_region_width):", self.gs_scan_width) basic_left.addRow("截图宽度 (scan_region_width):", self.gs_scan_width)
params_left.addRow("截图高度 (scan_region_height):", self.gs_scan_height) basic_right.addRow("截图高度 (scan_region_height):", self.gs_scan_height)
params_left.addRow("窗口左偏移 (offset_left):", self.gs_offset_left) basic_right.addRow("窗口左偏移 (offset_left):", self.gs_offset_left)
params_left.addRow("窗口顶偏移 (offset_top):", self.gs_offset_top) basic_right.addRow("窗口顶偏移 (offset_top):", self.gs_offset_top)
basic_layout.addLayout(basic_left)
basic_layout.addLayout(basic_right)
params_layout.addWidget(basic_group)
# Bot 参数(保存到 wow_multikey_qt.json # 游戏参数
game_group = QGroupBox("游戏参数")
game_layout = QHBoxLayout(game_group)
game_left = QFormLayout()
game_right = QFormLayout()
self.skinning_wait_spin = QDoubleSpinBox() self.skinning_wait_spin = QDoubleSpinBox()
self.skinning_wait_spin.setRange(0.1, 10.0) self.skinning_wait_spin.setRange(0.1, 10.0)
self.skinning_wait_spin.setSingleStep(0.1) self.skinning_wait_spin.setSingleStep(0.1)
self.skinning_wait_spin.setValue(1.5) self.skinning_wait_spin.setValue(1.5)
self.skinning_wait_spin.setSuffix("") self.skinning_wait_spin.setSuffix("")
params_right.addRow("剥皮等待时间:", self.skinning_wait_spin)
self.food_key_edit = QLineEdit() self.food_key_edit = QLineEdit()
self.food_key_edit.setPlaceholderText("如 f1") self.food_key_edit.setPlaceholderText("如 f1")
self.food_key_edit.setMaxLength(16) self.food_key_edit.setMaxLength(16)
@@ -923,22 +930,14 @@ class WoWMultiKeyGUI(QMainWindow):
self.eat_max_wait_spin.setSingleStep(1.0) self.eat_max_wait_spin.setSingleStep(1.0)
self.eat_max_wait_spin.setValue(30.0) self.eat_max_wait_spin.setValue(30.0)
self.eat_max_wait_spin.setSuffix("") self.eat_max_wait_spin.setSuffix("")
params_right.addRow("吃面包按键:", self.food_key_edit)
params_right.addRow("吃面包血量阈值:", self.eat_hp_threshold_spin)
params_right.addRow("吃面包最长等待:", self.eat_max_wait_spin)
self.gs_hearthstone_key = QLineEdit() self.gs_hearthstone_key = QLineEdit()
self.gs_hearthstone_key.setPlaceholderText("如 b") self.gs_hearthstone_key.setPlaceholderText("如 b")
self.gs_hearthstone_key.setMaxLength(16) self.gs_hearthstone_key.setMaxLength(16)
self.gs_hearthstone_key.setText("b") self.gs_hearthstone_key.setText("b")
self.gs_bag_full_hearthstone = QCheckBox("包满时用炉石回城并停止") self.gs_bag_full_hearthstone = QCheckBox("包满时用炉石回城并停止")
self.gs_bag_full_hearthstone.setChecked(False) self.gs_bag_full_hearthstone.setChecked(False)
params_right.addRow("炉石按键 (hearthstone_key):", self.gs_hearthstone_key)
params_right.addRow("包满是否炉石回城:", self.gs_bag_full_hearthstone)
self.gs_enable_mount = QCheckBox("启用上马") self.gs_enable_mount = QCheckBox("启用上马")
self.gs_enable_mount.setChecked(True) self.gs_enable_mount.setChecked(True)
params_right.addRow("是否上马 (enable_mount):", self.gs_enable_mount)
self.gs_mount_key = QLineEdit() self.gs_mount_key = QLineEdit()
self.gs_mount_key.setPlaceholderText("如 x") self.gs_mount_key.setPlaceholderText("如 x")
self.gs_mount_key.setMaxLength(16) self.gs_mount_key.setMaxLength(16)
@@ -953,10 +952,6 @@ class WoWMultiKeyGUI(QMainWindow):
self.gs_mount_retry.setSingleStep(0.1) self.gs_mount_retry.setSingleStep(0.1)
self.gs_mount_retry.setValue(2.0) self.gs_mount_retry.setValue(2.0)
self.gs_mount_retry.setSuffix("") self.gs_mount_retry.setSuffix("")
params_right.addRow("上马按键 (mount_key):", self.gs_mount_key)
params_right.addRow("上马按住时长 (mount_hold_sec):", self.gs_mount_hold)
params_right.addRow("上马重试间隔 (mount_retry_after_sec):", self.gs_mount_retry)
self.gs_release_spirit_key = QLineEdit() self.gs_release_spirit_key = QLineEdit()
self.gs_release_spirit_key.setPlaceholderText("如 9") self.gs_release_spirit_key.setPlaceholderText("如 9")
self.gs_release_spirit_key.setMaxLength(16) self.gs_release_spirit_key.setMaxLength(16)
@@ -965,12 +960,23 @@ class WoWMultiKeyGUI(QMainWindow):
self.gs_resurrect_key.setPlaceholderText("如 0") self.gs_resurrect_key.setPlaceholderText("如 0")
self.gs_resurrect_key.setMaxLength(16) self.gs_resurrect_key.setMaxLength(16)
self.gs_resurrect_key.setText("0") self.gs_resurrect_key.setText("0")
params_right.addRow("释放灵魂按键:", self.gs_release_spirit_key) game_left.addRow("剥皮等待时间:", self.skinning_wait_spin)
params_right.addRow("复活按键:", self.gs_resurrect_key) game_left.addRow("吃面包按键:", self.food_key_edit)
game_left.addRow("吃面包血量阈值:", self.eat_hp_threshold_spin)
game_left.addRow("吃面包最长等待:", self.eat_max_wait_spin)
game_left.addRow("炉石按键:", self.gs_hearthstone_key)
game_left.addRow("", self.gs_bag_full_hearthstone)
game_right.addRow("是否上马:", self.gs_enable_mount)
game_right.addRow("上马按键:", self.gs_mount_key)
game_right.addRow("上马按住时长:", self.gs_mount_hold)
game_right.addRow("上马重试间隔:", self.gs_mount_retry)
game_right.addRow("释放灵魂按键:", self.gs_release_spirit_key)
game_right.addRow("复活按键:", self.gs_resurrect_key)
game_layout.addLayout(game_left)
game_layout.addLayout(game_right)
params_layout.addWidget(game_group)
params_row.addLayout(params_left) params_layout.addStretch()
params_row.addLayout(params_right)
params_layout.addWidget(params_content)
params_save_btn = QPushButton("💾 保存配置") params_save_btn = QPushButton("💾 保存配置")
params_save_btn.clicked.connect(self._save_params_config) params_save_btn.clicked.connect(self._save_params_config)
params_layout.addWidget(params_save_btn) params_layout.addWidget(params_save_btn)