예제 #1
0
    // Handling custom gesture match callback - This is inovked when the Mode is set to Mode.IdentifyPlayerGesture and a gesture
    // is recorded.
    // gestureId - a serial number
    // match - the index that match or -1 if no match. The match index must be one in the SetTarget()
    void HandleOnPlayerGestureMatch(long gestureId, int match)
    {
        if (gestureId == 0)
        {
        }
        else
        {
            string result = "<color=red>Cannot find closest custom gesture</color>";
            if (PLAYER_GESTURE_ONE == match)
            {
                result = string.Format("<color=#FF00FF>Closest Custom Gesture GESTURE #1</color>");
            }
            else if (PLAYER_GESTURE_TWO == match)
            {
                result = string.Format("<color=yellow>Closest Custom Gesture GESTURE #2</color>");
            }

            // Check whether this gesture match any custom gesture in the database
            float[] data      = airsigManager.GetFromCache(gestureId);
            bool    isExisted = airsigManager.IsPlayerGestureExisted(data);
            result += isExisted?string.Format("\n<color=green>There is a similar gesture in DB!</color>"):
                      string.Format("\n<color=red>There is no similar gesture in DB!</color>");

            textToUpdate = result;
        }
    }