def update_servant_list(self): list_pos_y = 252 for i in range(len(self.canvas_servant_list_bg)): self.canvas_servant_list.delete(self.canvas_servant_list_bg[i]) self.canvas_servant_list.delete( self.canvas_servant_list_text_name[i]) self.canvas_servant_list.delete(self.canvas_servant_list_image[i]) self.canvas_servant_list.delete( self.canvas_servant_list_image_ref[i]) for servant in self.servant_list[self.servant_list_page]: self.canvas_servant_list_bg.append( self.canvas_servant_list.create_rectangle( 123, list_pos_y - 27, 580, list_pos_y + 27, fill="#2c2303", tags=(servant['Name'], "servant_list"))) self.canvas_servant_list_text_name.append( self.canvas_servant_list.create_text(180, list_pos_y, text=servant['Name'], fill="#cccccc", font=("Coolvetica Rg", 25), anchor="w", tags=(servant['Name'], "servant_list"))) try: servant_image = UIAssetImport.get_servant_icon(servant, 50, 50) except FileNotFoundError: GlobalLibrary.error( str("Servant needs icon: " + servant['Name'])) servant_image = UIAssetImport.image_resize( "Pictures/Class-Shielder-Gold.png", 50, 50) self.canvas_servant_list_image_ref.append(servant_image) self.canvas_servant_list_image.append( self.canvas_servant_list.create_image(150, list_pos_y, image=servant_image, anchor="c", tags=(servant['Name'], "servant_list"))) list_pos_y += 55 self.canvas_servant_list.tag_bind("servant_list", "<Button-1>", self.select_servant)
def show_servant_bio(self): for servant in self.servant_list[self.servant_list_page]: if servant['Name'] == self.selected_servant: self.servant_data = servant base_servant_data = Servants.get_servant(self.servant_data['Name']) self.canvas_servant_bio.create_image(415, 500, image=self.ui_servant_bio, anchor="c", tags="servant_bio") self.canvas_servant_bio.create_text(220, 280, text=self.servant_data['Name'], fill="#cccccc", font=("Coolvetica Rg", 30), anchor="w", tags="servant_bio") try: self.selected_servant_image = UIAssetImport.get_servant_icon( self.servant_data, 125, 125) except FileNotFoundError: GlobalLibrary.error("REMEMBER TO ADD ICON PATHS TO SERVANTS!!!") self.selected_servant_image = UIAssetImport.image_resize( "Pictures/Class-Shielder-Gold.png", 125, 125) self.canvas_servant_bio.create_image(107, 315, image=self.selected_servant_image, anchor="c", tags="servant_bio") self.canvas_servant_bio.create_text( 220, 320, text=str("HP: " + str(self.servant_data['HP']) + " (" + str(base_servant_data['HP']) + ")"), fill="#888888", font=("Coolvetica Rg", 15), anchor="w", tags="servant_bio") self.canvas_servant_bio.create_text( 400, 320, text=str("HP: " + str(self.servant_data['ATK']) + " (" + str(base_servant_data['ATK']) + ")"), fill="#888888", font=("Coolvetica Rg", 15), anchor="w", tags="servant_bio") self.canvas_servant_bio.create_text( 580, 320, text=str("Move: " + str(self.servant_data['Move'])), fill="#888888", font=("Coolvetica Rg", 15), anchor="w", tags="servant_bio") self.canvas_servant_bio.create_rectangle(215, 340, 780, 370, fill="#2c2303", tags="servant_bio") self.canvas_servant_bio.create_rectangle(220, 345, (self.servant_data['Level'] * ((775 - 215) / 100)) + 215, 365, fill="#433607", tags="servant_bio") self.canvas_servant_bio.create_text( ((self.servant_data['Level'] * ((775 - 215) / 100)) / 2) + 215, 355, text=str(self.servant_data['Level']), fill="#888888", font=("Coolvetica Rg", 12), anchor="c", tags="servant_bio") try: if self.servant_data['Class'] == "Saber": servant_class = self.ui_class_saber elif self.servant_data['Class'] == "Archer": servant_class = self.ui_class_archer elif self.servant_data['Class'] == "Lancer": servant_class = self.ui_class_lancer elif self.servant_data['Class'] == "Caster": servant_class = self.ui_class_caster elif self.servant_data['Class'] == "Rider": servant_class = self.ui_class_rider elif self.servant_data['Class'] == "Assassin": servant_class = self.ui_class_assassin elif self.servant_data['Class'] == "Ruler": servant_class = self.ui_class_ruler elif self.servant_data['Class'] == "Shielder": servant_class = self.ui_class_shielder elif self.servant_data['Class'] == "Berserker": servant_class = self.ui_class_berserker self.canvas_servant_bio.create_image(740, 290, image=servant_class, anchor="c", tags="servant_bio") except KeyError: GlobalLibrary.error("REMEMBER TO ADD CLASSES TO SERVANTS") except UnboundLocalError: GlobalLibrary.error("REMEMBER TO ADD CLASSES TO SERVANTS") try: self.canvas_servant_bio.create_text(55, 425, text=str( self.servant_data['Desc']), fill="#888888", font=("Coolvetica Rg", 15), anchor="nw", justify="left", width=725, tags="servant_bio") except KeyError: GlobalLibrary.error("REMEMBER TO ADD DESCRIPTIONS TO SERVANTS") self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) - 160, image=self.ui_servant_list_button, anchor="c", tags=("servant_bio", "team_slot1")) self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) - 160, image=self.ui_right_arrow, anchor="c", tags=("servant_bio", "team_slot1")) self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) - 30, image=self.ui_servant_list_button, anchor="c", tags=("servant_bio", "team_slot2")) self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) - 30, image=self.ui_right_arrow, anchor="c", tags=("servant_bio", "team_slot2")) self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) + 100, image=self.ui_servant_list_button, anchor="c", tags=("servant_bio", "team_slot3")) self.canvas_team_list.create_image( 100, (int(self.canvas_team_list.cget("height")) / 2) + 100, image=self.ui_right_arrow, anchor="c", tags=("servant_bio", "team_slot3")) self.canvas_team_list.tag_bind("team_slot1", "<Button-1>", self.set_player_servant) self.canvas_team_list.tag_bind("team_slot2", "<Button-1>", self.set_player_servant) self.canvas_team_list.tag_bind("team_slot3", "<Button-1>", self.set_player_servant)