Unity简易版的软件升级
来源:互联网 发布:linux查看压缩包格式 编辑:程序博客网 时间:2024/06/03 19:34
所谓简易版,就是用户每次登陆软件时,发现新版本,就提示用户去下载全新软件
using System.Collections;using UnityEngine;using AssemblyCSharp;using LitJson;using System.Xml;/*** *简易软件大版本升级 * */using System;public class UpdateScript{ private ServiceVersionVo serviceVersionVo = new ServiceVersionVo(); private string currentVersion = Application.version;//当前软件版本号 private string serverVersion ;//服务器上软件版本号 private string downloadPath;//应用下载链接 /** * 检测升级 */ public IEnumerator updateCheck () { WWW www = new WWW(APIS.UPDATE_INFO_JSON_URL); //"http://33.10.66:8080/MaJiangManage/images/update.xml";//服务器上最新的软件版本信息存储文件 yield return www; byte[] buffer = www.bytes; string returnxml = System.Text.Encoding.UTF8.GetString (buffer); //下面开始进行XML的解析 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(returnxml); XmlNodeList nodeList = xmlDoc.SelectSingleNode ("versions").ChildNodes; foreach(XmlNode xmlNodeVersion in nodeList){ Version123 temp = new Version123(); temp.title = xmlNodeVersion.SelectSingleNode ("title").InnerText; temp.url = xmlNodeVersion.SelectSingleNode ("url").InnerText; temp.note = xmlNodeVersion.SelectSingleNode ("note").InnerText; temp.version = xmlNodeVersion.SelectSingleNode ("versionname").InnerText; XmlElement xe =(XmlElement) xmlNodeVersion; if (xe.GetAttribute ("id") == "ios") { serviceVersionVo.ios = temp; serviceVersionVo.ios.url += "l=zh&mt=8"; } else if (xe.GetAttribute ("id") == "android") { serviceVersionVo.Android = temp; } } compareVersion (); } //对比版本虚 public void compareVersion(){ int currentVerCode;//当前版本号数字 int serverVerCode;//服务器上版本号数字 currentVersion = currentVersion.Replace (".", ""); currentVerCode = int.Parse (currentVersion); Version123 versionTemp = new Version123();//版本信息 //versionTemp = serviceVersionVo.Android; if (Application.platform == RuntimePlatform.Android) { versionTemp = serviceVersionVo.Android; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { versionTemp = serviceVersionVo.ios; } if (versionTemp != null &&versionTemp.version !=null) { serverVersion = versionTemp.version; serverVersion = serverVersion.Replace (".", ""); serverVerCode = int.Parse (serverVersion); if (serverVerCode > currentVerCode) {//服务器上有新版本 string note = versionTemp.note; downloadPath = versionTemp.url; //实例化下载界面,并将下载方法与下载按钮挂钩 TipsManagerScript.getInstance ().loadDialog ("发现新版本软件",note,onSureClick,onCancle); } } } public void onSureClick(){ if (downloadPath != null) { Application.OpenURL (downloadPath); // 点击下载按钮,打开下载页面 } } public void onCancle(){ }}
FR:海涛高软(QQ技术交流群:386476712)
阅读全文
1 0
- Unity简易版的软件升级
- Linux 软件安装,卸载,升级的操作步骤和简易说明
- 官方DFU固件更新软件实现对STM32的USB方式代码升级简易说明
- win7 简易版升级旗舰版
- 简易画图板的升级版本1.2
- MyUnity:简易的 Unity Tweak 工具
- Unity 下简易状态机的实现
- Unity 简易的对对碰游戏
- 简易计算器 (循环) 《升级版》
- 系统开发简易流程(升级版)
- 软件升级的设计思路
- 软件升级遇到的问题
- c#软件的在线升级
- 软件在线升级的实现
- 升级有漏洞的软件
- 单机软件软件升级时的数据库升级方案
- 一个简易的FTP客户端软件
- 伟大软件的简易三步骤
- [转] Linux shell判断文件和文件夹是否存在
- java锁机制
- Oauth协议
- C++对C的升级
- Linux操作系统下配置 ArcGIS Server 连接SDE空间库
- Unity简易版的软件升级
- swift不同地方 命名空间module iOS
- c++模板参数自动推导
- Jfinal(一)--------入门HelloWorld
- html5地理位置定位
- Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: forbidden (403)"原因
- js 实现页面的复制功能 clipboard.js
- Spring Boot+SpringMVC使用ueditor(jsp版)
- java 回文数