68 lines
1.7 KiB
GDScript
68 lines
1.7 KiB
GDScript
extends TextureRect
|
|
class_name FightCharacterCard
|
|
@onready var n: Label = $TextureRect/n
|
|
@onready var icon: TextureRect = $TextureRect/TextureRect2/icon
|
|
var data:Dictionary
|
|
var fight_data:Dictionary
|
|
var HP_max:int=100:
|
|
set(val):
|
|
HP_max=val
|
|
%HP_bar.max_value=val
|
|
%HP_label.text=str(HP)+"/"+str(val)
|
|
var HP:int=100:
|
|
set(val):
|
|
HP=val
|
|
%HP_bar.value=val
|
|
%HP_label.text=str(val)+"/"+str(HP_max)
|
|
var SP_max:int=100:
|
|
set(val):
|
|
SP_max=val
|
|
%SP_bar.max_value=val
|
|
%SP_label.text=str(SP)+"/"+str(val)
|
|
var SP:int=100:
|
|
set(val):
|
|
SP=val
|
|
%SP_bar.value=val
|
|
%SP_label.text=str(val)+"/"+str(SP_max)
|
|
var VIT_max:int=100:
|
|
set(val):
|
|
VIT_max=val
|
|
%VIT_bar.max_value=val
|
|
%VIT_label.text=str(VIT)+"/"+str(val)
|
|
var VIT:int=100:
|
|
set(val):
|
|
VIT=val
|
|
%VIT_bar.value=val
|
|
%VIT_label.text=str(val)+"/"+str(VIT_max)
|
|
func _ready() -> void:
|
|
set_data(Database.get_character_data("test_character_01"))
|
|
|
|
func set_data(_data:Dictionary):
|
|
data=_data
|
|
icon.texture=Database.get_texture(CharacterTool.get_skin_now_use_data(data)["card_face"])
|
|
n.text=CharacterTool.get_character_name(data)
|
|
fight_data=CharacterTool.cacul_fight_attribute(data)
|
|
HP_max=fight_data["HP"]
|
|
HP=HP_max
|
|
SP_max=fight_data["SP"]
|
|
SP=SP_max
|
|
VIT_max=fight_data["VIT"]
|
|
VIT=VIT_max
|
|
pass
|
|
|
|
func _on_area_2d_area_entered(area: Area2D) -> void:
|
|
material.set_shader_parameter("width",10)
|
|
pass # Replace with function body.
|
|
|
|
|
|
func _on_area_2d_area_exited(area: Area2D) -> void:
|
|
material.set_shader_parameter("width",0)
|
|
pass # Replace with function body.
|
|
func cacul_initiative_value()->int:
|
|
return CharacterTool.get_initiative_value(data)
|
|
func atk():
|
|
%turn_flag.show()
|
|
await get_tree().create_timer(1).timeout
|
|
%turn_flag.hide()
|
|
|