// Handling player signature training callback - This is invoked when the Mode is set to Mode.TrainPlayerSignature and a gesture is recorded. // gestureId - a serial number // error - error while training for this signature // progress - progress of training. 1 indicates the training is completed // securityLevel - the strength of this player sinature void HandleOnPlayerSignatureTrained(long gestureId, AirSigManager.Error error, float progress, AirSigManager.SecurityLevel securityLevel) { if (null == error) { if (progress < 1.0f) { textToUpdate = string.Format("Player signature training\nunder progress {0}%", Mathf.RoundToInt(progress * 100)); } else { // The training has completed, switch to the identification mode nextUiAction = () => { StopCoroutine(uiFeedback); SwitchToIdentify(); hasSignatureSet = true; }; } } else { textToUpdate = string.Format("<color=red>This attempt of training failed\ndue to {0} (see error code document),\ntry again</color>", error.code); trainFailCount++; if (trainFailCount >= 3 || progress < 0.5f) { // Reset if any error airsigManager.DeletePlayerRecord(PLAYER_SIGNATURE_INDEX); // Report error //textToUpdate = string.Format("<color=red>Inconsistent signature\ndue to {0} (see error code document),\nReset progress to 0%</color>", error.code); // Reset will also reset cumulative count trainFailCount = 0; } else if (progress >= 0.5f) { //textToUpdate = string.Format("<color=red>Failed {0} attempt(s)\ndue to {1} (see error code document),\ntry again</color>", trainFailCount, error.code); } if (error.code == -204) //Too few words { if (progress > 0) { textToUpdate = string.Format("<color=red>Inconsistent signature</color>"); } else { textToUpdate = string.Format("<color=red>Please write your full name.\nShort signature is less secure</color>"); } } else if (error.code == -201) //The signature is too short that considered as empty. { if (progress > 0) { textToUpdate = string.Format("<color=red>Inconsistent signature</color>"); } else { textToUpdate = string.Format("<color=red>Too short. Please write your full name</color>"); } } else if (error.code == -205) //Too few wrist //Use too few wriste { textToUpdate = string.Format("<color=red>Too slow. Please try to write faster</color>"); } else if (error.code == -207) //Too many kinds of signature (diverse) { textToUpdate = string.Format("<color=red>Inconsistent signature</color>"); } else if (error.code == -209) //Second Input is too different than first one { textToUpdate = string.Format("<color=red>Inconsistent signature</color>"); } else if (error.code == -202) //Too long { textToUpdate = string.Format("<color=red>Signature too long</color>"); } else if (error.code == -200) //Mistouch { textToUpdate = string.Format("<color=red>Inconsistent signature</color>"); } } }
// Handling player signature training callback - This is invoked when the Mode is set to Mode.TrainPlayerSignature and a gesture is recorded. // gestureId - a serial number // error - error while training for this signature // progress - progress of training. 1 indicates the training is completed // securityLevel - the strength of this player sinature void HandleOnPlayerSignatureTrained(long gestureId, AirSigManager.Error error, float progress, AirSigManager.SecurityLevel securityLevel) { if (null == error) { if (progress < 1.0f) { textToUpdate = string.Format("Player signature training\nunder progress {0}%", Mathf.RoundToInt(progress * 100)); } else { // The training has completed, switch to the identification mode nextUiAction = () => { StopCoroutine(uiFeedback); SwitchToIdentify(); }; } } else { textToUpdate = string.Format("<color=red>This attempt of training failed\ndue to {0} (see error code document),\ntry again</color>", error.code); } }