rougesetting.py 12 KB

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