Exemplo n.º 1
0
        private void CopyToStreamingAssets(BuildVersion buildVersion)
        {
            m_outputPlatformPath = string.Format($"{FinalPatchConst.ROOT_PATH}/{buildVersion.name}");
            m_outputFullPath     = FinalPatchUtility.GetOutputFullPath(m_outputPlatformPath, buildVersion.version);
            // copy asset bundles
            foreach (var file in Directory.GetFiles(m_outputFullPath, "*", SearchOption.AllDirectories))
            {
                string fileName = Path.GetFileName(file);
                if (fileName == FinalPatchConst.PATCH_DATA_FILE_NAME)
                {
                    continue;
                }

                string toPath = $"Assets/StreamingAssets/{FinalPatchConst.ASSET_BUNDLE_SUBDIRECTORY_NAME}{file.Remove(0, m_outputFullPath.Length)}";
                string toDir  = Path.GetDirectoryName(toPath);
                if (!Directory.Exists(toDir))
                {
                    Directory.CreateDirectory(toDir);
                }

                File.Copy(file, toPath, true);
            }

            PatchData patchData = PatchData.LoadAtPath(FinalPatchUtility.GetFullPatchDataFilePath(m_outputPlatformPath, buildVersion.version));

            patchData.SaveToStreamingAssets();
            AssetDatabase.Refresh();
        }
Exemplo n.º 2
0
        private void Build(BuildVersion buildVersion, int newVersion)
        {
            m_outputPlatformPath = string.Format($"{FinalPatchConst.ROOT_PATH}/{buildVersion.name}");
            m_outputFullPath     = FinalPatchUtility.GetOutputFullPath(m_outputPlatformPath, newVersion);
            m_outputPackagePath  = FinalPatchUtility.GetOutputPackagePath(m_outputPlatformPath, newVersion);
            if (Validate(newVersion))
            {
                AssetDatabase.SaveAssets();
                IBuildEditorCallback callback = CreateBuildCallback();
                BuildBundles(buildVersion, newVersion);
                callback?.OnBuildFullFinished(buildVersion);

                if (newVersion == 1)
                {
                    BuildFullPackage(newVersion);
                }
                else
                {
                    BuildIncrementalPackage(newVersion);
                }
                callback?.OnBuildPackageFinished(buildVersion);

                Debug.Log(Localization.GetString("msg_build_success"));
            }
        }