Redo some of the UI to be more flexible with further improvement

This commit is contained in:
CactiChameleon9 2022-03-22 10:49:06 +00:00
parent 596b879b41
commit f187f690af
4 changed files with 72 additions and 9 deletions

Binary file not shown.

View File

@ -77,7 +77,9 @@ func move(movement : Vector2):
if (potential_movement[2] == false): #not behind if (potential_movement[2] == false): #not behind
z_index = 100 z_index = 100
$UnitPopup.get_node("PopupMenu").popup() yield(get_tree().create_timer(.3), "timeout")
var popup = $Canvas/UnitPopup
popup.popup(Rect2(position.x + 0, position.y - 110, popup.rect_size.x, popup.rect_size.x))
func attack(damage : int, points : int, pattern : PoolVector2Array): func attack(damage : int, points : int, pattern : PoolVector2Array):

View File

@ -120,6 +120,7 @@ texture = ExtResource( 2 )
position = Vector2( 2, -12 ) position = Vector2( 2, -12 )
hframes = 4 hframes = 4
vframes = 6 vframes = 6
frame = 12
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle" autoplay = "Idle"
@ -130,4 +131,8 @@ autoplay = "Idle"
anims/Idle = SubResource( 5 ) anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 ) "anims/Idle back" = SubResource( 6 )
[node name="UnitPopup" parent="." instance=ExtResource( 3 )] [node name="Canvas" type="CanvasLayer" parent="."]
[node name="UnitPopup" parent="Canvas" instance=ExtResource( 3 )]
margin_right = 40.0
margin_bottom = 88.0

View File

@ -2,12 +2,68 @@
[ext_resource path="res://src/assets/theme.theme" type="Theme" id=1] [ext_resource path="res://src/assets/theme.theme" type="Theme" id=1]
[node name="UnitPopup" type="Control"] [node name="PopupMenu" type="PopupPanel"]
margin_right = 20.0 margin_right = 39.0
margin_bottom = 20.0 margin_bottom = 97.0
theme = ExtResource( 1 ) theme = ExtResource( 1 )
[node name="PopupMenu" type="PopupMenu" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 20.0 anchor_left = 0.5
margin_bottom = 20.0 anchor_top = 0.5
items = [ "Move 1", null, 0, false, false, 0, 0, null, "", false, "Move 2", null, 0, false, false, 1, 0, null, "", false, "Move 3", null, 0, false, false, 2, 0, null, "", false, "Move 4", null, 0, false, false, 3, 0, null, "", false, "Move 5", null, 0, false, false, 4, 0, null, "", false ] anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -16.0
margin_top = -44.5
margin_right = 16.0
margin_bottom = 44.5
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer"]
margin_top = 4.0
margin_right = 32.0
margin_bottom = 12.0
text = "Health"
align = 1
[node name="Label2" type="Label" parent="VBoxContainer"]
margin_top = 16.0
margin_right = 32.0
margin_bottom = 24.0
text = "Damage"
align = 1
[node name="Move1" type="Button" parent="VBoxContainer"]
margin_top = 28.0
margin_right = 32.0
margin_bottom = 36.0
text = "Move 1"
[node name="Move2" type="Button" parent="VBoxContainer"]
margin_top = 40.0
margin_right = 32.0
margin_bottom = 48.0
text = "Move 2"
[node name="Move3" type="Button" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 32.0
margin_bottom = 60.0
text = "Move 3"
[node name="Move4" type="Button" parent="VBoxContainer"]
margin_top = 64.0
margin_right = 32.0
margin_bottom = 72.0
text = "Move 4"
[node name="Move5" type="Button" parent="VBoxContainer"]
margin_top = 76.0
margin_right = 32.0
margin_bottom = 84.0
text = "Move 5"
[connection signal="button_down" from="VBoxContainer/Move1" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move2" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move3" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move4" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move5" to="." method="hide"]