diff --git a/labs/IoTClient/Assembly-CSharp.csproj b/labs/IoTClient/Assembly-CSharp.csproj index dd00a5f3..233d4db6 100644 --- a/labs/IoTClient/Assembly-CSharp.csproj +++ b/labs/IoTClient/Assembly-CSharp.csproj @@ -311,6 +311,7 @@ + diff --git a/labs/IoTClient/Assets/Scripts/FaceDetectionController.cs b/labs/IoTClient/Assets/Scripts/FaceDetectionController.cs index 53e0c1cc..eaa83bdf 100644 --- a/labs/IoTClient/Assets/Scripts/FaceDetectionController.cs +++ b/labs/IoTClient/Assets/Scripts/FaceDetectionController.cs @@ -7,6 +7,7 @@ using OpenCVForUnity.UnityUtils.Helper; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; +using UnityEngine.UI; namespace Assets.Scripts { @@ -39,6 +40,7 @@ namespace Assets.Scripts /// The webcam texture to mat helper. /// private WebCamTextureToMatHelper webCamTextureToMatHelper; + private bool _isChecking; private static object _lockObject = new object(); @@ -47,6 +49,8 @@ namespace Assets.Scripts /// protected static readonly string LBP_CASCADE_FILENAME = "lbpcascade_frontalface.xml"; + public Text text; + // Use this for initialization private void Start() { @@ -237,6 +241,11 @@ namespace Assets.Scripts else { Debug.Log(request.downloadHandler.text); + var result = JsonUtility.FromJson(request.downloadHandler.text); + if (result.Success) + { + text.text = result.NickName; + } } } } diff --git a/labs/IoTClient/Assets/Scripts/LoginResult.cs b/labs/IoTClient/Assets/Scripts/LoginResult.cs new file mode 100644 index 00000000..b7366346 --- /dev/null +++ b/labs/IoTClient/Assets/Scripts/LoginResult.cs @@ -0,0 +1,6 @@ +public class LoginResult +{ + public bool Success; + public string UserName; + public string NickName; +} \ No newline at end of file diff --git a/labs/IoTClient/Assets/Scripts/LoginResult.cs.meta b/labs/IoTClient/Assets/Scripts/LoginResult.cs.meta new file mode 100644 index 00000000..1b698aff --- /dev/null +++ b/labs/IoTClient/Assets/Scripts/LoginResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9cb5a1b1e4481dc4abd2ebc63f3094b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/projects/UserCenter/Controllers/AccountController.cs b/projects/UserCenter/Controllers/AccountController.cs index 5999d2bd..12721c33 100644 --- a/projects/UserCenter/Controllers/AccountController.cs +++ b/projects/UserCenter/Controllers/AccountController.cs @@ -134,7 +134,15 @@ namespace UserCenter.Controllers using (var bitmap = new System.Drawing.Bitmap(stream)) { var userName = this._frs.FindFace(bitmap); - return Json(new { success = !string.IsNullOrEmpty(userName), data = userName }); + if (!string.IsNullOrEmpty(userName)) + { + var user = this._userRepo.ReadOnlyTable().FirstOrDefault(o => o.UserName == userName); + if (user != null) + { + return Json(new { Success = true, UserName = userName, NickName = user.NickName }); + } + } + return Json(new { Success = false }); } } }