New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System; |
| | | using UnityEditor; |
| | | |
| | | public class ClientPackageExtension |
| | | { |
| | | |
| | | public static void BuildApk() |
| | | { |
| | | var parameters = new BuildParameters(); |
| | | |
| | | if (!parameters.error) |
| | | { |
| | | try |
| | | { |
| | | ClientPackage.BuildPublishers(parameters.assetbundlePath, parameters.outputPath, parameters.publishers, false, false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.Log("打包apk失败"); |
| | | Debug.Log(ex); |
| | | EditorApplication.Exit(1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | EditorApplication.Exit(1); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | class BuildParameters |
| | | { |
| | | public bool error = false; |
| | | public string assetbundlePath; |
| | | public string outputPath; |
| | | public string publishers; |
| | | |
| | | public BuildParameters() |
| | | { |
| | | try |
| | | { |
| | | var args = Environment.GetCommandLineArgs(); |
| | | for (int i = 0; i < args.Length; i++) |
| | | { |
| | | var arg = args[i]; |
| | | if (arg.ToLower() == "-outputpath") |
| | | { |
| | | outputPath = args[i + 1]; |
| | | } |
| | | else if (arg.ToLower() == "-assetbundlepath") |
| | | { |
| | | assetbundlePath = args[i + 1]; |
| | | } |
| | | else if (arg.ToLower() == "-publishers") |
| | | { |
| | | publishers = args[i + 1]; |
| | | } |
| | | } |
| | | |
| | | error = false; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | error = true; |
| | | Debug.LogException(ex); |
| | | EditorApplication.Exit(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |