本文整理汇总了C#中XmlNodeList.Item方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNodeList.Item方法的具体用法?C# XmlNodeList.Item怎么用?C# XmlNodeList.Item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNodeList
的用法示例。
在下文中一共展示了XmlNodeList.Item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseTiles
public static Tile[,] ParseTiles(XmlNodeList tilesXmlNodeList, TileMap map, int width, int height)
{
var tiles = new Tile[width, height];
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
tiles[x, y] = Tile.ParseTile(tilesXmlNodeList.Item(x * width + y), map, x, y);
}
}
return tiles;
}
示例2: GetItemStr
static string GetItemStr(XmlNodeList list, int index) { return list.Item(index).InnerText; }
示例3: GetItemFloat
static float GetItemFloat(XmlNodeList list, int index) { return float.Parse(list.Item(index).InnerText); }
示例4: GetItemShort
static ushort GetItemShort(XmlNodeList list, int index) { return ushort.Parse(list.Item(index).InnerText); }
示例5: GetItemInt
static int GetItemInt(XmlNodeList list, int index) { return int.Parse(list.Item(index).InnerText); }
示例6: showParameters
private void showParameters()
{
initXML();
tilesetNodes = xmlDoc.SelectNodes("map/tileset");
XmlNode tilesetParams = tilesetNodes.Item(1);
Debug.Log (tilesetParams);
Debug.Log (tilesetNodes);
}
示例7: CreateTeams
void CreateTeams(XmlNodeList team, XmlNodeList positions, GameObject boatPrefab, GameObject driverPrefab)
{
for(int i = 0; i < team.Count; i++) {
Quaternion rot=new Quaternion();
rot.eulerAngles = new Vector3(0, 0, float.Parse(positions.Item(i).Attributes["angle"].Value));
Vector3 temp = new Vector3(float.Parse(positions.Item(i).Attributes["x"].Value), float.Parse(positions.Item(i).Attributes["y"].Value), 0f);
GameObject pBoat = (GameObject) Instantiate(boatPrefab, temp, Quaternion.identity);
XmlNode controls = xmlDoc.DocumentElement.SelectNodes("p" + team.Item(i).Attributes["num"].Value).Item(0);
pBoat.GetComponent<BoatController>().upKey = controls.Attributes["up"].Value;
pBoat.GetComponent<BoatController>().leftKey = controls.Attributes["left"].Value;
pBoat.GetComponent<BoatController>().downKey = controls.Attributes["down"].Value;
pBoat.GetComponent<BoatController>().rightKey = controls.Attributes["right"].Value;
GameObject pDriver = (GameObject) Instantiate(driverPrefab);
pDriver.GetComponent<DriverController>().parent = pBoat;
pDriver.GetComponent<DriverController>().SetNumber(team.Item(i).Attributes["num"].Value);
pDriver.GetComponent<DriverController>().driverPos = pBoat.transform.GetChild(0).gameObject;
players.Add(pBoat);
spawnPts.Add(temp);
rotations.Add(rot);
}
}
示例8: parseHeaderParam
private void parseHeaderParam(AFSwinxConnection connection, XmlNodeList headerParam)
{
String key = "";
String value = "";
for (uint i = 0; i < headerParam.Length; i++)
{
IXmlNode concreteParam = headerParam.Item(i);
if (concreteParam.NodeType != NodeType.ElementNode)
{
continue;
}
String nodeName = concreteParam.NodeName;
String nodeValue = concreteParam.InnerText;
if (nodeName.Equals(PARAM))
{
key = evaluateEL(nodeValue);
}
else if (nodeName.Equals(VALUE))
{
value = evaluateEL(nodeValue);
}
}
// Parse content type and accept type separately
if (key.Equals(CONTENT_TYPE))
{
/* connection.setContentType((HeaderType)Utils.getEnumFromString(
HeaderType.class, value, true));*/
}
else if (key.Equals(ACCEPT_TYPE))
{
/*connection.setAcceptedType((HeaderType) Utils.getEnumFromString(
HeaderType.class, value, true));*/
}
else {
connection.addHeaderParam(key, value);
}
}
示例9: Info
public Info(XmlNodeList list)
{
for(int i = 0; i < list.Count; i++)
{
switch(list.Item(i).Name)
{
case "text": text = list.Item(i).InnerText; break;
case "sync": sync = list.Item(i).InnerText; break;
case "fragen":
{
XmlNodeList questionNode = list.Item(i).ChildNodes;
questions = new string[questionNode.Count];
for(int j = 0; j < questionNode.Count; j++)
{
questions[j] = questionNode.Item(j).InnerText;
}
}
break;
case "tipps":
{
XmlNodeList tippsNode = list.Item(i).ChildNodes;
tipps = new string[tippsNode.Count];
for(int j = 0; j < tippsNode.Count; j++)
{
tipps[j] = tippsNode.Item(j).InnerText;
}
}
break;
}
}
}
示例10: Games
public Games(XmlNodeList list)
{
info = new Info[PlayerPrefs.GetInt("LanguagesCount")];
for(int i = 0; i < list.Count; i++)
{
switch(list.Item(i).Name)
{
case "id": id = int.Parse(list.Item(i).InnerText); break;
case "reihenfolge": order = int.Parse(list.Item(i).InnerText); break;
case "info":
{
for(int j = 0; j < info.Length; j++)
{
info[j] = new Info(list.Item(i).ChildNodes.Item(j).ChildNodes);
}
}
break;
}
}
}
示例11: Artwork
public Artwork(XmlNodeList list)
{
info = new Info[PlayerPrefs.GetInt("LanguagesCount")];
for(int i = 0; i < list.Count; i++)
{
switch(list.Item(i).Name)
{
case "position": position = int.Parse(list.Item(i).InnerText); break;
case "minispiel-id": gameId = int.Parse(list.Item(i).InnerText); break;
case "bild": pic = list.Item(i).InnerText ; break;
case "info":
{
for(int j = 0; j < info.Length; j++)
{
info[j] = new Info(list.Item(i).ChildNodes.Item(j).ChildNodes);
}
}
break;
}
}
}
示例12: LoadXml
private void LoadXml(string file)
{
xmlDoc = new XmlDocument();
TextAsset xmlAsset = (TextAsset) Resources.Load(file);
xmlDoc.LoadXml(xmlAsset.text);
languagesNode = xmlDoc.GetElementsByTagName("sprachen") .Item(0).ChildNodes;
artworksNode = xmlDoc.GetElementsByTagName("kunstwerke").Item(0).ChildNodes;
gamesNode = xmlDoc.GetElementsByTagName("minispiele").Item(0).ChildNodes;
maxTipps = int.Parse(xmlDoc.GetElementsByTagName("maxTipps").Item(0).InnerText);
PlayerPrefs.SetInt("LanguagesCount", getLanguages().Length);
artworks = new Artwork[artworksNode.Count];
for(int i = 0; i < artworksNode.Count; i++)
{
artworks[i] = new Artwork(artworksNode.Item(i).ChildNodes);
}
games = new Games[gamesNode.Count];
for(int i = 0; i < gamesNode.Count; i++)
{
games[i] = new Games(gamesNode.Item(i).ChildNodes);
}
}
示例13: separateGuns
public List<XmlNode> separateGuns(XmlNodeList unlocks)
{
List<XmlNode> guns = new List<XmlNode>();
for (int i = 1; i < unlocks.Count; i++) // 1st item is empty
{
if (unlocks.Item(i).InnerText.Contains("mm_")) // _75mm_
guns.Add(unlocks.Item(i));
}
return guns;
}
示例14: checkFirstRepetition
private void checkFirstRepetition(XmlNodeList surveyElements, ImportingElement newRepElem, string groupRef)
{
XmlNodeList firstRep = surveyElements.Item(0).ChildNodes;
for (int j = 0; j < firstRep.Count; j++)
{
if (firstRep.Item(j).Name == "input")
{
XmlElement node = (XmlElement)firstRep.Item(j);
Debug.WriteLine("Found an input node");
ImportingElement importingElem = checkAttributesRefInput(node);
if (node.Attributes.GetNamedItem("ref") != null)
{
importingElem.reference = groupRef + "/" + node.Attributes.GetNamedItem("ref").Value.ToString();
importingElem.generateName();
}
importingElem.isRepItem = true;
importingElem.repContainer = newRepElem;
newRepElem.repElements.Add(importingElem);
}
if (firstRep.Item(j).Name == "select")
{
XmlElement node = (XmlElement)firstRep.Item(j);
Debug.WriteLine("Found a select node");
ImportingElement importingElem = checkAttributesRefSelect(node);
if (node.Attributes.GetNamedItem("ref") != null)
{
importingElem.reference = groupRef + "/" + node.Attributes.GetNamedItem("ref").Value.ToString();
importingElem.generateName();
}
importingElem.isRepItem = true;
importingElem.repContainer = newRepElem;
newRepElem.repElements.Add(importingElem);
}
if (firstRep.Item(j).Name == "select1")
{
XmlElement node = (XmlElement)firstRep.Item(j);
Debug.WriteLine("Found a select1 node");
ImportingElement importingElem = checkAttributesRefSelect1(node);
if (node.Attributes.GetNamedItem("ref") != null)
{
importingElem.reference = groupRef + "/" + node.Attributes.GetNamedItem("ref").Value.ToString();
importingElem.generateName();
}
importingElem.isRepItem = true;
importingElem.repContainer = newRepElem;
if (importingElem.typeAttribute != "currency")
newRepElem.repElements.Add(importingElem);
}
}
}
示例15: GetItemByte
static byte GetItemByte(XmlNodeList list, int index) { return byte.Parse(list.Item(index).InnerText); }