add: registry pass through
This commit is contained in:
@@ -40,9 +40,13 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedFiles Include="$(MSBuildThisFileDirectory)embedded/**/*.*"/>
|
||||
</ItemGroup>
|
||||
<Copy
|
||||
SourceFiles="@(EmbeddedFiles)"
|
||||
DestinationFolder="$(ProjectDir)embedded/%(RecursiveDir)"
|
||||
<Copy
|
||||
SourceFiles="@(EmbeddedFiles)"
|
||||
DestinationFolder="$(ProjectDir)embedded/%(RecursiveDir)"
|
||||
/>
|
||||
<Copy
|
||||
SourceFiles="$(MSBuildThisFileDirectory)editorconfig"
|
||||
DestinationFiles="$(ProjectDir).editorconfig"
|
||||
/>
|
||||
<ItemGroup>
|
||||
<PoloniumTemplateFiles Include="$(MSBuildThisFileDirectory)embedded/polonium_templates/**/*.*" />
|
||||
|
||||
2
Package/build/editorconfig
Normal file
2
Package/build/editorconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
[embedded/*]
|
||||
generated_code = true
|
||||
@@ -45,7 +45,6 @@ public static partial class GlobalRegistry
|
||||
}
|
||||
public static PoloniumRegistry PoloniumRegistry => PoloniumRegistry.Instance;
|
||||
public static bool Paused { get; set; }
|
||||
public static HashSet<ITimeConsumer> TimeConsumers { get; } = [];
|
||||
public static void Prepare() => PoloniumRegistry.Prepare();
|
||||
|
||||
// ReSharper disable once PartialTypeWithSinglePart
|
||||
|
||||
@@ -24,17 +24,25 @@
|
||||
TemplateDirectory="$(ProjectDir)Package/embedded/polonium_templates"
|
||||
AttributeName="ProxyNode"
|
||||
/>
|
||||
<Delete
|
||||
Files="$(ProjectDir)Package/embedded/RegistryPassThrough.p.cs"
|
||||
Condition="Exists('$(ProjectDir)Package/embedded/RegistryPassThrough.p.cs')"
|
||||
/>
|
||||
<GenerateRegistryPassThrough ProjectDir="$(ProjectDir)" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="NuGet.config" />
|
||||
<None Include="Package/build/$(AssemblyName).targets" Pack="true" PackagePath="build" />
|
||||
<None Include="Package/build/$(AssemblyName).props" Pack="true" PackagePath="build" />
|
||||
<None Include="Package/build/**/*" Pack="true" PackagePath="build" />
|
||||
<None Include="Package/embedded/**/*.*" Pack="true" PackagePath="build/embedded" />
|
||||
<None Include="publish" />
|
||||
<Compile Remove="Package/**/*.*"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Package\build\editorconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CleanPreviousPackages" BeforeTargets="Build">
|
||||
<Message Text="Cleaning Previous Packages -------------------------" Importance="high" />
|
||||
<Message Text="Cleaning --------------------------------------------" Importance="high" />
|
||||
|
||||
6
src/Attributes/RegistryPassThrough.cs
Normal file
6
src/Attributes/RegistryPassThrough.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Polonium.Attributes;
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class RegistryPassThrough(bool getterOnly = false) : Attribute
|
||||
{
|
||||
public bool GetterOnly { get; set; } = getterOnly;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Godot;
|
||||
using Polonium.Agents;
|
||||
using Polonium.Attributes;
|
||||
using Polonium.Interfaces;
|
||||
using Polonium.Resources;
|
||||
|
||||
@@ -9,16 +10,22 @@ public class PoloniumRegistry
|
||||
{
|
||||
private static PoloniumRegistry InternalInstance { get; set; }
|
||||
public static PoloniumRegistry Instance => InternalInstance ??= new PoloniumRegistry();
|
||||
[RegistryPassThrough]
|
||||
public Config Config { get; set; }
|
||||
[RegistryPassThrough]
|
||||
public Save Save { get; set; }
|
||||
|
||||
public static void Prepare()
|
||||
{
|
||||
DirAccess.MakeDirAbsolute("user://saves");
|
||||
}
|
||||
public Dictionary<string, Agent> Agents { get; set; } = new();
|
||||
// ReSharper disable once CollectionNeverQueried.Global
|
||||
[RegistryPassThrough(true)]
|
||||
public Dictionary<string, Agent> Agents { get; } = new();
|
||||
|
||||
public HashSet<ITimeConsumer> TimeConsumers { get; set; } = new();
|
||||
// ReSharper disable once CollectionNeverQueried.Global
|
||||
[RegistryPassThrough(true)]
|
||||
public HashSet<ITimeConsumer> TimeConsumers { get; } = new();
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user