Drawing.FontMap BuildFontMap(IO.TextSection filesection) { if (filesection == null) throw new ArgumentNullException("filesection"); Dictionary<Int32, Drawing.Font> fonts = new Dictionary<Int32, Drawing.Font>(); String fontpath1 = filesection.GetAttribute<String>("font1", null); if (fontpath1 != null) fonts[1] = GetSubSystem<Drawing.SpriteSystem>().LoadFont(fontpath1); String fontpath2 = filesection.GetAttribute<String>("font2", null); if (fontpath2 != null) fonts[2] = GetSubSystem<Drawing.SpriteSystem>().LoadFont(fontpath2); String fontpath3 = filesection.GetAttribute<String>("font3", null); if (fontpath3 != null) fonts[3] = GetSubSystem<Drawing.SpriteSystem>().LoadFont(fontpath3); Drawing.FontMap fontmap = new Drawing.FontMap(fonts); return fontmap; }
public DataMap(IO.TextSection section, String prefix) { if (section == null) throw new ArgumentNullException("section"); if (prefix == null) throw new ArgumentNullException("prefix"); m_prefix = prefix; m_animationnumber = section.GetAttribute<Int32>(prefix + ".anim", -1); m_spriteid = section.GetAttribute<SpriteId>(prefix + ".spr", SpriteId.Invalid); m_fontdata = section.GetAttribute<Drawing.PrintData>(prefix + ".font", new Drawing.PrintData()); m_text = section.GetAttribute<String>(prefix + ".text", null); m_soundid = section.GetAttribute<SoundId>(prefix + ".snd", SoundId.Invalid); m_soundtime = section.GetAttribute<Int32>(prefix + ".sndtime", 0); m_offset = (Vector2)section.GetAttribute<Point>(prefix + ".offset", new Point(0, 0)); m_displaytime = section.GetAttribute<Int32>(prefix + ".displaytime", 0); Int32 hflip = section.GetAttribute<Int32>(prefix + ".facing", 0); m_flip |= (hflip >= 0) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Int32 vflip = section.GetAttribute<Int32>(prefix + ".vfacing", 0); m_flip |= (vflip >= 0) ? SpriteEffects.None : SpriteEffects.FlipVertically; m_layernumber = section.GetAttribute<Int32>(prefix + ".layerno", 0); m_scale = section.GetAttribute<Vector2>(prefix + ".scale", Vector2.One); if (AnimationNumber > -1) { m_type = ElementType.Animation; } else if (SpriteId != SpriteId.Invalid) { m_type = ElementType.Static; } else if (FontData.IsValid == true) { m_type = ElementType.Text; } else { m_type = ElementType.None; } }