add: Scene
This commit is contained in:
@@ -6,9 +6,17 @@
|
||||
<Nullable>disable</Nullable>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
|
||||
<PackageId>Hangman.SDK</PackageId>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>0.0.1</Version>
|
||||
<Authors>Hangman</Authors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GodotSharp" Version="4.4.0-beta.2"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="build\.targets" Pack="true" PackagePath="build\.targets"/>
|
||||
<Content Include="build\publish"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
11
build/.targets
Normal file
11
build/.targets
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="Scene">
|
||||
<AdditionalFiles Include="Assets/**/*.tscn" />
|
||||
</ItemGroup>
|
||||
<Target Name="EnsureFolders" BeforeTargets="BeforeBuild">
|
||||
<MakeDir Directories="$(ProjectDir)Assets" Condition="!Exists('$(ProjectDir)Assets')"/>
|
||||
<MakeDir Directories="$(ProjectDir)Concepts" Condition="!Exists('$(ProjectDir)Concepts')"/>
|
||||
<MakeDir Directories="$(ProjectDir)Registries" Condition="!Exists('$(ProjectDir)Registries')"/>
|
||||
<MakeDir Directories="$(ProjectDir)Data" Condition="!Exists('$(ProjectDir)Data')"/>
|
||||
</Target>
|
||||
</Project>
|
||||
2
build/publish
Normal file
2
build/publish
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
dotnet nuget push "$(ls -t ../.godot/mono/temp/bin/Debug/Hangman.SDK.*.nupkg | head -n 1)" --source hangman-lab
|
||||
19
src/Scenes/RootScene.cs
Normal file
19
src/Scenes/RootScene.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Godot;
|
||||
|
||||
namespace Hangman.SDK.Scenes;
|
||||
|
||||
public abstract partial class RootScene : Node2D
|
||||
{
|
||||
private Scene CurrentScene { get; set; }
|
||||
|
||||
public void SwitchScene(Scene scene)
|
||||
{
|
||||
if (CurrentScene != null)
|
||||
RemoveChild(CurrentScene);
|
||||
AddChild(scene);
|
||||
CurrentScene = scene;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
8
src/Scenes/Scene.cs
Normal file
8
src/Scenes/Scene.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
|
||||
namespace Hangman.SDK.Scenes;
|
||||
|
||||
public abstract partial class Scene : Node2D
|
||||
{
|
||||
|
||||
}
|
||||
18
src/Utils.cs
Normal file
18
src/Utils.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace Hangman.SDK;
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
public static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException e)
|
||||
{
|
||||
return e.Types.Where(t => t != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user