detopoi před 1 rokem
rodič
revize
5b51b7fac7
5 změnil soubory, kde provedl 325 přidání a 134 odebrání
  1. 33 1
      game/algo/utils.py
  2. 2 2
      game/const/rouge.py
  3. 1 1
      game/const/window.py
  4. 137 0
      game/ui/menu/component.py
  5. 152 130
      laucher.py

+ 33 - 1
game/algo/utils.py

@@ -9,6 +9,7 @@ import easygui as eg
 import tkinter as tk
 from game.const import game as G
 from game.const import rouge as R
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
 
 server_ip = "123.249.17.43:5000"
 ALLOWED_CHARACTERS = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{}|;:,.<>?/")
@@ -46,9 +47,11 @@ def try_login():
                 G.USERNAME = _result['user_info']['name']
                 G.IS_ONLINE = True
                 # eg.msgbox(f"{G.USERNAME}({G.UID})登录成功!", "成功")
-                choice = eg.buttonbox(msg=f"{G.USERNAME}({G.UID})登录成功!", title="欢迎", choices=["进入主界面", "修改名字"])
+                choice = eg.buttonbox(msg=f"{G.USERNAME}({G.UID})登录成功!", title="欢迎", choices=["进入主界面", "修改名字", "覆盖本地数据"])
                 if choice == "修改名字":
                     change_username()
+                elif choice == "覆盖本地数据":
+                    update_local_data()
                 return True
         if G.USERNAME != "":
             _result = username_login(G.USERNAME, G.PASSWORD)
@@ -93,6 +96,35 @@ def change_username():
             change_username()
 
 
+def update_local_data():
+    online_data = get_online_data()
+    user_documents_folder = os.path.expanduser("~\\Documents")          # 获取用户的"文档"文件夹路径
+    qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")       # 构建QQTPVE文件夹路径
+    os.makedirs(qqtpve_folder, exist_ok=True)                           # 确保QQTPVE文件夹存在,如果不存在则创建
+    rouge_file_path = os.path.join(qqtpve_folder, "rougeOB.rougedata")  # 构建文件路径
+    local_data = load_rouge_data(rouge_file_path)
+    local_text = f"小倩等级{local_data['Fox']['lv']}; " \
+                 f"波波丽等级{local_data['Boboli']['lv']}; " \
+                 f"火影等级{local_data['Naruto_old']['lv']}; " \
+                 f"阿莎等级{local_data['Asha']['lv']}; " \
+                 f"玛利亚等级{local_data['Maria']['lv']}; " \
+                 f"???等级{local_data['Surprise']['lv']}"
+    oneline_text = f"小倩等级{online_data['Fox']['lv']}; " \
+                   f"波波丽等级{online_data['Boboli']['lv']}; " \
+                   f"火影等级{online_data['Naruto_old']['lv']}; " \
+                   f"阿莎等级{online_data['Asha']['lv']}; " \
+                   f"玛利亚等级{online_data['Maria']['lv']}; " \
+                   f"???等级{online_data['Surprise']['lv']}"
+    choice = eg.buttonbox(msg=f"是否将本地数据\n{local_text}\n更新为\n{oneline_text}\n?该操作不可重置!", title="注意", choices=["覆盖数据", "取消"])
+    if choice == "覆盖数据":
+        rouge_data = {}
+        for hero in ["Fox","Boboli","Naruto_old","Asha","Maria","Surprise"]:
+            rouge_data[hero] = online_data[hero]
+        save_encrypt_single_rouge_file(rouge_data, "rougeOB")
+        eg.msgbox(f"数据更新成功!", "结果")
+    return
+
+
 def get_online_data():
     if not G.IS_ONLINE:
         return

+ 2 - 2
game/const/rouge.py

@@ -3,8 +3,8 @@ from game.const import game as G
 import json
 import os
 
-# debug_mode = True
-debug_mode = False
+debug_mode = True
+# debug_mode = False
 test_mode = False
 # print_mode = True
 print_mode = False

+ 1 - 1
game/const/window.py

@@ -1,3 +1,3 @@
 WINDOW_SIZE = WINDOW_W, WINDOW_H = (800, 600)
-WINDOW_CAPTION = "QQTRogue2.3.2(底层逻辑:永恒; 地牢算法开发与设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!)"
+WINDOW_CAPTION = "QQTRogue2.4.0(底层逻辑:永恒; 地牢算法开发与设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!)"
 WINDOW_SCROLL_PADDING = 200

