maze_python/config.py
2025-07-04 12:22:51 +08:00

76 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 游戏配置文件
# UI 界面配置
UI_HEIGHT = 1000
UI_WIDTH = 1500
# 迷宫配置
MAZE_SIZE = 800
WALL_SIZE = 50
# 游戏性能配置
FPS = 120
# 路径播放配置
AUTO_PLAY_INTERVAL = 10 # 每10帧自动前进一步加快速度
# 按钮尺寸配置
BUTTON_START_SIZE = (200, 100)
BUTTON_SAVE_SIZE = (80, 80)
BUTTON_CONTROL_SIZE = (100, 50)
# 字体配置
FONT_FILE = "syht.otf"
FONT_SIZE = 18
# 资源路径配置
ASSETS_PATH = "assets"
WALL_IMAGE = f"{ASSETS_PATH}/wall.png"
COIN_IMAGE = f"{ASSETS_PATH}/coin.png"
TRAP_IMAGE = f"{ASSETS_PATH}/trap.png"
BOSS_IMAGE = f"{ASSETS_PATH}/boss.jpg"
LOCK_IMAGE = f"{ASSETS_PATH}/lock.png"
START_BUTTON_IMAGE = f"{ASSETS_PATH}/start_button.png"
SAVE_BUTTON_IMAGE = f"{ASSETS_PATH}/save.png"
LOAD_BUTTON_IMAGE = f"{ASSETS_PATH}/load.png"
# 默认文件名
DEFAULT_MAZE_FILE = "maze.csv"
# 颜色配置
COLOR_WHITE = (255, 255, 255)
COLOR_BLACK = (0, 0, 0)
COLOR_GRAY = (200, 200, 200)
COLOR_LIGHT_GRAY = (100, 100, 100)
COLOR_GREEN = (100, 255, 100)
COLOR_GOLD = (255, 215, 0)
# 布局配置
def get_button_positions(maze_display_size=MAZE_SIZE):
"""返回按钮位置配置,根据实际迷宫显示尺寸调整"""
control_panel_x = maze_display_size + 50
return {
'start_button': (control_panel_x, 0),
'save_button': (control_panel_x, 110),
'load_button': (control_panel_x + 100, 110),
'next_step_button': (control_panel_x, 200),
'reset_path_button': (control_panel_x + 120, 200),
'auto_play_button': (control_panel_x + 250, 200),
# 贪心搜索按钮
'greedy_search_button': (control_panel_x + 380, 200),
'greedy_auto_play_button': (control_panel_x + 500, 200),
# 历史迭代控制按钮
'history_prev_button': (control_panel_x, 260),
'history_next_button': (control_panel_x + 120, 260),
'history_auto_button': (control_panel_x + 250, 260),
'history_toggle_button': (control_panel_x + 380, 260),
# 文本显示位置
'progress_text': (control_panel_x, 320),
'history_progress_text': (control_panel_x, 350),
'hint_text': (control_panel_x, 380),
'shortcut_text': (control_panel_x, 410),
'greedy_info_text': (control_panel_x, 440), # 贪心算法信息显示位置
'save_list_area': (control_panel_x, 470, 400, 300) # x, y, width, height - 调整位置和高度
}