extends Control var now_select_item_index:int=-1 const BAG_SIDE_CARD = preload("res://scene/bag_side_card.tscn") const ABILITY_TO_CARD_NEED = preload("res://scene/ability_to_card_need.tscn") func fresh(): %level_up.disable(true) var all_item=Global.get_all_item_game_data() for i in %bag_side_card_add_pos.get_children(): i.queue_free() for i in %need_add_pos.get_children(): i.queue_free() for i in all_item.size(): if ItemTool.could_item_level_up(all_item[i]): var new_card=BAG_SIDE_CARD.instantiate() %bag_side_card_add_pos.add_child(new_card) new_card.set_data(all_item[i]) new_card.equip_index=i if now_select_item_index>=0: %level_up.disable(false) var selected_item_data=Global.get_all_item_game_data()[now_select_item_index] if selected_item_data.has("level") and selected_item_data["level"]>0: %level.text="+"+str(selected_item_data["level"]) else: %level.text="" %selected_face.texture=Database.get_texture(selected_item_data["texture"]) var level_up_need_material=ItemTool.get_item_level_up_need(selected_item_data) for i in level_up_need_material.keys(): var new_need=ABILITY_TO_CARD_NEED.instantiate() %need_add_pos.add_child(new_need) var now_item_num=Global.get_item_by_id(i) var need_num:int=level_up_need_material[i] if now_item_num void: fresh() func _on_close_pressed() -> void: self.hide() pass # Replace with function body. func _on_level_item_selected(index: int) -> void: now_select_item_index=index fresh() pass # Replace with function body. func _on_level_up_pressed() -> void: if now_select_item_index>=0: var selected_item_data=Global.get_all_item_game_data_not_copy()[now_select_item_index] var level_up_need_material=ItemTool.get_item_level_up_need(selected_item_data) var could_level_up:bool=true for i in level_up_need_material.keys(): var now_item_num=Global.get_item_by_id(i) var need_num:int=level_up_need_material[i] if need_num>now_item_num: could_level_up=false break if could_level_up: for i in level_up_need_material.keys(): var need_num:int=level_up_need_material[i] Global.decrease_item_num_id(i,need_num) var before_level:int=0 if selected_item_data.has("level"): before_level=selected_item_data["level"] selected_item_data["level"]=before_level+1 fresh() pass # Replace with function body.