This commit is contained in:
SoulliesOfficial
2026-04-01 12:23:27 -04:00
parent aff7ac0e03
commit c3b1561375
933 changed files with 114333 additions and 119360 deletions

View File

@@ -37,6 +37,19 @@ namespace SLSFramework.General
return new ActionCommand(action).SetDelay(seconds);
}
/// <summary>
/// 创建一条"等待外部信号"命令。
/// 调用返回的 <paramref name="signal"/> Action 时,命令立即完成,队列继续执行。
/// 典型用法:等待玩家点击按钮确认。
/// </summary>
/// <param name="signal">外部调用此委托以释放命令。</param>
public static CommandBase WaitForSignal(out Action signal)
{
var tcs = new UniTaskCompletionSource();
signal = () => tcs.TrySetResult();
return new WaitForSignalCommand(tcs);
}
// ── 组合工厂 ─────────────────────────────────────────────────────
/// <summary>创建一个顺序执行的命令组。</summary>
@@ -135,5 +148,20 @@ namespace SLSFramework.General
await asyncAction();
}
}
private sealed class WaitForSignalCommand : CommandBase
{
private readonly UniTaskCompletionSource tcs;
public WaitForSignalCommand(UniTaskCompletionSource tcs)
{
this.tcs = tcs;
}
protected override async UniTask ExecuteAsync(CommandContext outerContext)
{
await tcs.Task;
}
}
}
}

View File

@@ -31,6 +31,14 @@ namespace SLSFramework.General
action.Invoke(arg1, arg2);
}
}
public static void Invoke<T1, T2, T3>(this IDictionary<string, PrioritizedAction<T1, T2, T3>> dictionary, T1 arg1, T2 arg2, T3 arg3)
{
foreach (var action in dictionary.Values)
{
action.Invoke(arg1, arg2, arg3);
}
}
public static void ModifyOrAdd(this IDictionary<string, float> dictionary, string key, float delta)
{

View File

@@ -208,7 +208,7 @@ namespace SLSFramework.UModAssistance
if (TypeRegistry.TryAdd(typeID, type))
{
Debug.Log($"Registered script type '{typeID}' from mod '{host.CurrentMod.NameInfo.ModName}'.");
//Debug.Log($"Registered script type '{typeID}' from mod '{host.CurrentMod.NameInfo.ModName}'.");
}
else
{