Exemplo n.º 1
0
    public void PortraitPath()
    {
        string filter             = "*.jpg,*.png";
        string title              = "选择头像";
        string extension          = ".png";
        string selectPortraitPath = ToolFunction.OpenFilePath(filter, title, extension);
        var    tempSprite         = ToolFunction.CreateSpriteFromImage(selectPortraitPath);

        m_PortraitImage.overrideSprite = tempSprite;
    }
    private void AddListItembByFileName(string astrFileName)
    {
        var templist     = astrFileName.Split('\\');
        var tempFileName = templist[templist.Length - 1].Split('.')[0];
        var tempHeadData = FileReader.GetHeadFromFile(astrFileName);
        var tempListItem = Instantiate(m_ListItemPrefab, m_Content.transform);

        tempListItem.GetComponentsInChildren <Image>()[1].overrideSprite = ToolFunction.CreateSpriteFromImage(ToolFunction.GetDefaultPortraitPathByName(tempHeadData.strPortrait, ".jpg"));
        tempListItem.GetComponentInChildren <Text>().text = tempHeadData.strDoctorName + "\n" + tempFileName;
        tempListItem.GetComponent <ClickCompairListItem>().SetFilePath(astrFileName);
    }
 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;
     }
 }