Beispiel #1
0
    public void OnCaptureImage()
    {
        if (activeARController == null)
        {
            return;
        }
        //      Texture2D captureImage = activeARController.captureCurrentFrame();
        //		string filePath = GlobalController.Instance.SaveImage(captureImage);

        captureButton.gameObject.SetActive(false);
        loadingMessage.gameObject.SetActive(true);
        Vector3 cameraPos = Camera.main.transform.position;

        cameraPos.z = cameraPos.z - 1.0f;
        GameObject anchorObject = activeARController.createAnchor(cameraPos, Quaternion.identity);

        string filePath = Path.Combine(Application.persistentDataPath, "IMG_20190714_100544.jpg");

        Debug.Log(filePath);
        GlobalController.Instance.RecognizeImage(filePath, (string result) =>
        {
            Debug.Log(result);
            RecognizedResult recognizedResult = JsonConvert.DeserializeObject <RecognizedResult>(result);
            scanResultText.gameObject.SetActive(true);
            scanResultText.text = string.Join(",", recognizedResult.result.ToArray()) + " だって!!";
            GlobalController.Instance.RequestVideoInfo(recognizedResult.result, (string videoInfo) =>
            {
                List <VideoInfo> videoInfos = JsonConvert.DeserializeObject <List <VideoInfo> >(videoInfo);
                GlobalController.Instance.AppearVideo(videoInfos[0].formats[0].url, anchorObject);
                captureButton.gameObject.SetActive(true);
                loadingMessage.gameObject.SetActive(false);
            });
        });
    }
        internal RecognitionResultUpdatedEventArgs(RecognizedResult result, IntPtr cmdList, IntPtr recognizedText)
        {
            _result = result;
            SafeCommandListHandle handle = new SafeCommandListHandle(cmdList);
            VoiceCommandsGroup    _list  = new VoiceCommandsGroup(handle);

            _command        = _list.Commands;
            _recognizedText = Marshal.PtrToStringAnsi(recognizedText);
        }
 internal AllRecognitionResultEventArgs(RecognizedResult result, string recognizedText, string msg)
 {
     Result         = result;
     RecognizedText = recognizedText;
     Message        = msg;
 }