| | |
| | | |
| | | using UnityEngine.AssetBundles.AssetBundleDataSource; |
| | | using Assets.Editor.Tool; |
| | | using IFix.Editor; |
| | | |
| | | namespace UnityEngine.AssetBundles |
| | | { |
| | |
| | | EditorApplication.delayCall += ExcuteBuildAudio; |
| | | } |
| | | |
| | | if (GUILayout.Button("Video")) |
| | | { |
| | | EditorApplication.delayCall += ExcuteBuildVideo; |
| | | } |
| | | |
| | | if (GUILayout.Button("Levels")) |
| | | { |
| | | EditorApplication.delayCall += ExcuteBuildLevels; |
| | |
| | | if (GUILayout.Button("MobEffectShader")) |
| | | { |
| | | EditorApplication.delayCall += ExcuteBuildMobEffectShader; |
| | | } |
| | | |
| | | if (GUILayout.Button("patch")) |
| | | { |
| | | EditorApplication.delayCall += ExcuteBuildPatch; |
| | | } |
| | | |
| | | EditorGUILayout.EndHorizontal(); |
| | |
| | | if (GUILayout.Button("Make VersionFile")) |
| | | { |
| | | EditorApplication.delayCall += MakeAssetsVersionFile; |
| | | } |
| | | |
| | | if (GUILayout.Button("Copy to StreamingAssets")) |
| | | { |
| | | EditorApplication.delayCall += CopyToStreamingAssets; |
| | | } |
| | | |
| | | EditorGUILayout.EndHorizontal(); |
| | |
| | | EditorGUILayout.EndScrollView(); |
| | | } |
| | | |
| | | private void CopyToStreamingAssets() |
| | | { |
| | | if (Directory.Exists(m_streamingPath)) |
| | | Directory.Delete(m_streamingPath, true); |
| | | DirectoryCopy(m_UserData.m_OutputPath, m_streamingPath); |
| | | } |
| | | |
| | | private void ExecuteBuildAll() |
| | | { |
| | | |
| | |
| | | } |
| | | |
| | | ExcuteBuildAudio(); |
| | | ExcuteBuildVideo(); |
| | | ExcuteBuildMobEffectShader(); |
| | | ExcuteBuildConfig(); |
| | | ExcuteBuildLevels(); |
| | | ExcuteBuildUI(); |
| | | ExcuteBuildBuiltIn(); |
| | | ExcuteBuildLua(); |
| | | ExcuteBuildPatch(); |
| | | |
| | | AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void ExcuteBuildAsset(string _category) |
| | | private void ExcuteBuildAsset(string _category, bool uncompressed = false) |
| | | { |
| | | BuildAssetBundleOptions opt = BuildAssetBundleOptions.None; |
| | | if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions) |
| | | { |
| | | if (m_UserData.m_Compression == CompressOptions.Uncompressed) |
| | | if (m_UserData.m_Compression == CompressOptions.Uncompressed || uncompressed) |
| | | { |
| | | opt |= BuildAssetBundleOptions.UncompressedAssetBundle; |
| | | } |
| | |
| | | { |
| | | UpdateAudioSetting.SetAllAudioAssetBundleName(); |
| | | ExcuteBuildAsset("audio"); |
| | | } |
| | | |
| | | private void ExcuteBuildVideo() |
| | | { |
| | | UpdateVideoSetting.SetAllVideoAssetBundleName(); |
| | | ExcuteBuildAsset("video"); |
| | | ExcuteBuildAsset("video",true); |
| | | } |
| | | |
| | | private void ExcuteBuildMobEffectShader() |
| | |
| | | UpdateLuaSetting.SetAllLuaAssetBundleName(); |
| | | ExcuteBuildAsset("lua"); |
| | | LuaBuildHelper.OnPostBuild(); |
| | | } |
| | | |
| | | private void ExcuteBuildPatch() |
| | | { |
| | | string sourcePath; |
| | | if (m_UserData.m_BuildTarget == ValidBuildTarget.Android) |
| | | { |
| | | IFixEditor.CompileToAndroid(); |
| | | sourcePath = ResourcesPath.PATCH_ANDROID; |
| | | } |
| | | else if (m_UserData.m_BuildTarget == ValidBuildTarget.iOS) |
| | | { |
| | | IFixEditor.CompileToIOS(); |
| | | sourcePath = ResourcesPath.PATCH_IOS; |
| | | } |
| | | else |
| | | { |
| | | IFixEditor.Patch(); |
| | | sourcePath = ResourcesPath.PATCH_EDITOR; |
| | | } |
| | | var outputPath = Application.dataPath.Replace("Assets", m_UserData.m_OutputPath); |
| | | outputPath = StringUtility.Contact(outputPath, "/patch"); |
| | | if (Directory.Exists(outputPath)) |
| | | Directory.Delete(outputPath, true); |
| | | DirectoryCopy(sourcePath, outputPath, ".meta"); |
| | | } |
| | | |
| | | private void ExcuteBuildLevels() |
| | |
| | | } |
| | | } |
| | | |
| | | private static void DirectoryCopy(string sourceDirName, string destDirName) |
| | | private static void DirectoryCopy(string sourceDirName, string destDirName, string excludeEx = null) |
| | | { |
| | | // Get the subdirectories for the specified directory. |
| | | DirectoryInfo dir = new DirectoryInfo(sourceDirName); |
| | |
| | | foreach (FileInfo file in files) |
| | | { |
| | | string temppath = Path.Combine(destDirName, file.Name); |
| | | file.CopyTo(temppath, false); |
| | | if (excludeEx == null || file.Extension != excludeEx) |
| | | file.CopyTo(temppath, false); |
| | | } |
| | | |
| | | DirectoryInfo[] dirs = dir.GetDirectories(); |