Add some UI
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
class_name GameMenuPartyTab extends Control
|
||||
|
||||
func refresh() -> void:
|
||||
var list = $ScrollContainer/MemberList
|
||||
for child in list.get_children():
|
||||
child.queue_free()
|
||||
for member in PARTY.getFullParty():
|
||||
list.add_child(_makeMemberCard(member))
|
||||
|
||||
func _makeMemberCard(member:PartyMember) -> Control:
|
||||
var panel = PanelContainer.new()
|
||||
var margin = MarginContainer.new()
|
||||
panel.add_child(margin)
|
||||
margin.add_theme_constant_override("margin_left", 8)
|
||||
margin.add_theme_constant_override("margin_right", 8)
|
||||
margin.add_theme_constant_override("margin_top", 6)
|
||||
margin.add_theme_constant_override("margin_bottom", 6)
|
||||
|
||||
var vbox = VBoxContainer.new()
|
||||
margin.add_child(vbox)
|
||||
|
||||
# Name + status row
|
||||
var headerRow = HBoxContainer.new()
|
||||
vbox.add_child(headerRow)
|
||||
|
||||
var nameLabel = Label.new()
|
||||
nameLabel.text = member.name
|
||||
nameLabel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
headerRow.add_child(nameLabel)
|
||||
|
||||
var statusLabel = Label.new()
|
||||
statusLabel.text = "DEAD" if member.status == BattleFighter.Status.DEAD else "OK"
|
||||
headerRow.add_child(statusLabel)
|
||||
|
||||
# HP row
|
||||
var hpRow = HBoxContainer.new()
|
||||
hpRow.add_theme_constant_override("separation", 6)
|
||||
vbox.add_child(hpRow)
|
||||
var hpKey = Label.new()
|
||||
hpKey.text = "HP"
|
||||
hpKey.custom_minimum_size = Vector2(30, 0)
|
||||
hpRow.add_child(hpKey)
|
||||
var hpVal = Label.new()
|
||||
hpVal.text = "%d / %d" % [member.health, member.maxHealth]
|
||||
hpRow.add_child(hpVal)
|
||||
|
||||
# MP row
|
||||
var mpRow = HBoxContainer.new()
|
||||
mpRow.add_theme_constant_override("separation", 6)
|
||||
vbox.add_child(mpRow)
|
||||
var mpKey = Label.new()
|
||||
mpKey.text = "MP"
|
||||
mpKey.custom_minimum_size = Vector2(30, 0)
|
||||
mpRow.add_child(mpKey)
|
||||
var mpVal = Label.new()
|
||||
mpVal.text = "%d / %d" % [member.mp, member.maxMp]
|
||||
mpRow.add_child(mpVal)
|
||||
|
||||
# Stats row
|
||||
var statsRow = HBoxContainer.new()
|
||||
statsRow.add_theme_constant_override("separation", 14)
|
||||
vbox.add_child(statsRow)
|
||||
for pair in [["ATK", member.attack], ["DEF", member.defense], ["SPD", member.speed], ["MAG", member.magic], ["LCK", member.luck]]:
|
||||
var label = Label.new()
|
||||
label.text = "%s %d" % [pair[0], pair[1]]
|
||||
statsRow.add_child(label)
|
||||
|
||||
return panel
|
||||
Reference in New Issue
Block a user