重新设计了条件节点的Model

This commit is contained in:
fengjiayi
2024-10-28 22:18:48 +08:00
parent 66141533b1
commit e71a089067
6 changed files with 75 additions and 52 deletions

View File

@@ -405,15 +405,13 @@ namespace Serein.NodeFlow.Env
/// </summary>
/// <param name="nodeGuid"></param>
/// <returns></returns>
public async Task<object> InvokeNodeAsync(string nodeGuid)
public async Task<object> InvokeNodeAsync(IDynamicContext context, string nodeGuid)
{
IDynamicContext context = new DynamicContext(this);
object result = true;
if (this.NodeModels.TryGetValue(nodeGuid, out var model))
{
result = await model.InvokeAsync(context);
}
context.Exit();
return result;
}

View File

@@ -364,9 +364,9 @@ namespace Serein.NodeFlow.Env
await currentFlowEnvironment.StartAsyncInSelectNode(startNodeGuid);
}
public async Task<object> InvokeNodeAsync( string nodeGuid)
public async Task<object> InvokeNodeAsync(IDynamicContext context, string nodeGuid)
{
return await currentFlowEnvironment.InvokeNodeAsync( nodeGuid);
return await currentFlowEnvironment.InvokeNodeAsync(context, nodeGuid);
}
public async Task StartRemoteServerAsync(int port = 7525)

View File

@@ -459,7 +459,7 @@ namespace Serein.NodeFlow.Env
//UIContextOperation?.Invoke(() => OnStartNodeChange?.Invoke(new StartNodeChangeEventArgs(nodeGuid,nodeGuid)));
}
public async Task<object> InvokeNodeAsync(string nodeGuid)
public async Task<object> InvokeNodeAsync(IDynamicContext context, string nodeGuid)
{
Console.WriteLine("远程环境尚未实现接口 InvokeNodeAsync");
_ = msgClient.SendAsync(EnvMsgTheme.SetStartNode, new