public void BtnYes()
    {
        var filepath = m_DeleteObj.GetComponent <ClickMovieListItem>().GetFilePath();

        ConfigCenter.Instance().DeleteFileByPath(filepath);
        var temphead     = FileReader.GetHeadFromFile(filepath);
        var portraitpath = ToolFunction.GetDefaultPortraitPathByName(temphead.strPortrait, ".jpg");

        if (File.Exists(portraitpath))
        {
            File.Delete(portraitpath);
        }
        if (File.Exists(filepath))
        {
            File.Delete(filepath);
        }
        Destroy(m_DeleteObj);
        Destroy(gameObject);
    }
 public void SetFileName(string strFileName)
 {
     if (bIsRef)
     {
         m_studyManager.SetRefFileName(strFileName);
         bIsRefFileSet = true;
         var tempHeadData = FileReader.GetHeadFromFile(strFileName);
         m_BtnRefData.image.overrideSprite = ToolFunction.CreateSpriteFromImage(ToolFunction.GetDefaultPortraitPathByName(tempHeadData.strPortrait, ".jpg"));
         m_BtnRefData.GetComponentInChildren <Text>().text      = tempHeadData.strDoctorName;
         m_BtnRefData.GetComponentInChildren <Text>().alignment = TextAnchor.LowerCenter;
     }
     else
     {
         m_studyManager.SetCompairFileName(strFileName);
         bIsCompairFileSet = true;
         m_CompairData.SetActive(true);
         var tempHeadData = FileReader.GetHeadFromFile(strFileName);
         m_CompairData.GetComponentInChildren <Image>().overrideSprite = ToolFunction.CreateSpriteFromImage(ToolFunction.GetDefaultPortraitPathByName(tempHeadData.strPortrait, ".jpg"));
         m_CompairData.GetComponentInChildren <Text>().text            = tempHeadData.strDoctorName;
     }
 }
예제 #3
0
    public void Btn_Save()
    {
        if (string.IsNullOrEmpty(m_InputDoctorName.text) ||
            string.IsNullOrEmpty(m_InputFilePath.text))
        {
            m_InputDoctorName.placeholder.GetComponent <Text>().color = Color.red;
            m_InputFilePath.placeholder.GetComponent <Text>().color   = Color.red;
        }
        else
        {
            //根据输入的文件名和选择的头像,将文件存储到默认存储文件夹,将头像图片复制到默认头像存储文件夹
            m_FilePath = ToolFunction.GetMovieSaveFilePath(m_InputFilePath.text, ".txt");
            var tempPortrait = ToolFunction.GenerateStringID();
            ToolFunction.ImageSaveLocal(m_PortraitImage.mainTexture, ToolFunction.GetDefaultPortraitPathByName(tempPortrait, ".jpg"));
            int           tempTimeCount = m_RecordManager.GetFrameCount();
            int           tempStartTime = (int)(tempTimeCount * m_fLeftSliderValue);
            int           tempEndTime   = (int)(tempTimeCount * m_fRightSliderValue);
            MovieHeadData tempData      = new MovieHeadData(
                "MOVIE_DATA",
                m_InputDoctorName.text,
                tempPortrait,
                System.DateTime.Now.ToString("MM/dd/yyyy H:mm:ss"),
                tempEndTime - tempStartTime,
                0,
                ConfigCenter.Instance().GetFPS()
                );
            m_RecordManager.SaveDataToFile(
                tempData,
                m_FilePath,
                tempStartTime,
                tempEndTime
                );

            m_SavePanel.SetActive(false);
            m_InfoSaved.SetActive(true);
        }
    }
    public void AddListItembByFileName(string astrFileName)
    {
        if (string.IsNullOrEmpty(astrFileName))
        {
            return;
        }
        var templist     = astrFileName.Split('\\');
        var tempFileName = templist[templist.Length - 1].Split('.')[0];
        var tempHeadData = FileReader.GetHeadFromFile(astrFileName);
        var tempListItem = Instantiate(m_MovieListItemPrefab, m_Content.transform);

        tempListItem.GetComponent <Image>().overrideSprite = ToolFunction.CreateSpriteFromImage(ToolFunction.GetDefaultPortraitPathByName(tempHeadData.strPortrait, ".jpg"));
        tempListItem.GetComponentInChildren <Text>().text  = tempHeadData.strDoctorName + "\n" + tempFileName;
        tempListItem.GetComponent <ClickMovieListItem>().SetFilePath(astrFileName);
    }