rougesetting.py 12 KB

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