2024-09-10 16:34:05 +08:00
|
|
|
extends TextureRect
|
|
|
|
class_name CharacterBagCard
|
|
|
|
@onready var star_group:Array[TextureRect]=[$mask/HBoxContainer/HBoxContainer/TextureRect, $mask/HBoxContainer/HBoxContainer/TextureRect2, $mask/HBoxContainer/HBoxContainer/TextureRect3, $mask/HBoxContainer/HBoxContainer/TextureRect4, $mask/HBoxContainer/HBoxContainer/TextureRect5]
|
|
|
|
var data={
|
|
|
|
"star_num":3,
|
2024-09-10 16:43:08 +08:00
|
|
|
"face":"res://res/ui/ui_003_select/test.png",
|
2024-09-10 16:34:05 +08:00
|
|
|
"name":"角色名字"
|
|
|
|
}
|
|
|
|
|
|
|
|
func set_star_num(num:int):
|
|
|
|
for i in star_group.size():
|
|
|
|
if i<num:
|
|
|
|
star_group[i].show()
|
|
|
|
else:
|
|
|
|
star_group[i].hide()
|
|
|
|
pass
|
|
|
|
func set_face(path:String):
|
|
|
|
var new_face=load(path)
|
|
|
|
if new_face!=null and new_face is Texture2D:
|
|
|
|
%texture_face.texture=new_face
|
|
|
|
func set_character_name(n:String):
|
|
|
|
%n.text=n
|
|
|
|
pass
|
|
|
|
func _ready() -> void:
|
|
|
|
set_star_num(data.star_num)
|
|
|
|
set_face(data.face)
|
|
|
|
set_character_name(data.name)
|