Beispiel #1
0
        internal static SpriteGridSave FromXElement(System.Xml.Linq.XElement element)
        {
            SpriteGridSave sgs = new SpriteGridSave();

            foreach (var subElement in element.Elements())
            {
                switch (subElement.Name.LocalName)
                {
                case "AnimationChainGridSave":
                    sgs.AnimationChainGridSave = AnimationChainGridSave.FromXElement(subElement);
                    break;

                case "Axis":
                    sgs.Axis = SpriteEditorScene.AsChar(subElement);
                    break;

                case "Blueprint":
                    sgs.Blueprint = SpriteSave.FromXElement(subElement);
                    break;

                case "BaseTexture":
                    sgs.BaseTexture = (string)subElement.Value;
                    break;

                case "CreatesAutomaticallyUpdatedSprites":
                    sgs.CreatesAutomaticallyUpdatedSprites = SpriteEditorScene.AsBool(subElement);
                    break;

                case "CreatesParticleSprites":
                    sgs.CreatesParticleSprites = SpriteEditorScene.AsBool(subElement);
                    break;

                case "DisplayRegionGridSave":
                    sgs.DisplayRegionGridSave = DisplayRegionGridSave.FromXElement(subElement);
                    break;

                case "DrawableBatch":
                    sgs.DrawableBatch = SpriteEditorScene.AsBool(subElement);
                    break;

                case "DrawDefaultTile":
                    sgs.DrawDefaultTile = SpriteEditorScene.AsBool(subElement);
                    break;

                case "FirstPaintedX":
                    sgs.FirstPaintedX = SpriteEditorScene.AsFloatList(subElement);
                    break;

                case "FirstPaintedY":
                    sgs.FirstPaintedY = SceneSave.AsFloat(subElement);
                    break;

                case "GridSpacing":
                    sgs.GridSpacing = SceneSave.AsFloat(subElement);
                    break;

                case "GridTexturesArray":
                    sgs.GridTexturesArray = SpriteEditorScene.AsStringArrayArray(subElement);
                    break;

                case "Name":
                    sgs.Name = subElement.Value;
                    break;

                case "OrderingMode":
                    sgs.OrderingMode = (Graphics.OrderingMode)Enum.Parse(typeof(Graphics.OrderingMode), subElement.Value, true);
                    break;

                case "XLeftBound":
                    sgs.XLeftBound = SceneSave.AsFloat(subElement);
                    break;

                case "XRightBound":
                    sgs.XRightBound = SceneSave.AsFloat(subElement);
                    break;

                case "YBottomBound":
                    sgs.YBottomBound = SceneSave.AsFloat(subElement);
                    break;

                case "YTopBound":
                    sgs.YTopBound = SceneSave.AsFloat(subElement);
                    break;

                case "ZCloseBound":
                    sgs.ZCloseBound = SceneSave.AsFloat(subElement);
                    break;

                case "ZFarBound":
                    sgs.ZFarBound = SceneSave.AsFloat(subElement);
                    break;

                default:
                    throw new NotImplementedException("Node not understood: " + subElement.Name.LocalName);
                }
            }


            return(sgs);
        }