choose_hero_menu.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. import pygame
  2. import json
  3. import os
  4. import random
  5. from datetime import datetime
  6. from game.const import game as G
  7. from game.const import window as W
  8. from game.const import rouge as R
  9. from game.sound import sound_player
  10. from game.utils import local_data_manager as DM
  11. from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
  12. from game.ui.menu.component import PygameButton, PygameButtonBackIMG, PygameButtonBackIMGRoll, Particle, PygameIMG
  13. current_folder_path = os.getcwd()
  14. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  15. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  16. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  17. rouge_file_path = os.path.join(qqtpve_folder, "rougeOB.rougedata") # 构建文件路径
  18. rougeOB_data = load_rouge_data(rouge_file_path)
  19. def current_lv(lv):
  20. lv_list = R.lv_list
  21. if lv >= sum(lv_list):
  22. return "--"
  23. for k in range(0, 14):
  24. if sum(lv_list[:k]) <= lv < sum(lv_list[:k + 1]):
  25. return str(sum(lv_list[:k + 1]) - lv)
  26. diff_cn = {
  27. "简单": "Easy",
  28. "困难": "Normal",
  29. "炼狱": "Hell",
  30. "炼狱+": "Hell+",
  31. }
  32. # diff_HP = {"Easy": 0.7, "Normal": 1, "Hell": 1.2, "Hell+": 1.3}
  33. # diff_Delta_Defense = {"Easy": -1200, "Normal": 0, "Hell": 800, "Hell+": 1000}
  34. # diff_speed = {"Easy": 0.9, "Normal": 1, "Hell": 1.05, "Hell+": 1.08}
  35. # diff_contact = {"Easy": 0.7, "Normal": 1, "Hell": 1.2, "Hell+": 1.3}
  36. # diff_exp = {"Easy": 1, "Normal": 1.5, "Hell": 2.2, "Hell+": 3}
  37. diff_dict = {
  38. "Easy": {"unlock": 1, "name": "简单", "info": "经验效率100%, 怪物血量-30%, 防御-1200", "condition": "最初的起点"},
  39. "Normal": {"unlock": R.pass_status["Normal"], "name": "困难", "info": "经验效率150%, 怪物血量+0%, 防御+0", "condition": "通关简单难度解锁"},
  40. "Hell": {"unlock": R.pass_status["Hell"], "name": "炼狱", "info": "经验效率220%, 怪物血量+20%, 防御+800", "condition": "通关困难难度解锁"},
  41. "Hell+": {"unlock": R.pass_status["Hell+"], "name": "炼狱+", "info": "经验效率300%, 怪物血量+30%, 防御+1000", "condition": "通关炼狱难度解锁"},
  42. }
  43. diff_list = ["简单", "困难", "炼狱", "炼狱+"]
  44. hero_cn = {
  45. "小倩": "Fox",
  46. "波波丽": "Boboli",
  47. "火影": "Naruto_old",
  48. "阿莎": "Asha",
  49. "玛莉亚": "Maria",
  50. "随机": "Random",
  51. }
  52. hero_dict = {
  53. "Fox": {
  54. "own": True, "name": "小倩",
  55. "exp": f"等级{rougeOB_data['Fox']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Fox']['exp'])}",
  56. "info": f"技能: 自身血量减少1则糖泡伤害增加{R.FoxSkill(rougeOB_data['Fox']['lv'])}",
  57. "growth": f"成长: 血量: 100, 伤害: 50",
  58. "img": pygame.image.load(r"res/img/ui/game/icon_xq.png").convert_alpha()
  59. },
  60. "Boboli": {
  61. "own": True, "name": "波波丽",
  62. "exp": f"等级{rougeOB_data['Boboli']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Boboli']['exp'])}",
  63. "info": f"技能: 每次攻击额外造成{int(R.BoboliSkill(rougeOB_data['Boboli']['lv']) * 100)}%真实伤害",
  64. "growth": f"成长: 血量: 60, 伤害: 90",
  65. "img": pygame.image.load(r"res/img/ui/game/icon_bbl.png").convert_alpha()
  66. },
  67. "Naruto_old": {
  68. "own": True, "name": "火影",
  69. "exp": f"等级{rougeOB_data['Naruto_old']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Naruto_old']['exp'])}",
  70. "info": f"技能: 首次攻击每只怪物时攻击力变为{int(R.Naruto_oldSkill(rougeOB_data['Naruto_old']['lv']) * 100)}%",
  71. "growth": f"成长: 血量: 50, 伤害: 100",
  72. "img": pygame.image.load(r"res/img/ui/game/icon_hy.png").convert_alpha()
  73. },
  74. "Asha": {
  75. "own": True, "name": "阿莎",
  76. "exp": f"等级{rougeOB_data['Asha']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Asha']['exp'])}",
  77. "info": f"技能: 每次糖泡造成伤害恢复血量{R.AshaSkill(rougeOB_data['Asha']['lv']) * 100}%",
  78. "growth": f"成长: 血量: 90, 伤害: 60",
  79. "img": pygame.image.load(r"res/img/ui/game/icon_as.png").convert_alpha()
  80. },
  81. "Maria": {
  82. "own": True, "name": "玛莉亚",
  83. "exp": f"等级{rougeOB_data['Maria']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Maria']['exp'])}",
  84. "info": f"技能: 每次造成伤害降低怪物{R.MariaSkill2(rougeOB_data['Maria']['lv'])}防御",
  85. "growth": f"成长: 血量: 300, 伤害: 300",
  86. "img": pygame.image.load(r"res/img/ui/game/icon_mly.png").convert_alpha()
  87. },
  88. "Random": {
  89. "own": False, "name": "随机",
  90. "exp": f"--",
  91. "info": f"随机选择一个英雄(含隐藏角色)与引路人",
  92. "growth": f"--",
  93. "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
  94. },
  95. "Surprise": {
  96. "own": True, "name": "随机",
  97. "exp": f"--",
  98. "info": f"随机选择一个英雄(含隐藏角色)与引路人",
  99. "growth": f"--",
  100. "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
  101. },
  102. }
  103. hero_list = ["小倩", "波波丽", "火影", "阿莎", "玛莉亚", "随机"]
  104. random_hero_list = ["Fox", "Boboli", "Naruto_old", "Asha", "Maria", "Surprise", "Surprise", "Surprise"]
  105. # random_hero_list = ["Surprise"]
  106. # ["Fox", "Boboli", "Naruto_old", "Asha", "Maria", "Surprise"]
  107. # {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
  108. class ChoosePage:
  109. def __init__(self):
  110. self.screen = W.MENU
  111. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  112. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  113. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  114. self.rouge_achivements_file_path = os.path.join(qqtpve_folder, "rougeOB_achievement.rougedata") # 构建成就文件路径
  115. self.other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata") # 构建其他文件路径
  116. self.rougeOB_achievements = {}
  117. self.rougeOB_other_data = {}
  118. self.diff_map = {}
  119. self.is_random = False
  120. self.current_diff = None
  121. self.view_diff = None
  122. self.current_hero = R.rouge_hero
  123. self.diff_num = {"Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
  124. self.diff_status = {"Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
  125. self.max_diff = "Easy"
  126. self.init_choose_page()
  127. self.load_achievements_data()
  128. def init_choose_page(self):
  129. DM.init_achievement()
  130. self.rougeOB_achievements = load_rouge_data(self.rouge_achivements_file_path)
  131. def load_achievements_data(self):
  132. if self.rougeOB_achievements["Highest"]["diff"] != "":
  133. self.max_diff = self.rougeOB_achievements["Highest"]["diff"]
  134. if self.diff_num[self.max_diff] > 1:
  135. hero_dict["Random"]["own"] = True
  136. if self.diff_num[R.difficulty] > self.diff_num[self.max_diff]: # 作弊
  137. print("作弊!!!")
  138. R.difficulty = "Easy"
  139. with open("config.json", "r", encoding="utf-8") as json_file:
  140. mapsetdata = json.load(json_file)
  141. mapsetdata["map_set"] = "rogueMapSet"
  142. mapsetdata["rogue_difficulty"] = "Easy"
  143. with open("config.json", "w", encoding="utf-8") as json_file:
  144. json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
  145. def draw(self):
  146. self.screen.buttons.clear()
  147. # ================================= 信息展示 =================================
  148. info_button = PygameButton(
  149. self.screen.screen, "", 0.25, 0.47, 18, "#2a2a2a",
  150. fg_color=(215,220,217), action=None,
  151. anchor="center", is_bold=True, fix_shape=(360,120), bg_alpha=159,
  152. frosted_glass=True, blur_radius=8, glass_alpha=8, background=self.screen
  153. )
  154. # ================================= 图片 =================================
  155. cx, cy = 0.35, 0.7
  156. img_button = PygameButtonBackIMG(
  157. self.screen, self.screen.screen, cx, cy, "res/ui/button/img_board.png", "res/ui/button/img_board.png",
  158. action=None, anchor='center', shiny_spark=False
  159. )
  160. img = PygameIMG(self.screen, self.screen.screen, cx, cy, py_img=hero_dict[R.rouge_hero]["img"], anchor='center')
  161. # ================================= 选择 =================================
  162. choose_button = PygameButtonBackIMG(
  163. self.screen, self.screen.screen, 0.13, 0.7, "res/ui/button/choose.png", "res/ui/button/choose_press.png",
  164. action=None, anchor='center'
  165. )
  166. # ================================= 展示框 =================================
  167. cy = 0.2
  168. cx = 0.25
  169. button_blank = 0.13
  170. roll_button = PygameButtonBackIMGRoll(
  171. self.screen, self.screen.screen, cx, cy, "res/ui/button/cursor_board.png", hero_list,
  172. action=None, roll_action=None, hover_in_action=None, hover_out_action=None,
  173. anchor='center', font_name="hk4e_zh-cn.ttf", font_size=24, small_scale=0.7, small_alpha=159, color=(0, 0, 0), shiny_spark=False,
  174. related_button=[info_button, choose_button, img],
  175. notify_action=[
  176. lambda x: hero_update_notify(roll_button, x, self.current_hero),
  177. lambda _: self.update_choose_hero_btn(roll_button, choose_button, info_button),
  178. lambda _: hero_img_update(roll_button, img)
  179. ]
  180. )
  181. # ================================= 初始化 =================================
  182. choose_button.action = lambda: self.choose_hero(roll_button, info_button, choose_button) # 追加action
  183. roll_button.set_current_text(hero_dict[self.current_hero]["name"])
  184. hero_update_notify(roll_button, info_button, self.current_hero)
  185. self.update_choose_hero_btn(roll_button, choose_button, info_button)
  186. # ================================= 添加按钮 =================================
  187. self.screen.buttons.append(info_button)
  188. self.screen.buttons.append(choose_button)
  189. self.screen.buttons.append(roll_button)
  190. self.screen.buttons.append(img_button)
  191. self.screen.buttons.append(img)
  192. # ================================= 上翻页 =================================
  193. self.screen.buttons.append(PygameButtonBackIMG(
  194. self.screen, self.screen.screen, cx, cy-button_blank, "res/ui/button/up.png", "res/ui/button/up_press.png", action=roll_button.roll_up, anchor='center', shiny_spark=False)
  195. )
  196. # ================================= 下翻页 =================================
  197. self.screen.buttons.append(PygameButtonBackIMG(
  198. self.screen, self.screen.screen, cx, cy+button_blank, "res/ui/button/down.png", "res/ui/button/down_press.png", action=roll_button.roll_down, anchor='center', shiny_spark=False)
  199. )
  200. # ===================================================================================
  201. # ===================================================================================
  202. # ===================================================================================
  203. # ================================= 信息展示 =================================
  204. diff_info_button = PygameButton(
  205. self.screen.screen, "", 0.75, 0.47, 18, "#2a2a2a",
  206. fg_color=(215,220,217), action=None,
  207. anchor="center", is_bold=True, fix_shape=(360,100), bg_alpha=159,
  208. frosted_glass=True, blur_radius=8, glass_alpha=8, background=self.screen
  209. )
  210. # ================================= 选择 =================================
  211. diff_choose_button = PygameButtonBackIMG(
  212. self.screen, self.screen.screen, 0.87, 0.22, "res/ui/button/choose.png", "res/ui/button/choose_press.png",
  213. action=None, anchor='center'
  214. )
  215. # ================================= 展示框 =================================
  216. cx, cy = 0.6, 0.2
  217. button_blank = 0.13
  218. diff_roll_button = PygameButtonBackIMGRoll(
  219. self.screen, self.screen.screen, cx, cy, "res/ui/button/cursor_board.png", diff_list,
  220. action=None, roll_action=None, hover_in_action=None, hover_out_action=None,
  221. anchor='center', font_name="hk4e_zh-cn.ttf", font_size=24, small_scale=0.7, small_alpha=159, color=(0, 0, 0), shiny_spark=False,
  222. related_button=[diff_info_button, diff_choose_button],
  223. notify_action=[
  224. lambda x: diff_update_notify(diff_roll_button, x, R.difficulty),
  225. lambda _: self.update_choose_diff_btn(diff_roll_button, diff_choose_button, diff_info_button)
  226. ]
  227. )
  228. # ================================= 初始化 =================================
  229. diff_choose_button.action = lambda: self.choose_diff(diff_roll_button, diff_info_button, diff_choose_button) # 追加action
  230. diff_roll_button.set_current_text(diff_dict[R.difficulty]["name"])
  231. diff_update_notify(diff_roll_button, diff_info_button, R.difficulty)
  232. self.update_choose_diff_btn(diff_roll_button, diff_choose_button, diff_info_button)
  233. # ================================= 添加按钮 =================================
  234. self.screen.buttons.append(diff_info_button)
  235. self.screen.buttons.append(diff_choose_button)
  236. self.screen.buttons.append(diff_roll_button)
  237. # ================================= 上翻页 =================================
  238. self.screen.buttons.append(PygameButtonBackIMG(
  239. self.screen, self.screen.screen, cx, cy-button_blank, "res/ui/button/up.png", "res/ui/button/up_press.png", action=diff_roll_button.roll_up, anchor='center', shiny_spark=False)
  240. )
  241. # ================================= 下翻页 =================================
  242. self.screen.buttons.append(PygameButtonBackIMG(
  243. self.screen, self.screen.screen, cx, cy+button_blank, "res/ui/button/down.png", "res/ui/button/down_press.png", action=diff_roll_button.roll_down, anchor='center', shiny_spark=False)
  244. )
  245. # ================================= 开始 =================================
  246. self.screen.buttons.append(
  247. PygameButtonBackIMG(
  248. self.screen, self.screen.screen, 0.75, 0.64, "res/ui/button/go.png", "res/ui/button/go_press.png",
  249. action=self.start, anchor='center'
  250. )
  251. )
  252. # ================================= 返回上一级 =================================
  253. self.screen.buttons.append(PygameButtonBackIMG(
  254. self.screen, self.screen.screen, 0.75, 0.8, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
  255. )
  256. def start(self):
  257. if self.is_random or R.rouge_hero in {"Surprise"}:
  258. if not self.is_random:
  259. current = random.choice(random_hero_list)
  260. R.rouge_hero = current
  261. self.current_hero = current
  262. with open("config.json", "r", encoding="utf-8") as json_file:
  263. mapsetdata = json.load(json_file)
  264. mapsetdata["map_set"] = "rogueMapSet"
  265. mapsetdata["your_hero"] = current
  266. with open("config.json", "w", encoding="utf-8") as json_file:
  267. json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
  268. R.show_cursor = True
  269. other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata")
  270. if not os.path.exists(other_file_path):
  271. rougeOB_other_data = {
  272. "Bomb": [],
  273. "Pet": [],
  274. "Hat": [],
  275. "LastRandom": int(60*datetime.now().hour+datetime.now().minute),
  276. "Other": []
  277. }
  278. save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther")
  279. else:
  280. rougeOB_other_data = load_rouge_data(other_file_path)
  281. rougeOB_other_data["LastRandom"] = int(60*datetime.now().hour+datetime.now().minute)
  282. save_encrypt_single_rouge_file(rougeOB_other_data, "rougeOBOther")
  283. print(f">> R.show_cursor: {R.show_cursor}")
  284. self.screen.start()
  285. def choose_hero(self, roll_btn: PygameButtonBackIMGRoll, info_button, choose_btn):
  286. cn_name = roll_btn.get_current_text()
  287. current = hero_cn[cn_name]
  288. if current == "Random":
  289. current = random.choice(random_hero_list)
  290. self.is_random = True
  291. else:
  292. self.is_random = False
  293. R.rouge_hero = current
  294. self.current_hero = current
  295. with open("config.json", "r", encoding="utf-8") as json_file:
  296. mapsetdata = json.load(json_file)
  297. mapsetdata["map_set"] = "rogueMapSet"
  298. mapsetdata["your_hero"] = current
  299. with open("config.json", "w", encoding="utf-8") as json_file:
  300. json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
  301. if self.is_random:
  302. roll_btn.set_current_text("随机")
  303. else:
  304. roll_btn.set_current_text(hero_dict[self.current_hero]["name"])
  305. hero_update_notify(roll_btn, info_button, self.current_hero)
  306. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  307. choose_btn.shiny_spark = False
  308. choose_btn.action = None
  309. def update_choose_hero_btn(self, roll_button, choose_btn, info_button):
  310. # 拿到当前展示的中文名
  311. cn_name = roll_button.get_current_text()
  312. # 拿到内部 key
  313. key = hero_cn[cn_name]
  314. if self.is_random:
  315. if cn_name != "随机":
  316. choose_btn.update_image("res/ui/button/choose.png", "res/ui/button/choose_press.png")
  317. choose_btn.shiny_spark = True
  318. choose_btn.action = lambda cn=cn_name: self.choose_hero(roll_button, info_button, choose_btn)
  319. else:
  320. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  321. choose_btn.shiny_spark = False
  322. choose_btn.action = None
  323. return
  324. if R.rouge_hero in {"Surprise"}:
  325. if cn_name == "随机":
  326. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  327. choose_btn.shiny_spark = False
  328. choose_btn.action = None
  329. return
  330. # 拿到是否已解锁
  331. owned = hero_dict[key]["own"]
  332. if owned:
  333. if self.current_hero == key: # 当前
  334. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  335. choose_btn.shiny_spark = False
  336. choose_btn.action = None
  337. else:
  338. choose_btn.update_image("res/ui/button/choose.png", "res/ui/button/choose_press.png")
  339. choose_btn.shiny_spark = True
  340. choose_btn.action = lambda cn=cn_name: self.choose_hero(roll_button, info_button, choose_btn)
  341. else:
  342. choose_btn.update_image("res/ui/button/unlock.png", "res/ui/button/unlock.png")
  343. choose_btn.shiny_spark = False
  344. choose_btn.action = None
  345. def choose_diff(self, roll_btn: PygameButtonBackIMGRoll, info_button, choose_btn):
  346. cn_name = roll_btn.get_current_text()
  347. current = diff_cn[cn_name]
  348. R.difficulty = current
  349. with open("config.json", "r", encoding="utf-8") as json_file:
  350. mapsetdata = json.load(json_file)
  351. mapsetdata["map_set"] = "rogueMapSet"
  352. mapsetdata["rogue_difficulty"] = current
  353. with open("config.json", "w", encoding="utf-8") as json_file:
  354. json.dump(mapsetdata, json_file, indent=4, ensure_ascii=False)
  355. roll_btn.set_current_text(diff_dict[R.difficulty]["name"])
  356. diff_update_notify(roll_btn, info_button, R.difficulty)
  357. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  358. choose_btn.shiny_spark = False
  359. choose_btn.action = None
  360. def update_choose_diff_btn(self, roll_button, choose_btn, info_button):
  361. # 拿到当前展示的中文名
  362. cn_name = roll_button.get_current_text()
  363. # 拿到内部 key
  364. key = diff_cn[cn_name]
  365. # 拿到是否已解锁
  366. owned = (R.pass_status[key] > 0)
  367. if key == "Easy":
  368. owned = True
  369. if owned:
  370. if R.difficulty == key: # 当前
  371. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  372. choose_btn.shiny_spark = False
  373. choose_btn.action = None
  374. else:
  375. choose_btn.update_image("res/ui/button/choose.png", "res/ui/button/choose_press.png")
  376. choose_btn.shiny_spark = True
  377. choose_btn.action = lambda cn=cn_name: self.choose_diff(roll_button, info_button, choose_btn)
  378. else:
  379. choose_btn.update_image("res/ui/button/unlock.png", "res/ui/button/unlock.png")
  380. choose_btn.shiny_spark = False
  381. choose_btn.action = None
  382. def hero_update_notify(board: PygameButtonBackIMGRoll, observer: PygameButton, chosen):
  383. cn_name = board.get_current_text()
  384. current = hero_cn[cn_name]
  385. is_chosen = "<当前选择>" if (current == R.rouge_hero) else ""
  386. owned = "" if hero_dict[current]["own"] else "(通关一次游戏解锁)--"
  387. exp = hero_dict[current]["exp"]
  388. info = hero_dict[current]["info"]
  389. growth = hero_dict[current]["growth"]
  390. observer.set_text(f" {is_chosen}{cn_name} \n {exp}{owned} \n {info} \n {growth} ")
  391. def hero_img_update(board: PygameButtonBackIMGRoll, img: PygameIMG):
  392. cn_name = board.get_current_text()
  393. current = hero_cn[cn_name]
  394. img.update_image(hero_dict[current]["img"])
  395. def diff_update_notify(board: PygameButtonBackIMGRoll, observer: PygameButton, chosen):
  396. cn_name = board.get_current_text()
  397. current = diff_cn[cn_name]
  398. is_chosen = "<当前选择>" if (current == R.difficulty) else ""
  399. unlock = "" if (R.pass_status[current] > 0 or current == "Easy") else "(通关一次上一难度解锁)"
  400. info = diff_dict[current]["info"]
  401. condition = diff_dict[current]["condition"]
  402. observer.set_text(f" {is_chosen}{cn_name} \n {info} \n {condition} ")