Exemple #1
0
        internal static SpriteFrameSave FromXElement(System.Xml.Linq.XElement element)
        {
            SpriteFrameSave sfs = new SpriteFrameSave();

            foreach (var subElement in element.Elements())
            {
                switch (subElement.Name.LocalName)
                {
                case "BorderSides":
                    sfs.BorderSides = SceneSave.AsInt(subElement);
                    break;

                case "ParentSprite":
                    sfs.ParentSprite = SpriteSave.FromXElement(subElement);
                    break;

                case "SpriteBorderWidth":
                    sfs.SpriteBorderWidth = SceneSave.AsFloat(subElement);
                    break;

                case "TextureBorderWidth":
                    sfs.TextureBorderWidth = SceneSave.AsFloat(subElement);
                    break;

                default:
                    throw new NotImplementedException();

                    //break;
                }
            }

            return(sfs);
        }
Exemple #2
0
        public static SpriteFrameSave FromSpriteFrame(FlatRedBall.ManagedSpriteGroups.SpriteFrame spriteFrame)
        {
            SpriteFrameSave spriteFrameSave = new SpriteFrameSave();

            spriteFrameSave.ParentSprite =
                SpriteSave.FromSprite(spriteFrame);

            if (spriteFrame.CenterSprite != null && SpriteManager.ZBufferedSprites.Contains(spriteFrame.CenterSprite))
            {
                spriteFrameSave.ParentSprite.Ordered = false;
            }

            spriteFrameSave.BorderSides = (int)spriteFrame.Borders;

            spriteFrameSave.TextureBorderWidth = spriteFrame.TextureBorderWidth;
            spriteFrameSave.SpriteBorderWidth  = spriteFrame.SpriteBorderWidth;
            return(spriteFrameSave);
        }