summaryrefslogtreecommitdiff
path: root/scripts/GUI
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/GUI')
-rw-r--r--scripts/GUI/Details.cs20
-rw-r--r--scripts/GUI/Hud.cs2
-rw-r--r--scripts/GUI/InventoryMenu.cs8
-rw-r--r--scripts/GUI/ItemMenuEntry.cs42
-rw-r--r--scripts/GUI/MainMenu.cs22
-rw-r--r--scripts/GUI/MessageLog.cs6
6 files changed, 50 insertions, 50 deletions
diff --git a/scripts/GUI/Details.cs b/scripts/GUI/Details.cs
index 3ead3a9..42268b1 100644
--- a/scripts/GUI/Details.cs
+++ b/scripts/GUI/Details.cs
@@ -11,10 +11,10 @@ public partial class Details : CanvasLayer
[Export]
private Map.Map map;
- private VBoxContainer EntityNames { get; set; }
- private Godot.Collections.Array<Entity> Entities { get; set; } = [];
+ private VBoxContainer entityNames;
+ private Godot.Collections.Array<Entity> entities= [];
- private Godot.Collections.Array<Label> ActorsLabel { get; set; } = [];
+ private Godot.Collections.Array<Label> actorsLabel = [];
private SignalBus.EnterInspectionModeEventHandler enterLambda;
private SignalBus.ExitInspectionModeEventHandler exitLambda;
@@ -22,7 +22,7 @@ public partial class Details : CanvasLayer
public override void _Ready()
{
base._Ready();
- EntityNames = GetNode<VBoxContainer>("HBoxContainer/PanelContainer/ScrollContainer/Entities");
+ entityNames = GetNode<VBoxContainer>("HBoxContainer/PanelContainer/ScrollContainer/Entities");
enterLambda = () => Visible = true;
exitLambda = () => Visible = false;
@@ -34,7 +34,7 @@ public partial class Details : CanvasLayer
public void OnInspectorWalk(Vector2I pos)
{
MapData mapData = map.MapData;
- Entities = mapData.GetEntitiesAtPosition(pos);
+ entities = mapData.GetEntitiesAtPosition(pos);
UpdateLabels();
}
@@ -57,14 +57,14 @@ public partial class Details : CanvasLayer
private void UpdateLabels()
{
- foreach (Label label in ActorsLabel)
+ foreach (Label label in actorsLabel)
{
label.QueueFree();
}
- ActorsLabel.Clear();
+ actorsLabel.Clear();
- foreach (Entity entity in Entities)
+ foreach (Entity entity in entities)
{
Label label = new()
{
@@ -72,8 +72,8 @@ public partial class Details : CanvasLayer
LabelSettings = lblSettings
};
- ActorsLabel.Add(label);
- EntityNames.AddChild(label);
+ actorsLabel.Add(label);
+ entityNames.AddChild(label);
}
}
}
diff --git a/scripts/GUI/Hud.cs b/scripts/GUI/Hud.cs
index 227ca32..a1511b8 100644
--- a/scripts/GUI/Hud.cs
+++ b/scripts/GUI/Hud.cs
@@ -3,7 +3,7 @@ using Godot;
namespace TheLegendOfGustav.GUI;
-public partial class Hud : Node
+public partial class Hud : CanvasLayer
{
private TextureProgressBar hpBar;
private TextureProgressBar mpBar;
diff --git a/scripts/GUI/InventoryMenu.cs b/scripts/GUI/InventoryMenu.cs
index 5bac62b..dd8e133 100644
--- a/scripts/GUI/InventoryMenu.cs
+++ b/scripts/GUI/InventoryMenu.cs
@@ -8,18 +8,18 @@ public partial class InventoryMenu : CanvasLayer
{
private static readonly PackedScene itemMenuEntryScene = GD.Load<PackedScene>("res://scenes/GUI/item_menu_entry.tscn");
+ private VBoxContainer itemsNode;
+
[Signal]
public delegate void ItemSelectedEventHandler(ConsumableItem item);
[Signal]
public delegate void ItemDropEventHandler(ConsumableItem item);
- private VBoxContainer ItemsNode { get; set; }
-
public override void _Ready()
{
base._Ready();
- ItemsNode = GetNode<VBoxContainer>("CenterContainer/PanelContainer/VBoxContainer/Items");
+ itemsNode = GetNode<VBoxContainer>("CenterContainer/PanelContainer/VBoxContainer/Items");
Hide();
}
@@ -55,7 +55,7 @@ public partial class InventoryMenu : CanvasLayer
ItemMenuEntry itemEntry = itemMenuEntryScene.Instantiate<ItemMenuEntry>();
- ItemsNode.AddChild(itemEntry);
+ itemsNode.AddChild(itemEntry);
itemEntry.Initialize(item, shortcut);
itemEntry.Activate += OnActivate;
itemEntry.Drop += OnDrop;
diff --git a/scripts/GUI/ItemMenuEntry.cs b/scripts/GUI/ItemMenuEntry.cs
index 7070b21..6f18bd9 100644
--- a/scripts/GUI/ItemMenuEntry.cs
+++ b/scripts/GUI/ItemMenuEntry.cs
@@ -6,39 +6,39 @@ namespace TheLegendOfGustav.GUI;
public partial class ItemMenuEntry : HBoxContainer
{
+ private TextureRect icon;
+ private Label shortcutLabel;
+ private Label nameLabel;
+ private Button activateBtn;
+ private Button dropBtn;
+ private ConsumableItem item;
+
[Signal]
public delegate void ActivateEventHandler(ConsumableItem Item);
[Signal]
public delegate void DropEventHandler(ConsumableItem Item);
- private TextureRect Icon { get; set; }
- private Label ShortcutLabel { get; set; }
- private Label NameLabel { get; set; }
- private Button ActivateBtn { get; set; }
- private Button DropBtn { get; set; }
- private ConsumableItem Item { get; set; }
-
public override void _Ready()
{
base._Ready();
- Icon = GetNode<TextureRect>("Icon");
- ShortcutLabel = GetNode<Label>("Shortcut");
- NameLabel = GetNode<Label>("ItemName");
- ActivateBtn = GetNode<Button>("ActivateBtn");
- DropBtn = GetNode<Button>("DropButton");
+ icon = GetNode<TextureRect>("Icon");
+ shortcutLabel = GetNode<Label>("Shortcut");
+ nameLabel = GetNode<Label>("ItemName");
+ activateBtn = GetNode<Button>("ActivateBtn");
+ dropBtn = GetNode<Button>("DropButton");
- ActivateBtn.Pressed += () => EmitSignal(SignalName.Activate, Item);
- DropBtn.Pressed += () => EmitSignal(SignalName.Drop, Item);
+ activateBtn.Pressed += () => EmitSignal(SignalName.Activate, item);
+ dropBtn.Pressed += () => EmitSignal(SignalName.Drop, item);
}
public void Initialize(ConsumableItem item, char? shortcut)
{
- Item = item;
- NameLabel.Text = item.DisplayName;
+ this.item = item;
+ nameLabel.Text = item.DisplayName;
if (shortcut != null)
{
- ShortcutLabel.Text = $"{shortcut}";
+ shortcutLabel.Text = $"{shortcut}";
int index = (int)shortcut - 'a';
@@ -63,13 +63,13 @@ public partial class ItemMenuEntry : HBoxContainer
Events = [dropEvent]
};
- ActivateBtn.Shortcut = shortie;
- DropBtn.Shortcut = dropperino;
+ activateBtn.Shortcut = shortie;
+ dropBtn.Shortcut = dropperino;
}
else
{
- ShortcutLabel.Text = "";
+ shortcutLabel.Text = "";
}
- Icon.Texture = item.Texture;
+ icon.Texture = item.Texture;
}
}
diff --git a/scripts/GUI/MainMenu.cs b/scripts/GUI/MainMenu.cs
index 4d89b36..15ccc33 100644
--- a/scripts/GUI/MainMenu.cs
+++ b/scripts/GUI/MainMenu.cs
@@ -4,9 +4,9 @@ namespace TheLegendOfGustav.GUI;
public partial class MainMenu : Control
{
- private Button NewGameButton;
- private Button LoadGameButton;
- private Button QuitButton;
+ private Button newGameButton;
+ private Button loadGameButton;
+ private Button quitButton;
[Signal]
public delegate void GameRequestEventHandler(bool load);
@@ -15,17 +15,17 @@ public partial class MainMenu : Control
{
base._Ready();
- NewGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/neogame");
- LoadGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/continue");
- QuitButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/quit");
+ newGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/neogame");
+ loadGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/continue");
+ quitButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/quit");
- NewGameButton.Pressed += OnNewGameButtonPressed;
- LoadGameButton.Pressed += OnLoadGameButtonPressed;
- QuitButton.Pressed += OnQuitButtonPressed;
+ newGameButton.Pressed += OnNewGameButtonPressed;
+ loadGameButton.Pressed += OnLoadGameButtonPressed;
+ quitButton.Pressed += OnQuitButtonPressed;
- NewGameButton.GrabFocus();
+ newGameButton.GrabFocus();
bool hasSaveFile = FileAccess.FileExists("user://save.dat");
- LoadGameButton.Disabled = !hasSaveFile;
+ loadGameButton.Disabled = !hasSaveFile;
}
private void OnNewGameButtonPressed()
diff --git a/scripts/GUI/MessageLog.cs b/scripts/GUI/MessageLog.cs
index c83879a..2a69860 100644
--- a/scripts/GUI/MessageLog.cs
+++ b/scripts/GUI/MessageLog.cs
@@ -6,13 +6,13 @@ namespace TheLegendOfGustav.GUI;
public partial class MessageLog : ScrollContainer
{
- private VBoxContainer MessageList { get; set; }
+ private VBoxContainer messageList;
private MessageLogData.messageSentEventHandler joinSignal;
public override void _Ready()
{
base._Ready();
- MessageList = GetNode<VBoxContainer>("MessageList");
+ messageList = GetNode<VBoxContainer>("MessageList");
foreach (Message msg in MessageLogData.Instance.Messages)
{
@@ -38,7 +38,7 @@ public partial class MessageLog : ScrollContainer
private async Task AddMessageAsync(Message message)
{
- MessageList.AddChild(message);
+ messageList.AddChild(message);
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
EnsureControlVisible(message);
}