本文整理汇总了C#中Conversation.getRootNode方法的典型用法代码示例。如果您正苦于以下问题:C# Conversation.getRootNode方法的具体用法?C# Conversation.getRootNode怎么用?C# Conversation.getRootNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation.getRootNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: read
public static Conversation read(String fileName)
{
Conversation conv = new Conversation("");
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(fileName);
XmlNodeList xmlNL = xmlDoc.GetElementsByTagName("npcName");
XmlElement xmlEl;
xmlEl = (XmlElement)xmlNL[0];
conv.npcName = xmlEl.GetAttribute("npcName");
xmlNL = xmlDoc.GetElementsByTagName("resetConversation");
xmlEl = (XmlElement)xmlNL[0];
bool resetConv = bool.Parse(xmlEl.GetAttribute("resetConversation"));
conv.resetConversationOnEnd = resetConv;
xmlNL = xmlDoc.SelectNodes("/conversation/dialog/dialogNode");
List<DialogResponse> respWithouChildren = new List<DialogResponse>();
List<DialogResponse> respThatSwitchConv = new List<DialogResponse>();
for (int i = 0; i < xmlNL.Count; i++)
{
xmlEl = (XmlElement)xmlNL[i];
DialogNode node = loadNode(xmlEl, ref conv,
ref respWithouChildren, ref respThatSwitchConv);
conv.addRootNode(node);
}
for (int i = 0; i < respWithouChildren.Count; i++)
{
DialogResponse response = respWithouChildren[i];
DialogNode node = conv.getNodeById(response.link);
respWithouChildren[i].childNode = node;
}
for (int i = 0; i < respThatSwitchConv.Count; i++)
{
DialogResponse response = respThatSwitchConv[i];
DialogNode node = conv.getNodeById(response.switchConversation);
respThatSwitchConv[i].switchNode = node;
}
conv.curNode = conv.getRootNode(0);
conv.startNode = conv.getRootNode(0);
return conv;
}