from game import control from game.algo import rougeGen from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data import json import os import tkinter as tk from game.const import game as G from game.const import rouge as R from datetime import datetime import roguetest current_folder_path = os.getcwd() class Setting: def __init__(self, master): self.master = master master.geometry("1000x700") master.configure(bg='#7E587E') master.title(f"QQTRogue二测β{G.VERSION}(底层逻辑:永恒; 地牢设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!") master.attributes('-topmost', True) now = datetime.now() 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_achivements_file_path = os.path.join(qqtpve_folder, "rougeOB_achievement.rougedata") # 构建成就文件路径 other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata") # 构建其他文件路径 has_fire_cursor1 = True has_fire_cursor2 = False has_fire_cursor_kubi = False has_fire_cursor_gold_kubi = False self.current_cursor = None has_bomb1 = True has_bomb60 = False has_bomb1436 = False self.current_bomb = None # 第一次打开 if not os.path.exists(rouge_achivements_file_path): # 若参与过第一轮beta测试 rougeOB_achivements = [] save_encrypt_single_rouge_file(rougeOB_achivements, "rougeOB_achievement") # 正常打开 else: rougeOB_achivements = load_rouge_data(rouge_achivements_file_path) # print(rougeOB_achivements) max_level = 0 max_diff = "Easy" max_diff_num = 1 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} for data in rougeOB_achivements: if diff_num[data["DIFF"]] > max_diff_num: max_level = data["CL"] max_diff = data["DIFF"] max_diff_num = diff_num[data["DIFF"]] if diff_num[data["DIFF"]] == max_diff_num: if data["CL"] > max_level: max_level = data["CL"] if data["CL"] == 20: diff_status[data["DIFF"]] = 2 if max_diff == "Hell+": R.cursor_skin = "fire_cursor_kubi" has_fire_cursor_gold_kubi = True has_fire_cursor_kubi = True has_fire_cursor2 = True if max_diff == "Hell": R.cursor_skin = "fire_cursor_kubi" if max_level >= 15: has_fire_cursor_gold_kubi = True has_fire_cursor_kubi = True has_fire_cursor2 = True elif max_diff == "Normal": has_fire_cursor2 = True if max_level >= 15: has_fire_cursor_kubi = True has_fire_cursor2 = True else: if max_level >= 15: has_fire_cursor2 = True # 杂项第一次打开 if not os.path.exists(other_file_path): rougeOB_other_data = {"Bomb": [], "Pet": [], "Hat": [], "LastRandom": 0, "Other": []} save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther") # 正常打开 else: rougeOB_other_data = load_rouge_data(other_file_path) if 'Cursor_Skin' not in rougeOB_other_data.keys(): rougeOB_other_data['Cursor_Skin'] = "fire_cursor" self.current_cursor = "fire_cursor" save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther") else: self.current_cursor = rougeOB_other_data['Cursor_Skin'] if 'Bomb_Skin' not in rougeOB_other_data.keys(): rougeOB_other_data['Bomb_Skin'] = "bomb1" self.current_bomb = "bomb1" save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther") else: self.current_bomb = rougeOB_other_data['Bomb_Skin'] self.rougeOB_other_data = rougeOB_other_data # print(rougeOB_other_data) if "bomb60" in rougeOB_other_data['Bomb']: has_bomb60 = True if "bomb1436" in rougeOB_other_data['Bomb']: has_bomb1436 = True if self.current_bomb == "bomb1": self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-经典皮肤", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_bomb.place(relx=0.7, rely=0.15, anchor='w') elif self.current_bomb == "bomb60": self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-命运(伤害+50)", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_bomb.place(relx=0.7, rely=0.15, anchor='w') elif self.current_bomb == "bomb1436": self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-深林(生命+150)", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_bomb.place(relx=0.7, rely=0.15, anchor='w') self.button100 = tk.Button(master, text= "▶糖泡-经典皮肤", command=self.choose_bomb1, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button100.place(relx=0.5, rely=0.08, anchor='w') if has_bomb60: self.button160 = tk.Button(master, text= "▶糖泡-命运(伤害+50)", command=self.choose_bomb60, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button160.place(relx=0.5, rely=0.17, anchor='w') else: self.button160 = tk.Button(master, text= "(暂未获得) \n 糖泡-命运(伤害+50)", bg="#C6AEC7", font=("Microsoft YaHei", 12)) self.button160.place(relx=0.5, rely=0.17, anchor='w') if has_bomb1436: self.button1436 = tk.Button(master, text= "▶糖泡-深林(生命+150)", command=self.choose_bomb1436, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button1436.place(relx=0.5, rely=0.26, anchor='w') else: self.button1436 = tk.Button(master, text= "(暂未获得) \n 糖泡-深林(生命+150)", bg="#C6AEC7", font=("Microsoft YaHei", 12)) self.button1436.place(relx=0.5, rely=0.26, anchor='w') if self.current_cursor == "fire_cursor": self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-黄色荧火", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_total.place(relx=0.25, rely=0.15, anchor='w') elif self.current_cursor == "fire_cursor2": self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-森绿荧火", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_total.place(relx=0.25, rely=0.15, anchor='w') elif self.current_cursor == "fire_cursor_kubi": self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-小酷比", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_total.place(relx=0.25, rely=0.15, anchor='w') elif self.current_cursor == "fire_cursor_gold_kubi": self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-金酷比", bg="#C68E17", font=("Microsoft YaHei", 20)) self.button_total.place(relx=0.25, rely=0.15, anchor='w') self.button0 = tk.Button(master, text= "▶引路人-黄色荧火", command=self.choose_cursor1, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button0.place(relx=0.05, rely=0.08, anchor='w') if has_fire_cursor2: self.button1 = tk.Button(master, text= "▶引路人-森绿荧火", command=self.choose_cursor2, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button1.place(relx=0.05, rely=0.15, anchor='w') else: self.button1 = tk.Button(master, text= "(暂未获得)引路人-森绿荧火(通关简单难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12)) self.button1.place(relx=0.05, rely=0.15, anchor='w') if has_fire_cursor_kubi: self.button2 = tk.Button(master, text= "▶引路人-小酷比", command=self.choose_cursor3, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button2.place(relx=0.05, rely=0.22, anchor='w') else: self.button2 = tk.Button(master, text= "(暂未获得)引路人-小酷比(通关困难难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12)) self.button2.place(relx=0.05, rely=0.22, anchor='w') if has_fire_cursor_gold_kubi: self.button3 = tk.Button(master, text= "▶引路人-金酷比", command=self.choose_cursor4, bg="#A23BEC", font=("Microsoft YaHei", 12)) self.button3.place(relx=0.05, rely=0.29, anchor='w') else: self.button3 = tk.Button(master, text= "(暂未获得)引路人-金酷比(通关炼狱难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12)) self.button3.place(relx=0.05, rely=0.29, anchor='w') # 返回主界面 self.button000 = tk.Button(master, text= "返回主界面", command=lambda: self.button_return(), bg="#C68E17", font=("Microsoft YaHei", 24)) self.button000.place(relx=0.5, rely=0.8, anchor='center') # 返回主菜单 def button_return(self): self.master.destroy() def choose_cursor1(self): self.current_cursor = "fire_cursor" R.cursor_skin = "fire_cursor" self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_total.config(text = "(当前选择) \n 引路人-黄色荧火") def choose_cursor2(self): self.current_cursor = "fire_cursor2" R.cursor_skin = "fire_cursor2" self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor2" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_total.config(text = "(当前选择) \n 引路人-森绿荧火") def choose_cursor3(self): self.current_cursor = "fire_cursor_kubi" R.cursor_skin = "fire_cursor_kubi" self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor_kubi" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_total.config(text = "(当前选择) \n 引路人-小酷比") def choose_cursor4(self): self.current_cursor = "fire_cursor_gold_kubi" R.cursor_skin = "fire_cursor_gold_kubi" self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor_gold_kubi" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_total.config(text = "(当前选择) \n 引路人-金酷比") def choose_bomb1(self): self.current_bomb = "bomb1" R.bomb_skin = "bomb1" self.rougeOB_other_data['Bomb_Skin'] = "bomb1" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_bomb.config(text = "(当前选择) \n 糖泡-经典皮肤") def choose_bomb60(self): self.current_bomb = "bomb60" R.bomb_skin = "bomb60" self.rougeOB_other_data['Bomb_Skin'] = "bomb60" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_bomb.config(text = "(当前选择) \n 糖泡-命运(伤害+50)") def choose_bomb1436(self): self.current_bomb = "bomb1436" R.bomb_skin = "bomb1436" self.rougeOB_other_data['Bomb_Skin'] = "bomb1436" save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther") self.button_bomb.config(text = "(当前选择) \n 糖泡-深林(生命+150)") def setting(): """ Pygame 里直接做: from rougetask import Task Task() 就能跑出这个 Setting 界面。 """ root = tk.Tk() app = Setting(root) root.mainloop() # if __name__ == "__main__": # root = tk.Tk() # app = Setting(root) # root.mainloop()