From fb013f2b15f2e4a2820c6ae1ac76e4bb610ece42 Mon Sep 17 00:00:00 2001 From: Tony Bark <35226681+tonytins@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:34:12 -0400 Subject: [PATCH] Moved a lot of core functionality into new Common library - Remove System.IO from Implicit Usings. --- .idea/.idea.CyberBits/.idea/.gitignore | 15 ++++++++ .idea/.idea.CyberBits/.idea/indexLayout.xml | 8 +++++ .idea/.idea.CyberBits/.idea/vcs.xml | 6 ++++ CyberBits.Common/Addon.cs | 6 ++++ CyberBits.Common/Bits.cs | 12 +++++++ CyberBits.Common/CBConsts.cs | 8 +++++ CyberBits.Common/Class1.cs | 6 ---- CyberBits.Common/CyberBits.Common.csproj | 10 ++++-- CyberBits.Common/FileFetcher.cs | 31 ++++++++++++++++ CyberBits.Common/GlobalUsing.cs | 6 ++++ CyberBits.Common/ResourceFiles.cs | 8 +++++ CyberBits.Godot/CyberBits.Godot.csproj | 4 +++ CyberBits.Tests/CyberBits.Tests.csproj | 1 + CyberBits.slnx | 6 ++++ CyberBits/CyberBits.csproj | 6 ++++ CyberBits/GlobalUsings.cs | 5 +++ CyberBits/Program.cs | 39 ++++++++++++++++++--- README.md | 6 ++-- 18 files changed, 169 insertions(+), 14 deletions(-) create mode 100644 .idea/.idea.CyberBits/.idea/.gitignore create mode 100644 .idea/.idea.CyberBits/.idea/indexLayout.xml create mode 100644 .idea/.idea.CyberBits/.idea/vcs.xml create mode 100644 CyberBits.Common/Addon.cs create mode 100644 CyberBits.Common/Bits.cs create mode 100644 CyberBits.Common/CBConsts.cs delete mode 100644 CyberBits.Common/Class1.cs create mode 100644 CyberBits.Common/FileFetcher.cs create mode 100644 CyberBits.Common/GlobalUsing.cs create mode 100644 CyberBits.Common/ResourceFiles.cs create mode 100644 CyberBits/GlobalUsings.cs diff --git a/.idea/.idea.CyberBits/.idea/.gitignore b/.idea/.idea.CyberBits/.idea/.gitignore new file mode 100644 index 0000000..1a9ab9f --- /dev/null +++ b/.idea/.idea.CyberBits/.idea/.gitignore @@ -0,0 +1,15 @@ +# 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/indexLayout.xml b/.idea/.idea.CyberBits/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.CyberBits/.idea/indexLayout.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 new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.CyberBits/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CyberBits.Common/Addon.cs b/CyberBits.Common/Addon.cs new file mode 100644 index 0000000..7c94bbb --- /dev/null +++ b/CyberBits.Common/Addon.cs @@ -0,0 +1,6 @@ +namespace CyberBits.Common; + +public record Addon( + [property: JsonPropertyName("cyberware")] + string[] Cyberware + ); diff --git a/CyberBits.Common/Bits.cs b/CyberBits.Common/Bits.cs new file mode 100644 index 0000000..516f2f0 --- /dev/null +++ b/CyberBits.Common/Bits.cs @@ -0,0 +1,12 @@ +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/CBConsts.cs b/CyberBits.Common/CBConsts.cs new file mode 100644 index 0000000..aeb70d9 --- /dev/null +++ b/CyberBits.Common/CBConsts.cs @@ -0,0 +1,8 @@ +namespace CyberBits.Common; + +public struct CBConsts +{ + // Ignore VSCode if it complains about "ThisAssembly" not being found. + public const string VERSION = + $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}"; +} diff --git a/CyberBits.Common/Class1.cs b/CyberBits.Common/Class1.cs deleted file mode 100644 index b58ee50..0000000 --- a/CyberBits.Common/Class1.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace CyberBits.Common; - -public class Class1 -{ - -} diff --git a/CyberBits.Common/CyberBits.Common.csproj b/CyberBits.Common/CyberBits.Common.csproj index 6ff2815..a7794aa 100644 --- a/CyberBits.Common/CyberBits.Common.csproj +++ b/CyberBits.Common/CyberBits.Common.csproj @@ -1,16 +1,22 @@  - net10.0 - enable + net8.0 enable + LatestMajor + enable + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/CyberBits.Common/FileFetcher.cs b/CyberBits.Common/FileFetcher.cs new file mode 100644 index 0000000..91ed192 --- /dev/null +++ b/CyberBits.Common/FileFetcher.cs @@ -0,0 +1,31 @@ +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 new file mode 100644 index 0000000..2e66d5e --- /dev/null +++ b/CyberBits.Common/GlobalUsing.cs @@ -0,0 +1,6 @@ +// 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 new file mode 100644 index 0000000..46bd4ef --- /dev/null +++ b/CyberBits.Common/ResourceFiles.cs @@ -0,0 +1,8 @@ +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 index 70a73a3..576a44a 100644 --- a/CyberBits.Godot/CyberBits.Godot.csproj +++ b/CyberBits.Godot/CyberBits.Godot.csproj @@ -2,5 +2,9 @@ net8.0 true + LatestMajor + + + diff --git a/CyberBits.Tests/CyberBits.Tests.csproj b/CyberBits.Tests/CyberBits.Tests.csproj index 4cc74d8..ff01f66 100644 --- a/CyberBits.Tests/CyberBits.Tests.csproj +++ b/CyberBits.Tests/CyberBits.Tests.csproj @@ -4,6 +4,7 @@ enable enable false + LatestMajor diff --git a/CyberBits.slnx b/CyberBits.slnx index a8fb23e..8c8f124 100644 --- a/CyberBits.slnx +++ b/CyberBits.slnx @@ -1,4 +1,10 @@ + + + + + + diff --git a/CyberBits/CyberBits.csproj b/CyberBits/CyberBits.csproj index 806246e..670ba77 100644 --- a/CyberBits/CyberBits.csproj +++ b/CyberBits/CyberBits.csproj @@ -5,14 +5,20 @@ enable enable false + LatestMajor + + + + + diff --git a/CyberBits/GlobalUsings.cs b/CyberBits/GlobalUsings.cs new file mode 100644 index 0000000..7345cfd --- /dev/null +++ b/CyberBits/GlobalUsings.cs @@ -0,0 +1,5 @@ +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/Program.cs b/CyberBits/Program.cs index d1f002d..0dc4615 100644 --- a/CyberBits/Program.cs +++ b/CyberBits/Program.cs @@ -1,6 +1,3 @@ -using Godot; -using Engine = twodog.Engine; - // Create and start the Godot engine with your project using var engine = new Engine("CyberBits", Engine.ResolveProjectDir()); using var godot = engine.Start(); @@ -9,6 +6,40 @@ using var godot = engine.Start(); var scene = GD.Load("res://main.tscn"); engine.Tree.Root.AddChild(scene.Instantiate()); +var load = engine.Tree.CurrentScene; + +var bitsImage = load.GetNode("BitsImage"); +// var bitsSelection = curScene.GetNode("BitsSelection"); +var unlockedFeatLbl = load.GetNode