protected void _OnDownloadComplete(string error, byte[] data) { m_state = EnumJobState.Done; if (data == null) { return; } var name = m_curDownload; m_manager.AssetInfoManager.SetLocation(name, EnumFileLocation.Client); //保存下载文件 var path = XABUtilities.GetResPath(EnumFileLocation.Client, EnumBundleType.Hotfix); XUtilities.SaveFile($"{path}/{name}", data); var hotfixInfo = m_manager.AssetInfoManager.hotfixInfo; //保存filelist var client_filelist = hotfixInfo.client_filelist; var server_filelist = hotfixInfo.server_filelist; var serverFileInfo = server_filelist.GetFileInfo(name); var clientFileInfo = client_filelist.GetFileInfo(name); if (clientFileInfo == null) { clientFileInfo = new XFileList.XFileInfo(); client_filelist.AddFileInfo(name, clientFileInfo); } clientFileInfo.name = name; clientFileInfo.path = serverFileInfo.path; clientFileInfo.length = serverFileInfo.length; clientFileInfo.md5 = serverFileInfo.md5; XFileList.SaveFileList(XABUtilities.GetResPath(EnumFileLocation.Client, EnumBundleType.Hotfix), client_filelist); }
public override void Enter() { var clientHotfixPath = XABUtilities.GetResPath(EnumFileLocation.Client, EnumBundleType.Hotfix); if (XABUtilities.ExistManifest(clientHotfixPath)) { m_manager.AssetInfoManager.SetHotfixManifest(XABUtilities.ReadManifest(clientHotfixPath)); return; } var streamHotfixPath = XABUtilities.GetResPath(EnumFileLocation.Stream, EnumBundleType.Hotfix); if (XABUtilities.ExistManifest(streamHotfixPath)) { m_manager.AssetInfoManager.SetHotfixManifest(XABUtilities.ReadManifest(streamHotfixPath)); return; } }
public override void Enter() { var assetInfoManager = m_manager.AssetInfoManager; m_serverAddress = m_manager.serverAddress; #if UNITY_EDITOR m_serverAddress = EditorPrefs.GetString(XABConst.EKResUrl); if (string.IsNullOrEmpty(m_serverAddress)) { Debug.LogError("没有配置url"); return; } m_serverAddress += "/_filelist.json"; #endif m_server_filelist = null; m_client_filelist = XFileList.LoadFileList(XABUtilities.GetResPath(EnumFileLocation.Client, EnumBundleType.Hotfix)); m_origin_filelist = XFileList.LoadFileList(XABUtilities.GetResPath(EnumFileLocation.Stream, EnumBundleType.Hotfix)); if (m_client_filelist == null) { m_client_filelist = new XFileList(); } if (m_origin_filelist == null) { m_origin_filelist = new XFileList(); } XWebRequestManagerSingle.GetUrl(m_serverAddress, delegate(string error, string responseData) { if (!string.IsNullOrEmpty(error)) { return; } m_server_filelist = JsonUtility.FromJson <XFileList>(responseData); XDebug.Log(XABConst.Tag, m_server_filelist.ToLog()); }); }
public XAssetManagerOrdinary() { m_AssetInfoManager = new XABAssetInfoManager(); m_AssetInfoManager.SetStaticManifest(XABUtilities.ReadManifest(XABUtilities.GetResPath(EnumFileLocation.Stream, EnumBundleType.Static))); m_InitTaskSchedule = new XABHotfixTaskSchedule(this); }