Finished first EA Version #1

Merged
Nicola merged 110 commits from dev into main 2026-05-19 20:01:13 +02:00
5 changed files with 88 additions and 57 deletions
Showing only changes of commit abeb8c0902 - Show all commits
+37 -3
View File
@@ -353,6 +353,40 @@ text = "Exit"
visible = false
layout_mode = 1
[node name="Inventory" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=407422598]
visible = false
layout_mode = 1
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -525.0
grow_horizontal = 0
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Inventory" unique_id=1776118554]
layout_mode = 2
[node name="Title" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/Inventory/VBoxContainer" unique_id=1356874082]
layout_mode = 2
bbcode_enabled = true
text = "[font_size=32]Inventory[/font_size]"
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
[node name="ScrollContainer" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Inventory/VBoxContainer" unique_id=1743833752]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq")
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Inventory/VBoxContainer/ScrollContainer" unique_id=158199023]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 10
[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884]
layout_mode = 2
@@ -391,6 +425,6 @@ texture_normal = ExtResource("12_3so38")
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button" to="CanvasLayer/UIHandler" method="HandleMenu"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button2" to="CanvasLayer/UIHandler" method="ShowOptions"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button3" to="CanvasLayer/UIHandler" method="ExitGame"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Map" to="CanvasLayer/UIHandler/MainUI/Content/Map" method="ShowMap"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Robots" to="CanvasLayer/UIHandler/MainUI/Content/RobotList" method="ShowList"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Options" to="CanvasLayer/UIHandler" method="HandleMenu"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Map" to="CanvasLayer/UIHandler" method="HandleMapButton"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Robots" to="CanvasLayer/UIHandler" method="HandleRobotListButton"]
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Options" to="CanvasLayer/UIHandler" method="HandleMenuButton"]
-5
View File
@@ -20,11 +20,6 @@ public partial class Camera3d : Camera3D
public override void _Process(double delta)
{
if (canMove) MoveCamera(delta);
if (Input.IsActionJustPressed("map"))
{
isShowingMap = !isShowingMap;
canMove = !isShowingMap;
}
}
public void MoveCamera(double delta)
+5 -6
View File
@@ -23,12 +23,6 @@ public partial class CodingWindow : PanelContainer
}
public void ShowWindow(Robot robot)
{
Visible = true;
this.robot = robot;
}
//Move, Harvest, Craft
public void GenerateCodingBlocks()
{
@@ -74,4 +68,9 @@ public partial class CodingWindow : PanelContainer
if(nodes.Count > 0) robot.SetupExecution(nodes);
}
public void SetRobot(Robot robot)
{
this.robot = robot;
}
}
+40 -36
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Godot;
@@ -14,6 +15,8 @@ public partial class UIHandler : Control
[Export] PanelContainer options;
[Export] Control uiContent;
[Export] PanelContainer menu;
bool receivedRobotJumpSignal = false;
public override void _Ready()
{
@@ -24,50 +27,33 @@ public partial class UIHandler : Control
{
robotList.OnRobotJumpTo += (robot) =>
{
if(receivedRobotJumpSignal) return;
receivedRobotJumpSignal = true;
mainCam.Position = new Vector3(robot.Position.X, mainCam.Position.Y, robot.Position.Z + 3f);
ShowCodingWindow(robot);
codingWindow.SetRobot(robot);
OpenUIElement(codingWindow);
};
if (Input.IsActionJustPressed("map"))
{
map.ShowMap(false);
}
if (Input.IsActionJustPressed("menu"))
{
HandleMenu();
}
if (Input.IsActionJustPressed("map")) HandleMapButton();
if (Input.IsActionJustPressed("menu")) HandleMenuButton();
if (Input.IsActionJustPressed("robot_list")) HandleRobotListButton();
DisplayStats();
}
public void HandleMenu()
public void HandleMenuButton()
{
bool shouldMenuOpen = true;
foreach (PanelContainer element in uiContent.GetChildren())
{
if (element.Visible)
{
element.Visible = false;
shouldMenuOpen = false;
}
}
if (shouldMenuOpen)
{
menu.Visible = true;
}
OpenUIElement(menu);
}
public void ChangeColor(Color color)
public void HandleMapButton()
{
GameData.lightColor = color;
LightHandler.RedrawLights(color);
OpenUIElement(map);
}
public void ShowCodingWindow(Robot robot)
public void HandleRobotListButton()
{
codingWindow.ShowWindow(robot);
receivedRobotJumpSignal = false;
OpenUIElement(robotList);
}
public void DisplayStats()
@@ -78,13 +64,31 @@ public partial class UIHandler : Control
RAM.Text = memoryDisplay;
}
public void ShowOptions()
{
options.Visible = true;
}
public void ExitGame()
{
GetTree().ChangeSceneToFile("res://Scenes/MainMenu.tscn");
}
public void OpenUIElement(Control element)
{
if (element.Visible)
{
element.Hide();
}
else
{
element.Show();
}
HideUIElements(element);
}
private void HideUIElements(Control element)
{
foreach (PanelContainer child in uiContent.GetChildren())
{
GD.Print(child == element);
if (child == element) continue;
child.Visible = false;
}
}
}
+6 -7
View File
@@ -16,16 +16,15 @@ public partial class RobotList : PanelContainer
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("robot_list"))
{
ShowList();
}
}
public void ShowList()
public override void _Notification(int id)
{
Visible = !Visible;
if (Visible) ReloadRobots();
if (id == NotificationVisibilityChanged)
{
if (Visible) ReloadRobots();
}
}
public void ReloadRobots()