extends Control const ABILITY_TO_CARDS_SIDE_CARD = preload("res://scene/ability_to_cards_side_card.tscn") const ABILITY_TO_CARD_NEED = preload("res://scene/ability_to_card_need.tscn") signal close var all_could_make_item:Array func fresh(): before_click_card=null for i in %card_add_pos.get_children(): i.queue_free() for i in %need_add_pos.get_children(): i.queue_free() all_could_make_item=Global.get_now_game_item_could_make() for i in all_could_make_item.size(): var new_size_card=ABILITY_TO_CARDS_SIDE_CARD.instantiate() %card_add_pos.add_child(new_size_card) new_size_card.selected=false if i==0: side_click(new_size_card,0) new_size_card.click.connect(side_click.bindv([new_size_card,i])) new_size_card.set_text(Database.get_item_name(all_could_make_item[i])) pass var before_click_card var now_selected_item_ind:int=0 func side_click(side_card,ind:int): now_selected_item_ind=ind if before_click_card!=null: before_click_card.selected=false side_card.selected=true var item_id=all_could_make_item[ind] var item_data=Database.get_item_data(item_id) var need_material=ItemTool.get_item_make_material(item_data) %introduction.text=item_data["introduction"] for i in %need_add_pos.get_children(): i.queue_free() %make.disable(false) for i in 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=need_material[i] if now_item_num void: var could_make:bool=true var item_id=all_could_make_item[now_selected_item_ind] var item_data=Database.get_item_data(item_id) var need_material=ItemTool.get_item_make_material(item_data) for i in need_material.keys(): var now_item_num=Global.get_item_by_id(i) var need_num:int=need_material[i] if now_item_num void: self.hide() close.emit() pass # Replace with function body.