skin_menu.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. import pygame
  2. import json
  3. import os
  4. from datetime import datetime
  5. from game.const import game as G
  6. from game.const import window as W
  7. from game.const import rouge as R
  8. from game.sound import sound_player
  9. from game.utils import local_data_manager as DM
  10. from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
  11. from game.ui.menu.component import PygameButton, PygameButtonBackIMG, PygameButtonBackIMGRoll, Particle, PygameIMG
  12. current_folder_path = os.getcwd()
  13. cursor_cn = {
  14. "引路人-黄色荧火": "fire_cursor1",
  15. "引路人-森绿荧火": "fire_cursor2",
  16. "引路人-小酷比": "fire_cursor_kubi",
  17. "引路人-金酷比": "fire_cursor_gold_kubi",
  18. }
  19. cursor_dict = {
  20. "fire_cursor1": {"own": True, "name": "引路人-黄色荧火", "info": "原初的黄色荧火,为旅者指引前路", "condition": "初始拥有"},
  21. "fire_cursor2": {"own": False, "name": "引路人-森绿荧火", "info": "俏皮的森绿荧火,为旅者指引前路", "condition": "通关简单难度获得"},
  22. "fire_cursor_kubi": {"own": False, "name": "引路人-小酷比", "info": "顽皮的小酷比,为旅者指引前路", "condition": "通关困难难度获得"},
  23. "fire_cursor_gold_kubi": {"own": False, "name": "引路人-金酷比", "info": "稀有的金酷比,为旅者指引前路", "condition": "通关炼狱难度获得"},
  24. }
  25. cursor_list = ["引路人-黄色荧火", "引路人-森绿荧火", "引路人-小酷比", "引路人-金酷比"]
  26. bomb_cn = {
  27. "糖泡-经典": "bomb1",
  28. "糖泡-命运": "bomb60",
  29. "糖泡-狂沙": "bomb82",
  30. "糖泡-晶雪": "bomb86",
  31. "糖泡-炉心": "bomb91",
  32. "糖泡-炎魔": "bomb149",
  33. "糖泡-深林": "bomb1436",
  34. }
  35. bomb_dict = {
  36. "bomb1": {"own": True, "name": "糖泡-经典", "info": "陪伴旅人最初的糖泡外观", "img": pygame.image.load(r"res/img/bomb/bomb1_stand_0_0.png").convert_alpha()},
  37. "bomb60": {"own": False, "name": "糖泡-命运", "info": "糖泡伤害额外增加100", "img": pygame.image.load(r"res/img/bomb/bomb60_stand_0_0.png").convert_alpha()},
  38. "bomb82": {"own": False, "name": "糖泡-狂沙", "info": "最大生命额外增加200", "img": pygame.image.load(r"res/img/bomb/bomb82_stand_0_0.png").convert_alpha()},
  39. "bomb86": {"own": False, "name": "糖泡-晶雪", "info": "最大生命额外增加100且糖泡伤害额外增加20", "img": pygame.image.load(r"res/img/bomb/bomb86_stand_0_0.png").convert_alpha()},
  40. "bomb91": {"own": False, "name": "糖泡-炉心", "info": "防御力额外增加50", "img": pygame.image.load(r"res/img/bomb/bomb91_stand_0_0.png").convert_alpha()},
  41. "bomb149": {"own": False, "name": "糖泡-炎魔", "info": "糖泡伤害额外增加150但最大生命减少100", "img": pygame.image.load(r"res/img/bomb/bomb149_stand_0_0.png").convert_alpha()},
  42. "bomb1436": {"own": False, "name": "糖泡-深林", "info": "最大生命额外增加150", "img": pygame.image.load(r"res/img/bomb/bomb1436_stand_0_0.png").convert_alpha()},
  43. }
  44. bomb_list = ["糖泡-经典", "糖泡-命运", "糖泡-狂沙", "糖泡-晶雪", "糖泡-炉心", "糖泡-炎魔", "糖泡-深林"]
  45. class SkinPage:
  46. def __init__(self):
  47. self.screen = W.MENU
  48. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  49. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  50. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  51. self.rouge_achivements_file_path = os.path.join(qqtpve_folder, "rougeOB_achievement.rougedata") # 构建成就文件路径
  52. self.other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata") # 构建其他文件路径
  53. self.rougeOB_achievements = {}
  54. self.rougeOB_other_data = {}
  55. self.cursor_map = {}
  56. self.current_cursor = None
  57. self.view_cursor = None
  58. self.current_bomb = None
  59. self.init_skin_page()
  60. def init_skin_page(self):
  61. DM.init_achievement()
  62. self.rougeOB_achievements = load_rouge_data(self.rouge_achivements_file_path)
  63. def load_achievements_data(self):
  64. global cursor_dict
  65. max_level = 0
  66. max_diff = "Easy"
  67. max_diff_num = 1
  68. diff_num = {"Baby": 1, "Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
  69. diff_status = {"Baby": 1, "Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
  70. if self.rougeOB_achievements["Highest"]["level"] != "":
  71. max_level = self.rougeOB_achievements["Highest"]["level"]
  72. if self.rougeOB_achievements["Highest"]["hero"] != "":
  73. max_level_hero = self.rougeOB_achievements["Highest"]["hero"]
  74. if self.rougeOB_achievements["Highest"]["diff"] != "":
  75. max_diff = self.rougeOB_achievements["Highest"]["diff"]
  76. cursor_dict["fire_cursor_gold_kubi"]["own"] = (diff_num[max_diff] >= 4 or (diff_num[max_diff] == 3 and max_level >= 15))
  77. cursor_dict["fire_cursor_kubi"]["own"] = (diff_num[max_diff] >= 3 or (diff_num[max_diff] == 2 and max_level >= 15))
  78. cursor_dict["fire_cursor2"]["own"] = (diff_num[max_diff] >= 2 or (diff_num[max_diff] == 1 and max_level >= 15))
  79. cursor_dict["fire_cursor1"]["own"] = True
  80. def load_other_data(self):
  81. global bomb_dict
  82. # 杂项第一次打开
  83. if not os.path.exists(self.other_file_path):
  84. self.rougeOB_other_data = {
  85. "Bomb": [],
  86. "Pet": [],
  87. "Hat": [],
  88. "LastRandom": 0,
  89. "Other": []
  90. }
  91. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  92. # 正常打开
  93. else:
  94. self.rougeOB_other_data = load_rouge_data(self.other_file_path)
  95. # 读取引路人
  96. if 'Cursor_Skin' not in self.rougeOB_other_data.keys():
  97. self.rougeOB_other_data['Cursor_Skin'] = "fire_cursor1"
  98. self.current_cursor = "fire_cursor1"
  99. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  100. else:
  101. self.current_cursor = self.rougeOB_other_data['Cursor_Skin']
  102. if self.current_cursor not in cursor_dict.keys():
  103. self.current_cursor = "fire_cursor1"
  104. self.view_cursor = self.current_cursor
  105. # 读取糖泡皮肤
  106. if 'Bomb_Skin' not in self.rougeOB_other_data.keys():
  107. self.rougeOB_other_data['Bomb_Skin'] = "bomb1"
  108. self.current_bomb = "bomb1"
  109. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  110. else:
  111. self.current_bomb = self.rougeOB_other_data['Bomb_Skin']
  112. for bomb in self.rougeOB_other_data['Bomb']:
  113. bomb_dict[bomb]["own"] = True
  114. print(f"rougeOB_other_data: {self.rougeOB_other_data}")
  115. def draw(self):
  116. # 引路人
  117. self.screen.buttons.append(PygameButtonBackIMG(
  118. 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')
  119. )
  120. # 藏宝阁
  121. self.screen.buttons.append(PygameButtonBackIMG(
  122. 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')
  123. )
  124. # 返回主界面
  125. self.screen.buttons.append(PygameButtonBackIMG(
  126. 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')
  127. )
  128. def draw_cursor(self):
  129. self.screen.buttons.clear()
  130. self.load_achievements_data()
  131. self.load_other_data()
  132. # ================================= 信息展示 =================================
  133. info_button = PygameButton(
  134. self.screen.screen, "", 0.5, 0.56, 18, "#2a2a2a",
  135. fg_color=(215,220,217), action=None,
  136. anchor="center", is_bold=True, fix_shape=(320,80), bg_alpha=159,
  137. frosted_glass=True, blur_radius=8, glass_alpha=8, background=self.screen
  138. )
  139. # ================================= 选择 =================================
  140. choose_button = PygameButtonBackIMG(
  141. self.screen, self.screen.screen, 0.34, 0.72, "res/ui/button/choose.png", "res/ui/button/choose_press.png",
  142. action=None, anchor='center'
  143. )
  144. # ================================= 展示框 =================================
  145. cy = 0.29
  146. button_blank = 0.13
  147. roll_button = PygameButtonBackIMGRoll(
  148. self.screen, self.screen.screen, 0.5, cy, "res/ui/button/cursor_board.png", cursor_list,
  149. action=None, roll_action=None, hover_in_action=None, hover_out_action=None,
  150. 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,
  151. related_button=[info_button, choose_button],
  152. notify_action=[lambda x: cursor_update_notify(roll_button, x, self.current_cursor), lambda _: self.update_choose_btn(roll_button, choose_button, info_button)]
  153. )
  154. # ================================= 初始化 =================================
  155. choose_button.action = lambda: self.choose_cursor(roll_button, info_button, choose_button) # 追加action
  156. roll_button.set_current_text(cursor_dict[self.current_cursor]["name"])
  157. cursor_update_notify(roll_button, info_button, self.current_cursor)
  158. self.update_choose_btn(roll_button, choose_button, info_button)
  159. # ================================= 添加按钮 =================================
  160. self.screen.buttons.append(info_button)
  161. self.screen.buttons.append(choose_button)
  162. self.screen.buttons.append(roll_button)
  163. # ================================= 上翻页 =================================
  164. self.screen.buttons.append(PygameButtonBackIMG(
  165. self.screen, self.screen.screen, 0.5, cy-button_blank, "res/ui/button/up.png", "res/ui/button/up_press.png", action=roll_button.roll_up, anchor='center', shiny_spark=False)
  166. )
  167. # ================================= 下翻页 =================================
  168. self.screen.buttons.append(PygameButtonBackIMG(
  169. self.screen, self.screen.screen, 0.5, cy+button_blank, "res/ui/button/down.png", "res/ui/button/down_press.png", action=roll_button.roll_down, anchor='center', shiny_spark=False)
  170. )
  171. # ================================= 返回上一级 =================================
  172. self.screen.buttons.append(PygameButtonBackIMG(
  173. self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_setting, anchor='center')
  174. )
  175. def draw_treasure(self):
  176. self.screen.buttons.clear()
  177. self.load_other_data()
  178. # ================================= 信息展示 =================================
  179. info_button = PygameButton(
  180. self.screen.screen, "", 0.5, 0.56, 18, "#2a2a2a",
  181. fg_color=(215,220,217), action=None,
  182. anchor="center", is_bold=True, fix_shape=(320,80), bg_alpha=159,
  183. frosted_glass=True, blur_radius=8, glass_alpha=8, background=self.screen
  184. )
  185. # ================================= 图片 =================================
  186. img_button = PygameButtonBackIMG(
  187. self.screen, self.screen.screen, 0.65, 0.29, "res/ui/button/img_board.png", "res/ui/button/img_board.png",
  188. action=None, anchor='center', shiny_spark=False
  189. )
  190. img = PygameIMG(self.screen, self.screen.screen, 0.65, 0.29, py_img=bomb_dict["bomb1"]["img"], anchor='center')
  191. # ================================= 选择 =================================
  192. choose_button = PygameButtonBackIMG(
  193. self.screen, self.screen.screen, 0.34, 0.72, "res/ui/button/choose.png", "res/ui/button/choose_press.png",
  194. action=None, anchor='center'
  195. )
  196. # ================================= 展示框 =================================
  197. cy = 0.29
  198. cx = 0.35
  199. button_blank = 0.13
  200. roll_button = PygameButtonBackIMGRoll(
  201. self.screen, self.screen.screen, cx, cy, "res/ui/button/cursor_board.png", bomb_list,
  202. action=None, roll_action=None, hover_in_action=None, hover_out_action=None,
  203. 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,
  204. related_button=[info_button, choose_button, img],
  205. notify_action=[lambda x: bomb_update_notify(roll_button, x, self.current_bomb), lambda _: self.update_choose_bomb_btn(roll_button, choose_button, info_button), lambda _: bomb_img_update(roll_button, img)]
  206. )
  207. # ================================= 初始化 =================================
  208. choose_button.action = lambda: self.choose_bomb(roll_button, info_button, choose_button) # 追加action
  209. roll_button.set_current_text(bomb_dict[self.current_bomb]["name"])
  210. bomb_update_notify(roll_button, info_button, self.current_bomb)
  211. self.update_choose_bomb_btn(roll_button, choose_button, info_button)
  212. # ================================= 添加按钮 =================================
  213. self.screen.buttons.append(info_button)
  214. self.screen.buttons.append(choose_button)
  215. self.screen.buttons.append(roll_button)
  216. self.screen.buttons.append(img_button)
  217. self.screen.buttons.append(img)
  218. # ================================= 上翻页 =================================
  219. self.screen.buttons.append(PygameButtonBackIMG(
  220. 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)
  221. )
  222. # ================================= 下翻页 =================================
  223. self.screen.buttons.append(PygameButtonBackIMG(
  224. 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)
  225. )
  226. # ================================= 返回上一级 =================================
  227. self.screen.buttons.append(PygameButtonBackIMG(
  228. self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_setting, anchor='center')
  229. )
  230. """
  231. self.hero_dic= {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
  232. self.diff_dic = {"Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
  233. if self.current_bomb == "bomb1":
  234. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-经典皮肤", bg="#C68E17", font=("Microsoft YaHei", 20))
  235. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  236. elif self.current_bomb == "bomb60":
  237. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-命运(伤害+50)", bg="#C68E17", font=("Microsoft YaHei", 20))
  238. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  239. elif self.current_bomb == "bomb1436":
  240. self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-深林(生命+150)", bg="#C68E17", font=("Microsoft YaHei", 20))
  241. self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
  242. self.button100 = tk.Button(master, text= "▶糖泡-经典皮肤", command=self.choose_bomb1, bg="#A23BEC", font=("Microsoft YaHei", 12))
  243. self.button100.place(relx=0.5, rely=0.08, anchor='w')
  244. if has_bomb60:
  245. self.button160 = tk.Button(master, text= "▶糖泡-命运(伤害+50)", command=self.choose_bomb60, bg="#A23BEC", font=("Microsoft YaHei", 12))
  246. self.button160.place(relx=0.5, rely=0.17, anchor='w')
  247. else:
  248. self.button160 = tk.Button(master, text= "(暂未获得) \n 糖泡-命运(伤害+50)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  249. self.button160.place(relx=0.5, rely=0.17, anchor='w')
  250. if has_bomb1436:
  251. self.button1436 = tk.Button(master, text= "▶糖泡-深林(生命+150)", command=self.choose_bomb1436, bg="#A23BEC", font=("Microsoft YaHei", 12))
  252. self.button1436.place(relx=0.5, rely=0.26, anchor='w')
  253. else:
  254. self.button1436 = tk.Button(master, text= "(暂未获得) \n 糖泡-深林(生命+150)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
  255. self.button1436.place(relx=0.5, rely=0.26, anchor='w')
  256. def choose_bomb1(self):
  257. self.current_bomb = "bomb1"
  258. R.bomb_skin = "bomb1"
  259. self.rougeOB_other_data['Bomb_Skin'] = "bomb1"
  260. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  261. self.button_bomb.config(text = "(当前选择) \n 糖泡-经典皮肤")
  262. def choose_bomb60(self):
  263. self.current_bomb = "bomb60"
  264. R.bomb_skin = "bomb60"
  265. self.rougeOB_other_data['Bomb_Skin'] = "bomb60"
  266. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  267. self.button_bomb.config(text = "(当前选择) \n 糖泡-命运(伤害+50)")
  268. def choose_bomb1436(self):
  269. self.current_bomb = "bomb1436"
  270. R.bomb_skin = "bomb1436"
  271. self.rougeOB_other_data['Bomb_Skin'] = "bomb1436"
  272. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  273. self.button_bomb.config(text = "(当前选择) \n 糖泡-深林(生命+150)")
  274. """
  275. def choose_cursor(self, roll_btn: PygameButtonBackIMGRoll, info_button, choose_btn):
  276. cn_name = roll_btn.get_current_text()
  277. current = cursor_cn[cn_name]
  278. self.current_cursor = current
  279. R.cursor_skin = current
  280. self.rougeOB_other_data['Cursor_Skin'] = current
  281. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  282. roll_btn.set_current_text(cursor_dict[self.current_cursor]["name"])
  283. cursor_update_notify(roll_btn, info_button, self.current_cursor)
  284. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  285. choose_btn.shiny_spark = False
  286. choose_btn.action = None
  287. def update_choose_btn(self, roll_button, choose_btn, info_button):
  288. # 拿到当前展示的中文名
  289. cn_name = roll_button.get_current_text()
  290. # 拿到内部 key
  291. key = cursor_cn[cn_name]
  292. # 拿到是否已解锁
  293. owned = cursor_dict[key]["own"]
  294. if owned:
  295. if self.current_cursor == key:
  296. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  297. choose_btn.shiny_spark = False
  298. choose_btn.action = None
  299. else:
  300. choose_btn.update_image("res/ui/button/choose.png", "res/ui/button/choose_press.png")
  301. choose_btn.shiny_spark = True
  302. choose_btn.action = lambda cn=cn_name: self.choose_cursor(roll_button, info_button, choose_btn)
  303. else:
  304. choose_btn.update_image("res/ui/button/unlock.png", "res/ui/button/unlock.png")
  305. choose_btn.shiny_spark = False
  306. choose_btn.action = None
  307. def choose_bomb(self, roll_btn: PygameButtonBackIMGRoll, info_button, choose_btn):
  308. cn_name = roll_btn.get_current_text()
  309. current = bomb_cn[cn_name]
  310. self.current_bomb = current
  311. R.bomb_skin = current
  312. self.rougeOB_other_data['Bomb_Skin'] = current
  313. save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
  314. roll_btn.set_current_text(bomb_dict[self.current_bomb]["name"])
  315. bomb_update_notify(roll_btn, info_button, self.current_bomb)
  316. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  317. choose_btn.shiny_spark = False
  318. choose_btn.action = None
  319. def update_choose_bomb_btn(self, roll_button, choose_btn, info_button):
  320. # 拿到当前展示的中文名
  321. cn_name = roll_button.get_current_text()
  322. # 拿到内部 key
  323. key = bomb_cn[cn_name]
  324. # 拿到是否已解锁
  325. owned = bomb_dict[key]["own"]
  326. if owned:
  327. if self.current_bomb == key:
  328. choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
  329. choose_btn.shiny_spark = False
  330. choose_btn.action = None
  331. else:
  332. choose_btn.update_image("res/ui/button/choose.png", "res/ui/button/choose_press.png")
  333. choose_btn.shiny_spark = True
  334. choose_btn.action = lambda cn=cn_name: self.choose_bomb(roll_button, info_button, choose_btn)
  335. else:
  336. choose_btn.update_image("res/ui/button/unlock.png", "res/ui/button/unlock.png")
  337. choose_btn.shiny_spark = False
  338. choose_btn.action = None
  339. def cursor_update_notify(board: PygameButtonBackIMGRoll, observer: PygameButton, chosen):
  340. cn_name = board.get_current_text()
  341. current = cursor_cn[cn_name]
  342. is_chosen = "<当前选择>" if (current == chosen) else ""
  343. owned = "已拥有" if cursor_dict[current]["own"] else "未解锁"
  344. info = cursor_dict[current]["info"]
  345. condition = cursor_dict[current]["condition"]
  346. observer.set_text(f" {is_chosen}{cn_name} \n {info} \n {condition}({owned}) ")
  347. def bomb_update_notify(board: PygameButtonBackIMGRoll, observer: PygameButton, chosen):
  348. cn_name = board.get_current_text()
  349. current = bomb_cn[cn_name]
  350. is_chosen = "<当前选择>" if (current == chosen) else ""
  351. owned = "已拥有" if bomb_dict[current]["own"] else "未解锁"
  352. info = bomb_dict[current]["info"]
  353. observer.set_text(f" {is_chosen}{cn_name} \n {info} \n ({owned}) ")
  354. def bomb_img_update(board: PygameButtonBackIMGRoll, img: PygameIMG):
  355. cn_name = board.get_current_text()
  356. current = bomb_cn[cn_name]
  357. img.update_image(bomb_dict[current]["img"])