文本显示和Command大修

This commit is contained in:
SoulliesOfficial
2025-11-08 09:50:55 -05:00
parent 3f1e04dee7
commit b2e9e84c52
78 changed files with 293 additions and 244 deletions

View File

@@ -70,22 +70,27 @@ namespace SLSFramework.General
*/
}
public CommandBase AddCommand(CommandBase command, CommandContext context = null)
public List<CommandBase> AddCommands(List<CommandBase> command, CommandContext outerContext = null)
{
return AddCommand(command, true, context);
return command.Select(cmd => AddCommand(cmd, outerContext)).ToList();
}
public CommandBase AddCommand(CommandBase command, bool insertAtTail, CommandContext context = null)
public CommandBase AddCommand(CommandBase command, CommandContext context = null)
{
return AddCommand(command, false, context);
}
public CommandBase AddCommand(CommandBase command, bool insertAtFirst, CommandContext context = null)
{
context ??= new CommandContext();
// 将指令和其上下文入队
if (insertAtTail)
if (insertAtFirst || command.insertAtFirst)
{
commandQueue.AddLast(Tuple.Create(command, context));
commandQueue.AddFirst(Tuple.Create(command, context));
}
else
{
commandQueue.AddFirst(Tuple.Create(command, context));
commandQueue.AddLast(Tuple.Create(command, context));
}
//Debug.Log($"[Queue] 添加指令: {command.GetType()},队列长度: {commandQueue.Count}");
@@ -113,8 +118,9 @@ namespace SLSFramework.General
// 4. 标记为“忙碌”,并从队列中取出下一个指令。
isBusy = true;
var nextEntry = commandQueue.First.Value;
Tuple<CommandBase, CommandContext> nextEntry = commandQueue.First.Value;
commandQueue.RemoveFirst();
Debug.Log($"[Queue] 开始执行指令: {nextEntry.Item1.GetType()},队列剩余长度: {commandQueue.Count}");
var commandToExecute = nextEntry.Item1;
var context = nextEntry.Item2;