예제 #1
0
        public void Init(int _localVersion, int _remoteVersion, Func <int, string> _fixFun, Func <string, string> _fixFun2, Action _callBack)
        {
            if (File.Exists(Application.persistentDataPath + "/" + FILE_NAME))
            {
                data = SystemIO.LoadSerializeFile <VersionData>(Application.persistentDataPath + "/" + FILE_NAME);

                if (_localVersion > data.version)                //说明残留的version.dat是老版本的  必须立即清除掉

                {
                    SuperDebug.Log("发现残留的version.dat 删除掉!");

                    data = new VersionData();

                    data.version = _localVersion;

                    SystemIO.SaveSerializeFile(Application.persistentDataPath + "/" + FILE_NAME, data);
                }
            }
            else
            {
                data = new VersionData();

                data.version = _localVersion;

                SystemIO.SaveSerializeFile(Application.persistentDataPath + "/" + FILE_NAME, data);
            }

            if (data.version < _remoteVersion)
            {
                Dictionary <string, UpdateFileInfo> dic = new Dictionary <string, UpdateFileInfo>();

                LoadUpdateXML(dic, _remoteVersion, _remoteVersion, _fixFun, _fixFun2, _callBack);
            }
            else
            {
                _callBack();
            }
        }