From b9ecd4248d783eab88272ab694e4e3f8c9c9b56e Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 15 Jun 2020 17:49:14 +0200 Subject: [PATCH] Reworked castbar, now it will always be properly centered. --- game/ui/castbar/Castbar.gd | 2 +- game/ui/castbar/Castbar.tscn | 46 +++++++++++++++++++++++--------- game/ui/player_ui/player_ui.tscn | 6 +---- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/game/ui/castbar/Castbar.gd b/game/ui/castbar/Castbar.gd index 42f2501b..1e464bdc 100644 --- a/game/ui/castbar/Castbar.gd +++ b/game/ui/castbar/Castbar.gd @@ -1,4 +1,4 @@ -extends MarginContainer +extends VBoxContainer # Copyright (c) 2019-2020 Péter Magyar # diff --git a/game/ui/castbar/Castbar.tscn b/game/ui/castbar/Castbar.tscn index 57282e4e..d5bf1f4e 100644 --- a/game/ui/castbar/Castbar.tscn +++ b/game/ui/castbar/Castbar.tscn @@ -3,30 +3,50 @@ [ext_resource path="res://ui/castbar/Castbar.gd" type="Script" id=1] [ext_resource path="res://ui/theme/scrollbar_grabber_blue.tres" type="StyleBox" id=2] -[node name="Castbar" type="MarginContainer"] -margin_left = 339.0 -margin_top = 416.0 -margin_right = 691.0 -margin_bottom = 441.0 +[node name="Castbar" type="VBoxContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } -progress_bar_path = NodePath("ProgressBar") -label_path = NodePath("Label") +progress_bar_path = NodePath("HBoxContainer/ProgressBar") +label_path = NodePath("HBoxContainer/ProgressBar/Label") -[node name="ProgressBar" type="ProgressBar" parent="."] -margin_right = 352.0 -margin_bottom = 25.0 +[node name="Spacer" type="Control" parent="."] +margin_right = 1024.0 +margin_bottom = 447.0 +mouse_filter = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +size_flags_stretch_ratio = 3.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +margin_top = 451.0 +margin_right = 1024.0 +margin_bottom = 600.0 +mouse_filter = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 + +[node name="ProgressBar" type="ProgressBar" parent="HBoxContainer"] +margin_left = 402.0 +margin_right = 622.0 +margin_bottom = 20.0 +rect_min_size = Vector2( 220, 20 ) +mouse_filter = 2 custom_styles/fg = ExtResource( 2 ) percent_visible = false -[node name="Label" type="Label" parent="."] -margin_right = 352.0 -margin_bottom = 25.0 +[node name="Label" type="Label" parent="HBoxContainer/ProgressBar"] +anchor_right = 1.0 +anchor_bottom = 1.0 size_flags_horizontal = 3 size_flags_vertical = 3 align = 1 valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/game/ui/player_ui/player_ui.tscn b/game/ui/player_ui/player_ui.tscn index 629a91d2..283e8ccb 100644 --- a/game/ui/player_ui/player_ui.tscn +++ b/game/ui/player_ui/player_ui.tscn @@ -431,11 +431,7 @@ margin_left = -331.0 margin_bottom = 123.0 [node name="Castbar" parent="GUI" instance=ExtResource( 16 )] -visible = false -margin_left = 382.0 -margin_top = 461.0 -margin_right = 607.0 -margin_bottom = 480.0 +margin_top = 0.0 mouse_filter = 2 [node name="ErrorFrame" parent="GUI" instance=ExtResource( 4 )]