mirror of
https://git.tonybark.com/tonytins/CyberBits.git
synced 2026-05-12 05:23:34 -04:00
Moved a lot of core functionality into new Common library
- Remove System.IO from Implicit Usings.
This commit is contained in:
parent
1f2032dcf8
commit
fb013f2b15
18 changed files with 169 additions and 14 deletions
15
.idea/.idea.CyberBits/.idea/.gitignore
generated
vendored
Normal file
15
.idea/.idea.CyberBits/.idea/.gitignore
generated
vendored
Normal file
|
|
@ -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
|
||||
8
.idea/.idea.CyberBits/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.CyberBits/.idea/indexLayout.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.CyberBits/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.CyberBits/.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
6
CyberBits.Common/Addon.cs
Normal file
6
CyberBits.Common/Addon.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public record Addon(
|
||||
[property: JsonPropertyName("cyberware")]
|
||||
string[] Cyberware
|
||||
);
|
||||
12
CyberBits.Common/Bits.cs
Normal file
12
CyberBits.Common/Bits.cs
Normal file
|
|
@ -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
|
||||
);
|
||||
8
CyberBits.Common/CBConsts.cs
Normal file
8
CyberBits.Common/CBConsts.cs
Normal file
|
|
@ -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}";
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RollForward>LatestMajor</RollForward>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Remove="System.IO" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GitInfo" Version="3.6.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="GodotSharp" Version="4.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
31
CyberBits.Common/FileFetcher.cs
Normal file
31
CyberBits.Common/FileFetcher.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
6
CyberBits.Common/GlobalUsing.cs
Normal file
6
CyberBits.Common/GlobalUsing.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// System
|
||||
global using sys = System;
|
||||
global using System.Text.Json.Serialization;
|
||||
|
||||
// Godot
|
||||
global using Godot;
|
||||
8
CyberBits.Common/ResourceFiles.cs
Normal file
8
CyberBits.Common/ResourceFiles.cs
Normal file
|
|
@ -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";
|
||||
}
|
||||
|
|
@ -2,5 +2,9 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<RollForward>LatestMajor</RollForward>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CyberBits.Common\CyberBits.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<RollForward>LatestMajor</RollForward>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 2dog packages -->
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
<Solution>
|
||||
<Folder Name="/Solution Items/">
|
||||
<File Path="GitInfo.txt" />
|
||||
<File Path=".gitignore" />
|
||||
<File Path="README.md" />
|
||||
</Folder>
|
||||
<Project Path="CyberBits.Common/CyberBits.Common.csproj" />
|
||||
<Project Path="CyberBits.Godot/CyberBits.Godot.csproj" />
|
||||
<Project Path="CyberBits.Tests/CyberBits.Tests.csproj" />
|
||||
<Project Path="CyberBits/CyberBits.csproj" />
|
||||
|
|
|
|||
|
|
@ -5,14 +5,20 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<RollForward>LatestMajor</RollForward>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="2dog" Version="0.1.23-pre"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Remove="System.IO" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../CyberBits.Godot/CyberBits.Godot.csproj"/>
|
||||
<ProjectReference Include="..\CyberBits.Common\CyberBits.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Godot project location -->
|
||||
|
|
|
|||
5
CyberBits/GlobalUsings.cs
Normal file
5
CyberBits/GlobalUsings.cs
Normal file
|
|
@ -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;
|
||||
|
|
@ -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<PackedScene>("res://main.tscn");
|
||||
engine.Tree.Root.AddChild(scene.Instantiate());
|
||||
|
||||
var load = engine.Tree.CurrentScene;
|
||||
|
||||
var bitsImage = load.GetNode<TextureRect>("BitsImage");
|
||||
// var bitsSelection = curScene.GetNode<OptionButton>("BitsSelection");
|
||||
var unlockedFeatLbl = load.GetNode<Label>("UnlockedFeatLbl");
|
||||
var cyberwareList = load.GetNode<ItemList>("CyberwareList");
|
||||
var genitalList = load.GetNode<ItemList>("GenitalList");
|
||||
|
||||
var baseContents = FileFetcher.LoadTextFile(ResourceFiles.COCK_JSON);
|
||||
var addonContents = FileFetcher.LoadTextFile(ResourceFiles.ADDONS_JSON);
|
||||
|
||||
var screenSize = DisplayServer.ScreenGetSize();
|
||||
var window = load.GetWindow();
|
||||
window.Size = new Vector2I(screenSize.X - 66, screenSize.Y - 1);
|
||||
|
||||
ProjectSettings.SetSetting("application/config/version", CBConsts.VERSION);
|
||||
|
||||
if (!FileAccess.FileExists(baseContents)
|
||||
|| !FileAccess.FileExists(addonContents))
|
||||
Env.Exit(Env.ExitCode);
|
||||
|
||||
var bits = JsonSerializer.Deserialize<Bits>(baseContents);
|
||||
var addon = JsonSerializer.Deserialize<Addon>(addonContents);
|
||||
|
||||
bitsImage.Texture.ResourcePath = bits.Image;
|
||||
unlockedFeatLbl.Text = $"Feat: {bits?.Feat}";
|
||||
|
||||
foreach (var selection in bits.Base)
|
||||
genitalList.AddItem(selection);
|
||||
|
||||
foreach (var cyberware in addon.Cyberware)
|
||||
cyberwareList.AddItem(cyberware);
|
||||
|
||||
|
||||
GD.Print("2dog is running! Close window or press 'Q' to quit.");
|
||||
Console.WriteLine("Press 'Q' to quit.");
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ Loosely based on [Penis 2.0.77](https://glaiveguisarme.itch.io/penis-two-point-z
|
|||
### Prerequisites
|
||||
|
||||
- .NET 8 or later
|
||||
- [Godot Mono](https://godotengine.org/)
|
||||
- [Godot (.NET)](https://godotengine.org/)
|
||||
|
||||
Supported platforms: `win-x64`, `linux-x64`, and `osx-arm64`.
|
||||
|
||||
## License
|
||||
|
||||
I license this project under the GPL-3.0 license - see [LICENSE](LICENSE) for details.
|
||||
I license this project under the GPL-2.0 license - see [LICENSE](LICENSE) for details.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue