public static void GettingStarted()
 {
     BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.ExternalBuildflowPath);
     BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.InternalBuildflowPath);
     BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.InternalBuildflowDeployPath);
     BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.InternalBuildflowDeployConfigurePath);
     BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.InternalBuildflowDeployKeystorePath);
     Debug.Log("Buildflow Dirs initialize successful");
     if (!QuickAssetDatabase.ContainsAsset <GlobalToolConfigure>())
     {
         QuickAssetDatabase.CreateAsset <GlobalToolConfigure>(BuildPipelineAsset.GetRelativeAssetsPath(BuildPipelineAsset.InternalBuildflowDeployConfigurePath));
     }
     if (!QuickAssetDatabase.ContainsAsset <ProjectBuildConfigure>())
     {
         QuickAssetDatabase.CreateAsset <ProjectBuildConfigure>(BuildPipelineAsset.GetRelativeAssetsPath(BuildPipelineAsset.InternalBuildflowDeployConfigurePath));
     }
     if (!QuickAssetDatabase.ContainsAsset <ProjectCommonConfigure>())
     {
         QuickAssetDatabase.CreateAsset <ProjectCommonConfigure>(BuildPipelineAsset.GetRelativeAssetsPath(BuildPipelineAsset.InternalBuildflowDeployConfigurePath));
     }
     if (!QuickAssetDatabase.ContainsAsset <ProjectSDKConfigure>())
     {
         QuickAssetDatabase.CreateAsset <ProjectSDKConfigure>(BuildPipelineAsset.GetRelativeAssetsPath(BuildPipelineAsset.InternalBuildflowDeployConfigurePath));
     }
     if (!QuickAssetDatabase.ContainsAsset <ProjectXcodeConfigure>())
     {
         QuickAssetDatabase.CreateAsset <ProjectXcodeConfigure>(BuildPipelineAsset.GetRelativeAssetsPath(BuildPipelineAsset.InternalBuildflowDeployConfigurePath));
     }
     Debug.Log("Buildflow configuration files initialize successful");
     Debug.Log("Buildflow initialize successful");
     //#if ODIN_INSPECTOR
     //            GettingStartedWindow.ShowWindow();
     //#endif
 }
            public void GenerateCatalog()
            {
                BuildPipelineCommonTools.FileUtils.CheckDir(BuildPipelineAsset.GetExternalPluginLibsSourcePath(EditorUserBuildSettings.activeBuildTarget.ToString(), channel));
                string resPath = BuildPipelineAsset.GetExternalPluginResSourcePath(EditorUserBuildSettings.activeBuildTarget.ToString(), channel);

                BuildPipelineCommonTools.FileUtils.CheckDir(Path.Combine(resPath, GlobalToolConfigure.Current.SDK.DefaultIconFilterSearchPath));
                BuildPipelineCommonTools.FileUtils.CheckDir(Path.Combine(resPath, GlobalToolConfigure.Current.SDK.SplashLogosFilterSearchPath));
                BuildPipelineCommonTools.FileUtils.CheckDir(Path.Combine(resPath, GlobalToolConfigure.Current.SDK.SplashScreenFilterSearchPath));
                Debug.Log("插件目录生成成功");
            }
 public static void TakeSnapshot()
 {
     if (!mSnapshot)
     {
         string settingsPath     = BuildPipelineAsset.GetExternalGlobalPath(PROJECT_SETTINGS_PATH);
         string settingsPathTemp = BuildPipelineAsset.GetExternalGlobalPath(PROJECT_SETTINGS_TEMP_PATH);
         File.Copy(settingsPath, settingsPathTemp, true);
         mSnapshot = true;
         Debug.Log("Take PlayerSettings Snapshot succeeded");
     }
 }
