Exemplo n.º 1
0
        public override BuildReport Build(BuildConfiguration config, ILogger logger)
        {
            var args = config.Arguments;

            BuilderUtils.AssertRequiredArguments <BuilderArguments.IOS>(args, true);

            PlayerSettings.iOS.buildNumber = config.BuildNumber.ToString();

            var ios = args.Fill <iOSArgs>();

            args.SetStaticPropertiesFromFiels <PlayerSettings.iOS>(ios, true);
            args.OnExist(BuilderArguments.IOS.IPadLaunchScreenType, (key, value) => PlayerSettings.iOS.SetiPadLaunchScreenType(args.GetValueByEnum <iOSLaunchScreenType>(BuilderArguments.IOS.IPadLaunchScreenType)));
            args.OnExist(BuilderArguments.IOS.IPhoneLaunchScreenType, (key, value) => PlayerSettings.iOS.SetiPadLaunchScreenType(args.GetValueByEnum <iOSLaunchScreenType>(BuilderArguments.IOS.IPhoneLaunchScreenType)));

            PreBuild(config, logger);
            var result = UnityEditor.BuildPipeline.BuildPlayer(config.BuildPlayerOptions);

            PostBuild(result, logger);

            return(result);
        }
Exemplo n.º 2
0
        public override BuildReport Build(BuildConfiguration config, ILogger logger)
        {
            var args = config.Arguments;

            BuilderUtils.AssertRequiredArguments <BuilderArguments.Android>(args, true);

            args.AssertKeys(KeystorePath, KeystorePass, KeyaliasName, KeyaliasPass);

            PlayerSettings.Android.keystoreName = args[KeystorePath];
            PlayerSettings.Android.keystorePass = args[KeystorePass];

            PlayerSettings.Android.keyaliasName = args[KeyaliasName];
            PlayerSettings.Android.keyaliasPass = args[KeyaliasPass];

            if (args.Contains(BuilderArguments.Android.PreferredInstallLocation))
            {
                PlayerSettings.Android.preferredInstallLocation = args.GetValueByEnum <AndroidPreferredInstallLocation>(BuilderArguments.Android.PreferredInstallLocation);
            }

            if (args.Contains(BuilderArguments.Android.AndroidBuildSubtarget))
            {
                EditorUserBuildSettings.androidBuildSubtarget = args.GetValueByEnum <MobileTextureSubtarget>(BuilderArguments.Android.AndroidBuildSubtarget);
            }

            if (args.Contains(BuilderArguments.Android.BlitType))
            {
                PlayerSettings.Android.blitType = args.GetValueByEnum <AndroidBlitType>(args[BuilderArguments.Android.BlitType]);
            }

            if (args.Contains(BuilderArguments.Android.TargetSdkVersion))
            {
                PlayerSettings.Android.targetSdkVersion = args.GetValueByEnum <AndroidSdkVersions>(args[BuilderArguments.Android.TargetSdkVersion]);
            }

            if (args.Contains(BuilderArguments.Android.MinSdkVersion))
            {
                PlayerSettings.Android.minSdkVersion = args.GetValueByEnum <AndroidSdkVersions>(args[BuilderArguments.Android.MinSdkVersion]);
            }

            if (args.Contains(BuilderArguments.Android.MaxAspectRatio))
            {
                float maxAspectRatio;
                Assert.IsTrue(float.TryParse(args[BuilderArguments.Android.MaxAspectRatio], NumberStyles.Any, CultureInfo.InvariantCulture, out maxAspectRatio), BuilderUtils.GetMessageNotValidArgs(BuilderArguments.Android.MaxAspectRatio, args, new[] { "float (example: 1.4)" }));
                PlayerSettings.Android.maxAspectRatio = maxAspectRatio;
            }

            PlayerSettings.Android.targetArchitectures = args.Contains(BuilderArguments.Android.TargetArchitectures)
        ? args.GetValueByEnum <AndroidArchitecture>(BuilderArguments.Android.TargetArchitectures)
        : AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;

            PlayerSettings.Android.buildApkPerCpuArchitecture = args.GetAsBool(BuilderArguments.Android.BuildApkPerCpuArchitecture);

            PlayerSettings.Android.disableDepthAndStencilBuffers = args.GetAsBool(BuilderArguments.Android.DisableDepthAndStencilBuffers);
            PlayerSettings.Android.forceSDCardPermission         = args.GetAsBool(BuilderArguments.Android.ForceSDCardPermission);
            PlayerSettings.Android.forceInternetPermission       = args.GetAsBool(BuilderArguments.Android.ForceInternetPermission);
            PlayerSettings.Android.androidIsGame        = args.GetAsBool(BuilderArguments.Android.AndroidIsGame);
            PlayerSettings.Android.useAPKExpansionFiles = args.GetAsBool(BuilderArguments.Android.UseAPKExpansionFiles);
            PlayerSettings.Android.bundleVersionCode    = config.BuildNumber;

            EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
            PreBuild(config, logger);
            var result = UnityEditor.BuildPipeline.BuildPlayer(config.BuildPlayerOptions);

            PostBuild(result, logger);

            return(result);
        }