Пример #1
0
        public void Init(int _localVersion, int _remoteVersion, Func <int, string> _fixFun, Func <string, string> _fixFun2, Action _callBack, Action <string> _setTextCallBack, Action <float> _setPercentCallBack, int _updateWarningSize, Action <string, Action> _showWarningCallBack)
        {
            if (File.Exists(Application.persistentDataPath + "/" + FILE_NAME))
            {
                data = VersionData.LoadFromFile(Application.persistentDataPath + "/" + FILE_NAME);

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

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

                    data = new VersionData();

                    data.version = _localVersion;

                    VersionData.SaveToFile(Application.persistentDataPath + "/" + FILE_NAME, data);
                }
            }
            else
            {
                SuperDebug.Log("这是第一次进游戏  生成新的version.dat");

                data = new VersionData();

                data.version = _localVersion;

                VersionData.SaveToFile(Application.persistentDataPath + "/" + FILE_NAME, data);
            }

            SuperDebug.Log("客户端资源版本号:" + data.version + "  服务器资源版本号:" + _remoteVersion);

            if (data.version < _remoteVersion)
            {
                _setTextCallBack("读取热更新列表");

                Dictionary <string, UpdateFileInfo> dic = new Dictionary <string, UpdateFileInfo>();

                LoadUpdateXML(0, dic, _remoteVersion, _remoteVersion, _fixFun, _fixFun2, _callBack, _setTextCallBack, _setPercentCallBack, _updateWarningSize, _showWarningCallBack);
            }
            else
            {
                _callBack();
            }
        }
Пример #2
0
        private void UpdateOver(int _remoteVersion, Action _callBack)
        {
            data.version = _remoteVersion;

            VersionData.SaveToFile(Application.persistentDataPath + "/" + FILE_NAME, data);

#if PLATFORM_PC || PLATFORM_ANDROID
            if (codeBytes != null)
            {
                SystemIO.SaveFile(Application.persistentDataPath + "/" + CODE_BYTES_NAME, codeBytes);

                codeBytes = null;

                UseFulUtil.Instance.ShowDialogOne("更新已完成,请重启游戏。", "", QuitApplication);
            }
            else
            {
                _callBack();
            }
#else
            _callBack();
#endif
        }