示例#4
0
            public static void SetSplashLogos()
            {
                if (GlobalToolConfigure.Current == null || GlobalToolConfigure.Current.SDK == null)
                {
                    Debug.LogError("GlobalToolConfigure not found, Cannot set default icon");
                    return;
                }
                if (string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilter) || string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilterSearchPath))
                {
                    Debug.LogError("GlobalToolConfigure -> SplashLogosFilter、SplashLogosFilterSearchPath is error, Cannot set default icon");
                    return;
                }

                RestoreSplashData();
                Debug.Log("Starting set splash logos");
                string filter           = GlobalToolConfigure.Current.SDK.SplashLogosFilter;
                string filterSearchPath = BuildPipelineAsset.GetChannelFilterSearchPath(GlobalToolConfigure.Current.SDK.SplashLogosFilterSearchPath);
                var    folders          = new List <string>()
                {
                    filterSearchPath
                };

                string[] searchInFolders = folders.ToArray();
                string[] assets          = AssetDatabase.FindAssets(filter, searchInFolders);

                if (assets == null || assets.Length == 0)
                {
                    Debug.LogError(string.Format("Dir: {0} 下未找到匹配的资源, SplashLogos设置失败", filterSearchPath));
                    return;
                }
                PlayerSettingsResolver.SetSplashScreen(backgroundColor: Color.white, show: true, showUnityLogo: false, drawMode: PlayerSettings.SplashScreen.DrawMode.AllSequential);
                List <PlayerSettings.SplashScreenLogo> screenLogos = new List <PlayerSettings.SplashScreenLogo>();

                screenLogos.Clear();
                for (int i = 0; assets != null && i < assets.Length; i++)
                {
                    string assetPath = AssetDatabase.GUIDToAssetPath(assets[i]);
                    if (assetPath == null)
                    {
                        continue;
                    }
                    Sprite asset = AssetDatabase.LoadAssetAtPath <Sprite>(assetPath);
                    if (asset == null)
                    {
                        continue;
                    }

                    screenLogos.Add(PlayerSettings.SplashScreenLogo.Create(2f, asset));
                }
                PlayerSettingsResolver.SetSplashScreen(screenLogos.ToArray());
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                Debug.Log("Set splash logos succeeded");
            }
        public static void ApplySnapshot()
        {
            string settingsPath     = BuildPipelineAsset.GetExternalGlobalPath(PROJECT_SETTINGS_PATH);
            string settingsPathTemp = BuildPipelineAsset.GetExternalGlobalPath(PROJECT_SETTINGS_TEMP_PATH);

            if (File.Exists(settingsPathTemp))
            {
                File.Copy(settingsPathTemp, settingsPath, true);
                File.Delete(settingsPathTemp);
                mSnapshot = false;
                Debug.Log("Apply PlayerSettings Snapshot succeeded");
                AssetDatabase.Refresh();
            }
        }
 public void DeletePackagingCacheFolders()
 {
     string[] deletePaths = BuildPipelineAsset.NeedDeletePaths;
     if (deletePaths != null && deletePaths.Length > 0)
     {
         foreach (var assetPath in deletePaths)
         {
             string fullpath = BuildPipelineAsset.GetExternalGlobalPath(assetPath);
             if (string.IsNullOrEmpty(fullpath))
             {
                 continue;
             }
             BuildPipelineCommonTools.FileUtils.DeleteFolder(fullpath);
         }
     }
     AssetDatabase.Refresh();
 }
 protected void CopyExternalResFolder()
 {
     if (string.IsNullOrEmpty(channel))
     {
         return;
     }
     mInternalPackagingCacheResPath = BuildPipelineAsset.InternalPackagingCacheResPath;
     if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
     {
         mExternalResPath = BuildPipelineAsset.GetExternalPluginResSourcePath(EditorUserBuildSettings.activeBuildTarget.ToString(), channel);
         BuildPipelineCommonTools.FileUtils.CopyFolder(mExternalResPath, mInternalPackagingCacheResPath);
     }
     else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
     {
         mExternalResPath = BuildPipelineAsset.GetExternalPluginResSourcePath(EditorUserBuildSettings.activeBuildTarget.ToString(), channel);
         BuildPipelineCommonTools.FileUtils.CopyFolder(mExternalResPath, mInternalPackagingCacheResPath);
     }
 }
示例#8
0
            public static void SetSplashScreen()
            {
                if (GlobalToolConfigure.Current == null || GlobalToolConfigure.Current.SDK == null)
                {
                    Debug.LogError("GlobalToolConfigure not found, Cannot set default icon");
                    return;
                }
                if (string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilter) || string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilterSearchPath))
                {
                    Debug.LogError("GlobalToolConfigure -> SplashScreenFilter、SplashScreenFilterSearchPath is error, Cannot set default icon");
                    return;
                }

                RestoreSplashData();
                Debug.Log("Starting set splash screen");
                string filter           = GlobalToolConfigure.Current.SDK.SplashScreenFilter;
                string filterSearchPath = BuildPipelineAsset.GetChannelFilterSearchPath(GlobalToolConfigure.Current.SDK.SplashScreenFilterSearchPath);
                var    folders          = new List <string>()
                {
                    filterSearchPath
                };

                string[] searchInFolders = folders.ToArray();
                string[] assets          = AssetDatabase.FindAssets(filter, searchInFolders);

                if (assets == null || assets.Length == 0)
                {
                    Debug.LogError(string.Format("Dir: {0} 下未找到匹配的资源, SplashScreen设置失败", filterSearchPath));
                    return;
                }
                PlayerSettingsResolver.SetSplashScreen(backgroundColor: Color.white, show: true, showUnityLogo: false, drawMode: PlayerSettings.SplashScreen.DrawMode.AllSequential);

                List <Texture2D> mSplashs = new List <Texture2D>();

                mSplashs.Clear();
                for (int i = 0; assets != null && i < assets.Length; i++)
                {
                    string assetPath = AssetDatabase.GUIDToAssetPath(assets[i]);
                    if (assetPath == null)
                    {
                        continue;
                    }
                    Texture2D asset = AssetDatabase.LoadAssetAtPath <Texture2D>(assetPath);
                    if (asset == null)
                    {
                        continue;
                    }
                    mSplashs.Add(asset);
                }

                BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget;

                switch (buildTarget)
                {
                case BuildTarget.iOS:
                    PlayerSettingsResolver.iOS.SetiPhoneLaunchScreenType(iOSLaunchScreenType.ImageAndBackgroundRelative);
                    QuickEditorUtils.SetSplashScreen("iOSLaunchScreenPortrait", mSplashs[0]);
                    QuickEditorUtils.SetSplashScreen("iOSLaunchScreenLandscape", mSplashs[0]);
                    break;

                case BuildTarget.Android:
                    QuickEditorUtils.SetSplashScreen("androidSplashScreen", mSplashs[0]);
                    break;

                default:
                    break;
                }
                //PlayerSettings.SplashScreen.background = mSplashs[0];
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                Debug.Log("Set splash screen succeeded");
            }
