Exemple #1
0
    public byte[] LoadByte(string fileResPath)
    {
        string realResPath = LocalPath.HotUpdatePath + LocalPath.PackagingResources + "/" + fileResPath;

        if (!File.Exists(realResPath))
        {
            realResPath = LocalPath.StreamingAssetsPath + LocalPath.PackagingResources + "/" + fileResPath;
        }

        return(C_Save.LoadByte(C_String.GetFileName(fileResPath), C_String.GetSavePath(realResPath)));
    }
Exemple #2
0
    //下载开始,从最尾端开始
    private void Download()
    {
        if (m_nDownloadCount > 0)
        {
            m_bDownloading = true;

            string url = GameDataMgr.c_HotUpdate + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]);

            string localFilePath = LocalPath.LocalPackagingResources + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]);

            m_Downloader.DownloadFile(url, C_String.GetSavePath(localFilePath), () =>
            {
                m_CurDownloadLength += m_Downloader.DownloadFileLength;

                m_Downloader.Reset();

                m_nDownloadCount--;

                m_bDownloading = false;
            });
        }
        else
        {
            m_bDownloading = true;

            //如果都下载完了,就需要删除原来的文件,替换下载的文件
            if (ReplaceAllDownloadFile())
            {
                //配置文件替换,整个下载过程完成
                string stageConfigName = GameStageHotUpdateMgr.GetStageConfigName(StageName);

                string localFilePath = LocalPath.LocalHotUpdateConfigPath + stageConfigName;
                if (File.Exists(localFilePath))
                {
                    File.Delete(localFilePath);
                }

                m_Downloader.DownloadFile(LocalPath.ServerHotUpdateConfigPath + stageConfigName, LocalPath.LocalHotUpdateConfigPath, () =>
                {
                    m_bDownloading = false;

                    DownloadState = 2;
                });
            }
        }
    }