Exemplo n.º 1
0
    /// <summary>
    /// Perform appropriate functional after finish sending audio file.
    /// </summary>
    /// <param name="status">Status.</param>
    public void Finished(VoiceReportSentStatus status)
    {
        if (www != null)
        {
            www.Dispose();
        }

        RemoveFilesFromDisk();
        _isRecordingProcess = false;
        VoiceReportMenu.Instance.DisplayBackButton(true);
        VoiceReportMenu.Instance.DisplayMakeRecordButton(true);
        VoiceReportMenu.Instance.DisplayProgressResult(VoiceReportAction.Finished, status, 0);
    }
    /// <summary>
    /// Display the progress sending result.
    /// </summary>
    /// <param name="action">Action.</param>
    /// <param name="sendStatus">Send status.</param>
    /// <param name="recordingProgressValue">Recording progress value.</param>
    public void DisplayProgressResult(VoiceReportAction action, VoiceReportSentStatus sendStatus, float recordingProgressValue)
    {
        currentRecordingAction = action;
        reportSentStatus       = sendStatus;
        progressLabel.color    = Color.black;
        progressLabel.text     = "";
        switch (currentRecordingAction)
        {
        case VoiceReportAction.Recording:
            progressLabel.text = "recording ... " + (int)recordingProgressValue + " seconds left.";
            float progressBarValue = Mathf.Abs(recordingProgressValue - Constants.voiceReportLenght);
            progressLabel.color = (int)progressBarValue % 2 == 0 ? Color.red : Color.black;
            SetProgressBarValue((int)progressBarValue);
            break;

        case VoiceReportAction.Sending:
            progressLabel.color = (int)Time.deltaTime % 2 == 0 ? Color.red : Color.black;
            progressLabel.text  = "Your report is sending...";
            break;

        case VoiceReportAction.Finished:
            switch (sendStatus)
            {
            case VoiceReportSentStatus.Sussess:
                progressLabel.color = Color.green;
                progressLabel.text  = "The report was sent successfully. Thank you!";
                break;

            case VoiceReportSentStatus.Failed:
                progressLabel.color = Color.red;
                progressLabel.text  = "Sorry, some error occured. Please try later.";
                break;

            default:
                progressLabel.text = "";
                break;
            }
            break;

        case VoiceReportAction.None:
            progressLabel.text = " ";
            break;

        default:
            progressLabel.text = "";
            break;
        }
    }