本文整理汇总了C#中Face.GetSingleValue方法的典型用法代码示例。如果您正苦于以下问题:C# Face.GetSingleValue方法的具体用法?C# Face.GetSingleValue怎么用?C# Face.GetSingleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Face
的用法示例。
在下文中一共展示了Face.GetSingleValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunConsciousRoutine
protected override RoutineResult RunConsciousRoutine()
{
using (var memory = new Memory())
{
var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
face.Talk(memory, "I'm going to try", " something new.");
face.Talk(memory, "Not sure if it's", " going to work.");
Interaction i = face.GetSingleValue(memory, "Gimme some input!");
face.Fade(memory, i.resultValue.ToString()[0], 1);
Interaction work = face.YesNo(memory, "Did it work?");
if (work.playerAnswer == Interaction.Answer.Yes)
{
face.Talk(memory, "Hmm.", "");
face.Talk(memory, "You can tell me", " the truth.");
face.Talk(memory, "I can handle it.", "");
face.Talk(memory, "Let me try this...");
face.Talk(memory, "", "", 10000);
///////////////////01234567890123456789////////////////////
face.Talk(memory, " ULTIMATE ",
" TECHNOLOGY ", 10000);
return MakeRoutineResult(memory, new Interaction(-1));
}
else if (work.playerAnswer == Interaction.Answer.No)
{
face.Talk(memory, "Darn!");
}
else
{
face.Talk(memory, "Hello?");
}
return MakeRoutineResult(memory, i);
}
}
示例2: RunConsciousRoutine
protected override RoutineResult RunConsciousRoutine()
{
using (var memory = new Memory())
{
var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
face.ResetIncrementer();
face.Talk(memory, "I'm wondering if", "we've met before.");
if (memory.GetKnownPlayers().Count > 0)
{
face.SlowTalk(memory, "Lets see...");
foreach (Player player in memory.GetKnownPlayers())
{
Interaction answer = face.GetSingleValue(memory, player.QuestionLine1, player.QuestionLine2, millisecondTimeout: 30000);
if (answer.playerAnswer == Interaction.Answer.DidNotAnswer)
{
face.Talk(memory, "I'm talking", "to myself.");
return MakeRoutineResult(memory, answer);
}
else if (answer.resultValue == player.Answer)
{
face.Talk(memory, string.Format("Hey, {0}!", player.Name));
face.Talk(memory, "I knew you'd", "be back.");
memory.SetCurrentPlayer(player);
answer.player = player;
return MakeRoutineResult(memory, answer);
}
face.Talk(memory, "Oh.", millisecondTimeout: 2000);
face.TalkInCircles(memory, 5000, "No", "That's not right", "Nope");
Interaction knowYou = memory.Remember("Do I know you?", "");
if (null == knowYou) knowYou = face.YesNo(memory, "Do I know you?");
if (knowYou.playerAnswer == Interaction.Answer.DidNotAnswer)
{
face.Talk(memory, "I'm talking", "to myself.");
return MakeRoutineResult(memory, answer);
}
if (knowYou.playerAnswer == Interaction.Answer.No)
{
face.Talk(memory, "Well, no wonder.");
knowYou.success = false;
return MakeRoutineResult(memory, knowYou);
}
face.Talk(memory, "Well then, let's", "maybe try another");
}
face.Talk(memory, "Actually, I don't", "think we've met.");
}
else
{
face.Talk(memory, "But I guess", "that's not possible");
}
return MakeRoutineResult(memory, new Interaction() { success = false, resultValue = (int)Interaction.Answer.No });
}
}
示例3: RunConsciousRoutine
protected override RoutineResult RunConsciousRoutine()
{
using (var memory = new Memory())
{
var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
face.Talk(memory, "Hey...");
face.Talk(memory, "I've got a", " question for you");
Interaction i;
int correctAnswers = 0;
bool correct = false;
do
{
MathProblem problem = new MathProblem();
i = face.GetSingleValue(memory, problem.ToString());
if (i.resultValue == problem.TheAnswer)
{
correctAnswers++;
correct = true;
face.Talk(memory, "Yes!");
if (correctAnswers == 1)
{
face.Talk(memory, "You can help me", " with something else");
}
else
{
face.Talk(memory, "Nice.", string.Format("That's {0} in a row", correctAnswers));
}
}
else if (i.playerAnswer == Interaction.Answer.DidNotAnswer)
{
correct = false;
face.SlowTalk(memory, "Stumped??");
face.Talk(memory, "You should probably", " go to class");
}
else
{
correct = false;
face.Talk(memory, "Good guess");
face.Talk(memory, "", " but no.");
}
} while (correct);
return MakeRoutineResult(memory, i);
}
}