Merge pull request 'draft_texture_button' (#2) from draft_texture_button into master
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
7
Package/build/Polonium.props
Normal file
7
Package/build/Polonium.props
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<PoloniumTemplateTargetPath>$(ProjectDir)script_templates/</PoloniumTemplateTargetPath>
|
||||||
|
<PoloniumTemplateManifest>$(ProjectDir)embedded/templates.polonium.manifest</PoloniumTemplateManifest>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,38 +1,29 @@
|
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<ItemGroup>
|
||||||
<PoloniumTemplateTargetPath>$(ProjectDir)script_templates/</PoloniumTemplateTargetPath>
|
<Folder Include="Concepts"/>
|
||||||
<PoloniumTemplateManifest>$(PoloniumTemplateTargetPath).polonium.manifest</PoloniumTemplateManifest>
|
<Folder Include="Assets"/>
|
||||||
</PropertyGroup>
|
<Folder Include="Registries"/>
|
||||||
<ItemGroup Label="Scene">
|
<Folder Include="Data"/>
|
||||||
|
<Folder Include="Resources"/>
|
||||||
|
<None Include="script_templates/**/*.*"/>
|
||||||
|
<Compile Remove="script_templates/**/*.*"/>
|
||||||
|
<Compile Remove="embedded/polonium_templates/**/*.cs"/>
|
||||||
<AdditionalFiles Include="Assets/**/*.tscn"/>
|
<AdditionalFiles Include="Assets/**/*.tscn"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="EnsureFolders" BeforeTargets="BeforeBuild">
|
|
||||||
|
<Target Name="PoloniumPrepare" BeforeTargets="PoloniumClean">
|
||||||
<Message Text="Executing EnsureFolders target" Importance="High"/>
|
<Message Text="Executing EnsureFolders target" Importance="High"/>
|
||||||
<Message Text="$(ProjectDir)" Importance="High"/>
|
<Message Text="$(ProjectDir)" Importance="High"/>
|
||||||
<MakeDir Directories="$(ProjectDir)Assets" Condition="!Exists('$(ProjectDir)Assets')"/>
|
<MakeDir Directories="$(ProjectDir)Assets" Condition="!Exists('$(ProjectDir)Assets')"/>
|
||||||
<MakeDir Directories="$(ProjectDir)Concepts" Condition="!Exists('$(ProjectDir)Concepts')"/>
|
<MakeDir Directories="$(ProjectDir)Concepts" Condition="!Exists('$(ProjectDir)Concepts')"/>
|
||||||
<MakeDir Directories="$(ProjectDir)Registries" Condition="!Exists('$(ProjectDir)Registries')"/>
|
<MakeDir Directories="$(ProjectDir)Registries" Condition="!Exists('$(ProjectDir)Registries')"/>
|
||||||
<MakeDir Directories="$(ProjectDir)Data" Condition="!Exists('$(ProjectDir)Data')"/>
|
<MakeDir Directories="$(ProjectDir)Data" Condition="!Exists('$(ProjectDir)Data')"/>
|
||||||
|
<MakeDir Directories="$(ProjectDir)Resources" Condition="!Exists('$(ProjectDir)Resources')"/>
|
||||||
|
<MakeDir Directories="$(ProjectDir)Resources/ButtonTextureSet" Condition="!Exists('$(ProjectDir)Resources/ButtonTextureSet')"/>
|
||||||
<MakeDir Directories="$(ProjectDir)script_templates" Condition="!Exists('$(ProjectDir)script_templates')"/>
|
<MakeDir Directories="$(ProjectDir)script_templates" Condition="!Exists('$(ProjectDir)script_templates')"/>
|
||||||
<Exec
|
|
||||||
Command='rmdir "$(ProjectDir)GlobalClasses"'
|
|
||||||
Condition="'$(OS)'=='Windows_NT' and Exists('$(ProjectDir)GlobalClasses')"
|
|
||||||
/>
|
|
||||||
<Exec
|
|
||||||
Command='mklink /D "$(ProjectDir)GlobalClasses" "$(MSBuildThisFileDirectory)GlobalClasses"'
|
|
||||||
Condition="'$(OS)'=='Windows_NT' and !Exists('$(ProjectDir)GlobalClasses')"
|
|
||||||
/>
|
|
||||||
<Exec
|
|
||||||
Command='rm -rf "$(ProjectDir)GlobalClasses"'
|
|
||||||
Condition="'$(OS)'!='Windows_NT' and Exists('$(ProjectDir)GlobalClasses')"
|
|
||||||
/>
|
|
||||||
<Exec
|
|
||||||
Command='ln -s "$(MSBuildThisFileDirectory)GlobalClasses" "$(ProjectDir)GlobalClasses"'
|
|
||||||
Condition="'$(OS)'!='Windows_NT' and !Exists('$(ProjectDir)GlobalClasses')"
|
|
||||||
/>
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="CleanPoloniumTemplates" BeforeTargets="CopyPoloniumTemplates">
|
<Target Name="PoloniumClean" DependsOnTargets="PoloniumPrepare" BeforeTargets="PoloniumRegenerate">
|
||||||
<ReadLinesFromFile
|
<ReadLinesFromFile
|
||||||
File="$(PoloniumTemplateManifest)"
|
File="$(PoloniumTemplateManifest)"
|
||||||
Condition="Exists('$(PoloniumTemplateManifest)')"
|
Condition="Exists('$(PoloniumTemplateManifest)')"
|
||||||
@@ -40,21 +31,27 @@
|
|||||||
<Output TaskParameter="Lines" ItemName="PreviousTemplateFiles"/>
|
<Output TaskParameter="Lines" ItemName="PreviousTemplateFiles"/>
|
||||||
</ReadLinesFromFile>
|
</ReadLinesFromFile>
|
||||||
<Delete Files="@(PreviousTemplateFiles)" Condition="@(PreviousTemplateFiles) != ''" />
|
<Delete Files="@(PreviousTemplateFiles)" Condition="@(PreviousTemplateFiles) != ''" />
|
||||||
<Delete
|
<RemoveDir Directories="$(ProjectDir)embedded" Condition="Exists('$(ProjectDir)embedded')"/>
|
||||||
Files="$(PoloniumTemplateManifest)"
|
|
||||||
Condition="Exists('$(PoloniumTemplateManifest)')"
|
|
||||||
/>
|
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="CopyPoloniumTemplates" DependsOnTargets="CleanPoloniumTemplates" AfterTargets="Build">
|
|
||||||
|
|
||||||
|
<Target Name="PoloniumRegenerate" DependsOnTargets="PoloniumClean" BeforeTargets="CoreCompile">
|
||||||
|
<MakeDir Directories="$(ProjectDir)" Condition="!Exists('$(ProjectDir)embedded')"/>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PoloniumTemplateFiles Include="$(MSBuildThisFileDirectory)polonium_templates/**/*.*"/>
|
<EmbeddedFiles Include="$(MSBuildThisFileDirectory)embedded/**/*.*"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<Copy
|
||||||
|
SourceFiles="@(EmbeddedFiles)"
|
||||||
|
DestinationFolder="$(ProjectDir)embedded/%(RecursiveDir)"
|
||||||
|
/>
|
||||||
|
<ItemGroup>
|
||||||
|
<PoloniumTemplateFiles Include="$(MSBuildThisFileDirectory)embedded/polonium_templates/**/*.*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Message Text="Executing Copy Task" Importance="high"/>
|
|
||||||
<Copy
|
<Copy
|
||||||
SourceFiles="@(PoloniumTemplateFiles)"
|
SourceFiles="@(PoloniumTemplateFiles)"
|
||||||
DestinationFiles="@(PoloniumTemplateFiles->'$(PoloniumTemplateTargetPath)%(RecursiveDir)%(FileName)%(Extension)')"
|
DestinationFiles="@(PoloniumTemplateFiles->'$(PoloniumTemplateTargetPath)%(RecursiveDir)%(FileName)%(Extension)')"
|
||||||
>
|
>
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="CopiedTemplates"/>
|
<Output TaskParameter="CopiedFiles" ItemName="CopiedTemplates" />
|
||||||
</Copy>
|
</Copy>
|
||||||
<WriteLinesToFile
|
<WriteLinesToFile
|
||||||
File="$(PoloniumTemplateManifest)"
|
File="$(PoloniumTemplateManifest)"
|
||||||
@@ -62,14 +59,11 @@
|
|||||||
Overwrite="true"
|
Overwrite="true"
|
||||||
Encoding="UTF-8"
|
Encoding="UTF-8"
|
||||||
/>
|
/>
|
||||||
|
<GenerateTextureSetTask
|
||||||
|
RootPath="$(ProjectDir)Resources/ButtonTextureSet/"
|
||||||
|
OutputPath="$(ProjectDir)embedded/"
|
||||||
|
/>
|
||||||
</Target>
|
</Target>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Concepts"/>
|
|
||||||
<Folder Include="Assets"/>
|
|
||||||
<Folder Include="Registries"/>
|
|
||||||
<Folder Include="Data"/>
|
|
||||||
<None Include="script_templates/**/*.*"/>
|
|
||||||
<Compile Remove="script_templates/**/*.*"/>
|
|
||||||
<PackageReference Include="Polonium.Generators" Version="0.1.1-x" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#pragma warning disable IDE0130
|
||||||
|
using Godot;
|
||||||
|
using Polonium.Attributes;
|
||||||
|
using Polonium.DataStructures;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Polonium.Interfaces;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace GlobalClasses;
|
||||||
|
[GlobalClass]
|
||||||
|
[Tool]
|
||||||
|
[ProxyNode]
|
||||||
|
public partial class PoloniumTextureButton : TextureButton
|
||||||
|
{
|
||||||
|
[ProxyProperty]
|
||||||
|
public virtual TextureSet TextureSet => null;
|
||||||
|
|
||||||
|
private GlobalRegistry.TextureSetName PrivateTextureSetName { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public GlobalRegistry.TextureSetName TextureSetName
|
||||||
|
{
|
||||||
|
get => PrivateTextureSetName;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
PrivateTextureSetName = value;
|
||||||
|
t = GlobalRegistry.TextureSetMap.GetValueOrDefault(value, null);
|
||||||
|
if (t is not null)
|
||||||
|
{
|
||||||
|
TextureNormal = t.Normal;
|
||||||
|
TextureHover = t.Hover;
|
||||||
|
TexturePressed = t.Pressed;
|
||||||
|
TextureDisabled = t.Disabled;
|
||||||
|
TextureFocused = t.Focused;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void _Ready()
|
||||||
|
{
|
||||||
|
TextureSet t = TextureSet;
|
||||||
|
if (t is null)
|
||||||
|
t = GlobalRegistry.TextureSetMap.GetValueOrDefault(TextureSetName, null);
|
||||||
|
if (t is not null)
|
||||||
|
{
|
||||||
|
TextureNormal = t.Normal;
|
||||||
|
TextureHover = t.Hover;
|
||||||
|
TexturePressed = t.Pressed;
|
||||||
|
TextureDisabled = t.Disabled;
|
||||||
|
TextureFocused = t.Focused;
|
||||||
|
}
|
||||||
|
|
||||||
|
__Ready();
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
[ProxyMethod]
|
||||||
|
public virtual void __Ready()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore IDE0130
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using Polonium.Attributes;
|
using Polonium.Attributes;
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace GlobalClasses;
|
namespace GlobalClasses;
|
||||||
[ProxyNode]
|
[ProxyNode]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
@@ -20,9 +20,16 @@ public partial class CameraScene : Scene
|
|||||||
get => Camera.Zoom.X;
|
get => Camera.Zoom.X;
|
||||||
set => Camera.Zoom = value * Vector2.One;
|
set => Camera.Zoom = value * Vector2.One;
|
||||||
}
|
}
|
||||||
public override void _Ready()
|
|
||||||
|
[ProxyMethod]
|
||||||
|
public virtual void __Ready()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void _Ready()
|
||||||
{
|
{
|
||||||
Camera = GetNode<Camera2D>("Camera");
|
Camera = GetNode<Camera2D>("Camera");
|
||||||
|
__Ready();
|
||||||
base._Ready();
|
base._Ready();
|
||||||
}
|
}
|
||||||
protected void ZoomIn() => Zoom = Mathf.Max(Zoom * (1 + ZoomRate), MaxZoom);
|
protected void ZoomIn() => Zoom = Mathf.Max(Zoom * (1 + ZoomRate), MaxZoom);
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
#pragma warning disable IDE0130
|
||||||
using Godot;
|
using Godot;
|
||||||
using Polonium.Attributes;
|
using Polonium.Attributes;
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace GlobalClasses;
|
namespace GlobalClasses;
|
||||||
[ProxyNode]
|
[ProxyNode]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
@@ -12,7 +13,7 @@ public partial class DissolveScene : Scene
|
|||||||
private bool Finished { get; set; } = false;
|
private bool Finished { get; set; } = false;
|
||||||
private bool Terminated { get; set; } = false;
|
private bool Terminated { get; set; } = false;
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public sealed override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if(Finished && !Terminated)
|
if(Finished && !Terminated)
|
||||||
{
|
{
|
||||||
@@ -21,15 +22,15 @@ public partial class DissolveScene : Scene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process(delta);
|
__Process(delta);
|
||||||
base._Process(delta);
|
base._Process(delta);
|
||||||
}
|
}
|
||||||
[ProxyMethod]
|
[ProxyMethod]
|
||||||
public virtual void Enter()
|
public virtual void __Enter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
[ProxyMethod]
|
[ProxyMethod]
|
||||||
public virtual void Process(double delta)
|
public virtual void __Process(double delta)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +38,8 @@ public partial class DissolveScene : Scene
|
|||||||
{
|
{
|
||||||
Finished = false;
|
Finished = false;
|
||||||
Terminated = false;
|
Terminated = false;
|
||||||
Enter();
|
__Enter();
|
||||||
base._EnterTree();
|
base._EnterTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma warning restore IDE0130
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
|
#pragma warning disable IDE0130
|
||||||
using Godot;
|
using Godot;
|
||||||
using Polonium.Attributes;
|
using Polonium.Attributes;
|
||||||
using Polonium.Interfaces;
|
using Polonium.Interfaces;
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace GlobalClasses;
|
namespace GlobalClasses;
|
||||||
[ProxyNode]
|
[ProxyNode]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
@@ -19,28 +20,44 @@ public partial class RootScene : Scene
|
|||||||
CurrentScene = scene;
|
CurrentScene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Ready()
|
|
||||||
{
|
|
||||||
GlobalRegistry.RootScene = this;
|
|
||||||
base._Ready();
|
|
||||||
}
|
|
||||||
|
|
||||||
[ProxyMethod]
|
[ProxyMethod]
|
||||||
public virtual void Enter()
|
public virtual void __Enter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _EnterTree()
|
[ProxyMethod]
|
||||||
|
public virtual void __Ready()
|
||||||
{
|
{
|
||||||
Enter();
|
}
|
||||||
|
|
||||||
|
[ProxyMethod]
|
||||||
|
public virtual void __Process(double delta)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void _EnterTree()
|
||||||
|
{
|
||||||
|
GlobalRegistry.Prepare();
|
||||||
|
GlobalRegistry.Start();
|
||||||
|
__Enter();
|
||||||
base._EnterTree();
|
base._EnterTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public sealed override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if(!GlobalRegistry.Paused)
|
if(!GlobalRegistry.Paused)
|
||||||
foreach (ITimeConsumer tc in GlobalRegistry.TimeConsumers)
|
foreach (ITimeConsumer tc in GlobalRegistry.TimeConsumers)
|
||||||
tc.Process(delta);
|
tc.Process(delta);
|
||||||
|
__Process(delta);
|
||||||
base._Process(delta);
|
base._Process(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed override void _Ready()
|
||||||
|
{
|
||||||
|
GlobalRegistry.RootScene = this;
|
||||||
|
__Ready();
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#pragma warning restore IDE0130
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
#pragma warning disable IDE0130
|
||||||
using Godot;
|
using Godot;
|
||||||
using Polonium.Attributes;
|
using Polonium.Attributes;
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace GlobalClasses;
|
namespace GlobalClasses;
|
||||||
[ProxyNode]
|
[ProxyNode]
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
@@ -9,3 +10,4 @@ public partial class Scene : Node2D
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#pragma warning restore IDE0130
|
||||||
57
Package/embedded/Patches/GlobalRegistry.p.cs
Normal file
57
Package/embedded/Patches/GlobalRegistry.p.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#pragma warning disable IDE0130
|
||||||
|
#pragma warning disable CA1000
|
||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using Polonium.Attributes;
|
||||||
|
using Polonium;
|
||||||
|
using Polonium.Interfaces;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
public static partial class GlobalRegistry
|
||||||
|
{
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
PoloniumRegistry.Prepare();
|
||||||
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
IEnumerable<Type> registerTypes = Utils.GetLoadableTypes(assembly);
|
||||||
|
registerTypes = registerTypes.Where(t => t.IsClass && t.GetCustomAttributes(typeof(AutoRegister), false).Any());
|
||||||
|
foreach (Type t in registerTypes)
|
||||||
|
{
|
||||||
|
MethodInfo registerMethod = t.GetMethod("Register", BindingFlags.Static | BindingFlags.Public);
|
||||||
|
if (registerMethod != null)
|
||||||
|
registerMethod.Invoke(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Asset<T> where T : Node
|
||||||
|
{
|
||||||
|
private static readonly Queue<T> Pool = new();
|
||||||
|
// ReSharper disable once StaticMemberInGenericType
|
||||||
|
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||||
|
public static PackedScene Scene { get; set; }
|
||||||
|
private static T Instance => Scene.Instantiate<T>();
|
||||||
|
public static T Get() => Pool.Count > 0 ? Pool.Dequeue() : Instance;
|
||||||
|
|
||||||
|
public static void Return(T obj)
|
||||||
|
{
|
||||||
|
if(Pool.Count < 10)
|
||||||
|
Pool.Enqueue(obj);
|
||||||
|
else
|
||||||
|
obj.QueueFree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
|
public static partial class TextureSets
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore IDE0130
|
||||||
|
#pragma warning restore CA1000
|
||||||
@@ -13,37 +13,26 @@
|
|||||||
<DisableImplicitRestore>true</DisableImplicitRestore>
|
<DisableImplicitRestore>true</DisableImplicitRestore>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GodotSharp" Version="4.4.0-beta.3" />
|
|
||||||
<PackageReference Include="Polonium.Tasks" Version="0.1.1-x" />
|
<PackageReference Include="Polonium.Tasks" Version="0.1.1-x" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="GenerateProxyNodes" BeforeTargets="BeforeBuild">
|
<Target Name="Prepare" BeforeTargets="BeforeBuild">
|
||||||
|
<RemoveDir Directories="$(ProjectDir)Package/embedded/polonium_templates" Condition="Exists('$(ProjectDir)Package/polonium_templates')"/>
|
||||||
|
<MakeDir Directories="$(ProjectDir)Package/embedded/polonium_templates"/>
|
||||||
<GenerateProxyNodesTask
|
<GenerateProxyNodesTask
|
||||||
SourceDirectory="$(ProjectDir)GlobalClasses"
|
SourceDirectory="$(ProjectDir)Package/embedded/GlobalClasses"
|
||||||
TemplateDirectory="$(ProjectDir)polonium_templates"
|
TemplateDirectory="$(ProjectDir)Package/embedded/polonium_templates"
|
||||||
AttributeName="ProxyNode"
|
AttributeName="ProxyNode"
|
||||||
/>
|
/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="NuGet.config" />
|
<None Include="NuGet.config" />
|
||||||
<None
|
<None Include="Package/build/$(AssemblyName).targets" Pack="true" PackagePath="build" />
|
||||||
Include="Package/build/$(AssemblyName).targets"
|
<None Include="Package/build/$(AssemblyName).props" Pack="true" PackagePath="build" />
|
||||||
Pack="true"
|
<None Include="Package/embedded/**/*.*" Pack="true" PackagePath="build/embedded" />
|
||||||
PackagePath="build"
|
|
||||||
/>
|
|
||||||
<None
|
|
||||||
Include="GlobalClasses/**/*.cs"
|
|
||||||
Pack="true"
|
|
||||||
PackagePath="build\GlobalClasses"
|
|
||||||
/>
|
|
||||||
<None
|
|
||||||
Include="polonium_templates/**/*.cs"
|
|
||||||
Pack="true"
|
|
||||||
PackagePath="build/polonium_templates"
|
|
||||||
/>
|
|
||||||
<None Include="publish" />
|
<None Include="publish" />
|
||||||
<Compile Remove="polonium_templates/**/*.*" />
|
<None Include="build" />
|
||||||
<Compile Remove="GlobalClasses/**/*.cs" />
|
<Compile Remove="Package/**/*.*"/>
|
||||||
<Folder Include="polonium_templates" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="CleanPreviousPackages" BeforeTargets="Build">
|
<Target Name="CleanPreviousPackages" BeforeTargets="Build">
|
||||||
@@ -61,14 +50,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<NuGetPackages Include="$(OutputPath)*.nupkg" />
|
<NuGetPackages Include="$(OutputPath)*.nupkg" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Message Text="Printing pkgs--------------------" Importance="high"/>
|
<Message Text="Printing pkgs--------------------" Importance="high" />
|
||||||
<Message Text="Pkgs: @(NuGetPackages)" Importance="high"/>
|
<Message Text="Pkgs: @(NuGetPackages)" Importance="high" />
|
||||||
<Copy SourceFiles="@(NuGetPackages)" DestinationFolder="/NuGetFeed"/>
|
<Copy SourceFiles="@(NuGetPackages)" DestinationFolder="/NuGetFeed" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="RestoreNoCache" BeforeTargets="Build">
|
<Target Name="RestoreNoCache" BeforeTargets="Build">
|
||||||
<Message Text="Restoring packages with no chache" Importance="high"/>
|
<Message Text="Restoring packages with no chache" Importance="high" />
|
||||||
<Exec Command="dotnet restore --no-cache"/>
|
<Exec Command="dotnet restore --no-cache" />
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
22
Polonium.sln
22
Polonium.sln
@@ -2,12 +2,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polonium", "Polonium.csproj", "{5BA39DF8-7098-4348-A670-B3F34269F48F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polonium", "Polonium.csproj", "{5BA39DF8-7098-4348-A670-B3F34269F48F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polonium.Generators", "..\Polonium.Generators\Polonium.Generators.csproj", "{41B784D2-841C-44D6-90F3-9219BC264B19}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polonium.Generators.Test", "..\Polonium.Generators.Test\Polonium.Generators.Test.csproj", "{3BADB215-214B-41C1-B94E-89AF4A972F30}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polonium.Tasks", "..\Polonium.Tasks\Polonium.Tasks.csproj", "{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -16,28 +10,12 @@ Global
|
|||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{5BA39DF8-7098-4348-A670-B3F34269F48F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{41B784D2-841C-44D6-90F3-9219BC264B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{41B784D2-841C-44D6-90F3-9219BC264B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{41B784D2-841C-44D6-90F3-9219BC264B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{41B784D2-841C-44D6-90F3-9219BC264B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{41B784D2-841C-44D6-90F3-9219BC264B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{41B784D2-841C-44D6-90F3-9219BC264B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{41B784D2-841C-44D6-90F3-9219BC264B19}.Release|Any CPU.Build.0 = Release|Any CPU
|
{41B784D2-841C-44D6-90F3-9219BC264B19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{3BADB215-214B-41C1-B94E-89AF4A972F30}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{1B24F8AC-B185-48D0-835B-59857AF907E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{1B24F8AC-B185-48D0-835B-59857AF907E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{1B24F8AC-B185-48D0-835B-59857AF907E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{1B24F8AC-B185-48D0-835B-59857AF907E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{D2BA966D-140F-4C04-8EE1-88FFE5FEB67C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D2BA966D-140F-4C04-8EE1-88FFE5FEB67C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D2BA966D-140F-4C04-8EE1-88FFE5FEB67C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D2BA966D-140F-4C04-8EE1-88FFE5FEB67C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{25595747-BE10-4F36-BDE0-9400576EA921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{25595747-BE10-4F36-BDE0-9400576EA921}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{25595747-BE10-4F36-BDE0-9400576EA921}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{25595747-BE10-4F36-BDE0-9400576EA921}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5F0664A8-563F-408A-9EB6-05B2F25F5DC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|||||||
17
build
Executable file
17
build
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
rm -rf ~/.nuget/packages/polonium*
|
||||||
|
cd ../Polonium.Tasks
|
||||||
|
dotnet clean Polonium.Tasks.csproj
|
||||||
|
dotnet restore Polonium.Tasks.csproj
|
||||||
|
dotnet build Polonium.Tasks.csproj
|
||||||
|
|
||||||
|
cd ../Polonium.Generators
|
||||||
|
dotnet clean Polonium.Generators.csproj
|
||||||
|
dotnet restore Polonium.Generators.csproj
|
||||||
|
dotnet build Polonium.Generators.csproj
|
||||||
|
|
||||||
|
cd ../Polonium
|
||||||
|
rm -rf ~/.nuget/packages/polonium*
|
||||||
|
dotnet clean Polonium.csproj
|
||||||
|
dotnet restore Polonium.csproj
|
||||||
|
dotnet build Polonium.csproj
|
||||||
6
src/Attributes/ProxyProperty.cs
Normal file
6
src/Attributes/ProxyProperty.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Polonium.Attributes;
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ProxyProperty : Attribute
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
33
src/DataStructures/TextureSet.cs
Normal file
33
src/DataStructures/TextureSet.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Godot;
|
||||||
|
using FileAccess = Godot.FileAccess;
|
||||||
|
|
||||||
|
namespace Polonium.DataStructures;
|
||||||
|
|
||||||
|
public class TextureSet
|
||||||
|
{
|
||||||
|
public TextureSet(string path)
|
||||||
|
{
|
||||||
|
Normal = LoadTexture($"{path}/Normal");
|
||||||
|
Pressed = LoadTexture($"{path}/Pressed");
|
||||||
|
Disabled = LoadTexture($"{path}/Disabled");
|
||||||
|
Hover = LoadTexture($"{path}/Hover");
|
||||||
|
Focused = LoadTexture($"{path}/Focused");
|
||||||
|
}
|
||||||
|
public Texture2D Normal { get; init; }
|
||||||
|
public Texture2D Pressed { get; init; }
|
||||||
|
public Texture2D Hover { get; init; }
|
||||||
|
public Texture2D Disabled { get; init; }
|
||||||
|
public Texture2D Focused { get; init; }
|
||||||
|
|
||||||
|
private static Texture2D LoadTexture(string path)
|
||||||
|
{
|
||||||
|
Texture2D res = new();
|
||||||
|
if(FileAccess.FileExists($"{path}.png"))
|
||||||
|
res = ResourceLoader.Load<Texture2D>($"{path}.png");
|
||||||
|
else if(DirAccess.DirExistsAbsolute($"{path}.at_dir"))
|
||||||
|
res = Utils.LoadAnimatedTextureFromDirectory($"{path}.at_dir");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
8
src/Interfaces/IGlobalRegistry.cs
Normal file
8
src/Interfaces/IGlobalRegistry.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Polonium.Interfaces;
|
||||||
|
|
||||||
|
public interface IGlobalRegistry
|
||||||
|
{
|
||||||
|
public bool Paused { get; set; }
|
||||||
|
public void Start();
|
||||||
|
public void Prepare();
|
||||||
|
}
|
||||||
33
src/Utils.cs
33
src/Utils.cs
@@ -1,4 +1,7 @@
|
|||||||
|
#pragma warning disable CS0618
|
||||||
|
#pragma warning disable CS0168
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
namespace Polonium;
|
namespace Polonium;
|
||||||
|
|
||||||
@@ -15,4 +18,32 @@ public static class Utils
|
|||||||
return e.Types.Where(t => t != null);
|
return e.Types.Where(t => t != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private static Dictionary<StringName, AnimatedTexture> AnimatedTextureCache { get; } = new();
|
||||||
|
|
||||||
|
public static AnimatedTexture LoadAnimatedTextureFromDirectory(StringName path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!AnimatedTextureCache.ContainsKey(path))
|
||||||
|
{
|
||||||
|
AnimatedTextureCache[path] = new AnimatedTexture();
|
||||||
|
int f = 0;
|
||||||
|
foreach (string fname in DirAccess.GetFilesAt(path))
|
||||||
|
{
|
||||||
|
if (!fname.EndsWith(".png"))
|
||||||
|
continue;
|
||||||
|
AnimatedTextureCache[path].SetFrameTexture(f, ResourceLoader.Load<Texture2D>(fname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnimatedTextureCache[path];
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
#pragma warning restore CS0168
|
||||||
Reference in New Issue
Block a user