void ValidateDrawing(GestureRecognizerResponse response)
 {
     _gestureScript.Enabled = false;
     if (response.IsMatch && response.MatchedTemplate.Letter == _requestedLetter.Letter)
     {
         HandleCorrectLetter();
     }
     else
     {
         HandleWrongLetter();
     }
 }
Пример #2
0
 public void RecognizerFinished(GestureRecognizerResponse response)
 {
     LastNormalizedGesture = response.OptimizedPoints;
     if (response.IsMatch)
     {
         LastMatchedGesture = response.MatchedTemplate;
         SetDebugText(response.MatchedTemplate.Name);
         Debug.Log("Matched with " + response.MatchedTemplate.Name + ". Score: " + response.Score);
     }
     else
     {
         LastMatchedGesture = null;
         SetDebugText("No match");
         Debug.Log("No match");
     }
 }
Пример #3
0
    /// <summary>
    /// If match  the recognizer will only concern itself with the given letters
    /// </summary>
    public GestureRecognizerResponse StartRecognizer(IList <Stroke> strokes, float sensitivity, params Letter[] lettersToMatch)
    {
        var normalizedStrokes = normalizer.NormalizeGesture(strokes);

        if (normalizer.IsNormalizationInvalid(normalizedStrokes))
        {
            return(GestureRecognizerResponse.Fail(normalizedStrokes));
        }

        var matchedTemplate = templateMatcher.MatchGesture(normalizedStrokes, sensitivity, lettersToMatch);

        if (matchedTemplate == null)
        {
            return(GestureRecognizerResponse.Fail(normalizedStrokes));
        }

        return(new GestureRecognizerResponse(matchedTemplate.Template, normalizedStrokes, matchedTemplate.Score));
    }