示例#1
0
        internal GMSpriteFrame(GMSprite sprite)
        {
            if (sprite == null)
            {
                throw new ArgumentNullException(nameof(sprite));
            }

            Sprite         = sprite;
            CompositeImage = GMSpriteImage.Create(this, null);

            layers = new List <GMSpriteImage>();
            foreach (var layer in sprite.Layers)
            {
                layers.Add(GMSpriteImage.Create(this, layer));
            }
        }
示例#2
0
            public GMSpriteImageLayer Create()
            {
                var layer = new GMSpriteImageLayer(sprite)
                {
                    Id   = Guid.NewGuid(),
                    Name = layers.Count == 0 ? "default" : $"Layer {layers.Count}"
                };

                layers.Insert(0, layer);

                foreach (var frame in sprite.Frames)
                {
                    frame.layers.Insert(0, GMSpriteImage.Create(frame, layer));
                }

                return(layer);
            }