Example #1
0
        private static string StatePretty(WebglAvatarState state)
        {
            switch (state)
            {
            case WebglAvatarState.UPLOADING:
                return("uploading photo to the server");

            case WebglAvatarState.CALCULATING_IN_CLOUD:
                return("deep learning inference");

            case WebglAvatarState.DOWNLOADING:
                return("downloading avatar files");

            case WebglAvatarState.FINISHED:
                return("done");

            case WebglAvatarState.FAILED:
                return("calculations failed, please try a different photo");
            }

            return("unknown state");
        }
Example #2
0
        private void UpdateAvatarState(WebglAvatarState state, PipelineType pipelineType)
        {
            Debug.LogFormat("Pipeline: {0}, state: {1}", pipelineType, state);

            if (pipelineType == PipelineType.FACE)
            {
                // Don't display avatar status of animated face pipeline
                // It is being calculated in background
                return;
            }

            avatarState     = state;
            statusText.text = string.Format("State: {0}", StatePretty(state));

            uploadButton.gameObject.SetActive(false);
            showButton.gameObject.SetActive(false);
            statusText.gameObject.SetActive(true);
            progressText.gameObject.SetActive(true);

            if (state == WebglAvatarState.FAILED)
            {
                return;
            }

            switch (state)
            {
            case WebglAvatarState.FINISHED:
                showButton.gameObject.SetActive(true);
                statusText.gameObject.SetActive(false);
                progressText.gameObject.SetActive(false);
                break;

            default:
                break;
            }
        }