ChocolateBird/widgets/PartyMenuCharacter.gd

39 lines
1.8 KiB
GDScript3
Raw Normal View History

2023-08-04 01:05:19 +09:30
extends ReferenceRect
onready var rect_frontrow := Rect2($ref0/ref_frontrow.rect_position, $ref0/ref_frontrow.rect_size)
onready var rect_backrow := Rect2($ref0/ref_backrow.rect_position, $ref0/ref_backrow.rect_size)
onready var row_rects := [rect_frontrow, rect_backrow]
func update_labels(data: Dictionary, i: int):
var c = data.characters[i]
var character = c.character_id
var job = c.current_job_id
var cj_idx = character*22 + job
$ref0/lbl_name.text = data.character_names_decoded[character]
$ref0/lbl_lv_cur.text = '%d' % c.level
$ref1/lbl_job.text = StringLoader.tables.job_names[job]
$ref1/lbl_abp_lv_cur.text = '%d-' % c.current_job_level
$ref1/lbl_abp_progress.text = '%d/' % c.current_job_abp
$ref1/lbl_abp_next.text = '%d' % c.current_job_abp # Revisit
$ref1/lbl_hp_cur.text = '%d/' % c.hp_current
$ref1/lbl_hp_max.text = '%d' % c.hp_max
$ref1/lbl_mp_cur.text = '%d/' % c.mp_current
$ref1/lbl_mp_max.text = '%d' % c.mp_max
$'ref_commands/1'.text = StringLoader.get_ability_name(c.ability_1)
$'ref_commands/2'.text = StringLoader.get_ability_name(c.ability_2)
$'ref_commands/3'.text = StringLoader.get_ability_name(c.ability_3)
$'ref_commands/4'.text = StringLoader.get_ability_name(c.ability_4)
2023-08-04 01:05:19 +09:30
# Draw character battle sprite in either ref_frontrow or ref_backrow
$ref0/PC.position = row_rects[c.is_back_row].position
$ref0/PC.material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[cj_idx])
$ref0/PC.texture = SpriteLoader.strip_textures[cj_idx]
# Think about status icons
2023-08-04 01:05:19 +09:30
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass