From abed8dc3031e216a986028382f4be24a3d44ce46 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Sat, 3 Feb 2024 13:20:09 +0100 Subject: [PATCH] Add basic level generation --- src/TextLore.sln | 2 +- src/TextLore/Components/Pages/Home.razor | 5 +- src/TextLore/Components/Shared/Console.razor | 29 ++++- src/TextLore/Components/_Imports.razor | 4 +- src/TextLore/{Models => Console}/Command.cs | 2 +- src/TextLore/Console/CommandResult.cs | 39 +++++++ .../{ => Console}/Commands/ClearCommand.cs | 8 +- .../{ => Console}/Commands/HelpCommand.cs | 10 +- .../{ => Console}/Commands/TestCommand.cs | 6 +- .../{Models => Console}/ConsoleInput.cs | 2 +- .../{Models => Console}/ConsoleMessageType.cs | 2 +- .../{Models => Console}/ConsoleOutput.cs | 2 +- .../ConsoleOutputEventArgs.cs | 2 +- .../{Models => Console}/ConsoleWriter.cs | 23 +++- src/TextLore/Database/GamesDatabaseContext.cs | 8 ++ .../Commands/GenerateLevelCommand.cs | 96 +++++++++++++++++ .../Games/Roguelike/Logic/LevelGenerator.cs | 100 ++++++++++++++++++ src/TextLore/Games/Roguelike/Models/Level.cs | 59 +++++++++++ src/TextLore/Games/Roguelike/Models/Room.cs | 10 ++ .../Games/Roguelike/Models/RoomDefinition.cs | 14 +++ .../Games/Roguelike/RoguelikePage.razor | 6 ++ .../Games/Roguelike/RoguelikePage.razor.cs | 43 ++++++++ src/TextLore/Games/_Imports.razor | 14 +++ src/TextLore/Models/CommandResult.cs | 22 ---- src/TextLore/Program.cs | 40 +++++-- src/TextLore/TextLore.csproj | 5 + .../Utilities/Logic/DeterministicRandom.cs | 95 +++++++++++++++++ src/TextLore/Utilities/Models/Direction.cs | 15 +++ .../Utilities/Models/PercentageProgress.cs | 9 ++ src/TextLore/Utilities/Models/Position.cs | 27 +++++ src/TextLore/Utilities/Models/Size.cs | 7 ++ src/TextLore/appsettings.Development.json | 15 +-- src/TextLore/games.sqlite | Bin 0 -> 12288 bytes src/TextLore/games.sqlite-shm | Bin 0 -> 32768 bytes src/TextLore/games.sqlite-wal | 0 src/TextLore/wwwroot/app.css | 12 +-- src/TextLore/wwwroot/console.css | 10 ++ 37 files changed, 668 insertions(+), 75 deletions(-) rename src/TextLore/{Models => Console}/Command.cs (92%) create mode 100644 src/TextLore/Console/CommandResult.cs rename src/TextLore/{ => Console}/Commands/ClearCommand.cs (68%) rename src/TextLore/{ => Console}/Commands/HelpCommand.cs (86%) rename src/TextLore/{ => Console}/Commands/TestCommand.cs (74%) rename src/TextLore/{Models => Console}/ConsoleInput.cs (81%) rename src/TextLore/{Models => Console}/ConsoleMessageType.cs (72%) rename src/TextLore/{Models => Console}/ConsoleOutput.cs (86%) rename src/TextLore/{Models => Console}/ConsoleOutputEventArgs.cs (87%) rename src/TextLore/{Models => Console}/ConsoleWriter.cs (69%) create mode 100644 src/TextLore/Database/GamesDatabaseContext.cs create mode 100644 src/TextLore/Games/Roguelike/Commands/GenerateLevelCommand.cs create mode 100644 src/TextLore/Games/Roguelike/Logic/LevelGenerator.cs create mode 100644 src/TextLore/Games/Roguelike/Models/Level.cs create mode 100644 src/TextLore/Games/Roguelike/Models/Room.cs create mode 100644 src/TextLore/Games/Roguelike/Models/RoomDefinition.cs create mode 100644 src/TextLore/Games/Roguelike/RoguelikePage.razor create mode 100644 src/TextLore/Games/Roguelike/RoguelikePage.razor.cs create mode 100644 src/TextLore/Games/_Imports.razor delete mode 100644 src/TextLore/Models/CommandResult.cs create mode 100644 src/TextLore/Utilities/Logic/DeterministicRandom.cs create mode 100644 src/TextLore/Utilities/Models/Direction.cs create mode 100644 src/TextLore/Utilities/Models/PercentageProgress.cs create mode 100644 src/TextLore/Utilities/Models/Position.cs create mode 100644 src/TextLore/Utilities/Models/Size.cs create mode 100644 src/TextLore/games.sqlite create mode 100644 src/TextLore/games.sqlite-shm create mode 100644 src/TextLore/games.sqlite-wal diff --git a/src/TextLore.sln b/src/TextLore.sln index 8175d64..f54db4e 100644 --- a/src/TextLore.sln +++ b/src/TextLore.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34511.84 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextLore", "TextLore\TextLore.csproj", "{1F935415-BA18-42C8-B210-D6195F93A719}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TextLore", "TextLore\TextLore.csproj", "{1F935415-BA18-42C8-B210-D6195F93A719}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/TextLore/Components/Pages/Home.razor b/src/TextLore/Components/Pages/Home.razor index fb74bde..1802ce1 100644 --- a/src/TextLore/Components/Pages/Home.razor +++ b/src/TextLore/Components/Pages/Home.razor @@ -1,9 +1,8 @@ @page "/" - TextLore - + @code { @@ -11,6 +10,8 @@ HelpCommand? helpCommand; + string desctiption = "Select a game mode by using the 'play' command."; + protected override void OnInitialized() { helpCommand = new HelpCommand(commands); diff --git a/src/TextLore/Components/Shared/Console.razor b/src/TextLore/Components/Shared/Console.razor index 47143a2..64a0bc9 100644 --- a/src/TextLore/Components/Shared/Console.razor +++ b/src/TextLore/Components/Shared/Console.razor @@ -1,5 +1,4 @@ @using Microsoft.AspNetCore.Components.Forms -@using TextLore.Models