Former-commit-id: 5deb1de0f857cbe775572cda4c8a76532fbccba6
TangShanKaiPing
wanggang 6 years ago
parent 1338d9a77e
commit d3d90cf505

@ -311,6 +311,7 @@
<Compile Include="Assets\OpenCVForUnity\org\opencv_contrib\xphoto\WhiteBalancer.cs" />
<Compile Include="Assets\OpenCVForUnity\org\opencv_contrib\xphoto\Xphoto.cs" />
<Compile Include="Assets\Scripts\FaceDetectionController.cs" />
<Compile Include="Assets\Scripts\LoginResult.cs" />
<Compile Include="Assets\Scripts\WebViewController.cs" />
<Compile Include="Assets\UniversalMediaPlayer\Scripts\ARVideoCanvasHelper.cs" />
<Compile Include="Assets\UniversalMediaPlayer\Scripts\EventsHandlerExample.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.
/// </summary>
private WebCamTextureToMatHelper webCamTextureToMatHelper;
private bool _isChecking;
private static object _lockObject = new object();
@ -47,6 +49,8 @@ namespace Assets.Scripts
/// </summary>
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<LoginResult>(request.downloadHandler.text);
if (result.Success)
{
text.text = result.NickName;
}
}
}
}

@ -0,0 +1,6 @@
public class LoginResult
{
public bool Success;
public string UserName;
public string NickName;
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cb5a1b1e4481dc4abd2ebc63f3094b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -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 });
}
}
}

Loading…
Cancel
Save