예제 #1
0
        /** 写出版本 */
        private void writeVersion()
        {
            VersionSaveData  versionSaveData = _newVersion.createOriginalData();
            BytesWriteStream stream          = new BytesWriteStream();

            stream.writeVersion(ShineGlobal.versionInfoVersion);
            versionSaveData.writeBytes(stream);
            FileUtils.writeFileForBytesWriteStream(getTargetSourcePath() + "/" + ShineGlobal.versionInfoPath, stream);

            // XML vXml=new XML();
            // vXml.name="info";
            // vXml.setProperty("version",ShineToolSetting.bundlePackVersion);
            // FileUtils.writeFileForXML(ShineToolGlobal.clientBundleRecordPath,vXml);

            //发布包
            if (_isReleasePack)
            {
                EditorPrefs.SetString("AssetBundleWindow_version", _newVersion.version);

                stream.clear();
                stream.writeVersion(ShineGlobal.versionInfoVersion);
                _newVersion.writeBytes(stream);

                FileUtils.writeFileForBytesWriteStream(getTargetSavePath() + "/" + ShineGlobal.versionInfoPath, stream);

                VersionRecordData recordData = _newVersion.createRecordData();
                XML xml = recordData.writeXML();
                FileUtils.writeFileForXML(getTargetSavePath() + "/" + "versionRecord.xml", xml);

                Ctrl.print("已覆盖原记录,当前版本为:", _newVersion.version);
            }
        }
예제 #2
0
        /** 生成打包信息文件并复制打包文件到发布目录 */
        private void copyFilesAndInfo()
        {
            //复制bundle文件
            string buildPath   = ShineToolGlobal.bundleTempPath + "/" + _targetName;
            string releasePath = getTargetSourcePath() + "/" + ShineToolGlobal.bundleDirName;

            if (!Directory.Exists(releasePath))
            {
                Directory.CreateDirectory(releasePath);
            }

            FileUtils.clearDir(releasePath);

            SList <string> delBundleList = new SList <string>();

            string[] files = Directory.GetFiles(buildPath, "*.bundle");
            for (int i = 0; i < files.Length; i++)
            {
                string fromFileName = files[i];
                string fileName     = Path.GetFileName(fromFileName);

                //如果是无效bundle
                if (!_bundleInfoDataList.contains(fileName))
                {
                    delBundleList.add(fromFileName);
                    delBundleList.add(fromFileName + ".manifest");
                    continue;
                }

                string toFileName = Path.Combine(releasePath, fileName);
                File.Copy(fromFileName, toFileName);
            }

            //删除无效bundle以及对应manifest
            foreach (string filePath in delBundleList)
            {
                Ctrl.print("删除无效文件", filePath);
                File.Delete(filePath);
            }

            //生成打包信息文件
            string           infoPath = getTargetSourcePath() + "/" + ShineGlobal.bundleInfoPath;
            BytesWriteStream buffer   = new BytesWriteStream();

            buffer.writeVersion(ShineGlobal.bundleInfoVersion);

            buffer.writeInt(_bundleInfoDataList.length());
            foreach (BundleInfoData info in _bundleInfoDataList)
            {
                info.writeBytes(buffer);
            }

            buffer.writeInt(_resourceInfoDataList.length());
            foreach (ResourceInfoData info in _resourceInfoDataList)
            {
                info.writeBytes(buffer);
            }

            FileUtils.writeFileForBytes(infoPath, buffer);
        }
예제 #3
0
    /** 保存登录缓存数据 */
    private void saveLoginCache(ClientLoginCacheData data)
    {
        _loginData = data;
        BytesWriteStream stream = new BytesWriteStream();

        stream.writeVersion(ShineGlobal.loginDataVersion);
        data.writeBytesFull(stream);
        FileUtils.writeFileForBytesWriteStream(_loginDataPath, stream);
    }
예제 #4
0
    private void doSave(KeepSaveData data)
    {
        _stream.clear();
        _stream.writeVersion(ShineGlobal.localSaveVersion);

        data.writeBytesFull(_stream);

        FileUtils.writeFileForBytes(_localSavePath, _stream);
    }
예제 #5
0
    public void writeConfigVersion(BytesWriteStream stream)
    {
        stream.writeVersion(ShineGlobal.configVersion);
        stream.writeInt(CodeCheckRecord.configVersion);
        stream.writeInt(getGameConfigVersion());

        if (CommonSetting.clientNeedHotfix)
        {
            stream.writeInt(getHotfixConfigVersion());
        }
    }
