/// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!Parse())
            return new OTAtlasData[] { };
        List<OTAtlasData> data = new List<OTAtlasData>();

        First();
        if (Exists("info") && Exists("face"))
        {
            metaType = "FONT";
            name = "Font "+Data("face")+"-"+Data ("size");
            if (Data ("bold")=="1")
                name += "b";
            if (Data ("italic")=="1")
                name += "i";
            do
            {
                if (Exists ("char"))
                {
                        OTAtlasData ad = new OTAtlasData();

                        ad.name = Data ("id");
                        ad.position = new Vector2(IData("x"), IData("y"));
                        ad.size = new Vector2(IData("width"), IData("height"));
                        ad.offset = new Vector2(IData("xoffset"), IData("yoffset"));

                        ad.AddMeta("dx",Data("xadvance"));

                        data.Add(ad);
                }
            } while (Next ());
        }
        return data.ToArray();
    }
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!Parse())
        {
            return new OTAtlasData[] { }
        }
        ;
        List <OTAtlasData> data = new List <OTAtlasData>();

        First();
        if (Exists("info") && Exists("face"))
        {
            metaType = "FONT";

            if (name.IndexOf("Container (id=") == 0)
            {
                name = "Font " + Data("face") + "-" + Data("size");
                if (Data("bold") == "1")
                {
                    name += "b";
                }
                if (Data("italic") == "1")
                {
                    name += "i";
                }
            }

            do
            {
                if (Exists("common"))
                {
                    if (lineHeight == 0)
                    {
                        lineHeight = System.Convert.ToInt16(Data("lineHeight"));
                    }
                    if (Data("scaleW") != "")
                    {
                        sheetSize = new Vector2(System.Convert.ToSingle(Data("scaleW")), System.Convert.ToSingle(Data("scaleH")));
                    }
                }

                if (Exists("char"))
                {
                    OTAtlasData ad = new OTAtlasData();

                    ad.name     = Data("id");
                    ad.position = new Vector2(IData("x"), IData("y"));
                    ad.size     = new Vector2(IData("width"), IData("height"));
                    ad.offset   = new Vector2(IData("xoffset"), IData("yoffset"));

                    ad.AddMeta("dx", Data("xadvance"));
                    ad.frameSize = new Vector2(IData("width"), lineHeight);

                    data.Add(ad);
                }
            } while (Next());
        }
        return(data.ToArray());
    }
