rougesetting.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. from game import control
  2. from game.algo import rougeGen
  3. from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
  4. import json
  5. import os
  6. import tkinter as tk
  7. from game.const import rouge as R
  8. from datetime import datetime
  9. import roguetest
  10. current_folder_path = os.getcwd()
  11. class Setting:
  12. def __init__(self, master):
  13. self.master = master
  14. master.geometry("1000x700")
  15. master.configure(bg='#7E587E')
  16. master.title("QQTRogue二测β2.0(底层逻辑:永恒; 地牢设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!")
  17. now = datetime.now()
  18. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  19. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  20. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  21. rouge_achivements_file_path = os.path.join(qqtpve_folder, "rougeOB_achievement.rougedata") # 构建成就文件路径
  22. other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata") # 构建其他文件路径
  23. has_fire_cursor1 = True
  24. has_fire_cursor2 = False
  25. has_fire_cursor_kubi = False
  26. has_fire_cursor_gold_kubi = False
  27. self.current_cursor = None
  28. has_bomb1 = True
  29. has_bomb60 = False
  30. has_bomb1436 = False
  31. self.current_bomb = None
  32. # 第一次打开
  33. if not os.path.exists(rouge_achivements_file_path):
  34. # 若参与过第一轮beta测试
  35. rougeOB_achivements = []
  36. save_encrypt_single_rouge_file(rougeOB_achivements, "rougeOB_achievement")
  37. # 正常打开
  38. else:
  39. rougeOB_achivements = load_rouge_data(rouge_achivements_file_path)
  40. # print(rougeOB_achivements)
  41. max_level = 0
  42. max_diff = "Easy"
  43. max_diff_num = 1
  44. self.hero_dic= {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
  45. self.diff_dic = {"Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
  46. diff_num = {"Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
  47. diff_status = {"Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
  48. for data in rougeOB_achivements:
  49. if diff_num[data["DIFF"]] > max_diff_num:
  50. max_level = data["CL"]
  51. max_diff = data["DIFF"]
  52. max_diff_num = diff_num[data["DIFF"]]
  53. if diff_num[data["DIFF"]] == max_diff_num:
  54. if data["CL"] > max_level:
  55. max_level = data["CL"]
  56. if data["CL"] == 20:
  57. diff_status[data["DIFF"]] = 2
  58. if max_diff == "Hell+":
  59. R.cursor_skin = "fire_cursor_kubi"
  60. has_fire_cursor_gold_kubi = True
  61. has_fire_cursor_kubi = True
  62. has_fire_cursor2 = True
  63. if max_diff == "Hell":
  64. R.cursor_skin = "fire_cursor_kubi"
  65. if max_level >= 15:
  66. has_fire_cursor_gold_kubi = True
  67. has_fire_cursor_kubi = True
  68. has_fire_cursor2 = True
  69. elif max_diff == "Normal":
  70. has_fire_cursor2 = True
  71. if max_level >= 15:
  72. has_fire_cursor_kubi = True
  73. has_fire_cursor2 = True
  74. else:
  75. if max_level >= 15:
  76. has_fire_cursor2 = True
  77. # 杂项第一次打开
  78. if not os.path.exists(other_file_path):
  79. rougeOB_other_data = {"Bomb": [],
  80. "Pet": [],
  81. "Hat": [],
  82. "LastRandom": 0,
  83. "Other": []}
  84. save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther")
  85. # 正常打开
  86. else:
  87. rougeOB_other_data = load_rouge_data(other_file_path)
  88. if 'Cursor_Skin' not in rougeOB_other_data.keys():
  89. rougeOB_other_data['Cursor_Skin'] = "fire_cursor"
  90. self.current_cursor = "fire_cursor"
  91. save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther")
  92. else:
  93. self.current_cursor = rougeOB_other_data['Cursor_Skin']
  94. if 'Bomb_Skin' not in rougeOB_other_data.keys():
  95. rougeOB_other_data['Bomb_Skin'] = "bomb1"
  96. self.current_bomb = "bomb1"
  97. save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther")
  98. else:
  99. self.current_bomb = rougeOB_other_data['Bomb_Skin']
  100. self.rougeOB_other_data = rougeOB_other_data
  101. # print(rougeOB_other_data)
  102. if "bomb60" in rougeOB_other_data['Bomb']:
  103. has_bomb60 = True
  104. if "bomb1436" in rougeOB_other_data['Bomb']:
  105. has_bomb1436 = True
  106. if self.current_bomb == "bomb1":
  107. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-经典皮肤", bg="#C68E17", font=("Microsoft YaHei", 20))
  108. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  109. elif self.current_bomb == "bomb60":
  110. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-命运(伤害+50)", bg="#C68E17", font=("Microsoft YaHei", 20))
  111. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  112. elif self.current_bomb == "bomb1436":
  113. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-深林(生命+150)", bg="#C68E17", font=("Microsoft YaHei", 20))
  114. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  115. self.button100 = tk.Button(master, text= "▶糖泡-经典皮肤", command=self.choose_bomb1, bg="#A23BEC", font=("Microsoft YaHei", 12))
  116. self.button100.place(relx=0.5, rely=0.08, anchor='w')
  117. if has_bomb60:
  118. self.button160 = tk.Button(master, text= "▶糖泡-命运(伤害+50)", command=self.choose_bomb60, bg="#A23BEC", font=("Microsoft YaHei", 12))
  119. self.button160.place(relx=0.5, rely=0.17, anchor='w')
  120. else:
  121. self.button160 = tk.Button(master, text= "(暂未获得) \n 糖泡-命运(伤害+50)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  122. self.button160.place(relx=0.5, rely=0.17, anchor='w')
  123. if has_bomb1436:
  124. self.button1436 = tk.Button(master, text= "▶糖泡-深林(生命+150)", command=self.choose_bomb1436, bg="#A23BEC", font=("Microsoft YaHei", 12))
  125. self.button1436.place(relx=0.5, rely=0.26, anchor='w')
  126. else:
  127. self.button1436 = tk.Button(master, text= "(暂未获得) \n 糖泡-深林(生命+150)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  128. self.button1436.place(relx=0.5, rely=0.26, anchor='w')
  129. if self.current_cursor == "fire_cursor":
  130. self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-黄色荧火", bg="#C68E17", font=("Microsoft YaHei", 20))
  131. self.button_total.place(relx=0.25, rely=0.15, anchor='w')
  132. elif self.current_cursor == "fire_cursor2":
  133. self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-森绿荧火", bg="#C68E17", font=("Microsoft YaHei", 20))
  134. self.button_total.place(relx=0.25, rely=0.15, anchor='w')
  135. elif self.current_cursor == "fire_cursor_kubi":
  136. self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-小酷比", bg="#C68E17", font=("Microsoft YaHei", 20))
  137. self.button_total.place(relx=0.25, rely=0.15, anchor='w')
  138. elif self.current_cursor == "fire_cursor_gold_kubi":
  139. self.button_total = tk.Button(master, text= "(当前选择) \n 引路人-金酷比", bg="#C68E17", font=("Microsoft YaHei", 20))
  140. self.button_total.place(relx=0.25, rely=0.15, anchor='w')
  141. self.button0 = tk.Button(master, text= "▶引路人-黄色荧火", command=self.choose_cursor1, bg="#A23BEC", font=("Microsoft YaHei", 12))
  142. self.button0.place(relx=0.05, rely=0.08, anchor='w')
  143. if has_fire_cursor2:
  144. self.button1 = tk.Button(master, text= "▶引路人-森绿荧火", command=self.choose_cursor2, bg="#A23BEC", font=("Microsoft YaHei", 12))
  145. self.button1.place(relx=0.05, rely=0.15, anchor='w')
  146. else:
  147. self.button1 = tk.Button(master, text= "(暂未获得)引路人-森绿荧火(通关简单难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  148. self.button1.place(relx=0.05, rely=0.15, anchor='w')
  149. if has_fire_cursor_kubi:
  150. self.button2 = tk.Button(master, text= "▶引路人-小酷比", command=self.choose_cursor3, bg="#A23BEC", font=("Microsoft YaHei", 12))
  151. self.button2.place(relx=0.05, rely=0.22, anchor='w')
  152. else:
  153. self.button2 = tk.Button(master, text= "(暂未获得)引路人-小酷比(通关困难难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  154. self.button2.place(relx=0.05, rely=0.22, anchor='w')
  155. if has_fire_cursor_gold_kubi:
  156. self.button3 = tk.Button(master, text= "▶引路人-金酷比", command=self.choose_cursor4, bg="#A23BEC", font=("Microsoft YaHei", 12))
  157. self.button3.place(relx=0.05, rely=0.29, anchor='w')
  158. else:
  159. self.button3 = tk.Button(master, text= "(暂未获得)引路人-金酷比(通关炼狱难度获得)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  160. self.button3.place(relx=0.05, rely=0.29, anchor='w')
  161. # 返回主界面
  162. self.button000 = tk.Button(master, text= "返回主界面", command=lambda: self.button_return(), bg="#C68E17", font=("Microsoft YaHei", 24))
  163. self.button000.place(relx=0.5, rely=0.8, anchor='center')
  164. # 返回主菜单
  165. def button_return(self):
  166. self.master.destroy()
  167. app_task = tk.Tk()
  168. roguetest.App(app_task)
  169. def choose_cursor1(self):
  170. self.current_cursor = "fire_cursor"
  171. R.cursor_skin = "fire_cursor"
  172. self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor"
  173. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  174. self.button_total.config(text = "(当前选择) \n 引路人-黄色荧火")
  175. def choose_cursor2(self):
  176. self.current_cursor = "fire_cursor2"
  177. R.cursor_skin = "fire_cursor2"
  178. self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor2"
  179. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  180. self.button_total.config(text = "(当前选择) \n 引路人-森绿荧火")
  181. def choose_cursor3(self):
  182. self.current_cursor = "fire_cursor_kubi"
  183. R.cursor_skin = "fire_cursor_kubi"
  184. self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor_kubi"
  185. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  186. self.button_total.config(text = "(当前选择) \n 引路人-小酷比")
  187. def choose_cursor4(self):
  188. self.current_cursor = "fire_cursor_gold_kubi"
  189. R.cursor_skin = "fire_cursor_gold_kubi"
  190. self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor_gold_kubi"
  191. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  192. self.button_total.config(text = "(当前选择) \n 引路人-金酷比")
  193. def choose_bomb1(self):
  194. self.current_bomb = "bomb1"
  195. R.bomb_skin = "bomb1"
  196. self.rougeOB_other_data['Bomb_Skin'] = "bomb1"
  197. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  198. self.button_bomb.config(text = "(当前选择) \n 糖泡-经典皮肤")
  199. def choose_bomb60(self):
  200. self.current_bomb = "bomb60"
  201. R.bomb_skin = "bomb60"
  202. self.rougeOB_other_data['Bomb_Skin'] = "bomb60"
  203. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  204. self.button_bomb.config(text = "(当前选择) \n 糖泡-命运(伤害+50)")
  205. def choose_bomb1436(self):
  206. self.current_bomb = "bomb1436"
  207. R.bomb_skin = "bomb1436"
  208. self.rougeOB_other_data['Bomb_Skin'] = "bomb1436"
  209. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  210. self.button_bomb.config(text = "(当前选择) \n 糖泡-深林(生命+150)")
  211. if __name__ == "__main__":
  212. root = tk.Tk()
  213. app = Setting(root)
  214. root.mainloop()