本文整理汇总了C#中XmlNode.GetBool方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.GetBool方法的具体用法?C# XmlNode.GetBool怎么用?C# XmlNode.GetBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNode
的用法示例。
在下文中一共展示了XmlNode.GetBool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportAtlasData
/* *** Private Methods *** */
/// <summary>
/// Read and parse atlas data from XML file.
/// </summary>
private void ImportAtlasData()
{
XmlDocument xml = new XmlDocument();
xml.LoadXml(atlasDataFile.text);
XmlNode frames = xml.DocumentElement.SelectSingleNode("dict/key");
List<AtlasData> data = new List<AtlasData>();
if (frames != null && frames.InnerText == "frames") {
XmlNodeList subTextureNames = xml.DocumentElement.SelectNodes("dict/dict/key");
XmlNodeList subTextures = xml.DocumentElement.SelectNodes("dict/dict/dict");
try {
for (int si = 0; si < subTextures.Count; si++) {
_subTexture = subTextures[si];
AtlasData ad = new AtlasData();
bool rotated = _subTexture.GetBool("rotated");
Rect frame = _subTexture.GetRect("frame");
Rect colorRect = _subTexture.GetRect("sourceColorRect");
Vector2 sourceSize = _subTexture.GetVector2("sourceSize");
try {
ad.name = subTextureNames[si].InnerText.Split('.')[0];
} catch (System.Exception) {
ad.name = subTextureNames[si].InnerText;
}
ad.position = new Vector2(frame.xMin, frame.yMin);
ad.rotated = rotated;
ad.size = new Vector2(colorRect.width, colorRect.height);
ad.frameSize = sourceSize;
ad.offset = new Vector2(colorRect.xMin, colorRect.yMin);
data.Add(ad);
}
} catch (System.Exception ERR) {
Debug.LogError("Atlas Import error!");
Debug.LogError(ERR.Message);
}
}
InitVertices();
spriteData = new SpriteData[data.Count];
SpriteData sprite = null;
for (int i = 0; i < data.Count; i++) {
sprite = new SpriteData();
sprite.name = data[i].name;
sprite.size = data[i].size;
sprite.sheetPixelCoords = data[i].position;
sprite.texture = texture;
sprite.UpdateUVs();
spriteData[i] = sprite;
}
}