Example #1
0
        private static Command CreateCommand_Asset_Create_SpriteAnimation()
        {
            var command           = new Command("sprite-animation", "Create sprite animation asset file.");
            var directoryArgument = new Argument("directory")
            {
                Description = "Path to directory containing sprite assets to use for animation. Asset files are composed into animation in alphabetical order."
            };

            command.AddArgument(directoryArgument);
            command.AddOption(new Option <string>("--file-pattern", "Filter sprite asset files to be included in animation using wildcard based pattern."));
            command.AddOption(new Option <FileInfo[]>("--files",
                                                      "Use specified ordered list of sprite asset files. Paths are relative to current working directory."));
            command.AddOption(CreateOption_KeepAssetId());
            command.Handler = CommandHandler.Create <DirectoryInfo, string, FileInfo[], bool, IConsole>(
                (directory, filePattern, files, keepAssetId, console) =>
            {
                console.Out.WriteLine($"Creating sprite animation asset file for: {directory.FullName}");
                var spriteAnimationAssetFilePath =
                    AssetTool.CreateSpriteAnimationAsset(
                        directory.FullName,
                        string.IsNullOrEmpty(filePattern) ? null : filePattern,
                        files.Length == 0 ? null : files.Select(f => f.FullName),
                        keepAssetId
                        );
                console.Out.WriteLine($"Sprite animation asset file created: {spriteAnimationAssetFilePath}");
            });

            return(command);
        }