示例#9
0
            public static void SetDefaultIcon()
            {
                if (GlobalToolConfigure.Current == null || GlobalToolConfigure.Current.SDK == null)
                {
                    Debug.LogError("GlobalToolConfigure not found, Cannot set default icon");
                    return;
                }
                if (string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilter) || string.IsNullOrEmpty(GlobalToolConfigure.Current.SDK.DefaultIconFilterSearchPath))
                {
                    Debug.LogError("GlobalToolConfigure -> DefaultIconFilter、DefaultIconFilterSearchPath is error, Cannot set default icon");
                    return;
                }

                Debug.Log("Starting set default icon");
                string filter           = GlobalToolConfigure.Current.SDK.DefaultIconFilter;
                string filterSearchPath = BuildPipelineAsset.GetChannelFilterSearchPath(GlobalToolConfigure.Current.SDK.DefaultIconFilterSearchPath);
                var    folders          = new List <string>()
                {
                    filterSearchPath
                };

                string[] searchInFolders = folders.ToArray();
                string[] assets          = AssetDatabase.FindAssets(filter, searchInFolders);

                if (assets == null || assets.Length == 0)
                {
                    Debug.LogError(string.Format("Dir: {0} 下未找到匹配的资源, Icon设置失败", filterSearchPath));
                    return;
                }

                List <Texture2D> mTextures = new List <Texture2D>();

                mTextures.Clear();
                for (int i = 0; assets != null && i < assets.Length; i++)
                {
                    string assetPath = AssetDatabase.GUIDToAssetPath(assets[i]);
                    if (assetPath == null)
                    {
                        continue;
                    }
                    Texture2D asset = AssetDatabase.LoadAssetAtPath <Texture2D>(assetPath);
                    if (asset == null)
                    {
                        continue;
                    }
                    mTextures.Add(asset);
                }

                BuildTarget      buildTarget      = EditorUserBuildSettings.activeBuildTarget;
                BuildTargetGroup buildTargetGroup = BuildPipelineCommonTools.BuildUtils.GetBuildTargetGroup(buildTarget);

                int[]       iconSize     = PlayerSettings.GetIconSizesForTargetGroup(buildTargetGroup);
                Texture2D[] textureArray = new Texture2D[iconSize.Length];
                for (int i = 0; i < textureArray.Length; i++)
                {
                    textureArray[i] = mTextures[0];
                }
                PlayerSettings.SetIconsForTargetGroup(buildTargetGroup, textureArray);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                Debug.Log("Set default icon succeeded");
                //MethodInfo getIconFormPlatform = typeof(PlayerSettings).GetMethod("GetIconsForPlatform", BindingFlags.NonPublic | BindingFlags.Static);
                //MethodInfo getIconSizesForPlatform = typeof(PlayerSettings).GetMethod("GetIconSizesForPlatform", BindingFlags.NonPublic | BindingFlags.Static);
                //MethodInfo setIconsForPlatform = typeof(PlayerSettings).GetMethod("SetIconsForPlatform", BindingFlags.NonPublic | BindingFlags.Static);
                //Texture2D[] textureArray = (Texture2D[])getIconFormPlatform.Invoke(null, new object[] { string.Empty });
                //var iconSizesForPlatform = (int[])getIconSizesForPlatform.Invoke(null, new object[] { string.Empty });
                //if (textureArray.Length != iconSizesForPlatform.Length)
                //{
                //    textureArray = new Texture2D[iconSizesForPlatform.Length];
                //    setIconsForPlatform.Invoke(null, new object[] { string.Empty, textureArray });
                //}
                //textureArray[0] = mTextures[0];
                //setIconsForPlatform.Invoke(null, new object[] { string.Empty, textureArray });
                //AssetDatabase.SaveAssets();
            }