Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/microbe_stage/gui/CompoundProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public partial class CompoundProgressBar : Control
[Export]
private Label amountLabel = null!;

[Export]
private LabelSettings compactLabelSettings = null!;

private LabelSettings normalLabelSettings = null!;

private StyleBoxFlat? fillStyleBox;

private Texture2D? queuedIcon;
Expand Down Expand Up @@ -334,6 +339,8 @@ public override void _Ready()
// TODO: check that this fetches per scene instances properly
fillStyleBox = (StyleBoxFlat)progressBar.GetThemeStylebox("fill");

normalLabelSettings = amountLabel.LabelSettings;

UpdateName();
UpdateValue();
UpdateColour();
Expand Down Expand Up @@ -617,13 +624,15 @@ private void ApplyCompactMode(bool playAnimation)
tween.TweenProperty(this, minSizeXReference,
Narrow ? Constants.COMPOUND_BAR_NARROW_COMPACT_WIDTH : Constants.COMPOUND_BAR_COMPACT_WIDTH, 0.3);

amountLabel.LabelSettings = compactLabelSettings;
nameLabel.Hide();
}
else
{
tween.TweenProperty(this, minSizeXReference,
Narrow ? Constants.COMPOUND_BAR_NARROW_NORMAL_WIDTH : Constants.COMPOUND_BAR_NORMAL_WIDTH, 0.3);

amountLabel.LabelSettings = normalLabelSettings;
nameLabel.Show();
}
}
Expand All @@ -636,6 +645,7 @@ private void ApplyCompactMode(bool playAnimation)
Narrow ? Constants.COMPOUND_BAR_NARROW_COMPACT_WIDTH : Constants.COMPOUND_BAR_COMPACT_WIDTH,
CustomMinimumSize.Y);

amountLabel.LabelSettings = compactLabelSettings;
nameLabel.Hide();
}
else
Expand All @@ -645,6 +655,7 @@ private void ApplyCompactMode(bool playAnimation)
Narrow ? Constants.COMPOUND_BAR_NARROW_NORMAL_WIDTH : Constants.COMPOUND_BAR_NORMAL_WIDTH,
CustomMinimumSize.Y);

amountLabel.LabelSettings = normalLabelSettings;
nameLabel.Show();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/microbe_stage/gui/CompoundProgressBar.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://clnc61bm71h04"]
[gd_scene load_steps=6 format=3 uid="uid://clnc61bm71h04"]

[ext_resource type="Script" uid="uid://mj3dsqw5jf12" path="res://src/microbe_stage/gui/CompoundProgressBar.cs" id="1_dosnj"]
[ext_resource type="LabelSettings" uid="uid://u7fwx3p3shvk" path="res://src/gui_common/fonts/Body-Regular-Small-Shadow.tres" id="2_txlhc"]
[ext_resource type="LabelSettings" uid="uid://dvqx73nhtr0y2" path="res://src/gui_common/fonts/Body-Regular-Small.tres" id="2_xwjgn"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cwyqo"]
Expand All @@ -21,6 +22,7 @@ icon = NodePath("Icon")
progressBar = NodePath("Bar")
nameLabel = NodePath("Bar/Name")
amountLabel = NodePath("Value")
compactLabelSettings = ExtResource("2_txlhc")

[node name="Icon" type="TextureRect" parent="."]
custom_minimum_size = Vector2(25, 25)
Expand Down