本文整理汇总了C#中System.Xml.XmlElement.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.GetFloat方法的具体用法?C# XmlElement.GetFloat怎么用?C# XmlElement.GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.GetFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
protected virtual void Parse(XmlElement element)
{
Vector2 position;
position.x = element.GetFloat("x", 0.0f);
position.y = element.GetFloat("y", 0.0f);
Position = position;
Vector2 scale = Vector2.one;
scale.x = element.GetFloat("scale_x", 1.0f);
scale.y = element.GetFloat("scale_y", 1.0f);
Scale = scale;
Angle_Deg = element.GetFloat("angle", 0.0f);
Spin = (SpinDirection)element.GetInt("spin", 1);
}
示例2: Parse
protected virtual void Parse(XmlElement element)
{
Vector2 position;
position.x = element.GetFloat("x", 0.0f);
position.y = element.GetFloat("y", 0.0f);
Position = position;
Vector2 scale = Vector2.one;
scale.x = element.GetFloat("scale_x", 1.0f);
scale.y = element.GetFloat("scale_y", 1.0f);
Scale = scale;
Angle_Deg = element.GetFloat("angle", 0.0f);
int spinVal = element.GetInt("spin", 1);
Spin = (spinVal == -1) ? SpinDirection.Clockwise : SpinDirection.CounterClockwise;
}
示例3: Parse
protected virtual void Parse(XmlElement element, Folder folder)
{
Folder = folder;
var type = element.GetString("type", "image");
switch(type)
{
case "image":
FileType = FileType.Image;
break;
case "atlas_image":
FileType = FileType.AtlasImage;
break;
case "sound_effect":
FileType = FileType.SoundEffect;
break;
case "entity":
FileType = FileType.Entity;
break;
default:
FileType = FileType.INVALID_TYPE;
break;
}
Name = element.GetString("name", "");
Vector2 pivot;
pivot.x = element.GetFloat("pivot_x", 0.0f);
pivot.y = element.GetFloat("pivot_y", 0.0f);
Pivot = pivot;
Vector2 size;
size.x = element.GetInt("width", 0);
size.y = element.GetInt("height", 0);
Size = size;
Vector2 offset;
offset.x = element.GetInt("offset_x", 0);
offset.y = element.GetInt("offset_y", 0);
Offset = offset;
Vector2 originalSize;
originalSize.x = element.GetInt("original_width", 0);
originalSize.y = element.GetInt("original_height", 0);
OriginalSize = originalSize;
}