IEnumerator ReadXml(Action callBack) { string xmlUrl = "http://annuzhiting2.oss-cn-hangzhou.aliyuncs.com/ServerInfo.xml"; UnityWebRequest webRequest = UnityWebRequest.Get(xmlUrl); webRequest.timeout = 30; yield return(webRequest.SendWebRequest()); if (webRequest.isNetworkError) { Debug.Log("Download Error" + webRequest.error); } else { FileTool.CreateFile(m_ServerXmlPath, webRequest.downloadHandler.data); if (File.Exists(m_ServerXmlPath)) { m_ServerInfo = BinarySerializeOpt.XmlDeserialize(m_ServerXmlPath, typeof(ServerInfo)) as ServerInfo; } else { Debug.LogError("热更配置读取错误!"); } } if (callBack != null) { callBack(); } }
/// <summary> /// 检查本地热更信息与服务器热更信息比较 /// </summary> /// <returns></returns> bool CheckLocalAndServerPatch() { if (!File.Exists(m_LocalXmlPath)) { return(true); } m_LocalInfo = BinarySerializeOpt.XmlDeserialize(m_LocalXmlPath, typeof(ServerInfo)) as ServerInfo; VersionInfo localGameVesion = null; if (m_LocalInfo != null) { foreach (VersionInfo version in m_LocalInfo.GameVersion) { if (version.Version == m_CurVersion) { localGameVesion = version; break; } } } if (localGameVesion != null && m_GameVersion.Pathces != null && localGameVesion.Pathces != null && m_GameVersion.Pathces.Length > 0 && m_GameVersion.Pathces[m_GameVersion.Pathces.Length - 1].Version != localGameVesion.Pathces[localGameVesion.Pathces.Length - 1].Version) { return(true); } return(false); }