Beispiel #1
0
        IEnumerator getUpdateVersion()
        {
            dirVersion = Application.version;
            WWW www = new WWW(AppConst.WebUrlVersion); yield return(www);

            if (www.error != null)
            {
                _loadassets.updateAnimaPos(1, 1, "获取版本失败,请检测网络。");
                _loadassets.showBigVersion("获取版本失败,请检测网络。", 1);
                yield break;
            }

            dirVersion = www.text;
            float  version    = float.Parse(dirVersion);
            float  nowversion = float.Parse(Application.version);
            int    yy         = (int)version;
            string temp       = PlayerPrefs.GetString("Version");

            if (temp == "")
            {
                temp = "0";
            }
            float ver = float.Parse(temp);

            if (version > nowversion && 0 == (version - (float)yy))
            {
                _loadassets.showBigVersion("检测到新版本,请到官网重新下包。", 2);
            }
            else
            {
                if (version - nowversion > 1)
                {
                    _loadassets.showBigVersion("检测到新版本,请到官网重新下包。", 2);
                }
                else
                {
                    if (ver < nowversion && version > nowversion)
                    {
                        if (Directory.Exists(Util.DataPath))
                        {
                            Directory.Delete(Util.DataPath, true);
                        }
                    }
                    PlayerPrefs.SetString("Version", dirVersion);
                    Init();
                }
            }
        }