+ 137 - 0
game/ui/menu/component.py

@@ -0,0 +1,137 @@
+import pygame
+
+from game.sound import sound_player
+
+
+class PygameButton:
+    """
+    文字渲染按钮
+    """
+    def __init__(self, screen, text, relx, rely, font_size, bg_color, fg_color=(0,0,0), action=None, anchor='center', is_bold=True, fix_shape=None, bg_alpha=255):
+        self.screen = screen
+        self.text = text
+        self.lines = text.split('\n')
+        self.font = pygame.font.SysFont("Microsoft JhengHei", font_size, bold=is_bold)
+        self.bg_color_normal = pygame.Color(bg_color)
+        # # 计算 hover 颜色:加深 20%
+
+        # h = self.bg_color_normal
+        # self.bg_color_hover = pygame.Color(max(0, int(h.r*0.8)), max(0, int(h.g*0.8)), max(0, int(h.b*0.8)))
+
+        self.bg_color_normal.a = bg_alpha
+        h = self.bg_color_normal
+        hover_rgb = (
+            max(0, int(h.r * 0.8)),
+            max(0, int(h.g * 0.8)),
+            max(0, int(h.b * 0.8)),
+        )
+        self.bg_color_hover = pygame.Color(*hover_rgb)
+        self.bg_color_hover.a = bg_alpha
+
+        self.fg_color = fg_color
+        self.action = action
+        self.relx = relx
+        self.rely = rely
+        self.fix_shape = fix_shape
+        self.anchor = anchor  # 'center', 'topleft'
+        self.hovered = False
+        self._render()
+
+    def _render(self):
+        # 渲染多行文本
+        self.text_surfs = [self.font.render(line, True, self.fg_color) for line in self.lines]
+        widths = [surf.get_width() for surf in self.text_surfs]
+        heights = [surf.get_height() for surf in self.text_surfs]
+        if self.fix_shape is None:
+            total_width = max(widths)
+            total_height = sum(heights) + (len(heights)-1) * 5
+        else:
+            total_width = self.fix_shape[0]
+            total_height = self.fix_shape[1]
+        sw, sh = self.screen.get_size()
+        x = int(sw * self.relx)
+        y = int(sh * self.rely)
+        # 根据锚点决定位置
+        if self.anchor == 'center':
+            topleft = (x - total_width//2 - 10, y - total_height//2 - 5)
+        elif self.anchor == 'topleft':
+            topleft = (x, y)
+        else:
+            topleft = (x - total_width//2 - 10, y - total_height//2 - 5)
+        self.bg_rect = pygame.Rect(topleft[0], topleft[1], total_width + 20, total_height + 10)
+        # 计算每行文本位置
+        self.text_positions = []
+        offset_y = self.bg_rect.y + 5
+        for surf in self.text_surfs:
+            line_x = self.bg_rect.x + (self.bg_rect.width - surf.get_width())//2 if self.anchor=='center' else self.bg_rect.x + 10
+            self.text_positions.append((line_x, offset_y))
+            offset_y += surf.get_height() + 5
+
+    def draw(self):
+        # 绘制背景
+        # color = self.bg_color_hover if self.hovered else self.bg_color_normal
+        # pygame.draw.rect(self.screen, color, self.bg_rect)
+
+        color = self.bg_color_hover if self.hovered else self.bg_color_normal
+        bg_surf = pygame.Surface(
+            (self.bg_rect.width, self.bg_rect.height),
+            pygame.SRCALPHA  # 允许 per-pixel alpha
+        )
+        bg_surf.fill(color)       # color 中已包含 a 通道
+        self.screen.blit(bg_surf, self.bg_rect.topleft)
+        # 绘制文本
+        for surf, pos in zip(self.text_surfs, self.text_positions):
+            self.screen.blit(surf, pos)
+
+    def handle_event(self, event):
+        if event.type == pygame.MOUSEMOTION:
+            self.hovered = self.bg_rect.collidepoint(event.pos)
+        elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
+            if self.hovered:
+                if self.action:
+                    self.action()
+                sound_player.play("uiLeave")
+
+
+class PygameButtonBackIMG:
+    """
+    一个仅使用图片作为按钮的类,不含文字渲染,图片本身包含文字。
+    - default_img_path: 默认状态下的背景图路径
+    - hover_img_path: 悬停状态下的背景图路径
+    """
+    def __init__(self, screen, relx, rely,
+                 default_img_path, hover_img_path,
+                 action=None, anchor='center'):
+        self.screen = screen
+        # 加载按钮图片
+        self.default_img = pygame.image.load(default_img_path).convert_alpha()
+        self.hover_img = pygame.image.load(hover_img_path).convert_alpha()
+        self.action = action
+        self.relx = relx
+        self.rely = rely
+        self.anchor = anchor  # 'center' 或 'topleft'
+        self.hovered = False
+        # 按钮尺寸使用图片原始尺寸
+        self.width, self.height = self.default_img.get_size()
+        # 计算按钮位置
+        sw, sh = self.screen.get_size()
+        x = int(sw * self.relx)
+        y = int(sh * self.rely)
+        if self.anchor == 'center':
+            topleft = (x - self.width//2, y - self.height//2)
+        else:
+            topleft = (x, y)
+        self.bg_rect = pygame.Rect(topleft[0], topleft[1], self.width, self.height)
+
+    def draw(self):
+        # 根据悬停状态绘制对应图片
+        img = self.hover_img if self.hovered else self.default_img
+        self.screen.blit(img, self.bg_rect.topleft)
+
+    def handle_event(self, event):
+        if event.type == pygame.MOUSEMOTION:
+            self.hovered = self.bg_rect.collidepoint(event.pos)
+        elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
+            if self.hovered and self.action:
+                sound_player.play("uiLeave")
+                self.action()

+ 152 - 130
laucher.py

@@ -2,7 +2,6 @@ import random
 import json
 import os
 import win32gui
-import tkinter as tk
 import sys
 import logging
 import rougetask
@@ -22,7 +21,7 @@ from game.const import window as W, color as C, game as G
 from game.const import rouge as R
 from game.music import music_loader
 from game.sound import sound_player
-
+from game.ui.menu.component import PygameButton, PygameButtonBackIMG
 
 current_folder_path = os.getcwd()
 
@@ -31,9 +30,9 @@ def current_lv(lv):
     lv_list = R.lv_list
     if lv >= sum(lv_list):
         return "--"
-    for k in range(0,14):
-        if sum(lv_list[:k]) <= lv < sum(lv_list[:k+1]):
-            return str(sum(lv_list[:k+1])-lv)
+    for k in range(0, 14):
+        if sum(lv_list[:k]) <= lv < sum(lv_list[:k + 1]):
+            return str(sum(lv_list[:k + 1]) - lv)
 
 
 def check_rouge_ob_data(data):
@@ -51,81 +50,32 @@ def check_rouge_ob_data(data):
         save_encrypt_single_rouge_file(data, "rougeOB")
 
 
-class PygameButton:
-    def __init__(self, screen, text, relx, rely, font_size, bg_color, fg_color=(0,0,0), action=None, anchor='center', is_bold=False):
-        self.screen = screen
-        self.text = text
-        self.lines = text.split('\n')
-        self.font = pygame.font.SysFont("Microsoft YaHei", font_size, bold=is_bold)
-        self.bg_color_normal = pygame.Color(bg_color)
-        # 计算 hover 颜色:加深 20%
-        h = self.bg_color_normal
-        self.bg_color_hover = pygame.Color(max(0, int(h.r*0.8)), max(0, int(h.g*0.8)), max(0, int(h.b*0.8)))
-        self.fg_color = fg_color
-        self.action = action
-        self.relx = relx
-        self.rely = rely
-        self.anchor = anchor  # 'center', 'topleft'
-        self.hovered = False
-        self._render()
-
-    def _render(self):
-        # 渲染多行文本
-        self.text_surfs = [self.font.render(line, True, self.fg_color) for line in self.lines]
-        widths = [surf.get_width() for surf in self.text_surfs]
-        heights = [surf.get_height() for surf in self.text_surfs]
-        total_width = max(widths)
-        total_height = sum(heights) + (len(heights)-1) * 5
-        sw, sh = self.screen.get_size()
-        x = int(sw * self.relx)
-        y = int(sh * self.rely)
-        # 根据锚点决定位置
-        if self.anchor == 'center':
-            topleft = (x - total_width//2 - 10, y - total_height//2 - 5)
-        elif self.anchor == 'topleft':
-            topleft = (x, y)
-        else:
-            topleft = (x - total_width//2 - 10, y - total_height//2 - 5)
-        self.bg_rect = pygame.Rect(topleft[0], topleft[1], total_width + 20, total_height + 10)
-        # 计算每行文本位置
-        self.text_positions = []
-        offset_y = self.bg_rect.y + 5
-        for surf in self.text_surfs:
-            line_x = self.bg_rect.x + (self.bg_rect.width - surf.get_width())//2 if self.anchor=='center' else self.bg_rect.x + 10
-            self.text_positions.append((line_x, offset_y))
-            offset_y += surf.get_height() + 5
-
-    def draw(self):
-        # 绘制背景
-        color = self.bg_color_hover if self.hovered else self.bg_color_normal
-        pygame.draw.rect(self.screen, color, self.bg_rect)
-        # 绘制文本
-        for surf, pos in zip(self.text_surfs, self.text_positions):
-            self.screen.blit(surf, pos)
-
-    def handle_event(self, event):
-        if event.type == pygame.MOUSEMOTION:
-            self.hovered = self.bg_rect.collidepoint(event.pos)
-        elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
-            if self.hovered:
-                if self.action:
-                    self.action()
-                sound_player.play("uiLeave")
-
-
 class Menu:
 
-    def __init__(self, screen):
+    def __init__(self, screen, bg_image_path=None):
         self.screen = screen
         self.buttons = []
+        self.current_hero = "Fox"
+        self.current_difficulty = "Easy"
+        self.is_random = False  # 随机选择角色
+        if bg_image_path:
+            img = pygame.image.load(bg_image_path).convert()
+            self.bg_image = pygame.transform.scale(img, screen.get_size())
+        else:
+            self.bg_image = None
         self._init_data()
         self._create_buttons()
 
     def _init_data(self):
         rougeOB_data = {}
         rougeOB_achivements = []
-        self.current_hero = "Fox"
-        self.current_difficulty = "Easy"
+        with open("config.json", "r", encoding="utf-8") as json_file:
+            mapsetdata = json.load(json_file)
+        R.rouge_hero = mapsetdata["your_hero"]
+        self.current_hero = mapsetdata["your_hero"]
+        R.difficulty = mapsetdata["rogue_difficulty"]
+        self.current_difficulty = mapsetdata["rogue_difficulty"]
+        print(mapsetdata["rogue_difficulty"])
         user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
         qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
         os.makedirs(qqtpve_folder, exist_ok=True)  # 确保QQTPVE文件夹存在,如果不存在则创建
@@ -165,19 +115,33 @@ class Menu:
 
         # 第一次打开
         if not os.path.exists(rouge_task_file_path):
-            rougeOB_task_data = {"1":  {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "2":  {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "3":  {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "4":  {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "5":  {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "6":  {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "7":  {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "8":  {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "9":  {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                                 "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1, "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}}
+            rougeOB_task_data = {
+                "1": {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "2": {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "3": {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "4": {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "5": {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "6": {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "7": {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "8": {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "9": {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
+                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970,
+                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970,
+                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
+                "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1,
+                          "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}}
             save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
         # 正常打开
         else:
@@ -256,11 +220,21 @@ class Menu:
 
         for hero in ["Fox", "Boboli", "Naruto_old", "Asha", "Maria"]:
             rougeOB_data[hero]["lv"] = R.current_lv(rougeOB_data[hero]["exp"])
-        self.Fox_info = "小倩: 等级"+str(rougeOB_data["Fox"]["lv"])+", 升级还需经验:"+current_lv(rougeOB_data["Fox"]["exp"]) + ", 技能: 自身血量减少1则糖泡伤害增加"+str(R.FoxSkill(rougeOB_data["Fox"]["lv"]))
-        self.Boboli_info = "波波丽: 等级"+str(rougeOB_data["Boboli"]["lv"])+", 升级还需经验:"+current_lv(rougeOB_data["Boboli"]["exp"]) + ", 技能: 每次攻击额外造成"+str(int(R.BoboliSkill(rougeOB_data["Boboli"]["lv"])*100))+"%真实伤害"
-        self.Naruto_old_info = "火影: 等级"+str(rougeOB_data["Naruto_old"]["lv"])+", 升级还需经验:"+current_lv(rougeOB_data["Naruto_old"]["exp"]) + ", 技能: 首次攻击每只怪物时攻击力变为"+str(int(R.Naruto_oldSkill(rougeOB_data["Naruto_old"]["lv"])*100))+"%"
-        self.Asha_info = "阿莎: 等级"+str(rougeOB_data["Asha"]["lv"])+", 升级还需经验:"+current_lv(rougeOB_data["Asha"]["exp"]) + ", 技能: 每次糖泡造成伤害恢复血量"+str(R.AshaSkill(rougeOB_data["Asha"]["lv"])*100)+"%"
-        self.Maria_info = "玛莉亚: 等级"+str(rougeOB_data["Maria"]["lv"])+", 升级还需经验:"+current_lv(rougeOB_data["Maria"]["exp"]) + ", 技能: 每次造成伤害降低怪物近身"+str(R.MariaSkill(rougeOB_data["Maria"]["lv"])*100)+"%(最高50%)与"+str(R.MariaSkill2(rougeOB_data["Maria"]["lv"]))+"防御"
+        self.Fox_info = "小倩: 等级" + str(rougeOB_data["Fox"]["lv"]) + ", 升级还需经验:" + current_lv(
+            rougeOB_data["Fox"]["exp"]) + "\n技能: 自身血量减少1则糖泡伤害增加" + str(R.FoxSkill(rougeOB_data["Fox"]["lv"]))
+        self.Boboli_info = "波波丽: 等级" + str(rougeOB_data["Boboli"]["lv"]) + ", 升级还需经验:" + current_lv(
+            rougeOB_data["Boboli"]["exp"]) + "\n技能: 每次攻击额外造成" + str(
+            int(R.BoboliSkill(rougeOB_data["Boboli"]["lv"]) * 100)) + "%真实伤害"
+        self.Naruto_old_info = "火影: 等级" + str(rougeOB_data["Naruto_old"]["lv"]) + ", 升级还需经验:" + current_lv(
+            rougeOB_data["Naruto_old"]["exp"]) + "\n技能: 首次攻击每只怪物时攻击力变为" + str(
+            int(R.Naruto_oldSkill(rougeOB_data["Naruto_old"]["lv"]) * 100)) + "%"
+        self.Asha_info = "阿莎: 等级" + str(rougeOB_data["Asha"]["lv"]) + ", 升级还需经验:" + current_lv(
+            rougeOB_data["Asha"]["exp"]) + "\n技能: 每次糖泡造成伤害恢复血量" + str(
+            R.AshaSkill(rougeOB_data["Asha"]["lv"]) * 100) + "%"
+        self.Maria_info = "玛莉亚: 等级" + str(rougeOB_data["Maria"]["lv"]) + ", 升级还需经验:" + current_lv(
+            rougeOB_data["Maria"]["exp"]) + "\n技能: 每次造成伤害降低怪物近身" + str(
+            R.MariaSkill(rougeOB_data["Maria"]["lv"]) * 100) + "%(最高50%)与" + str(
+            R.MariaSkill2(rougeOB_data["Maria"]["lv"])) + "防御"
 
         # 第一次打开
         if not os.path.exists(rouge_achivements_file_path):
@@ -286,7 +260,8 @@ class Menu:
         max_level_hero = "Fox"
         max_diff = "Easy"
         max_diff_num = 1
-        self.hero_dic= {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
+        self.hero_dic = {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚",
+                         "Surprise": "???"}
         self.diff_dic = {"Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
         diff_num = {"Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
         diff_status = {"Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
@@ -304,9 +279,9 @@ class Menu:
                 diff_status[data["DIFF"]] = 2
 
         if max_level > 0:
-            record_text = f"最高挑战纪录: 通关<{self.diff_dic[max_diff]}{(max_level -1)//5+1}-{(max_level-1)%5+1}>; 使用英雄: {self.hero_dic[max_level_hero]}"
+            self.record_text = f"最高挑战纪录: 通关<{self.diff_dic[max_diff]}{(max_level - 1) // 5 + 1}-{(max_level - 1) % 5 + 1}>; 使用英雄: {self.hero_dic[max_level_hero]}"
         else:
-            record_text = "暂无挑战记录"
+            self.record_text = "暂无挑战记录"
 
         if max_diff == "Hell+":
             R.pass_status["Easy"] = 1
@@ -331,7 +306,7 @@ class Menu:
             if max_level >= 15:
                 R.pass_status["Easy"] = 1
                 # R.cursor_skin = "fire_cursor2"
-        for dif in ["Easy","Normal","Hell","Hell+"]:
+        for dif in ["Easy", "Normal", "Hell", "Hell+"]:
             if diff_status[dif] == 2:
                 R.pass_status[dif] = 2
 
@@ -339,51 +314,74 @@ class Menu:
         # 主界面按钮
         self.buttons.clear()
         # "进入游戏"
-        text = f"进入游戏 \n (当前难度: {self.diff_dic[R.difficulty]}; 当前英雄: {self.hero_dic[R.rouge_hero]})"
-        self.buttons.append(PygameButton(self.screen, text, 0.5, 0.29, 20, "#C68E17", action=self._start_game, is_bold=True))
+        # self.buttons.append(PygameButton(self.screen, "进入游戏", 0.5, 0.29, 32, "#e1bd48", action=self._start_game, is_bold=True))
+        self.buttons.append(PygameButtonBackIMG(self.screen, 0.5, 0.3, "res/ui/game/start_button_0.png", "res/ui/game/start_button_1.png", action=self._start_game, anchor='center'))
         # "继续游戏"
         if os.path.exists(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata")):
             last = load_rouge_data(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata"))
-            lvl = ((last["current_level"]+2)//2 -1)//5+1
-            stage = ((last["current_level"]+2)//2 -1)%5+1
+            lvl = ((last["current_level"] + 2) // 2 - 1) // 5 + 1
+            stage = ((last["current_level"] + 2) // 2 - 1) % 5 + 1
             text_c = f"继续游戏 (关卡: {lvl}-{stage}) \n (难度: {self.diff_dic[last['difficulty']]}; 英雄: {self.hero_dic[last['rouge_hero']]})"
-            self.buttons.append(PygameButton(self.screen, text_c, 0.5, 0.44, 18, "#C68E17", action=lambda: self._continue_game(last), is_bold=True))
+            self.buttons.append(PygameButton(self.screen, text_c, 0.5, 0.44, 18, "#e1bd48", action=lambda: self._continue_game(last), is_bold=True, bg_alpha=191))
         # 任务系统
-        self.buttons.append(PygameButton(self.screen, "任务系统", 0.16, 0.16, 24, "#C68E17", action=self._open_task, is_bold=True))
+        self.buttons.append(
+            PygameButton(self.screen, "任务系统", 0.16, 0.16, 24, "#e1bd48", action=self._open_task, is_bold=True, fix_shape=(120,30), bg_alpha=127))
         # 陈列馆
-        self.buttons.append(PygameButton(self.screen, "陈列馆", 0.16, 0.28, 18, "#C68E17", action=self._open_setting, is_bold=True))
+        self.buttons.append(
+            PygameButton(self.screen, "陈列馆", 0.16, 0.28, 24, "#e1bd48", action=self._open_setting, is_bold=True, fix_shape=(120,30), bg_alpha=127))
         # 难度选择
+        last_diff = {"Easy": "Easy", "Normal": "Easy", "Hell": "Normal", "Hell+": "Hell"}
         for diff, rel in [("Easy", 0.1), ("Normal", 0.18), ("Hell", 0.26), ("Hell+", 0.34)]:
-            enabled = R.pass_status.get(diff, 0) > 0
-            if diff == "Easy":
-                text = f"● 选择{self.diff_dic[diff]}难度"
-                color = "#C47451"
+            if diff == R.difficulty:
+                text = f"★ 当前难度: {self.diff_dic[diff]}"
+                color = "#c7a44f"
+                self.buttons.append(PygameButton(self.screen, text, 0.75, rel, 13, color, anchor="topleft", is_bold=True, fix_shape=(120,15), bg_alpha=191))
             else:
-                text = f"● 选择{self.diff_dic[diff]}难度" if enabled else f"○ {self.diff_dic[diff]}难度(未解锁)"
-                color = "#C47451" if enabled else "#614051"
-            action = lambda d=diff: self._choose_diff(d) if enabled else None
-            self.buttons.append(PygameButton(self.screen, text, 0.75, rel, 13, color, action=action, anchor="topleft", is_bold=False))
+                enabled = R.pass_status.get(last_diff[diff], 0) > 0
+                if diff == "Easy":
+                    text = f"● 选择{self.diff_dic[diff]}难度"
+                    color = "#99be7f"
+                    action = lambda d=diff: self._choose_diff(d)
+                    self.buttons.append(
+                        PygameButton(self.screen, text, 0.75, rel, 13, color, action=action, anchor="topleft", is_bold=True, fix_shape=(120,15), bg_alpha=191))
+                else:
+                    text = f"● 选择{self.diff_dic[diff]}难度" if enabled else f"○ {self.diff_dic[diff]}难度(未解锁)"
+                    color = "#99be7f" if enabled else "#55516d"
+                    if enabled:
+                        action = lambda d=diff: self._choose_diff(d)
+                        self.buttons.append(PygameButton(self.screen, text, 0.75, rel, 13, color, action=action, anchor="topleft", is_bold=True, fix_shape=(120,15), bg_alpha=191))
+                    else:
+                        self.buttons.append(PygameButton(self.screen, text, 0.75, rel, 13, color, fg_color=(255, 255, 255), anchor="topleft", is_bold=False, fix_shape=(120,15), bg_alpha=63))
         # ================================= 英雄选择 =================================
         heroes = ["Fox", "Boboli", "Naruto_old", "Asha", "Maria", "Surprise"]
-        x_position = 0.07
+        x_position = 0.1
         y_positions = [0.64, 0.70, 0.76, 0.82, 0.88, 0.49]
         for hero, y in zip(heroes, y_positions):
-            text = f"● 选择{self.hero_dic[hero]}"
-            self.buttons.append(PygameButton(self.screen, text, x_position, y, 12, "#C47451", action=lambda h=hero: self._choose_hero(h), anchor="topleft", is_bold=True))
+            if not self.is_random and hero == R.rouge_hero:
+                text = f"★ 使用{self.hero_dic[hero]}"
+                self.buttons.append(PygameButton(self.screen, text, x_position, y, 12, "#c7a44f", action=lambda h=hero: self._choose_hero(h), anchor="topleft", is_bold=True, fix_shape=(80,15), bg_alpha=191))
+            else:
+                text = f"● 选择{self.hero_dic[hero]}"
+                self.buttons.append(PygameButton(self.screen, text, x_position, y, 12, "#99be7f", action=lambda h=hero: self._choose_hero(h), anchor="topleft", is_bold=True, fix_shape=(80,15), bg_alpha=127))
         # 随机开局
-        self.buttons.append(PygameButton(self.screen, "● 随机开局", x_position, 0.94, 12, "#C47451", action=lambda: self._choose_hero("Random"), anchor="topleft", is_bold=True))
+        if self.is_random:
+            self.buttons.append(PygameButton(self.screen, "★ 使用随机", x_position, 0.94, 12, "#c7a44f", action=lambda: self._choose_hero("Random"), anchor="topleft", is_bold=True, fix_shape=(80,15), bg_alpha=127))
+        else:
+            self.buttons.append(PygameButton(self.screen, "● 随机开局", x_position, 0.94, 12, "#99be7f", action=lambda: self._choose_hero("Random"), anchor="topleft", is_bold=True, fix_shape=(80,15), bg_alpha=127))
         # 英雄信息提示
-        infos = [getattr(self, attr) for attr in ['Fox_info','Boboli_info','Naruto_old_info','Asha_info','Maria_info']]
-        for info, y in zip(infos, y_positions):
-            self.buttons.append(PygameButton(self.screen, info, 0.2, y, 12, "#E6A9EC", fg_color=(0,0,0), anchor="topleft"))
+        infos = [getattr(self, attr) for attr in ['Fox_info', 'Boboli_info', 'Naruto_old_info', 'Asha_info', 'Maria_info']]
+        base_heroes = ["Fox", "Boboli", "Naruto_old", "Asha", "Maria"]
+        if not self.is_random:
+            for hero, info, y in zip(base_heroes, infos, y_positions):
+                if hero == R.rouge_hero:
+                    self.buttons.append(PygameButton(self.screen, info, 0.32, y-0.03, 14, "#d7b8da", fg_color=(0, 0, 0), anchor="topleft", bg_alpha=127))
         # ==========================================================================
         # 最高记录
         record = getattr(self, 'record_text', "暂无挑战记录")
-        self.buttons.append(PygameButton(self.screen, record, 0.5, 0.56, 14, "#7E354D", fg_color=(255,255,255)))
+        self.buttons.append(PygameButton(self.screen, record, 0.5, 0.56, 14, "#7E354D", fg_color=(255, 255, 255), bg_alpha=191))
 
     # 各个按钮动作方法
     def _start_game(self):
-        # self.screen = None
         rougeGen.main_func()
         game = Control(
             screen=self.screen,
@@ -392,8 +390,12 @@ class Menu:
         game.update()
 
     def _continue_game(self, last):
-        # 同原tk逻辑,将last数据写入R然后启动Control
-        rogue_control.Control(is_continue=True)
+        self.read_continue_data(last)
+        game = rogue_control.Control(
+            screen=self.screen,
+            is_continue=True
+        )
+        game.update()
 
     def _open_task(self):
         from rougetask import Task
@@ -405,12 +407,28 @@ class Menu:
 
     def _choose_diff(self, diff):
         R.difficulty = diff
+        with open("config.json", "r", encoding="utf-8") as json_file:
+            mapsetdata = json.load(json_file)
+        mapsetdata["map_set"] = "rogueMapSet"
+        mapsetdata["rogue_difficulty"] = diff
+        with open("config.json", "w", encoding="utf-8") as json_file:
+            json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
         self._create_buttons()
 
     def _choose_hero(self, hero):
         if hero == "Random":
-            hero = random.choice(["Fox","Boboli","Naruto_old","Asha","Maria","Surprise"])
+            hero = random.choice(["Fox", "Boboli", "Naruto_old", "Asha", "Maria", "Surprise"])
+            self.is_random = True
+        else:
+            self.is_random = False
         R.rouge_hero = hero
+        self.current_hero = hero
+        with open("config.json", "r", encoding="utf-8") as json_file:
+            mapsetdata = json.load(json_file)
+        mapsetdata["map_set"] = "rogueMapSet"
+        mapsetdata["your_hero"] = hero
+        with open("config.json", "w", encoding="utf-8") as json_file:
+            json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
         self._create_buttons()
 
     def run(self):
@@ -426,15 +444,20 @@ class Menu:
                     # 看看有没有按钮自己处理了这次点击
                     if not any(btn.bg_rect.collidepoint(event.pos) for btn in self.buttons):
                         sound_player.play("uiFail")
-            self.screen.fill((30,30,30))
+            # 先画背景
+            # self.screen.fill((30,30,30))
+            if self.bg_image:
+                self.screen.blit(self.bg_image, (0, 0))
+            else:
+                self.screen.fill((60, 90, 60))
+            # 再画按钮
             for btn in self.buttons:
                 btn.draw()
             pygame.display.flip()
             clock.tick(60)
 
     # 读取上次存档
-    def button_continue(self, last_data, last_path):
-        # self.master.destroy()
+    def read_continue_data(self, last_data):
         R.continuing_game = True
         G.CURRENT_LEVEL = last_data["current_level"]
         R.map_json_dic = last_data["map_json_dic"]
@@ -478,15 +501,12 @@ class Menu:
         R.random_dmg = last_data["random_dmg"]
         R.show_cursor = last_data["show_cursor"]
         R.last_item = last_data["items"]
-
-        if os.path.exists(last_path):
-            os.remove(last_path)
+        if os.path.exists(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata")):
+            os.remove(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata"))
             print("已读取,清除数据!!!!!!!!!!!!!")
         else:
             print("???")
 
-        rogue_control.Control(is_continue=True)
-
 
 def show_prompt():
     """显示提示框,询问用户如何操作"""
@@ -506,12 +526,14 @@ def show_prompt():
 # 获取所有窗口句柄
 def get_all_windows():
     windows = []
+
     def enum_windows_proc(hwnd, _):
         if win32gui.IsWindowVisible(hwnd):
             window_text = win32gui.GetWindowText(hwnd)
             if window_text:
                 windows.append(window_text)
         return True
+
     win32gui.EnumWindows(enum_windows_proc, None)
     return windows
 
@@ -532,15 +554,15 @@ class Launcher:
         self.screen = pygame.display.set_mode(W.WINDOW_SIZE)
         pygame.display.set_caption(W.WINDOW_CAPTION)
         self.cfg_json = {}
-        self.music_volume = 1
+        self.music_volume = 0.7
         self.display_flags = 0
         self.init_config()
         self.init_window()
         # 预加载资源
         # self.preload_resources()
         # 启动菜单
-        music_loader.play("M10.ogg", self.music_volume)
-        self.menu = Menu(self.screen)
+        music_loader.play("rogue_menu.mp3", self.music_volume)
+        self.menu = Menu(self.screen, bg_image_path="res/ui/game/rogue_menu.png")
         self.menu.run()
 
     def init_config(self):