feat: add Godot C# compatibility and shared codegen weaving
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s

This commit is contained in:
2026-09-05 02:37:43 +08:00
parent 60cf457230
commit 88ba3cdc48
95 changed files with 2712 additions and 19 deletions
@@ -0,0 +1,25 @@
#nullable enable
using System;
using System.Collections.Generic;
namespace ShrinkModFramework;
public sealed class ShrinkModContext
{
private readonly Dictionary<Type, object> _services = new();
public ShrinkModContext(string modDirectory) => ModDirectory = modDirectory ?? throw new ArgumentNullException(nameof(modDirectory));
public string ModDirectory { get; }
public void RegisterService<T>(T service) where T : class => _services[typeof(T)] = service ?? throw new ArgumentNullException(nameof(service));
public bool TryGetService<T>(out T? service) where T : class
{
service = _services.TryGetValue(typeof(T), out var value) ? value as T : null;
return service != null;
}
public T GetRequiredService<T>() where T : class => TryGetService<T>(out var value) ? value! : throw new InvalidOperationException($"Service is not registered: {typeof(T).FullName}");
}
public interface IShrinkModUnload
{
void OnUnload(ShrinkModContext context);
}
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<AssemblyName>ShrinkModFramework.Runtime</AssemblyName>
<RootNamespace>ShrinkModFramework</RootNamespace>
<PackageId>ShrinkSDK.ModFramework</PackageId>
<Version>0.3.0</Version>
<Description>Engine-neutral ShrinkSDK mod contracts and lifecycle.</Description>
<Nullable>disable</Nullable>
<ShrinkCodeGenEnabled>false</ShrinkCodeGenEnabled>
</PropertyGroup>
<ItemGroup>
<Compile Include="Runtime\ShrinkModContext.cs" />
<Compile Include="..\..\..\Assets\Modules\ShrinkModFramework\Runtime\Core\IShrinkMod.cs" />
<Compile Include="..\..\..\Assets\Modules\ShrinkModFramework\Runtime\Core\ShrinkModBase.cs" />
<Compile Include="..\..\..\Assets\Modules\ShrinkModFramework\Runtime\Core\ShrinkModHandle.cs" />
<Compile Include="..\..\..\Assets\Modules\ShrinkModFramework\Runtime\Metadata\*.cs" />
<ProjectReference Include="..\ShrinkSDK.Runtime.Abstractions\ShrinkSDK.Runtime.Abstractions.csproj" />
</ItemGroup>
</Project>