| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- 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 window as W
- from game.const import rouge as R
- from datetime import datetime
- from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle
- from game.utils import local_data_manager as DM
- current_folder_path = os.getcwd()
- class SkinPage:
- def __init__(self):
- self.screen = W.MENU
- 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文件夹存在,如果不存在则创建
- self.rouge_achivements_file_path = os.path.join(qqtpve_folder, "rougeOB_achievement.rougedata") # 构建成就文件路径
- self.other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata") # 构建其他文件路径
- self.rougeOB_achievements = {}
- self.rougeOB_other_data = {}
- self.cursor_map = {}
- self.current_cursor = None
- self.current_bomb = None
- self.init_skin_page()
- def init_skin_page(self):
- has_fire_cursor1 = True
- has_fire_cursor2 = False
- has_fire_cursor_kubi = False
- has_fire_cursor_gold_kubi = False
- has_bomb1 = True
- has_bomb60 = False
- has_bomb1436 = False
- DM.init_achievement()
- self.rougeOB_achievements = load_rouge_data(self.rouge_achivements_file_path)
- def load_achievements_data(self):
- max_level = 0
- max_diff = "Easy"
- max_diff_num = 1
- diff_num = {"Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
- diff_status = {"Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
- max_level = self.rougeOB_achievements["Highest"]["level"]
- max_level_hero = self.rougeOB_achievements["Highest"]["hero"]
- max_diff = self.rougeOB_achievements["Highest"]["diff"]
- self.cursor_map = {
- "gold_kubi": (diff_num[max_diff] >= 4 or (diff_num[max_diff] == 3 and max_level >= 15)),
- "kubi": (diff_num[max_diff] >= 3 or (diff_num[max_diff] == 2 and max_level >= 15)),
- "cursor2": (diff_num[max_diff] >= 2 or (diff_num[max_diff] == 1 and max_level >= 15)),
- "cursor1": True,
- }
- def load_other_data(self):
- # 杂项第一次打开
- if not os.path.exists(self.other_file_path):
- self.rougeOB_other_data = {
- "Bomb": [],
- "Pet": [],
- "Hat": [],
- "LastRandom": 0,
- "Other": []
- }
- save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
- # 正常打开
- else:
- self.rougeOB_other_data = load_rouge_data(self.other_file_path)
- if 'Cursor_Skin' not in self.rougeOB_other_data.keys():
- self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor"
- self.current_cursor = "fire_cursor"
- save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
- else:
- self.current_cursor = self.rougeOB_other_data['Cursor_Skin']
- if 'Bomb_Skin' not in self.rougeOB_other_data.keys():
- self.rougeOB_other_data['Bomb_Skin'] = "bomb1"
- self.current_bomb = "bomb1"
- save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
- else:
- self.current_bomb = self.rougeOB_other_data['Bomb_Skin']
- self.rougeOB_other_data = self.rougeOB_other_data
- print(f"通关次数: {len(self.rougeOB_other_data)}")
- if "bomb60" in self.rougeOB_other_data['Bomb']:
- has_bomb60 = True
- if "bomb1436" in self.rougeOB_other_data['Bomb']:
- has_bomb1436 = True
- def draw(self):
- # 引路人
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.3, "res/ui/button/cursor.png", "res/ui/button/cursor_press.png", action=self.draw_cursor, anchor='center')
- )
- # 藏宝阁
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.45, "res/ui/button/treasure.png", "res/ui/button/treasure_press.png", action=self.draw_treasure, anchor='center')
- )
- # 返回主界面
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.6, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
- )
- def draw_cursor(self):
- self.screen.buttons.clear()
- self.load_achievements_data()
- # 返回主界面
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.6, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
- )
- def draw_treasure(self):
- self.screen.buttons.clear()
- self.load_other_data()
- # 返回主界面
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.6, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
- )
- """
- self.hero_dic= {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
- self.diff_dic = {"Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
-
- 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)")
- """
|