static void CheckLocalVersion() { string streamVersionPath = ResourceIOTool.ReadStringByFile(PathTool.GetAbsolutePath( ResLoadLocation.Streaming, c_versionFileName + "." + ConfigManager.c_expandName)); if (!File.Exists(streamVersionPath)) { return; } string StreamVersionContent = ResourceIOTool.ReadStringByFile(streamVersionPath); //stream版本 Dictionary <string, object> StreamVersion = (Dictionary <string, object>)MiniJSON.Json.Deserialize(StreamVersionContent); //Streaming版本如果比Persistent版本还要新,则更新Persistent版本 if ((GetInt(StreamVersion[c_largeVersionKey]) > GetInt(m_versionConfig[c_largeVersionKey])) || (GetInt(StreamVersion[c_smallVersonKey]) > GetInt(m_versionConfig[c_smallVersonKey])) ) { RecordManager.CleanRecord(c_HotUpdateRecordName); Init(); } }
static void CheckLocalVersion() { if (ApplicationManager.Instance.m_useAssetsBundle) { AssetBundle ab = AssetBundle.LoadFromFile(PathTool.GetAbsolutePath(ResLoadLocation.Streaming, c_versionFileName + "." + AssetsBundleManager.c_AssetsBundlesExpandName)); TextAsset text = (TextAsset)ab.mainAsset; string StreamVersionContent = text.text; ab.Unload(true); //stream版本 Dictionary <string, object> StreamVersion = (Dictionary <string, object>)FrameWork.Json.Deserialize(StreamVersionContent); //Streaming版本如果比Persistent版本还要新,则更新Persistent版本 if ((GetInt(StreamVersion[c_largeVersionKey]) > GetInt(m_versionConfig[c_largeVersionKey])) || (GetInt(StreamVersion[c_smallVersonKey]) > GetInt(m_versionConfig[c_smallVersonKey])) ) { RecordManager.CleanRecord(c_HotUpdateRecordName); Init(); } } else { } }
static bool CheckLocalVersion() { try { if (ApplicationManager.Instance.m_useAssetsBundle) { string path = PathTool.GetAbsolutePath(ResLoadLocation.Streaming, c_versionFileName.ToLower()); #if UNITY_EDITOR //判断本地文件是否存在 if (!File.Exists(path)) { Debug.LogError("本地 Version 文件不存在,请先创建本地文件!"); UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, 1); return(false); } #endif AssetBundle ab = AssetBundle.LoadFromFile(path); TextAsset text = ab.LoadAsset <TextAsset>(c_versionFileName); string StreamVersionContent = text.text; ab.Unload(true); Debug.Log("Streaming版本:" + StreamVersionContent); //stream版本 Dictionary <string, object> StreamVersion = (Dictionary <string, object>)FrameWork.Json.Deserialize(StreamVersionContent); //Streaming版本如果比Persistent版本还要新,则更新Persistent版本 if ((GetInt(StreamVersion[c_largeVersionKey]) > GetInt(s_versionConfig[c_largeVersionKey])) || (GetInt(StreamVersion[c_smallVersonKey]) > GetInt(s_versionConfig[c_smallVersonKey]) )) { Debug.Log("Streaming版本比Persistent版本还要新"); MemoryManager.FreeMemory(); RecordManager.CleanRecord(c_HotUpdateRecordName); Init(); AssetsManifestManager.LoadAssetsManifest(); } return(true); } else { Debug.Log("没有使用Bundle 无需更新"); UpdateDateCallBack(HotUpdateStatusEnum.NoUpdate, 0); return(false); } } catch (Exception e) { Debug.LogError(e.ToString()); UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, 0); } return(false); }
public static bool CheckLocalVersion() { try { string StreamPath = PathTool.GetAbsolutePath(ResLoadLocation.Streaming, c_versionFileName.ToLower()); //判断本地文件是否存在 if (!File.Exists(StreamPath)) { Debug.LogError("本地 Version 文件不存在,请先创建本地文件!"); return(false); } int s_bigVersion = 0; int s_smallVersion = 0; GetVersion(StreamPath, ref s_bigVersion, ref s_smallVersion); GameInfoCollecter.AddAppInfoValue("Streaming Bundle Version", s_bigVersion + "." + s_smallVersion); string persistentPath = PathTool.GetAssetsBundlePersistentPath() + c_versionFileName; //判断沙盒路径是否存在 if (!File.Exists(persistentPath)) { Debug.Log("沙盒 Version 文件不存在!"); return(false); } int p_bigVersion = 0; int p_smallVersion = 0; GetVersion(persistentPath, ref p_bigVersion, ref p_smallVersion); GameInfoCollecter.AddAppInfoValue("Persistent Bundle Version", p_bigVersion + "." + p_smallVersion); Debug.Log("largeVersionKey Streaming " + s_bigVersion + " 本地 " + p_bigVersion); Debug.Log("smallVersonKey Streaming " + s_smallVersion + " 本地 " + p_smallVersion); //Streaming版本如果比Persistent版本还要新,则更新Persistent版本 if (s_bigVersion > p_bigVersion || (s_bigVersion == p_bigVersion && s_smallVersion > p_smallVersion) || (s_bigVersion == p_bigVersion && s_smallVersion == p_smallVersion) ) { Debug.Log("Streaming版本比Persistent版本还要新"); MemoryManager.FreeMemory(); RecordManager.CleanRecord(c_HotUpdateRecordName); AssetsManifestManager.LoadAssetsManifest(); } return(true); } catch (Exception e) { Debug.LogError(e.ToString()); //UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, 0); } return(false); }
static int CleanRecord(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); RecordManager.CleanRecord(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }