本文整理汇总了C#中Place.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Place.GetType方法的具体用法?C# Place.GetType怎么用?C# Place.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fill
public void Fill()
{
m_hasPutOnMap = false;
XmlDocument xmlDoc = new XmlDocument();
try
{
// let's hope it is good XML and we can load it the easy way:
xmlDoc.Load(m_fileName);
// we want to traverse XmlDocument fast, as tile load operations can be numerous
// and come in pack. So we avoid using XPath and rely mostly on "foreach child":
foreach(XmlNode nnode in xmlDoc.ChildNodes)
{
if(nnode.Name.Equals("features"))
{
foreach(XmlNode node in nnode)
{
try
{
string type = node.Name;
if(type.Equals("name"))
{
Place place = new Place(node);
if(place.Importance > 0 && !place.Name.Equals("NAME NOT KNOWN")) {
// if(checkForDuplicates) {
bool found = false;
foreach(LiveObject lo in m_list)
{
if(lo.GetType().Equals(place.GetType()))
{
Place p = (Place)lo;
if (p.sameAs(place))
{
found = true;
//LibSys.StatusBar.Trace("duplicate PLACE: " + place + " to " + p);
break;
}
}
}
if(!found)
{
m_list.Add(place);
namesCount++;
}
// } else { // checkForDuplicates
// m_list.Add(place);
// namesCount++;
// }
}
}
else if(type.Equals("ppl"))
{
City city = new City(node);
if(checkForDuplicates)
{
bool found = false;
foreach(LiveObject lo in m_list)
{
if(lo.GetType().Equals(city.GetType()))
{
City c = (City)lo;
if (c.sameAs(city))
{
found = true;
break;
}
}
}
if(!found)
{
m_list.Add(city);
citiesCount++;
}
}
else
{
m_list.Add(city);
citiesCount++;
}
}
}
catch (Exception ee)
{
// bad node, no big deal. Just continue.
LibSys.StatusBar.Error("Features:Fill() bad node: " + ee.Message);
}
}
}
}
}
catch (Exception e)
{
// bad XML. Try to load it the old way.
#if DEBUG
LibSys.StatusBar.Trace("Warning: Features:Fill(): " + m_fileName + " - bad XML. Loading old style");
#endif
StreamReader stream = null;
try
//.........这里部分代码省略.........