Example #1
0
        private static PlistMetaData ParseMetaData(PlistDictionary dMetaData)
        {
            PlistMetaData metaData = new PlistMetaData();

            metaData.format = (int)dMetaData["format"];
            metaData.realTextureFileName = dMetaData["realTextureFileName"] as string;
            metaData.size            = PlistDictionary.ParseVector2(dMetaData["size"] as string);
            metaData.smartpdate      = dMetaData["smartupdate"] as string;
            metaData.textureFileName = dMetaData["textureFileName"] as string;
            return(metaData);
        }
Example #2
0
        private static List <FrameDataDict> ParseFrames(PlistDictionary dFrames, int format)
        {
            List <FrameDataDict> frames = new List <FrameDataDict>();

            foreach (KeyValuePair <string, object> kv in dFrames)
            {
                if (kv.Value is PlistDictionary)
                {
                    FrameDataDict frameDataDict = new FrameDataDict();
                    frameDataDict.name = kv.Key;
                    PlistDictionary frameDict = kv.Value as PlistDictionary;
                    if (format == 2)
                    {
                        RectInt frame = PlistDictionary.ParseRectInt(frameDict["frame"] as string);
                        frameDataDict.x      = frame.x;
                        frameDataDict.y      = frame.y;
                        frameDataDict.width  = frame.width;
                        frameDataDict.height = frame.height;
                    }
                    else
                    {
                        RectInt frame = PlistDictionary.ParseRectInt(frameDict["textureRect"] as string);
                        frameDataDict.x      = frame.x;
                        frameDataDict.y      = frame.y;
                        frameDataDict.width  = frame.width;
                        frameDataDict.height = frame.height;
                    }

                    if (format == 2)
                    {
                        Vector2 offset = PlistDictionary.ParseVector2(frameDict["offset"] as string);
                        frameDataDict.offsetHeight = (int)offset.y;
                        frameDataDict.offsetWidth  = (int)offset.x;
                    }
                    else
                    {
                        Vector2 offset = PlistDictionary.ParseVector2(frameDict["spriteOffset"] as string);
                        frameDataDict.offsetHeight = (int)offset.y;
                        frameDataDict.offsetWidth  = (int)offset.x;
                    }
                    if (format == 2)
                    {
                        frameDataDict.rotated = (bool)frameDict["rotated"];
                    }
                    else
                    {
                        frameDataDict.rotated = (bool)frameDict["textureRotated"];
                    }
                    if (format == 2)
                    {
                        Vector2 size = PlistDictionary.ParseVector2(frameDict["sourceSize"] as string);
                        frameDataDict.sourceSizeWidth  = (int)size.x;
                        frameDataDict.sourceSizeHeight = (int)size.y;
                    }
                    else
                    {
                        Vector2 size = PlistDictionary.ParseVector2(frameDict["spriteSourceSize"] as string);
                        frameDataDict.sourceSizeWidth  = (int)size.x;
                        frameDataDict.sourceSizeHeight = (int)size.y;
                    }

                    frames.Add(frameDataDict);
                }
            }
            return(frames);
        }