Beispiel #1
0
    /// <summary>
    /// 加载列表
    /// </summary>
    public void LoadList()
    {
        CommonTools.ClearObjectChilds(content);


        PaperManager.GetFileList();//取得文件列表

        UserMemoryList uml = UserMemoryManager.ReadList();

        if (uml == null)
        {
        }
        else
        {
            for (int i = uml.allMemorys.Count - 1; i >= 0; i--)
            {
                MemoryInfoItemCtrl miic = CommonTools.NewAnObjectA(infoPrefab, content.transform).GetComponent <MemoryInfoItemCtrl>();

                UserMemoryList.Common common = uml.allMemorys[i]; //读取

                miic.common   = common;                           //文件
                miic.memoryID = i;                                //储存ID

                string endText = "";
                switch (common.type)
                {
                case UserMemoryList.MemoryType.GD_CELST:    //CELST
                    endText = "<Color='Orange'>#广东高考口语#" + i + "</Color>\n";


                    break;

                case UserMemoryList.MemoryType.CETB4B6:    //CETB4B6
                    endText = "<Color='Orange'>#英语四六级#" + i + "</Color>\n";


                    break;
                }
                endText           += "时间:" + common.time;
                miic.mainText.text = endText;
            }
        }
    }
Beispiel #2
0
 public void DeleteObj()
 {
     GlobalUIManager.guim.CreateNewSelectBox("确认删除曾经数据?数据一旦删除无法恢复!", delegate(bool ok) {
         if (ok)
         {
             if (tempObjectID != -1)
             {
                 UserMemoryManager.DeleteOneData(tempObjectID);
                 GlobalUIManager.guim.CreateNewDialogTie("删除成功!");
             }
             else
             {
                 GlobalUIManager.guim.CreateNewDialogTie("未知错误删除失败!");
             }
             CloseWindows();
             LoadList();
         }
     });
 }
    IEnumerator SavePaper()
    {
        tempPaper.id = classPaper.id;
        uploadHandle.infoText.text = "正在处理录音数据...";
        string rootPath = classPaper.path + "/Memory";

        PaperManager.CreatePath(rootPath);
        string fileName = "TempPaperCELSTWhen" + System.DateTime.Now.ToString("TyyyyMMddhhmmss") + "Random" + Random.Range(-23333, 23333) + ".lhirin";

        tempPath = rootPath + "/" + fileName;


        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());

        PaperManager.SaveFile(tempPath, JsonUtility.ToJson(tempPaper));
        UserMemoryManager.InsertIntoList(new UserMemoryList.Common {
            dataPath = tempPath,
            time     = System.DateTime.Now.ToString(),
            type     = UserMemoryList.MemoryType.GD_CELST
        });
        uploadHandle.infoText.text = "缓存创建完毕!";

        GlobalUIManager.guim.CreateNewSelectBox("缓存完毕,是否上传音频呢?\n如果需要机器改卷或他人协助必须上传到服务器.", delegate(bool ok) {
            if (ok)
            {
                StartCoroutine(CheakPaper());
            }
            else
            {
                uploadHandle.gradeObj.SetActive(true);
                uploadHandle.gradeText.text = "用户取消上传!请点击关闭回到大厅进行自评或进行其他操作!";
            }
        });
        //PlayerPrefs.SetString("tempPaper", JsonUtility.ToJson(tempPaper));
        //PlayerPrefs.Save();
    }