IEnumerator CheakPaper() { yield return(new WaitForEndOfFrame()); uploadHandle.infoText.text = "正在上传..."; yield return(new WaitForEndOfFrame()); StartCoroutine(UploadVoiceHandle.Uploader(classPaper.id, tempPaper.partA, tempPaper.partBA, tempPaper.partBB, tempPaper.partC, delegate(ulong size, float process) { uploadHandle.process.fillAmount = process; uploadHandle.processText.text = "(" + GetFileSize(size) + "/" + GetFileSize((ulong)(float.Parse(size.ToString()) / process)) + ")" + Mathf.CeilToInt(process * 100).ToString() + "%"; }, OnUploadDone )); }
IEnumerator CheakPaper() { tempPaper.id = classPaper.id; uploadHandle.infoText.text = "正在处理录音数据..."; //string rootPath = classPaper.path + "/TEMP/Exam" + System.DateTime.Now.ToString("TyyyyMMddhhmmss"); // PaperManager.CreatePath(rootPath); //rootPath += "/"; string partA_b64 = ""; if (pac.scucess) { uploadHandle.infoText.text = "正在处理-PartA"; yield return(new WaitForEndOfFrame()); partA_b64 = CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PA)); tempPaper.partA = partA_b64; } string partBA_b64 = ""; string partBB_b64 = ""; if (pbc.scucess) { for (int i = 0; i < PB_P1.Count; i++) { uploadHandle.infoText.text = "正在处理-PartB问题" + (i + 1).ToString(); yield return(new WaitForEndOfFrame()); partBA_b64 += CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PB_P1[i])); if (i != PB_P1.Count - 1) { partBA_b64 += "|"; } } tempPaper.partBA = partBA_b64; for (int i = 0; i < PB_P2.Count; i++) { uploadHandle.infoText.text = "正在处理-PartB回答" + (i + 1).ToString(); yield return(new WaitForEndOfFrame()); partBB_b64 += CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PB_P2[i])); if (i != PB_P2.Count - 1) { partBB_b64 += "|"; } } tempPaper.partBB = partBB_b64; } string partC_b64 = ""; if (pcc.scucess) { uploadHandle.infoText.text = "正在处理-PartC"; yield return(new WaitForEndOfFrame()); partC_b64 = CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PA)); tempPaper.partC = partC_b64; } tempPaper.isUpload = false; uploadHandle.infoText.text = "正在创建缓存..."; yield return(new WaitForEndOfFrame()); PlayerPrefs.SetString("tempPaper", JsonUtility.ToJson(tempPaper)); PlayerPrefs.Save(); uploadHandle.infoText.text = "正在上传..."; yield return(new WaitForEndOfFrame()); StartCoroutine(UploadVoiceHandle.Uploader(classPaper.id, partA_b64, partBA_b64, partBB_b64, partC_b64, delegate(ulong size, float process) { uploadHandle.process.fillAmount = process; uploadHandle.processText.text = "(" + GetFileSize(size) + "/" + GetFileSize((ulong)(float.Parse(size.ToString()) / process)) + ")" + Mathf.CeilToInt(process * 100).ToString() + "%"; }, OnUploadDone )); }