/// <summary>
        /// 添加tbd
        /// </summary>
        /// <param name="lib"></param>
        public void AddLibrary(string lib)
        {
            string fileGuid = mProj.AddFile("usr/lib/" + lib, "Frameworks/" + lib, PBXSourceTree.Sdk);

            mProj.AddFileToBuild(mTargetGuid, fileGuid);
            Debug.Log(string.Format("Adding library : {0}", lib));
        }
 public void AddCapability(PBXCapabilityType capability, string entitlementsFilePath = null, bool addOptionalFramework = false)
 {
     Debug.Log(string.Format("{0}: Begin Add Capability : {1}, EntitlementsFilePath : {2}, AddOptionalFramework : {3}", TAG, capability.id, entitlementsFilePath, addOptionalFramework));
     if (string.IsNullOrEmpty(entitlementsFilePath))
     {
         mProj.AddCapability(mTargetGuid, capability);
     }
     else
     {
         string mTargetEntitlementPath = entitlementsFilePath;
         string xcodeEntitlementPath   = entitlementsFilePath;
         string packToolsPath          = Application.dataPath.Replace("/YL/Assets", "/ProjectBuilder/PackTools/ExportOptions");
         string entitlement            = Path.Combine(packToolsPath, entitlementsFilePath);
         if (File.Exists(entitlement))
         {
             mTargetEntitlementPath = mTargetName + "/" + entitlementsFilePath;
             xcodeEntitlementPath   = Path.Combine(mBuildProjectPath, mTargetName + "/" + entitlementsFilePath);
             File.Copy(entitlement, xcodeEntitlementPath, true);
         }
         //mProj.AddFile(mTargetEntitlementPath, Path.GetFileName(entitlementsFilePath));
         //mProj.AddBuildProperty(mTargetGuid, "CODE_SIGN_ENTITLEMENTS", mTargetEntitlementPath);
         mProj.AddCapability(mTargetGuid, capability, mTargetEntitlementPath, addOptionalFramework);
     }
     Debug.Log(string.Format("{0}: Adding Capability : {1}, EntitlementsFilePath : {2}, AddOptionalFramework : {3}", TAG, capability.id, entitlementsFilePath, addOptionalFramework));
 }
 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
 }
Ejemplo n.º 4
0
 public static void Process(string pathToBuildProject)
 {
     Debug.Log("AndroidPostProcess: Starting to perform post build tasks for Android platform.");
     if (pathToBuildProject == null)
     {
         return;
     }
 }
 /// <summary>
 /// 添加内部框架 Framework
 /// </summary>
 /// <param name="framework"></param>
 /// <param name="weak"></param>
 public void AddFramework(string framework, bool weak)
 {
     if (mProj.ContainsFramework(mTargetGuid, framework))
     {
         mProj.RemoveFrameworkFromProject(mTargetGuid, framework);
     }
     mProj.AddFrameworkToProject(mTargetGuid, framework, weak);
     Debug.Log(string.Format("Adding framework : {0}, IsWeek : {1}", framework, weak));
 }
Ejemplo n.º 6
0
        ///// <summary>

        ///// 设置私有数据

        ///// </summary>

        ///// <param name="plist"></param>

        ///// <param name="privacySensiticeDataList"></param>

        //private static void SetPrivacySensiticeData(PlistDocument plist, List<XcodeProjectSetting.PrivacySensiticeData> privacySensiticeDataList)

        //{
        //    PlistElementDict rootDict = plist.root;

        //    int count = privacySensiticeDataList.Count;

        //    for (int i = 0; i < count; i++)

        //    {
        //        XcodeProjectSetting.PrivacySensiticeData data = privacySensiticeDataList[i];

        //        switch (data.type)

        //        {
        //            case XcodeProjectSetting.NValueType.String:

        //                rootDict.SetString(data.key, data.value);

        //                break;

        //            case XcodeProjectSetting.NValueType.Int:

        //                rootDict.SetInteger(data.key, int.Parse(data.value));

        //                break;

        //            case XcodeProjectSetting.NValueType.Bool:

        //                rootDict.SetBoolean(data.key, bool.Parse(data.value));

        //                break;

        //            default:

        //                rootDict.SetString(data.key, data.value);

        //                break;

        //        }

        //    }

        //}

        public void AddStringKey(string key, string val)
        {
            root.SetString(key, val);
            Debug.Log(string.Format("Set String -> Key : {0}, Value : {1}", key, val));
            //rootDic.SetBoolean("ITSAppUsesNonExemptEncryption", false);

            // for share sdk 截屏
            root.SetString("NSPhotoLibraryUsageDescription", "We need use photo library usage");
        }
