示例#1
0
        public async void SubmitResult(ChoreographyCue cue)
        {
            Log.Debug(_tag, "Waiting for opponent submission signal.");
            await opponentSubmissionSignal.WaitAsync();

            Log.Debug(_tag, "Opponent submission received.");

            if (double.IsNaN(cue.Score))
            {
                Speech.Say("Gesture unrecognized."); cue.Score = double.NegativeInfinity;
            }
            else if (double.IsNaN(opponentSubmittedCue.Score))
            {
                Opponent.SendMessage(MsgType.PushSpeech, "Gesture unrecognized."); opponentSubmittedCue.Score = double.NegativeInfinity;
            }
            else
            {
                var ownNetScore = cue.Score - cue.Delay.TotalSeconds;
                var oppNetScore = opponentSubmittedCue.Score - opponentSubmittedCue.Delay.TotalSeconds;
                if (Math.Abs(ownNetScore - oppNetScore) < 0.35)
                {
                    Speech.Say("Tie."); Opponent.SendMessage(MsgType.PushSpeech, "Tie.");
                }
                else if (ownNetScore > oppNetScore)
                {
                    Speech.Say("Point.");
                }
                else
                {
                    Opponent.SendMessage(MsgType.PushSpeech, "Point.");
                }
            }

            Generator.SubmitResults(cue, opponentSubmittedCue);
        }
示例#2
0
        public void SubmitResult(ChoreographyCue cue)
        {
            //if (double.IsNaN(cue.Score))
            //{
            //    Speech.Say("What the heck was that?");
            //}
            //else if (cue.Score < 0)
            //{
            //    var recognizedAsName = Classifiers[cue.ClassifierKey].MatchingDatasetClasses[cue.GestureClassIndex].className;
            //    Speech.Say($"Looked more like {recognizedAsName}, with {(-1 * cue.Score):f1} points.", SoundOptions.AtSpeed(2.0));
            //}
            //else
            //{
            //    Speech.Say($"Score {cue.Score:f1}, {cue.Delay.TotalSeconds:f1} seconds", SoundOptions.AtSpeed(2.0));
            //}

            if (IsOnPlayerTwo)
            {
                if (double.IsNaN(PlayerOneCue.Score))
                {
                    Speech.Say("First gesture unrecognized.", SoundOptions.AtSpeed(2.0));
                }
                else if (double.IsNaN(cue.Score))
                {
                    Speech.Say("Second gesture unrecognized.", SoundOptions.AtSpeed(2.0));
                }
                else
                {
                    var P1netscore = PlayerOneCue.Score - PlayerOneCue.Delay.TotalSeconds;
                    var P2netscore = cue.Score - cue.Delay.TotalSeconds;
                    if (Math.Abs(P1netscore - P2netscore) < 0.35)
                    {
                        Speech.Say("Tie.");
                    }
                    else if (P1netscore > P2netscore)
                    {
                        Speech.Say("Point to first.", SoundOptions.AtSpeed(2.0));
                    }
                    else
                    {
                        Speech.Say("Point to second.", SoundOptions.AtSpeed(2.0));
                    }
                }

                Generator.SubmitResults(PlayerOneCue, cue);
                IsOnPlayerTwo = false;
                PlayerOneCue  = null;
            }
            else
            {
                PlayerOneCue  = cue;
                IsOnPlayerTwo = true;
                ReceivedSubmission.Set();
            }
        }
示例#3
0
 public void SubmitResult(ChoreographyCue cue)
 {
     if (double.IsNaN(cue.Score))
     {
         Speech.Say("What the heck was that?");
     }
     else if (cue.Score < 0) // Encodes "score but for the wrong gesture" in our Cue.Score scheme.
     {
         var recognizedAsName = Classifiers[cue.ClassifierKey].MatchingDatasetClasses[cue.GestureClassIndex].className;
         Speech.Say($"Looked more like {recognizedAsName}, with {(-1 * cue.Score):f1} points.", SoundOptions.AtSpeed(2.0));
     }
     else
     {
         Speech.Say($"Score {cue.Score:f1}, {cue.Delay.TotalSeconds:f1} seconds", SoundOptions.AtSpeed(2.0));
     }
     Generator.SubmitResults(cue, default(ChoreographyCue));
 }