static IEnumerator StartDownLoad() { Debug.Log("下载服务器文件到本地"); UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(0))); RecordTable hotupdateData = RecordManager.GetData(c_HotUpdateRecordName); for (int i = 0; i < s_downLoadList.Count; i++) { Hash128 md5Tmp = Hash128.Parse(hotupdateData.GetRecord(s_downLoadList[i].name, "null")); if (md5Tmp.Equals(s_downLoadList[i].md5)) { Debug.Log("文件已更新完毕 " + s_downLoadList[i].name); //该文件已更新完毕 UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); } else { string downloadPath = s_resourcesFileDownLoadPath + s_downLoadList[i].name; WWW www = new WWW(downloadPath); yield return(www); if (www.error != null && www.error != "") { Debug.LogError("下载出错! " + downloadPath + " " + www.error); UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); yield break; } else { Debug.Log("下载成功! " + downloadPath); ResourceIOTool.CreateFile(PathTool.GetAssetsBundlePersistentPath() + "/" + s_downLoadList[i].name, www.bytes); RecordManager.SaveRecord(c_HotUpdateRecordName, s_downLoadList[i].name, s_downLoadList[i].md5.ToString()); UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); } } } //保存版本信息 //保存文件信息 ResourceIOTool.CreateFile(PathTool.GetAssetsBundlePersistentPath() + c_versionFileName, s_versionByteCache); ResourceIOTool.CreateFile(PathTool.GetAssetsBundlePersistentPath() + AssetsManifestManager.c_ManifestFileName, s_ManifestByteCache); //从stream读取配置 RecordManager.SaveRecord(c_HotUpdateRecordName, c_useHotUpdateRecordKey, true); //重新生成资源配置 ResourcesConfigManager.LoadResourceConfig(); AssetsManifestManager.LoadAssetsManifest(); //延迟2秒卸载Bundle缓存,防止更新界面掉图(更新时间短时,卸载过快界面会掉图) //yield return new WaitForSeconds(2); ResourceManager.ReleaseAll(false); UpdateDateCallBack(HotUpdateStatusEnum.UpdateSuccess, 1); }
//static List<ResourcesConfig> s_deleteList = new List<ResourcesConfig>(); static IEnumerator StartDownLoad() { Debug.Log("下载服务器文件到本地"); UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(0))); RecordTable hotupdateData = RecordManager.GetData(c_HotUpdateRecordName); for (int i = 0; i < s_downLoadList.Count; i++) { string md5Tmp = hotupdateData.GetRecord(s_downLoadList[i].name, "null"); if (md5Tmp == s_downLoadList[i].md5) { //该文件已更新完毕 UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); } else { string downloadPath = s_resourcesFileDownLoadPath + s_downLoadList[i].path + "." + AssetsBundleManager.c_AssetsBundlesExpandName; WWW www = new WWW(downloadPath); yield return(www); if (www.error != null && www.error != "") { Debug.LogError("下载出错! " + downloadPath + " " + www.error); UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); yield break; } else { Debug.Log("下载成功! " + downloadPath); ResourceIOTool.CreateFile(Application.persistentDataPath + "/" + s_downLoadList[i].path + "." + AssetsBundleManager.c_AssetsBundlesExpandName, www.bytes); RecordManager.SaveRecord(c_HotUpdateRecordName, s_downLoadList[i].name, s_downLoadList[i].md5); UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i))); } } } //保存版本信息 //保存文件信息 ResourceIOTool.WriteStringByFile(PathTool.GetAbsolutePath(ResLoadLocation.Persistent, HotUpdateManager.c_versionFileName + "." + ConfigManager.c_expandName), m_versionFileCatch); ResourceIOTool.WriteStringByFile(PathTool.GetAbsolutePath(ResLoadLocation.Persistent, ResourcesConfigManager.c_ManifestFileName + "." + ConfigManager.c_expandName), m_Md5FileCatch); //从stream读取配置 RecordManager.SaveRecord(c_HotUpdateRecordName, c_useHotUpdateRecordKey, true); UpdateDateCallBack(HotUpdateStatusEnum.UpdateSuccess, 1); //重新生成资源配置 ResourcesConfigManager.Initialize(); }
private void _Init() { _dictionaryData = new Hashtable(); for (int i = 0; i < _recordTable.Count; ++i) { T record = _recordTable.GetRecord(i); if (null == record) { continue; } #if USING_STRING_KEY string key = GetStringKey(record); #else int key = GetIntKey(record); #endif if (_dictionaryData.ContainsKey(key)) { LogMgr.instance.Log(LogLevel.ERROR, LogTag.CoryEntry, "duplicate key: " + key + ", table: " + _recordTable.Name); continue; } _dictionaryData.Add(key, record); } }
static int GetRecord(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); SingleField o = obj.GetRecord(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Vector2))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Vector2 arg1 = (UnityEngine.Vector2)ToLua.ToObject(L, 3); UnityEngine.Vector2 o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Vector3))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Vector3 arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 3); UnityEngine.Vector3 o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Color))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Color arg1 = (UnityEngine.Color)ToLua.ToObject(L, 3); UnityEngine.Color o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(string))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); string arg1 = ToLua.ToString(L, 3); string o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushstring(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(bool))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); bool arg1 = LuaDLL.lua_toboolean(L, 3); bool o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(float))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); float arg1 = (float)LuaDLL.lua_tonumber(L, 3); float o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushnumber(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: RecordTable.GetRecord")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static Color GetColorRecord(string RecordName, string key, Color defaultValue) { RecordTable table = GetData(RecordName); return(table.GetRecord(key, defaultValue)); }
public static Vector3 GetVector3Record(string RecordName, string key, Vector3 defaultValue) { RecordTable table = GetData(RecordName); return(table.GetRecord(key, defaultValue)); }
public static float GetFloatRecord(string RecordName, string key, float defaultValue) { RecordTable table = GetData(RecordName); return(table.GetRecord(key, defaultValue)); }
public static bool GetBoolRecord(string RecordName, string key, bool defaultValue) { RecordTable table = GetData(RecordName); return(table.GetRecord(key, defaultValue)); }
public static int GetIntRecord(string RecordName, string key, int defaultValue) { RecordTable table = GetData(RecordName); return(table.GetRecord(key, defaultValue)); }