Ejemplo n.º 7
0
        public static void Process(string pathToBuildProject)
        {
            Debug.Log("StandalonePostProcess: Starting to perform post build tasks for Windows platform.");
            if (pathToBuildProject == null)
            {
                return;
            }

            //GenerateWinExe(pathToBuildProject);
        }
            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("插件目录生成成功");
            }
Ejemplo n.º 9
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 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");
     }
 }
        private static void onPreprocessBuild(BuildTarget target, string pathToBuildProject)
        {
            Debug.Log("Starting to perform preprocess build tasks for {0} platform.", target);
#if UNITY_EDITOR_LINUX
            if (target == BuildTarget.Android)
            {
                KillUnityShaderCompiler();
            }
#endif

            BuildPipelineExecutor.DefaultBuildEnvsOptions.CopyPackagingResources();
            BuildPipelineExecutor.DefaultBuildEnvsOptions.ApplyPackagingResources();
        }
        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();
            }
        }
        private static int BuildPlayer(BuildEnvsOptions buildOptions, bool revealInFinder = false)
        {
            BuildPipelineCommonTools.FileUtils.CheckDir(Path.GetDirectoryName(buildOptions.locationPathName));
#if UNITY_2018_1_OR_NEWER
            UnityEditor.Build.Reporting.BuildReport  report  = BuildPipeline.BuildPlayer(buildOptions.GetBuildPlayerOptions());
            UnityEditor.Build.Reporting.BuildSummary summary = report.summary;
            string errorMessage   = string.Join("\n", report.steps.SelectMany(s => s.messages).Where(m => m.type == LogType.Error).Select(m => m.content).ToArray());
            bool   buildSucceeded = (summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded);
#else
            string errorMessage   = BuildPipeline.BuildPlayer(buildOptions.scenes, buildOptions.locationPathName, buildOptions.target, buildOptions.options);
            bool   buildSucceeded = !string.IsNullOrEmpty(errorMessage);
#endif

            UnityEngine.Debug.ClearDeveloperConsole();
            BuildPipelineExecutor.DefaultBuildEnvsOptions.DeletePackagingCacheFolders();
            if (buildSucceeded)
            {
                if (revealInFinder)
                {
                    EditorUtility.RevealInFinder(buildOptions.locationPathName);
                }
#if UNITY_2018_1_OR_NEWER
                Debug.Log("Build completed successfully for {0}: {1} mb and took {2} seconds with {3} error(s). Location: {4}",
                          summary.platform.ToString(),
                          (summary.totalSize / 1024 / 1024).ToString("N2"),
                          summary.totalTime.Seconds,
                          summary.totalErrors,
                          summary.outputPath
                          );
#else
                Debug.Log(string.Format("Build completed successfully for {0} to {1}", buildPlayerOptions.target, buildPlayerOptions.locationPathName));
#endif
                return(0);
            }
            else
            {
                Debug.LogError("Build failed with errors \n" + errorMessage);
                //throw new BuildFailedException("Build failed with errors \n" + errorMessage);
                return(1);
            }
        }
        public static void Process(string pathToBuildProject)
        {
            Debug.Log("iOSPostProcess: Starting to perform post build tasks for iOS platform.");
#if UNITY_IOS
            if (pathToBuildProject == null)
            {
                return;
            }
            var settings = ProjectXcodeConfigure.Current.Settings;
            if (settings == null || settings.Count == 0)
            {
                return;
            }
            var setting = settings.Find(s => s.group == "default");
            if (setting == null)
            {
                return;
            }
            SetInfoPlist(pathToBuildProject, setting);
            ModifyPBXProject(pathToBuildProject, setting, "");
            ModifyXcodeCodes(pathToBuildProject, setting);
#endif
        }
