This commit is contained in:
2026-05-31 14:36:07 +02:00
parent b4ac00dcdd
commit 69c941b0e1
41 changed files with 39 additions and 324 deletions

39
Scripts/Gui/Gui.cs Normal file
View File

@@ -0,0 +1,39 @@
using System.Globalization;
using Godot;
using GodotUtilities;
using NodeWar.Scripts.Globals;
namespace NodeWar.Scripts.Gui;
[Scene]
public partial class Gui : Control
{
[Node]
private Label _infoLabel;
[Node]
private Label _energyGeneration;
[Node]
private Label _energyConsumption;
[Node]
private Label _energyStorage;
public override void _Ready()
{
_energyGeneration.Text = 1f.ToString(CultureInfo.InvariantCulture);
_energyConsumption.Text = 0f.ToString(CultureInfo.InvariantCulture);
_energyStorage.Text = 100f.ToString(CultureInfo.InvariantCulture);
Autoloads.EventBus.SelectionChanged += text => _infoLabel.Text = text;
}
public override void _Notification(int what)
{
if (what == NotificationSceneInstantiated)
{
WireNodes();
}
}
}

1
Scripts/Gui/Gui.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://7jql2b33svuv

102
Scripts/Gui/Gui.tscn Normal file
View File

@@ -0,0 +1,102 @@
[gd_scene format=3 uid="uid://b1a13w4ckxnub"]
[ext_resource type="Script" uid="uid://7jql2b33svuv" path="res://Scripts/Gui/Gui.cs" id="1_80edf"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_80edf"]
bg_color = Color(0.7245737, 0.5838865, 0, 1)
corner_radius_top_left = 8
corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8
[sub_resource type="LabelSettings" id="LabelSettings_k6omp"]
line_spacing = -2.0
font_size = 14
[node name="GUI" type="Control" unique_id=1209092314]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_80edf")
[node name="Top" type="PanelContainer" parent="." unique_id=1900556325]
layout_mode = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 406.0
offset_bottom = 58.0
[node name="MarginContainer" type="MarginContainer" parent="Top" unique_id=653072330]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_right = 8
[node name="HBoxContainer" type="HBoxContainer" parent="Top/MarginContainer" unique_id=1812335530]
layout_mode = 2
theme_override_constants/separation = 4
[node name="VBoxContainer" type="VBoxContainer" parent="Top/MarginContainer/HBoxContainer" unique_id=523855758]
custom_minimum_size = Vector2(54, 0)
layout_mode = 2
theme_override_constants/separation = -4
alignment = 1
[node name="EnergyGeneration" type="Label" parent="Top/MarginContainer/HBoxContainer/VBoxContainer" unique_id=358814115]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
text = "XX.XX"
[node name="EnergyConsumption" type="Label" parent="Top/MarginContainer/HBoxContainer/VBoxContainer" unique_id=343891974]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
theme_override_colors/font_color = Color(0.8701904, 0, 0.20575893, 1)
text = "-XX.XX"
[node name="EnergyProgressBar" type="ProgressBar" parent="Top/MarginContainer/HBoxContainer" unique_id=1761250517]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 25)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_styles/fill = SubResource("StyleBoxFlat_80edf")
value = 37.15
show_percentage = false
[node name="EnergyStorage" type="Label" parent="Top/MarginContainer/HBoxContainer" unique_id=1992827443]
unique_name_in_owner = true
custom_minimum_size = Vector2(80, 0)
layout_mode = 2
size_flags_horizontal = 0
text = "MM,MMM"
[node name="PanelContainer" type="PanelContainer" parent="." unique_id=2071011957]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 3.0
offset_top = -140.0
offset_right = 153.0
offset_bottom = -3.0
grow_vertical = 0
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer" unique_id=14334117]
layout_mode = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="InfoLabel" type="Label" parent="PanelContainer/MarginContainer" unique_id=1653366042]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
size_flags_vertical = 1
label_settings = SubResource("LabelSettings_k6omp")
autowrap_mode = 3
text_overrun_behavior = 3