diff --git a/.editorconfig b/.editorconfig index aeff653..3e6adb7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,7 +14,6 @@ indent_style = space # C# files [*.cs] # Nullable reference types -csharp_nullable_reference_types = enable # Naming conventions dotnet_naming_rule.async_methods_end_in_async.severity = suggestion @@ -27,6 +26,23 @@ dotnet_naming_symbols.async_methods.required_modifiers = async dotnet_naming_style.end_in_async.required_suffix = Async dotnet_naming_style.end_in_async.capitalization = pascal_case +dotnet_naming_symbols.locals.applicable_kinds = local, parameter + +dotnet_naming_symbols.const_fields.applicable_kinds = field +dotnet_naming_symbols.const_fields.required_modifiers = const + +dotnet_naming_style.camel_case.capitalization = camel_case + +dotnet_naming_style.all_caps.capitalization = all_upper + +dotnet_naming_rule.locals_must_be_camel.severity = warning +dotnet_naming_rule.locals_must_be_camel.symbols = locals +dotnet_naming_rule.locals_must_be_camel.style = camel_case + +dotnet_naming_rule.consts_must_be_all_caps.severity = warning +dotnet_naming_rule.consts_must_be_all_caps.symbols = const_fields +dotnet_naming_rule.consts_must_be_all_caps.style = all_caps + # Formatting csharp_new_line_before_open_brace = all csharp_indent_case_contents = true diff --git a/.gitignore b/.gitignore index 9239ba5..72cfd91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,18 @@ -# Created by https://www.toptal.com/developers/gitignore/api/godot,rider,dotnetcore,visualstudio,visualstudiocode,obsidian -# Edit at https://www.toptal.com/developers/gitignore?templates=godot,rider,dotnetcore,visualstudio,visualstudiocode,obsidian +### VisualStudioCode template +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets -### DotnetCore ### -# .NET Core build folders -bin/ -obj/ +# Local History for Visual Studio Code +.history/ -# Common node modules locations -/node_modules -/wwwroot/node_modules +# Built Visual Studio Code Extensions +*.vsix -### Godot ### -# Godot 4+ specific ignores -.godot/ - -# Godot-specific ignores -.import/ -export.cfg -export_presets.cfg - -# Imported translations (automatically generated from CSV files) -*.translation - -# Mono-specific ignores -.mono/ -data_*/ -mono_crash.*.json - -### Obsidian ### -# config dir -.obsidian/ - -### Rider ### +### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 @@ -110,26 +91,7 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - -# Local History for Visual Studio Code -.history/ - -# Built Visual Studio Code Extensions -*.vsix - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -.ionide - -### VisualStudio ### +### VisualStudio template ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## @@ -319,7 +281,7 @@ publish/ *.pubxml *.publishproj -# Microslop Azure Web App publish settings. Comment the next line if you want to +# Microsoft Azure Web App publish settings. Comment the next line if you want to # checkin your Azure Web App publish settings, but sensitive information contained # in these scripts will be unencrypted PublishScripts/ @@ -338,11 +300,11 @@ PublishScripts/ *.nuget.props *.nuget.targets -# Microslop Azure Build Output +# Microsoft Azure Build Output csx/ *.build.csdef -# Microslop Azure Emulator +# Microsoft Azure Emulator ecf/ rcf/ @@ -407,7 +369,7 @@ ServiceFabricBackup/ *- [Bb]ackup ([0-9]).rdl *- [Bb]ackup ([0-9][0-9]).rdl -# Microslop Fakes +# Microsoft Fakes FakesAssemblies/ # GhostDoc plugin setting file @@ -521,10 +483,3 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml -### VisualStudio Patch ### -# Additional files built by Visual Studio - -# End of https://www.toptal.com/developers/gitignore/api/godot,rider,dotnetcore,visualstudio,visualstudiocode,obsidian - -**/*.toml -*.pck diff --git a/.idea/.idea.CyberBits/.idea/.gitignore b/.idea/.idea.CyberBits/.idea/.gitignore deleted file mode 100644 index 1a9ab9f..0000000 --- a/.idea/.idea.CyberBits/.idea/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/projectSettingsUpdater.xml -/contentModel.xml -/modules.xml -/.idea.CyberBits.iml -# Editor-based HTTP Client requests -/httpRequests/ -# Ignored default folder with query files -/queries/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/.idea.CyberBits/.idea/avalonia.xml b/.idea/.idea.CyberBits/.idea/avalonia.xml new file mode 100644 index 0000000..940bd08 --- /dev/null +++ b/.idea/.idea.CyberBits/.idea/avalonia.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.CyberBits/.idea/projectSettingsUpdater.xml b/.idea/.idea.CyberBits/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..ef20cb0 --- /dev/null +++ b/.idea/.idea.CyberBits/.idea/projectSettingsUpdater.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.CyberBits/.idea/vcs.xml b/.idea/.idea.CyberBits/.idea/vcs.xml index 35eb1dd..8306744 100644 --- a/.idea/.idea.CyberBits/.idea/vcs.xml +++ b/.idea/.idea.CyberBits/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/CyberBits.Common/Addon.cs b/CyberBits.Common/Addon.cs deleted file mode 100644 index 7c94bbb..0000000 --- a/CyberBits.Common/Addon.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace CyberBits.Common; - -public record Addon( - [property: JsonPropertyName("cyberware")] - string[] Cyberware - ); diff --git a/CyberBits.Common/Bits.cs b/CyberBits.Common/Bits.cs deleted file mode 100644 index 516f2f0..0000000 --- a/CyberBits.Common/Bits.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace CyberBits.Common; - -public record Bits( - [property: JsonPropertyName("image")] - string Image, - [property: JsonPropertyName("feat")] - string Feat, - [property: JsonPropertyName("base")] - string[] Base, - [property: JsonPropertyName("style")] - string[] Style - ); diff --git a/CyberBits.Common/CyberBits.Common.csproj b/CyberBits.Common/CyberBits.Common.csproj deleted file mode 100644 index a7794aa..0000000 --- a/CyberBits.Common/CyberBits.Common.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - enable - LatestMajor - enable - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - diff --git a/CyberBits.Common/FileFetcher.cs b/CyberBits.Common/FileFetcher.cs deleted file mode 100644 index 91ed192..0000000 --- a/CyberBits.Common/FileFetcher.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace CyberBits.Common; - -public static class FileFetcher -{ - public static string LoadTextFile(string filename, bool userDir = false) - { - var location = "res"; - - if (userDir) - location = "user"; - - using var file = FileAccess.Open($"{location}://{filename}", FileAccess.ModeFlags.Read); - var contents = file.GetAsText(); - - file.Close(); - return contents; - } - - public static ConfigFile LoadConfig(string filename, bool userDir = false) - { - var config = new ConfigFile(); - -// Load data from a file. - var err = config.Load(LoadTextFile(filename, userDir)); - - if (err != Error.Ok) - sys.Environment.Exit(sys.Environment.ExitCode); - - return config; - } -} diff --git a/CyberBits.Common/GlobalUsing.cs b/CyberBits.Common/GlobalUsing.cs deleted file mode 100644 index 2e66d5e..0000000 --- a/CyberBits.Common/GlobalUsing.cs +++ /dev/null @@ -1,6 +0,0 @@ -// System -global using sys = System; -global using System.Text.Json.Serialization; - -// Godot -global using Godot; diff --git a/CyberBits.Common/ResourceFiles.cs b/CyberBits.Common/ResourceFiles.cs deleted file mode 100644 index 46bd4ef..0000000 --- a/CyberBits.Common/ResourceFiles.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace CyberBits.Common; - -public struct ResourceFiles -{ - public const string COCK_JSON = "resources/cock.json"; - public const string PUSSY_JSON = "resources/pussy.json"; - public const string ADDONS_JSON = "resources/addons.json"; -} diff --git a/CyberBits.Godot/CyberBits.Godot.csproj b/CyberBits.Godot/CyberBits.Godot.csproj deleted file mode 100644 index 576a44a..0000000 --- a/CyberBits.Godot/CyberBits.Godot.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - net8.0 - true - LatestMajor - - - - - diff --git a/CyberBits.Godot/main.tscn b/CyberBits.Godot/main.tscn deleted file mode 100644 index 36e156c..0000000 --- a/CyberBits.Godot/main.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene format=3] - -[node name="Main" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="CenterContainer" type="CenterContainer" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="Label" type="Label" parent="CenterContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 32 -text = "Hello from 2dog!" diff --git a/CyberBits.Godot/project.godot b/CyberBits.Godot/project.godot deleted file mode 100644 index 8a4bcb0..0000000 --- a/CyberBits.Godot/project.godot +++ /dev/null @@ -1,26 +0,0 @@ -; Engine configuration file. -; It's best edited using the editor UI and not directly, -; since the parameters that go here are not all obvious. -; -; Format: -; [section] ; section goes between [] -; param=value ; assign values to parameters - -config_version=5 - -custom_features="dotnet" - -[application] - -config/name="CyberBits" -run/main_scene="res://main.tscn" -config/features=PackedStringArray("4.6", "C#") - -[dotnet] - -project/assembly_name="CyberBits.Godot" - -[display] - -window/size/viewport_width=1280 -window/size/viewport_height=720 diff --git a/CyberBits.Tests/BasicTests.cs b/CyberBits.Tests/BasicTests.cs deleted file mode 100644 index 5cf2862..0000000 --- a/CyberBits.Tests/BasicTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Godot; -using twodog.xunit; - -namespace CyberBits.Tests; - -[Collection("GodotHeadless")] -public class BasicTests(GodotHeadlessFixture godot) -{ - [Fact] - public void LoadMainScene_Succeeds() - { - // Arrange - var scene = GD.Load("res://main.tscn"); - - // Act - var instance = scene.Instantiate(); - godot.Tree.Root.AddChild(instance); - - // Assert - Assert.NotNull(instance); - Assert.NotNull(instance.GetParent()); - } - - [Fact] - public void PhysicsIteration_Succeeds() - { - // Arrange & Act - godot.Tree.Root.PhysicsInterpolationMode = Node.PhysicsInterpolationModeEnum.Off; - godot.GodotInstance.Iteration(); - - // Assert - if we get here without crashing, test passes - Assert.True(true); - } - - [Fact] - public void CreateNode_AddsToTree() - { - // Arrange - var node = new Node(); - node.Name = "TestNode"; - - // Act - godot.Tree.Root.AddChild(node); - - // Assert - Assert.True(godot.Tree.Root.HasNode("TestNode")); - Assert.Equal("TestNode", (string)godot.Tree.Root.GetNode("TestNode").Name); - - // Cleanup - node.QueueFree(); - } -} diff --git a/CyberBits.Tests/CyberBits.Tests.csproj b/CyberBits.Tests/CyberBits.Tests.csproj deleted file mode 100644 index ff01f66..0000000 --- a/CyberBits.Tests/CyberBits.Tests.csproj +++ /dev/null @@ -1,60 +0,0 @@ - - - net8.0 - enable - enable - false - LatestMajor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../CyberBits.Godot - - - - - - - - - diff --git a/CyberBits.Tests/GodotHeadlessCollection.cs b/CyberBits.Tests/GodotHeadlessCollection.cs deleted file mode 100644 index b6ea7a6..0000000 --- a/CyberBits.Tests/GodotHeadlessCollection.cs +++ /dev/null @@ -1,7 +0,0 @@ -using twodog.xunit; -using Xunit; - -namespace CyberBits.Tests; - -[CollectionDefinition("GodotHeadless", DisableParallelization = true)] -public class GodotHeadlessCollection : ICollectionFixture; diff --git a/CyberBits.Tests/xunit.runner.json b/CyberBits.Tests/xunit.runner.json deleted file mode 100644 index 08c512b..0000000 --- a/CyberBits.Tests/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", - "parallelizeTestCollections": false -} diff --git a/CyberBits.slnx b/CyberBits.slnx index 8c8f124..b620695 100644 --- a/CyberBits.slnx +++ b/CyberBits.slnx @@ -1,12 +1,9 @@ - + + - - - - - + diff --git a/CyberBits/App.axaml b/CyberBits/App.axaml new file mode 100644 index 0000000..cbead4d --- /dev/null +++ b/CyberBits/App.axaml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/CyberBits/App.axaml.cs b/CyberBits/App.axaml.cs new file mode 100644 index 0000000..5681af9 --- /dev/null +++ b/CyberBits/App.axaml.cs @@ -0,0 +1,28 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using CyberBits.ViewModels; +using CyberBits.Views; + +namespace CyberBits; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow + { + DataContext = new MainWindowViewModel(), + }; + } + + base.OnFrameworkInitializationCompleted(); + } +} diff --git a/CyberBits.Common/CBConsts.cs b/CyberBits/AppConsts.cs similarity index 81% rename from CyberBits.Common/CBConsts.cs rename to CyberBits/AppConsts.cs index aeb70d9..0df5518 100644 --- a/CyberBits.Common/CBConsts.cs +++ b/CyberBits/AppConsts.cs @@ -1,6 +1,6 @@ -namespace CyberBits.Common; +namespace CyberBits; -public struct CBConsts +public struct AppConsts { // Ignore VSCode if it complains about "ThisAssembly" not being found. public const string VERSION = diff --git a/CyberBits/Assets/avalonia-logo.ico b/CyberBits/Assets/avalonia-logo.ico new file mode 100644 index 0000000..f7da8bb Binary files /dev/null and b/CyberBits/Assets/avalonia-logo.ico differ diff --git a/CyberBitsOld/project/sprites/cock.jpg b/CyberBits/Assets/cock.jpg similarity index 100% rename from CyberBitsOld/project/sprites/cock.jpg rename to CyberBits/Assets/cock.jpg diff --git a/CyberBitsOld/project/sprites/pussy.jpg b/CyberBits/Assets/pussy.jpg similarity index 100% rename from CyberBitsOld/project/sprites/pussy.jpg rename to CyberBits/Assets/pussy.jpg diff --git a/CyberBitsOld/Bits.cs b/CyberBits/Bits.cs similarity index 53% rename from CyberBitsOld/Bits.cs rename to CyberBits/Bits.cs index aeba4e8..930eed5 100644 --- a/CyberBitsOld/Bits.cs +++ b/CyberBits/Bits.cs @@ -1,12 +1,17 @@ -namespace Cyberbits; +namespace CyberBits; public record Bits( [property: JsonPropertyName("image")] string Image, [property: JsonPropertyName("feat")] string Feat, - [property: JsonPropertyName("base")] - string[] Base, + [property: JsonPropertyName("model")] + string[] Model, [property: JsonPropertyName("style")] string[] Style ); + +public record Addon( + [property: JsonPropertyName("cyberware")] + string[] Cyberware +); diff --git a/CyberBits/CyberBits.csproj b/CyberBits/CyberBits.csproj index 670ba77..c4b89b3 100644 --- a/CyberBits/CyberBits.csproj +++ b/CyberBits/CyberBits.csproj @@ -1,36 +1,33 @@ - + - net8.0 - Exe - enable + WinExe + net10.0 enable - false - LatestMajor + app.manifest + true - + + + + + - + + + + + + None + All + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - - - - - - - - ../CyberBits.Godot - - - - - - - - diff --git a/CyberBits/GlobalUsing.cs b/CyberBits/GlobalUsing.cs new file mode 100644 index 0000000..6abfda8 --- /dev/null +++ b/CyberBits/GlobalUsing.cs @@ -0,0 +1 @@ +global using System.Text.Json.Serialization; diff --git a/CyberBits/GlobalUsings.cs b/CyberBits/GlobalUsings.cs deleted file mode 100644 index 7345cfd..0000000 --- a/CyberBits/GlobalUsings.cs +++ /dev/null @@ -1,5 +0,0 @@ -global using CyberBits.Common; -global using Godot; -global using Engine = twodog.Engine; -global using Env = System.Environment; -global using System.Text.Json; diff --git a/CyberBits/ImageHelper.cs b/CyberBits/ImageHelper.cs new file mode 100644 index 0000000..808204b --- /dev/null +++ b/CyberBits/ImageHelper.cs @@ -0,0 +1,34 @@ +namespace CyberBits; + +using System; +using System.IO; +using System.Net.Http; +using System.Threading.Tasks; +using Avalonia.Media.Imaging; +using Avalonia.Platform; + +public static class ImageHelper +{ + private static readonly HttpClient HttpClient = new(); + + public static Bitmap LoadFromResource(Uri resourceUri) + { + return new Bitmap(AssetLoader.Open(resourceUri)); + } + + public static async Task LoadFromWeb(Uri url) + { + try + { + var response = await HttpClient.GetAsync(url); + response.EnsureSuccessStatusCode(); + var data = await response.Content.ReadAsByteArrayAsync(); + return new Bitmap(new MemoryStream(data)); + } + catch (HttpRequestException ex) + { + Console.WriteLine($"An error occurred while downloading image '{url}' : {ex.Message}"); + return null; + } + } +} diff --git a/CyberBits/Program.cs b/CyberBits/Program.cs index 0dc4615..0cdeb4a 100644 --- a/CyberBits/Program.cs +++ b/CyberBits/Program.cs @@ -1,55 +1,24 @@ -// Create and start the Godot engine with your project -using var engine = new Engine("CyberBits", Engine.ResolveProjectDir()); -using var godot = engine.Start(); +using Avalonia; +using System; -// Load your main scene -var scene = GD.Load("res://main.tscn"); -engine.Tree.Root.AddChild(scene.Instantiate()); +namespace CyberBits; -var load = engine.Tree.CurrentScene; - -var bitsImage = load.GetNode("BitsImage"); -// var bitsSelection = curScene.GetNode("BitsSelection"); -var unlockedFeatLbl = load.GetNode