예제 #6
0
    private void doWrite()
    {
        ClientPlayerLocalCacheData data = GameC.factory.createClientPlayerLocalCacheData();

        data.copy(_data);

        //缓存一手
        string path = _savePath;

        ThreadControl.addIOFunc(() =>
        {
            _stream.clear();
            _stream.writeVersion(ShineGlobal.playerSaveVersion);

            data.writeBytesFull(_stream);
            FileUtils.writeFileForBytes(path, _stream);
        });
    }
예제 #7
0
        /// <summary>
        /// 生成UI预制
        /// </summary>
        /// <param name="force">是否强制全部生成(如果否,则增量生成,只生成改变量)</param>
        public static void make(bool force = false)
        {
            EditorUtility.DisplayProgressBar("请耐心等待", "正在抽离UI预制体...", 0.0f);

            /** 需要处理的预制体列表 */
            SMap <string, long> generateList = new SMap <string, long>();
            /** 全部预处理列表(包含当前所有的预制体修改记录,用于生成记录文件) */
            SMap <string, long> allGenerateList = new SMap <string, long>();

            if (!Directory.Exists(ShineToolGlobal.uiModelsPath))
            {
                Directory.CreateDirectory(ShineToolGlobal.uiModelsPath);
            }

            if (!Directory.Exists(ShineToolGlobal.uiGenerateModelsPath))
            {
                Directory.CreateDirectory(ShineToolGlobal.uiGenerateModelsPath);
                force = true;
            }

            //生成新预处理列表
            string[] files   = FileUtils.getDeepFileList(ShineToolGlobal.uiModelsPath, "prefab");
            int      pathLen = ShineToolGlobal.gamePath.Length + 1;

            for (int i = 0; i < files.Length; i++)
            {
                string file = files[i];
                long   time = File.GetLastWriteTime(file).Ticks;
                file = file.Substring(pathLen);
                generateList.put(file, time);
                allGenerateList.put(file, time);
            }

            //读取旧预处理列表
            BytesReadStream stream = FileUtils.readFileForBytesReadStream(ShineToolGlobal.uiRecordPath);

            //读取旧预处理列表
            if (force || stream == null || !stream.checkVersion(ShineToolGlobal.uiRecordVersion))
            {
                FileUtils.clearDir(ShineToolGlobal.uiGenerateModelsPath);
            }
            else
            {
                /** 旧预处理列表 */
                SMap <string, long> oldGenerateList = new SMap <string, long>();

                int len = stream.readInt();
                for (int i = 0; i < len; ++i)
                {
                    oldGenerateList[stream.readUTF()] = stream.readLong();
                }

                //比较新旧预制列表,并删除无效预制
                oldGenerateList.forEach((k, v) =>
                {
                    long newTime;
                    string genPath = ShineToolGlobal.uiGenerateModelsPath + "/";
                    if (generateList.tryGetValue(k, out newTime))                //如果新列表里有
                    {
                        if (newTime == oldGenerateList[k])                       //如果未修改,则不用抽离
                        {
                            generateList.remove(k);
                        }
                        else                          //如果已修改
                        {
                            File.Delete(genPath + Path.GetFileName(k));
                        }
                    }
                    else                      //新列表里没有,说明已删除
                    {
                        File.Delete(genPath + Path.GetFileName(k));
                    }
                });
            }

            //生成UI预制
            int progressNum = generateList.length() + 1;
            int curNum      = 0;

            generateList.forEach((k, v) =>
            {
                generateUIPrefab(k);
                ++curNum;
                EditorUtility.DisplayProgressBar("请耐心等待", "正在抽离UI预制体...", (float)curNum / progressNum);
            });

            //写入记录
            BytesWriteStream buffer = new BytesWriteStream();

            buffer.writeVersion(ShineToolGlobal.uiRecordVersion);

            buffer.writeInt(allGenerateList.Count);

            allGenerateList.forEach((k, v) =>
            {
                buffer.writeUTF(k);
                buffer.writeLong(allGenerateList[k]);
            });

            FileUtils.writeFileForBytes(ShineToolGlobal.uiRecordPath, buffer);

            EditorUtility.ClearProgressBar();
        }
예제 #8
0
 public void writeSplitConfigVersion(BytesWriteStream stream)
 {
     stream.writeVersion(ShineGlobal.configVersion);
     stream.writeInt(splitConfigVersion);
 }