maze_python/config.py
2025-06-30 21:05:34 +08:00

72 lines
2.1 KiB
Python

# 游戏配置文件
# UI 界面配置
UI_HEIGHT = 1000
UI_WIDTH = 1500
# 迷宫配置
MAZE_SIZE = 800
WALL_SIZE = 50
# 游戏性能配置
FPS = 120
# 路径播放配置
AUTO_PLAY_INTERVAL = 30 # 每30帧自动前进一步
# 按钮尺寸配置
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),
# 历史迭代控制按钮
'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),
'save_list_area': (control_panel_x, 440, 400, 330) # x, y, width, height - 增加高度到330
}