Ejemplo n.º 1
0
        protected override Task <ResultStatus> DoCommandOverride(ICommandContext commandContext)
        {
            var assetManager = new AssetManager();

            var imageGroupData = new TImageGroupData {
                Images = new List <TImageData>()
            };

            // add the sprite data to the sprite list.
            foreach (var uiImage in asset.GroupAsset.Images)
            {
                var newImage = new TImageData
                {
                    Name          = uiImage.Name,
                    Region        = uiImage.TextureRegion,
                    IsTransparent = asset.GroupAsset.Alpha != AlphaFormat.None, // todo analyze texture region texture data to auto-determine alpha?
                    Orientation   = uiImage.Orientation,
                };

                if (UseSeparateAlphaTexture)
                {
                    var baseLocation = ImageGroupAsset.BuildTextureUrl(Url, ImageToTextureIndex[uiImage]);
                    newImage.Texture = new ContentReference <Graphics.Texture> {
                        Location = TextureAlphaComponentSplitter.GenerateColorTextureURL(baseLocation)
                    };
                    newImage.TextureAlpha = new ContentReference <Graphics.Texture> {
                        Location = TextureAlphaComponentSplitter.GenerateAlphaTextureURL(baseLocation)
                    };
                }
                else
                {
                    newImage.Texture = new ContentReference <Graphics.Texture> {
                        Location = ImageGroupAsset.BuildTextureUrl(Url, ImageToTextureIndex[uiImage])
                    };
                }

                SetImageSpecificFields(uiImage, newImage);

                imageGroupData.Images.Add(newImage);
            }

            // save the imageData into the data base
            assetManager.Save(Url, imageGroupData);

            return(Task.FromResult(ResultStatus.Successful));
        }
Ejemplo n.º 2
0
        public override IEnumerable <ObjectUrl> GetInputFiles()
        {
            for (int i = 0; i < ImageToTextureIndex.Values.Distinct().Count(); i++)
            {
                if (UseSeparateAlphaTexture)
                {
                    var textureUrl = ImageGroupAsset.BuildTextureUrl(Url, i);
                    yield return(new ObjectUrl(UrlType.Internal, TextureAlphaComponentSplitter.GenerateColorTextureURL(textureUrl)));

                    yield return(new ObjectUrl(UrlType.Internal, TextureAlphaComponentSplitter.GenerateAlphaTextureURL(textureUrl)));
                }
                else
                {
                    yield return(new ObjectUrl(UrlType.Internal, ImageGroupAsset.BuildTextureUrl(Url, i)));
                }
            }
        }