Beispiel #1
0
    /// <summary>
    /// called whenever a screenshot was taken by the screenshot manager
    /// </summary>
    /// <param name="sender"> the sender of the event </param>
    /// <param name="e"> the photograph event parameters </param>
    private void OnScreenshotTaken(object sender, EventArgs e)
    {
        // Save ref for latest picture taken
        screenshotManager.GetLatestPicture(out imageAsTextureTmp, out cameraToWorldMatrixTmp, out projectionMatrixTmp);

        cameraPositionResultTmp = new CameraPositionResult();
        cameraPositionResultTmp.cameraToWorldMatrix = cameraToWorldMatrixTmp;
        cameraPositionResultTmp.projectionMatrix    = projectionMatrixTmp;

        //start analyzing image
        analysingScreenshot = true;

#if (!UNITY_EDITOR)
        if (screenshotsTakeable)
        {
            //id
            switch (currentRequestCause)
            {
            case RequestCause.REGULAR:

                if (regularCameraPositionResultList.Count > 9)
                {
                    // removing game object
                    Destroy(regularCameraPositionResultList[0].textHighlightObject);

                    regularCameraPositionResultList.RemoveAt(0);
                }

                cameraPositionResultTmp.id = currentId;
                regularCameraPositionResultList.Insert(regularCameraPositionResultList.Count, cameraPositionResultTmp);
                // Debug.Log("!!!!!RegularLIST Count" + regularCameraPositionResultList.Count);
                apiManager.AnalyzeImageAsync(RequestType.LOCAL, new Picture(imageAsTextureTmp));
                break;

            case RequestCause.USERINITIATED:

                screenshotsTakeable = false;
                this.screenshotManager._screenshotsTakeable = false;

                if (initiatedCameraPositionResultList.Count > 9)
                {
                    // removing game object
                    Destroy(initiatedCameraPositionResultList[0].visualizedTextObject);

                    initiatedCameraPositionResultList.RemoveAt(0);
                }
                cameraPositionResultTmp.id = currentId;
                initiatedCameraPositionResultList.Insert(initiatedCameraPositionResultList.Count, cameraPositionResultTmp);
                // Debug.Log("!!!!!InitiatedLIST Count" + initiatedCameraPositionResultList.Count);
                apiManager.AnalyzeImageAsync(RequestType.REMOTE, new Picture(imageAsTextureTmp));
                break;
            }
        }
#endif
    }