a bit more stuff
This commit is contained in:
@@ -1,39 +1,34 @@
|
||||
using System.Globalization;
|
||||
using Godot;
|
||||
using GodotUtilities;
|
||||
using NodeWar.Scripts.Globals;
|
||||
|
||||
namespace NodeWar.Scripts.Gui;
|
||||
|
||||
[Scene]
|
||||
[SceneTree]
|
||||
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);
|
||||
base._Ready();
|
||||
|
||||
Autoloads.EventBus.SelectionChanged += text => _infoLabel.Text = text;
|
||||
EnergyGeneration.Text = 1f.ToString(CultureInfo.InvariantCulture);
|
||||
EnergyConsumption.Text = 0f.ToString(CultureInfo.InvariantCulture);
|
||||
EnergyCapacity.Text = 100f.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
Autoloads.EventBus.SelectionChanged += text => _InfoLabel.Text = text;
|
||||
}
|
||||
|
||||
public override void _Notification(int what)
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (what == NotificationSceneInstantiated)
|
||||
{
|
||||
WireNodes();
|
||||
}
|
||||
EnergyGeneration.Text = EnergyManager
|
||||
.Instance.GetEnergyGeneration()
|
||||
.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
EnergyCapacity.Text = EnergyManager
|
||||
.Instance.GetTotalEnergyCapacity()
|
||||
.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
EnergyProgressBar.MaxValue = EnergyManager.Instance.GetTotalEnergyCapacity();
|
||||
EnergyProgressBar.Value = EnergyManager.Instance.GetEnergyStored();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +64,9 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_80edf")
|
||||
value = 37.15
|
||||
show_percentage = false
|
||||
value = 36.59
|
||||
|
||||
[node name="EnergyStorage" type="Label" parent="Top/MarginContainer/HBoxContainer" unique_id=1992827443]
|
||||
[node name="EnergyCapacity" type="Label" parent="Top/MarginContainer/HBoxContainer" unique_id=1992827443]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(80, 0)
|
||||
layout_mode = 2
|
||||
|
||||
Reference in New Issue
Block a user