chore: initialize standalone UPM package
Publish UPM package / publish (push) Failing after 1s

This commit is contained in:
2026-08-26 02:50:31 +08:00
commit 78ccae3e07
142 changed files with 6572 additions and 0 deletions
@@ -0,0 +1,25 @@
#nullable enable
using ShrinkEventBus;
using ShrinkNetwork;
namespace __ROOT_NAMESPACE__
{
public sealed class __PROJECT_NAME__Event : IShrinkEvent
{
public string Message { get; set; } = string.Empty;
}
[ShrinkNetworkMessage(__REQUEST_OPCODE__, "__ROUTE_PREFIX__/ping")]
public sealed class __PROJECT_NAME__PingRequest : IShrinkNetworkRequest
{
public string Message { get; set; } = string.Empty;
}
[ShrinkNetworkMessage(__RESPONSE_OPCODE__, "__ROUTE_PREFIX__/ping_response")]
public sealed class __PROJECT_NAME__PingResponse : ShrinkRpcResponseBase
{
public string Message { get; set; } = string.Empty;
public int Counter { get; set; }
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f4ff81758d9539947ba6f4df94c2db91
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
#nullable enable
using ShrinkCommand;
using ShrinkEventBus;
using ShrinkModFramework;
using ShrinkNetwork;
namespace __ROOT_NAMESPACE__
{
[ShrinkMod("__MOD_ID__", "__DISPLAY_NAME__", "1.0.0")]
[ShrinkEventSubscriber(OwnerId = "__MOD_ID__", DefaultBus = "mod:__MOD_ID__")]
[ShrinkCommandSubscriber]
[ShrinkNetworkSubscriber]
public sealed partial class __PROJECT_NAME__Mod : ShrinkModBase
{
private readonly RuntimeState _state = new();
public override void OnConstruct(ShrinkModContext context)
{
context.Log("模组已构造。");
}
public override void OnRegisterContent(ShrinkModContext context)
{
context.RegisterContent("example.items", "example_item", "__DISPLAY_NAME__ Item");
}
public override void OnInitialize(ShrinkModContext context)
{
context.RegisterNetworkHandler<int>("sync.counter", (_, value) =>
{
_state.Counter = value;
context.Log("收到模组网络计数:" + value);
});
}
[ShrinkSubscribe]
private void OnExampleEvent(__PROJECT_NAME__Event evt)
{
_state.LastEventMessage = evt.Message ?? string.Empty;
_state.Counter++;
}
[ShrinkCommand("__COMMAND_ROOT__ ping", Description = "测试模组命令", Permission = "__MOD_ID__.command.ping")]
private string Ping()
{
return "pong:" + _state.Counter;
}
[ShrinkNetworkSubscribe(Permission = "__MOD_ID__.rpc.ping")]
private __PROJECT_NAME__PingResponse HandlePing(__PROJECT_NAME__PingRequest request)
{
return new __PROJECT_NAME__PingResponse
{
Message = "pong:" + (request.Message ?? string.Empty),
Counter = _state.Counter
};
}
private sealed class RuntimeState
{
public int Counter { get; set; }
public string LastEventMessage { get; set; } = string.Empty;
}
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a2a0ac418f07ef74393b89e9612e3f5f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: