From 09a63ad164b99f3a06e2430461be13da2c33901d Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 4 Aug 2023 01:05:19 +0930 Subject: [PATCH] prototyping party menu --- party_menu.tscn | 76 ++++++++++++------ project.godot | 1 + widgets/PartyMenuCharacter.gd | 24 ++++++ widgets/PartyMenuCharacter.tscn | 133 ++++++++++++++++++++++++++++++++ 4 files changed, 209 insertions(+), 25 deletions(-) create mode 100644 widgets/PartyMenuCharacter.gd create mode 100644 widgets/PartyMenuCharacter.tscn diff --git a/party_menu.tscn b/party_menu.tscn index d8b3e1f..319d21f 100644 --- a/party_menu.tscn +++ b/party_menu.tscn @@ -1,10 +1,36 @@ -[gd_scene format=2] +[gd_scene load_steps=3 format=2] -[node name="PanelContainer" type="Panel"] -margin_right = 360.0 +[ext_resource path="res://theme/menu_theme.tres" type="Theme" id=1] +[ext_resource path="res://widgets/PartyMenuCharacter.tscn" type="PackedScene" id=2] + +[node name="Panel" type="Panel"] +margin_right = 264.0 margin_bottom = 240.0 +theme = ExtResource( 1 ) -[node name="VBoxContainer2" type="VBoxContainer" parent="."] +[node name="characters" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 8.0 +margin_top = 8.0 +margin_right = -8.0 +margin_bottom = -8.0 + +[node name="PartyMenuCharacter" parent="characters" instance=ExtResource( 2 )] + +[node name="PartyMenuCharacter2" parent="characters" instance=ExtResource( 2 )] +margin_top = 58.0 +margin_bottom = 108.0 + +[node name="PartyMenuCharacter3" parent="characters" instance=ExtResource( 2 )] +margin_top = 116.0 +margin_bottom = 166.0 + +[node name="PartyMenuCharacter4" parent="characters" instance=ExtResource( 2 )] +margin_top = 174.0 +margin_bottom = 224.0 + +[node name="rightside" type="VBoxContainer" parent="."] anchor_left = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 @@ -14,32 +40,32 @@ size_flags_vertical = 8 custom_constants/separation = 0 alignment = 2 -[node name="panel_menu" type="PanelContainer" parent="VBoxContainer2"] +[node name="panel_menu" type="PanelContainer" parent="rightside"] margin_left = 16.0 margin_right = 72.0 margin_bottom = 36.0 rect_min_size = Vector2( 56, 0 ) size_flags_horizontal = 8 -[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2/panel_menu"] +[node name="VBoxContainer" type="VBoxContainer" parent="rightside/panel_menu"] margin_left = 4.0 margin_top = 4.0 margin_right = 52.0 margin_bottom = 32.0 custom_constants/separation = 0 -[node name="lbl_job" type="Label" parent="VBoxContainer2/panel_menu/VBoxContainer"] +[node name="lbl_job" type="Label" parent="rightside/panel_menu/VBoxContainer"] margin_right = 48.0 margin_bottom = 14.0 text = "Job" -[node name="lbl_ability" type="Label" parent="VBoxContainer2/panel_menu/VBoxContainer"] +[node name="lbl_ability" type="Label" parent="rightside/panel_menu/VBoxContainer"] margin_top = 14.0 margin_right = 48.0 margin_bottom = 28.0 text = "Ability" -[node name="panel_menu2" type="PanelContainer" parent="VBoxContainer2"] +[node name="panel_menu2" type="PanelContainer" parent="rightside"] margin_left = 16.0 margin_top = 36.0 margin_right = 72.0 @@ -47,55 +73,55 @@ margin_bottom = 128.0 rect_min_size = Vector2( 56, 0 ) size_flags_horizontal = 8 -[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2/panel_menu2"] +[node name="VBoxContainer" type="VBoxContainer" parent="rightside/panel_menu2"] margin_left = 4.0 margin_top = 4.0 margin_right = 52.0 margin_bottom = 88.0 custom_constants/separation = 0 -[node name="lbl_items" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_items" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_right = 48.0 margin_bottom = 14.0 text = "Items" -[node name="lbl_magic" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_magic" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_top = 14.0 margin_right = 48.0 margin_bottom = 28.0 text = "Magic" -[node name="lbl_equip" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_equip" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_top = 28.0 margin_right = 48.0 margin_bottom = 42.0 text = "Equip" -[node name="lbl_status" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_status" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_top = 42.0 margin_right = 48.0 margin_bottom = 56.0 text = "Status" -[node name="lbl_config" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_config" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_top = 56.0 margin_right = 48.0 margin_bottom = 70.0 text = "Config" -[node name="lbl_save" type="Label" parent="VBoxContainer2/panel_menu2/VBoxContainer"] +[node name="lbl_save" type="Label" parent="rightside/panel_menu2/VBoxContainer"] margin_top = 70.0 margin_right = 48.0 margin_bottom = 84.0 text = "Save" -[node name="spacer" type="Control" parent="VBoxContainer2"] +[node name="spacer" type="Control" parent="rightside"] margin_top = 128.0 margin_right = 72.0 margin_bottom = 168.0 size_flags_vertical = 3 -[node name="panel_time" type="PanelContainer" parent="VBoxContainer2"] +[node name="panel_time" type="PanelContainer" parent="rightside"] margin_left = 8.0 margin_top = 168.0 margin_right = 72.0 @@ -103,45 +129,45 @@ margin_bottom = 204.0 rect_min_size = Vector2( 64, 0 ) size_flags_horizontal = 8 -[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2/panel_time"] +[node name="VBoxContainer" type="VBoxContainer" parent="rightside/panel_time"] margin_left = 4.0 margin_top = 4.0 margin_right = 60.0 margin_bottom = 32.0 custom_constants/separation = 0 -[node name="lbl_time" type="Label" parent="VBoxContainer2/panel_time/VBoxContainer"] +[node name="lbl_time" type="Label" parent="rightside/panel_time/VBoxContainer"] margin_right = 56.0 margin_bottom = 14.0 text = "Time" -[node name="lbl_ability" type="Label" parent="VBoxContainer2/panel_time/VBoxContainer"] +[node name="lbl_ability" type="Label" parent="rightside/panel_time/VBoxContainer"] margin_top = 14.0 margin_right = 56.0 margin_bottom = 28.0 text = "9:42" align = 2 -[node name="panel_gil" type="PanelContainer" parent="VBoxContainer2"] +[node name="panel_gil" type="PanelContainer" parent="rightside"] margin_top = 204.0 margin_right = 72.0 margin_bottom = 240.0 rect_min_size = Vector2( 72, 0 ) -[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2/panel_gil"] +[node name="VBoxContainer" type="VBoxContainer" parent="rightside/panel_gil"] margin_left = 4.0 margin_top = 4.0 margin_right = 68.0 margin_bottom = 32.0 custom_constants/separation = 0 -[node name="lbl_gilcount" type="Label" parent="VBoxContainer2/panel_gil/VBoxContainer"] +[node name="lbl_gilcount" type="Label" parent="rightside/panel_gil/VBoxContainer"] margin_right = 64.0 margin_bottom = 14.0 text = "36988" align = 2 -[node name="lbl_gil" type="Label" parent="VBoxContainer2/panel_gil/VBoxContainer"] +[node name="lbl_gil" type="Label" parent="rightside/panel_gil/VBoxContainer"] margin_top = 14.0 margin_right = 64.0 margin_bottom = 28.0 diff --git a/project.godot b/project.godot index 352ca44..953e301 100644 --- a/project.godot +++ b/project.godot @@ -46,6 +46,7 @@ window/size/snap_to_integer=true [gui] theme/use_hidpi=true +theme/custom="res://theme/menu_theme.tres" [importer_defaults] diff --git a/widgets/PartyMenuCharacter.gd b/widgets/PartyMenuCharacter.gd new file mode 100644 index 0000000..155de4a --- /dev/null +++ b/widgets/PartyMenuCharacter.gd @@ -0,0 +1,24 @@ +extends ReferenceRect + +func update_labels(data: Dictionary): + var character = data.character_id + $lbl_lv_cur.text = data.level + $lbl_abp_lv_cur.text = data.current_job_level + '-' + $lbl_abp_progress.text = data.current_job_abp + '/' + $lbl_abp_next.text = data.current_job_abp # Revisit + $lbl_hp_cur.text = data.hp_current + '/' + $lbl_hp_max.text = data.hp_max + $lbl_mp_cur.text = data.mp_current + '/' + $lbl_mp_max.text = data.mp_max + $lbl_lv_cur.text = data.level + # Draw character battle sprite in either ref_frontrow or ref_backrow + # THink about status icons + +# 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 diff --git a/widgets/PartyMenuCharacter.tscn b/widgets/PartyMenuCharacter.tscn new file mode 100644 index 0000000..0d60f97 --- /dev/null +++ b/widgets/PartyMenuCharacter.tscn @@ -0,0 +1,133 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://widgets/PartyMenuCharacter.gd" type="Script" id=1] + +[node name="PartyMenuCharacter" type="ReferenceRect"] +margin_right = 180.0 +margin_bottom = 50.0 +rect_min_size = Vector2( 180, 50 ) +size_flags_horizontal = 0 +size_flags_vertical = 0 +script = ExtResource( 1 ) + +[node name="lbl_name" type="Label" parent="."] +margin_right = 40.0 +margin_bottom = 14.0 +text = "Butz" + +[node name="lbl_job" type="Label" parent="."] +margin_left = 72.0 +margin_right = 144.0 +margin_bottom = 14.0 +text = "Freelancer" + +[node name="LV" type="Label" parent="."] +margin_left = 8.0 +margin_top = 12.0 +margin_right = 23.0 +margin_bottom = 26.0 +text = "LV" + +[node name="lbl_lv_cur" type="Label" parent="."] +margin_left = 32.0 +margin_top = 12.0 +margin_right = 56.0 +margin_bottom = 26.0 +text = "26" +align = 2 + +[node name="abp_LV" type="Label" parent="."] +margin_left = 84.0 +margin_top = 12.0 +margin_right = 99.0 +margin_bottom = 26.0 +text = "LV" + +[node name="lbl_abp_lv_cur" type="Label" parent="."] +margin_left = 100.0 +margin_top = 12.0 +margin_right = 124.0 +margin_bottom = 26.0 +text = "2-" +align = 2 + +[node name="lbl_abp_progress" type="Label" parent="."] +margin_left = 112.0 +margin_top = 12.0 +margin_right = 156.0 +margin_bottom = 26.0 +text = "76/" +align = 2 + +[node name="lbl_abp_next" type="Label" parent="."] +margin_left = 136.0 +margin_top = 12.0 +margin_right = 180.0 +margin_bottom = 26.0 +text = "135" +align = 2 + +[node name="ref_frontrow" type="ReferenceRect" parent="."] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_left = 8.0 +margin_top = -24.0 +margin_right = 24.0 +border_color = Color( 1, 0.501961, 0, 1 ) + +[node name="ref_backrow" type="ReferenceRect" parent="."] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_left = 40.0 +margin_top = -24.0 +margin_right = 56.0 +border_color = Color( 0, 1, 0, 1 ) + +[node name="HP" type="Label" parent="."] +margin_left = 84.0 +margin_top = 25.0 +margin_right = 108.0 +margin_bottom = 39.0 +rect_min_size = Vector2( 24, 0 ) +text = "HP" + +[node name="lbl_hp_cur" type="Label" parent="."] +margin_left = 108.0 +margin_top = 25.0 +margin_right = 148.0 +margin_bottom = 39.0 +rect_min_size = Vector2( 40, 0 ) +text = "9999/" +align = 2 + +[node name="lbl_hp_max" type="Label" parent="."] +margin_left = 148.0 +margin_top = 25.0 +margin_right = 180.0 +margin_bottom = 39.0 +rect_min_size = Vector2( 32, 0 ) +text = "9999" +align = 2 + +[node name="MP" type="Label" parent="."] +margin_left = 84.0 +margin_top = 36.0 +margin_right = 108.0 +margin_bottom = 50.0 +text = "MP" + +[node name="lbl_mp_cur" type="Label" parent="."] +margin_left = 108.0 +margin_top = 36.0 +margin_right = 148.0 +margin_bottom = 50.0 +text = "999/" +align = 2 + +[node name="lbl_mp_max" type="Label" parent="."] +margin_left = 148.0 +margin_top = 36.0 +margin_right = 180.0 +margin_bottom = 50.0 +text = "999" +align = 2