keyword + animation
This commit is contained in:
@@ -47,6 +47,46 @@ namespace SLSFramework.General
|
||||
commands.Add(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有子指令,包含嵌套的指令组中的指令。
|
||||
/// </summary>
|
||||
/// <param name="alsoIncludeGroups">是否也包含CommandGroup,false则不会将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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user