fix: 优化代码

This commit is contained in:
2026-01-22 07:53:30 +08:00
parent 4afa37c87d
commit 05a566f42b
6 changed files with 25 additions and 3 deletions
+2
View File
@@ -2,6 +2,8 @@ extends Node
var current_scene = null
var Card = ResourceLoader.load("res://prefabs/game/card.tscn")
func _ready():
var root = get_tree().root
current_scene = root.get_child(root.get_child_count() - 1)
+5
View File
@@ -0,0 +1,5 @@
extends Node2D
func set_texture(pic: String) -> void:
$Sprite.texture = ResourceLoader.load(pic)
+1
View File
@@ -0,0 +1 @@
uid://di3cxx8th55lg
+6 -1
View File
@@ -16,4 +16,9 @@ func init() -> void:
ipaddress = address
$IPLabel.text = ipaddress
$Player1/Username.text = GameManager.username
func new_card(card_name: String):
var card = SceneManager.Card.new()
add_child(card)
card.set_texture(GameManager.pic_list[card_name])
return card