本文整理汇总了C#中IO.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IO.GetAttribute方法的具体用法?C# IO.GetAttribute怎么用?C# IO.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.GetAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildFontMap
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;
}
示例2: DataMap
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;
}
}