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); }
/// <summary> /// 初始化 /// </summary> /// <param name="loadType"></param> /// <param name="useCache"></param> public static void Initialize(AssetsLoadType loadType, bool useCache) { //if (isInit) // return; if (loadType == AssetsLoadType.AssetBundle) { useCache = true; } if (!Application.isPlaying) { useCache = false; } UseCache = useCache; ResourceManager.loadType = loadType; ReleaseAll(); GameInfoCollecter.AddAppInfoValue("AssetsLoadType", loadType); loadAssetsController = new AssetsLoadController(loadType, useCache); //Debug.Log("ResourceManager初始化 AssetsLoadType:" + loadType + " useCache:" + useCache); }
public void Awake() { //Debug.Log("persistentDataPath:" + Application.persistentDataPath); instance = this; GameInfoCollecter.AddAppInfoValue("Build App Mode", m_AppMode); if (Application.platform != RuntimePlatform.WindowsEditor && Application.platform != RuntimePlatform.OSXEditor) { try { string modeStr = PlayerPrefs.GetString("AppMode", m_AppMode.ToString()); m_AppMode = (AppMode)Enum.Parse(typeof(AppMode), modeStr); } catch (Exception e) { Debug.LogError(e); } } AppLaunch(); }