本文整理汇总了C#中Conversation.addMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Conversation.addMessage方法的具体用法?C# Conversation.addMessage怎么用?C# Conversation.addMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation.addMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createGuideText
public static Conversation createGuideText(string fileName)
{
Debug.Log ("Text/" + fileName + ".json");
string jsonString = readTextFile (/*"Assets/Resources/*/"Text/" + fileName/* + ".json"*/);
var N = JSON.Parse (jsonString);
string name = N ["name"].Value;
string img = N ["img"].Value;
Conversation conv = new Conversation (name, img);
for (int i = 0; i < N["messages"].Count; i++) {
Message msg = createMessage(N["messages"][i]);
conv.addMessage(msg);
}
return conv;
}
示例2: createConversation
public static Conversation createConversation(string fileName)
{
string jsonString = readTextFile (/*"Assets/Resources/"*/"Text/" + fileName/* + ".json"*/);
var N = JSON.Parse (jsonString);
string name = N ["name"].Value;
string img = N ["img"].Value;
List<Conversation> conversations = new List<Conversation>();
List<Answer> answers = new List<Answer>();
Conversation start = new Conversation (name, img);
for (int i = 0; i < N["start"].Count; i++) {
Message msg = createMessage(N["start"][i]);
start.addMessage(msg);
}
conversations.Add(start);
for (int i = 0; i < N["ans"].Count; i++) {
Conversation conv = new Conversation(name, img);
Answer ans = new Answer(N["ans"][i]["text"].Value, N["ans"][i]["url"].Value);
Debug.Log(N["ans"][i]["url"].Value);
for (int j = 0; j < N["ans"][i]["nans"].Count; j++) {
Message msg = createMessage(N["ans"][i]["nans"][j]);
conv.addMessage(msg);
}
conversations.Add(conv);
ans.setNextConversation(conv);
answers.Add(ans);
}
for (int i = 0; i < conversations.Count - 1; i++) {
foreach (Answer ans in answers) {
conversations[i].addAnswer(ans);
}
}
return conversations [0];
}