本文整理汇总了C#中Vehicle.setType方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.setType方法的具体用法?C# Vehicle.setType怎么用?C# Vehicle.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.setType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getVehicle
/**
* Parse vehicle.xml
*/
private static Vehicle getVehicle(XmlNode node, String country)
{
XmlNode tags = node.SelectSingleNode("tags");
if (tags == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", missing 'tags' node");
return null;
}
if (tags.InnerText.Contains("observer"))
{
Console.WriteLine("Skipping \"" + node.Name + "\" - observer");
return null;
}
XmlNode tankId = node.SelectSingleNode("id");
if (tankId == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", missing 'id' node");
return null;
}
XmlNode level = node.SelectSingleNode("level");
if (level == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", missing 'level' node");
return null;
}
XmlNode price = node.SelectSingleNode("price");
if (price == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", missing 'price' node");
return null;
}
XmlNode shortUserString = node.SelectSingleNode("shortUserString");
if (shortUserString == null)
{
shortUserString = node.SelectSingleNode("userString");
if (shortUserString == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", missing 'userString' and 'shortUserString' node");
return null;
}
}
/*
else
{
//TODO: issue #484 https://code.google.com/p/wot-xvm/issues/detail?id=484
String s = shortUserString.InnerText;
String l = node.SelectSingleNode("userString").InnerText;
if (s.Remove(s.LastIndexOf("_short"), 6) != l)
{
Console.WriteLine("short: " + shortUserString.InnerText);
Console.WriteLine("long: " + node.SelectSingleNode("userString").InnerText);
}
}*/
/** Load vehicle xml */
XmlNode vdata = decodeXml(Path.Combine(Settings.Default.GAME_PATH, VEHICLE_DIR_PATH, country, node.Name + ".xml"));
if (vdata == null)
{
Console.WriteLine("Skipping \"" + node.Name + "\", can't decode vehicle .xml");
return null;
}
Vehicle vehicle = new Vehicle(vdata)
{
vid = (int.Parse(tankId.InnerText) << 8) + (Array.IndexOf(Defines.COUNTRIES, country) << 4),
tankId = int.Parse(tankId.InnerText),
name = node.Name,
nation = country,
level = int.Parse(level.InnerText),
premium = price.InnerXml.ToLower().Contains("<gold>"),
shortUserString = shortUserString.InnerText,
};
vehicle.setType(tags.InnerText);
return vehicle;
}