Skip to content

Commit

Permalink
重写replay逻辑,会删除当前节点,然后重新实例化一个节点并切换至该节点
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunnycxk authored and ligen131 committed Jan 28, 2024
1 parent 5dfcd15 commit ee03aa1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions levels/base_level/base_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,11 @@ func _on_next_level_button_pressed():
queue_free()

func _on_replay_button_pressed():
for card_base: CardBase in $CardBases.get_children():
card_base.reset_all_card_position()
var new_level = BaseLevel.instantiate()
new_level.init(chap_id, lvl_id)
get_tree().root.add_child(new_level)
queue_free()
#print(get_tree().current_scene)
#get_tree().reload_current_scene()
#for card_base: CardBase in $CardBases.get_children():
#card_base.reset_all_card_position()

0 comments on commit ee03aa1

Please sign in to comment.