- Created README.md with project description and setup instructions - Added project configuration files (TheGame.csproj, TheGame.sln, project.godot) - Implemented main game scenes (MainMenu.tscn, Game.tscn, LoadGameMenu.tscn) - Developed game logic in C# scripts (Game.cs, MainMenu.cs, LoadGameMenu.cs, PauseMenu.cs, SaveManager.cs) - Introduced save/load functionality and timer display - Included icon.svg for game branding
38 lines
995 B
C#
38 lines
995 B
C#
using Godot;
|
|
|
|
namespace TheGame
|
|
{
|
|
public partial class MainMenu : Control
|
|
{
|
|
private Button _loadButton;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_loadButton = GetNode<Button>("VBoxContainer/LoadButton");
|
|
UpdateLoadButtonState();
|
|
}
|
|
|
|
private void UpdateLoadButtonState()
|
|
{
|
|
// Kontrollera om det finns sparade spel
|
|
var saveManager = new SaveManager();
|
|
var savedGames = saveManager.GetSavedGames();
|
|
_loadButton.Disabled = savedGames.Count == 0;
|
|
}
|
|
|
|
private void _on_start_button_pressed()
|
|
{
|
|
GetTree().ChangeSceneToFile("res://scenes/Game.tscn");
|
|
}
|
|
|
|
private void _on_load_button_pressed()
|
|
{
|
|
GetTree().ChangeSceneToFile("res://scenes/LoadGameMenu.tscn");
|
|
}
|
|
|
|
private void _on_exit_button_pressed()
|
|
{
|
|
GetTree().Quit();
|
|
}
|
|
}
|
|
} |