keyword + animation

This commit is contained in:
SoulliesOfficial
2025-10-27 07:04:34 -04:00
parent c3c4a17440
commit 2906206f0c
40 changed files with 512 additions and 384 deletions

View File

@@ -47,6 +47,46 @@ namespace SLSFramework.General
commands.Add(command);
return this;
}
/// <summary>
/// 获取所有子指令,包含嵌套的指令组中的指令。
/// </summary>
/// <param name="alsoIncludeGroups">是否也包含CommandGroupfalse则不会将CommandGroup返回</param>
/// <returns></returns>
public List<CommandBase> GetAllCommands(bool alsoIncludeGroups = false)
{
//CommandBase可能也是CommandGroup,需要递归获取
List<CommandBase> allCommands = new List<CommandBase>();
if (alsoIncludeGroups)
{
allCommands.Add(this);
}
foreach (CommandBase cmd in commands)
{
if (cmd is CommandGroup group)
{
if (alsoIncludeGroups)
{
allCommands.Add(group);
}
allCommands.AddRange(group.GetAllCommands(alsoIncludeGroups));
}
else
{
allCommands.Add(cmd);
}
}
return allCommands;
}
public List<T> GetAllCommands<T>() where T : CommandBase
{
return GetAllCommands(true).OfType<T>().ToList();
}
protected override IObservable<Unit> OnExecute(CommandContext outerContext)
{