コード例 #1
0
        //public AnimationFrame ToAnimationFrame(TextureAtlas textureAtlas)
        //{
        //    AnimationFrame toReturn = ToAnimationFrame(null, false);
        //    var entry = textureAtlas.GetEntryFor(this.TextureName);

        //    if (entry != null)
        //    {

        //        float left;
        //        float right;
        //        float top;
        //        float bottom;


        //        entry.FullToReduced(toReturn.LeftCoordinate, toReturn.RightCoordinate,
        //            toReturn.TopCoordinate, toReturn.BottomCoordinate,
        //            out left, out right, out top, out bottom);

        //        toReturn.LeftCoordinate = left;
        //        toReturn.RightCoordinate = right;
        //        toReturn.TopCoordinate = top;
        //        toReturn.BottomCoordinate = bottom;

        //    }

        //    return toReturn;
        //}


        internal static AnimationFrameSave FromXElement(System.Xml.Linq.XElement element)
        {
            AnimationFrameSave toReturn = new AnimationFrameSave();


            foreach (var subElement in element.Elements())
            {
                switch (subElement.Name.LocalName)
                {
                case "FlipHorizontal":
                    toReturn.FlipHorizontal = SceneSave.AsBool(subElement);
                    break;

                case "FlipVertical":
                    toReturn.FlipVertical = SceneSave.AsBool(subElement);
                    break;

                case "TextureName":
                    toReturn.TextureName = subElement.Value;
                    break;

                case "FrameLength":
                    toReturn.FrameLength = SceneSave.AsFloat(subElement);
                    break;

                case "LeftCoordinate":
                    toReturn.LeftCoordinate = SceneSave.AsFloat(subElement);
                    break;

                case "RightCoordinate":
                    toReturn.RightCoordinate = SceneSave.AsFloat(subElement);
                    break;

                case "TopCoordinate":
                    toReturn.TopCoordinate = SceneSave.AsFloat(subElement);
                    break;

                case "BottomCoordinate":
                    toReturn.BottomCoordinate = SceneSave.AsFloat(subElement);
                    break;

                case "RelativeX":
                    toReturn.RelativeX = SceneSave.AsFloat(subElement);
                    break;

                case "RelativeY":
                    toReturn.RelativeY = SceneSave.AsFloat(subElement);
                    break;
                }
            }

            return(toReturn);
        }