Ejemplo n.º 15
0
        //[UnityEditor.MenuItem("Tools/导出自解压安装包exe")]
        //public static void Test()
        //{
        //    string path = EditorUtility.OpenFolderPanel("请选择需要压缩的目录", "../ProjectBuilder/Output/PC", "");
        //    if (string.IsNullOrEmpty(path)) return;

        //    if (!File.Exists(path + "/ylqt-Setup.exe"))
        //    {
        //        EditorUtility.DisplayDialog("", "不合法的目录", "确认");
        //        return;
        //    }

        //    GenerateWinExe(path + "/ylqt-Setup.exe");
        //}

        public static void GenerateWinExe(string pathToBuiltProject)
        {
            Debug.Log("BuildProjectPath: " + pathToBuiltProject);
            string zipRootDir = Path.GetDirectoryName(pathToBuiltProject) + "/";
            string path       = Path.GetDirectoryName(pathToBuiltProject);
            int    index      = path.LastIndexOf("/");
            string setupName  = path.Substring(index, path.Length - index);
            //string setupExeName = Path.GetFileName(pathToBuiltProject);
            string targetExePath = zipRootDir + setupName + ".exe";

            if (File.Exists(targetExePath))
            {
                File.Delete(targetExePath);
            }

            //复制icon
            string icoFilePath   = zipRootDir + "icon.ico";
            string bmpFilePath   = zipRootDir + "icon.bmp";
            string sfxConfigPath = zipRootDir + "sfxConfig.txt";
            string uninstallPath = zipRootDir + "uninstall.exe";

            File.Copy("Assets/Res/Logo/PC/icon.ico", icoFilePath, true);
            File.Copy("Assets/Res/Logo/PC/icon.bmp", bmpFilePath, true);
            File.Copy("Assets/Res/Logo/PC/sfxConfig.txt", sfxConfigPath, true);
            File.Copy("Assets/Res/Logo/PC/uninstall.exe", uninstallPath, true);

            //获取winrar路径
            var    regKeyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe";
            string winrarPath = null;

            try
            {//windows
                var regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKeyPath);
                winrarPath = regKey.GetValue("").ToString();
                regKey.Close();
            }
            catch (Exception)
            {//mac os
                winrarPath = "/usr/local/bin/rar";
                File.Copy("Assets/Res/Logo/PC/sfxConfigMac.txt", sfxConfigPath, true);
            }

            Debug.Log("WinRAR.exe Path=" + winrarPath);

            //        StringBuilder sfxConfig = new StringBuilder();
            //        sfxConfig.AppendLine("Title=妖恋奇谭安装程序"); //安装标题
            //        sfxConfig.AppendLine("Text=妖恋奇谭说明"); //安装说明
            //        sfxConfig.AppendLine("Path=C:\\Program Files\\ylqt\\"); //安装路径
            //        sfxConfig.AppendLine("Shortcut=D," + setupExeName + ",,,"+"妖恋奇谭,"+ "icon.ico"); //桌面快捷方式
            //        sfxConfig.AppendLine("Overwrite=1"); //覆盖所有文件
            //        sfxConfig.AppendLine("Update=U"); //更新新的或不存在的文件
            //        sfxConfig.AppendLine(
            //@"License=最终用户许可协议书
            //{
            //所有版权于 妖恋奇谭 均属于作者所专有。
            //此程序是共享软件,任何人在测试期限内均可以使用此软件。
            //在测试期限过后,您“必须”注册。
            //}"
            //        ); //许可
            //File.WriteAllText(sfxConfigPath, sfxConfig.ToString());

            string argument = "";

            argument += "a -r -sfx ";           //压缩,递归,自解压
            argument += "-iimg" + "icon.bmp ";  //解压图标
            argument += "-iicon" + "icon.ico "; //解压图标
            argument += "-zsfxConfig.txt ";     //注释

            argument += targetExePath + " * ";  //指定目录

            Debug.Log("argument=" + argument);
            try
            {//运行进程
                var p = new System.Diagnostics.Process();
                p.StartInfo.FileName               = winrarPath;
                p.StartInfo.WorkingDirectory       = zipRootDir;
                p.StartInfo.Arguments              = argument;
                p.StartInfo.ErrorDialog            = false;
                p.StartInfo.UseShellExecute        = false;
                p.StartInfo.CreateNoWindow         = false;
                p.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Normal;//与CreateNoWindow联合使用可以隐藏进程运行的窗体
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardInput  = true;
                p.StartInfo.RedirectStandardError  = true;
                p.EnableRaisingEvents              = true;         // 启用Exited事件
                                                                   //p.Exited += p_Exited;
                p.Start();

                p.WaitForExit();

                if (p.ExitCode == 0)//正常退出
                {
                    //TODO记录日志
                    Debug.Log("执行完毕!");
                }
                else
                {
                    Debug.LogError("error exitcode " + p.ExitCode);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("系统错误:", ex);
            }
        }
Ejemplo n.º 16
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();
            }
Ejemplo n.º 17
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");
            }
 private static void onPostprocessBuild(BuildTarget target, string pathToBuildProject)
 {
     Debug.Log("Starting to perform Postprocess build tasks for {0} platform.", target);
     PlayerSettingsSnapshot.ApplySnapshot();
 }
Ejemplo n.º 19
0
 public void SetPermission(string key, string val)
 {
     root.SetString(key, val);
     Debug.Log(string.Format("Set Permission : {0}, Value : {1}", key, val));
 }
Ejemplo n.º 20
0
 public void AddBooleanKey(string key, bool val)
 {
     root.SetBoolean(key, val);
     Debug.Log(string.Format("Set Boolean -> Key : {0}, Value : {1}", key, val));
 }