Exemple #1
0
    public void GetPlayerHeader(uint playerid, uint crc, HeaderOptType opt, object extraData)
    {
        DownPlayerHeader dph = new DownPlayerHeader();

        dph.PlayerID  = playerid;
        dph.Crc       = crc;
        dph.Opt       = (byte)opt;
        dph.extraData = extraData;
        m_DownList.Add(dph);
        //SceneMain.Instance.StartInnerCoroutine(GetHeader(dph));
    }
Exemple #2
0
 void CheckDownList()
 {
     if (m_ActiveDown != null)
     {
         if (m_ActiveDown.DownData != null)
         {
             if (m_ActiveDown.DownData.IsCompletion)
             {
                 if (m_ActiveDown.DownData.IsOK)
                 {
                     bool bret = SaveTex(m_ActiveDown.PlayerID, m_ActiveDown.Crc, m_ActiveDown.DownData.Bytes);
                     if (bret)
                     {
                         m_ActiveDown.DownData = null;
                         SceneMain.Instance.StartInnerCoroutine(GetHeader(m_ActiveDown));
                     }
                     else
                     {
                         GetPlayerHeaderResult(m_ActiveDown.PlayerID, null, (HeaderOptType)m_ActiveDown.Opt, m_ActiveDown.extraData);
                         m_ActiveDown.DownData = null;
                     }
                 }
                 else
                 {
                     GetPlayerHeaderResult(m_ActiveDown.PlayerID, null, (HeaderOptType)m_ActiveDown.Opt, m_ActiveDown.extraData);
                     m_ActiveDown = null;
                 }
             }
         }
         else if (m_ActiveDown.W.error != null)
         {
             GetPlayerHeaderResult(m_ActiveDown.PlayerID, null, (HeaderOptType)m_ActiveDown.Opt, m_ActiveDown.extraData);
             m_ActiveDown = null;
         }
         else if (m_ActiveDown.W.isDone)
         {
             if (!m_ActiveDown.Local)
             {
                 SaveTex(m_ActiveDown.PlayerID, m_ActiveDown.Crc, m_ActiveDown.W.texture.EncodeToJPG());
             }
             GetPlayerHeaderResult(m_ActiveDown.PlayerID, m_ActiveDown.W.texture, (HeaderOptType)m_ActiveDown.Opt, m_ActiveDown.extraData);
             m_ActiveDown = null;
         }
     }
     if (m_ActiveDown == null)
     {
         if (m_DownList.Count > 0)
         {
             m_ActiveDown = m_DownList[0];
             Utility.ListRemoveAt(m_DownList, 0);
             SceneMain.Instance.StartInnerCoroutine(GetHeader(m_ActiveDown));
         }
     }
 }
Exemple #3
0
    //获取头像
    System.Collections.IEnumerator GetHeader(object obj)
    {
        DownPlayerHeader dph  = (DownPlayerHeader)obj;
        string           pic  = dph.PlayerID + "_" + dph.Crc + ".jpg";
        string           path = RuntimeInfo.GetLocalDirectory() + "/images/" + pic;

        if (System.IO.File.Exists(path))
        {
            dph.Local = true;
            dph.W     = new WWW("file:///" + path);
        }
        else
        {
            dph.Local    = false;
            dph.DownData = FTPClient.Instance.AddDownload(DownloadType.DOWNLOAD_DEFAULT, ServerSetting.RT_IMAGE_DIR + pic, null);
        }
        yield break;
    }