Exemple #3
0
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!ValidXML())
        {
            return new OTAtlasData[] { }
        }
        ;

        List <OTAtlasData> data = new List <OTAtlasData>();

        if (xml.DocumentElement.Name == "font")
        {
            XmlNode info = xml.DocumentElement.SelectSingleNode("info");

            if (info != null && AttrS(info, "face") != "")
            {
                if (name.IndexOf("Container (id=") == 0)
                {
                    name = "Font " + AttrS(info, "face") + "-" + AttrS(info, "size");
                    if (AttrS(info, "bold") == "1")
                    {
                        name += "b";
                    }
                    if (AttrS(info, "italic") == "1")
                    {
                        name += "i";
                    }
                }

                metaType = "FONT";
                XmlNode charsNode = xml.DocumentElement.SelectSingleNode("chars");
                if (charsNode != null)
                {
                    XmlNodeList chars = charsNode.SelectNodes("char");
                    for (int si = 0; si < chars.Count; si++)
                    {
                        XmlNode     charNode = chars[si];
                        OTAtlasData ad       = new OTAtlasData();

                        ad.name     = "" + AttrI(charNode, "id");
                        ad.position = new Vector2(AttrI(charNode, "x"), AttrI(charNode, "y"));
                        ad.size     = new Vector2(AttrI(charNode, "width"), AttrI(charNode, "height"));
                        ad.offset   = new Vector2(AttrI(charNode, "xoffset"), AttrI(charNode, "yoffset"));

                        ad.AddMeta("dx", AttrS(charNode, "xadvance"));

                        data.Add(ad);
                    }
                }
            }
        }
        return(data.ToArray());
    }
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!Parse())
            return new OTAtlasData[] { };
        List<OTAtlasData> data = new List<OTAtlasData>();

        First();
        if (Exists("info") && Exists("face"))
        {
            metaType = "FONT";

            if (name.IndexOf("Container (id=")==0)
            {
                name = "Font "+Data("face")+"-"+Data ("size");
                if (Data ("bold")=="1")
                    name += "b";
                if (Data ("italic")=="1")
                    name += "i";
            }

            do
            {

                if (Exists ("common"))
                {
                    if (lineHeight == 0)
                    {
                        lineHeight = System.Convert.ToInt16(Data ("lineHeight"));
                    }
                    if (Data("scaleW")!="")
                        sheetSize = new Vector2(System.Convert.ToSingle(Data ("scaleW")),System.Convert.ToSingle(Data ("scaleH")));
                }

                if (Exists ("char"))
                {
                        OTAtlasData ad = new OTAtlasData();

                        ad.name = Data ("id");
                        ad.position = new Vector2(IData("x"), IData("y"));
                        ad.size = new Vector2(IData("width"), IData("height"));
                        ad.offset = new Vector2(IData("xoffset"), IData("yoffset"));

                        ad.AddMeta("dx",Data("xadvance"));
                        ad.frameSize = new Vector2(IData("width"), lineHeight);

                        data.Add(ad);
                }
            } while (Next ());
        }
        return data.ToArray();
    }
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!ValidXML())
        {
            return new OTAtlasData[] { }
        }
        ;

        List <OTAtlasData> data = new List <OTAtlasData>();

        if (xml.rootName == "font")
        {
            OTDataset dsInfo = xml.Dataset("info");

            if (!dsInfo.EOF)
            {
                if (dsInfo.AsString("face") != "")
                {
                    if (name.IndexOf("Container (id=") == 0)
                    {
                        name = "Font " + dsInfo.AsString("face") + "-" + dsInfo.AsString("size");
                        if (dsInfo.AsString("bold") == "1")
                        {
                            name += "b";
                        }
                        if (dsInfo.AsString("italic") == "1")
                        {
                            name += "i";
                        }
                    }

                    metaType = "FONT";
                    OTDataset dsChars = xml.Dataset("chars");
                    while (!dsChars.EOF)
                    {
                        OTAtlasData ad = new OTAtlasData();

                        ad.name     = "" + dsChars.AsInt("id");
                        ad.position = new Vector2(dsChars.AsInt("x"), dsChars.AsInt("y"));
                        ad.size     = new Vector2(dsChars.AsInt("width"), dsChars.AsInt("height"));
                        ad.offset   = new Vector2(dsChars.AsInt("xoffset"), dsChars.AsInt("yoffset"));

                        ad.AddMeta("dx", dsChars.AsString("xadvance"));
                        data.Add(ad);
                        dsChars.Next();
                    }
                }
            }
        }
        return(data.ToArray());
    }
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!ValidXML())
            return new OTAtlasData[] { };

        List<OTAtlasData> data = new List<OTAtlasData>();
        if (xml.DocumentElement.Name == "font")
        {
			XmlNode info = xml.DocumentElement.SelectSingleNode("info");
			if (info!=null && AttrS(info,"face")!="")
			{					
				if (name.IndexOf("Container (id=")==0)
				{			
					name = "Font "+AttrS(info,"face")+"-"+AttrS(info,"size");
					if (AttrS(info,"bold")=="1")
						name += "b";
					if (AttrS(info,"italic")=="1")
						name += "i";
				}
							
				metaType = "FONT";
            	XmlNode charsNode = xml.DocumentElement.SelectSingleNode("chars");
				if (charsNode!=null)
				{
					XmlNodeList chars = charsNode.SelectNodes("char");
		            for (int si = 0; si < chars.Count; si++)
		            {
		                XmlNode charNode = chars[si];
		                OTAtlasData ad = new OTAtlasData();
		
		                ad.name = ""+AttrI(charNode,"id");
		                ad.position = new Vector2(AttrI(charNode,"x"), AttrI(charNode,"y"));
		                ad.size = new Vector2(AttrI(charNode,"width"), AttrI(charNode,"height"));
		                ad.offset = new Vector2(AttrI(charNode,"xoffset"), AttrI(charNode,"yoffset"));		
						
						ad.AddMeta("dx",AttrS(charNode,"xadvance"));
						
		                data.Add(ad);
		            }
				}
			}
        }
        return data.ToArray();
    }
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!ValidXML())
            return new OTAtlasData[] { };

        List<OTAtlasData> data = new List<OTAtlasData>();

        if (xml.rootName == "font")
        {
            OTDataset dsInfo = xml.Dataset("info");
            if (!dsInfo.EOF)
            {
                if (dsInfo.AsString("face")!="")
                {
                    if (name.IndexOf("Container (id=")==0)
                    {
                        name = "Font "+dsInfo.AsString("face")+"-"+dsInfo.AsString("size");
                        if (dsInfo.AsString("bold")=="1")
                            name += "b";
                        if (dsInfo.AsString("italic")=="1")
                            name += "i";
                    }

                    metaType = "FONT";
                    OTDataset dsChars = xml.Dataset("chars");
                    while (!dsChars.EOF)
                    {
                        OTAtlasData ad = new OTAtlasData();

                        ad.name = ""+dsChars.AsInt("id");
                        ad.position = new Vector2(dsChars.AsInt("x"), dsChars.AsInt("y"));
                         ad.size = new Vector2(dsChars.AsInt("width"), dsChars.AsInt("height"));
                        ad.offset = new Vector2(dsChars.AsInt("xoffset"), dsChars.AsInt("yoffset"));

                        ad.AddMeta("dx",dsChars.AsString("xadvance"));
                        data.Add(ad);
                        dsChars.Next();
                    }
                }
            }
        }
        return data.ToArray();
    }
Exemple #8
0
    /// <summary>
    /// Import atlasData from sparrow xml
    /// </summary>
    protected override OTAtlasData[] Import()
    {
        if (!Parse())
        {
            return new OTAtlasData[] { }
        }
        ;
        List <OTAtlasData> data = new List <OTAtlasData>();

        First();
        if (Exists("info") && Exists("face"))
        {
            metaType = "FONT";

            name = "Font " + Data("face") + "-" + Data("size");
            if (Data("bold") == "1")
            {
                name += "b";
            }
            if (Data("italic") == "1")
            {
                name += "i";
            }
            do
            {
                if (Exists("char"))
                {
                    OTAtlasData ad = new OTAtlasData();

                    ad.name     = Data("id");
                    ad.position = new Vector2(IData("x"), IData("y"));
                    ad.size     = new Vector2(IData("width"), IData("height"));
                    ad.offset   = new Vector2(IData("xoffset"), IData("yoffset"));

                    ad.AddMeta("dx", Data("xadvance"));

                    data.Add(ad);
                }
            } while (Next());
        }
        return(data.ToArray());
    }