| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System; |
| | | using UnityEditor; |
| | | using System.IO; |
| | | using System.Text.RegularExpressions; |
| | | using System.Text; |
| | | using TableConfig; |
| | | |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using System;
|
| | | using UnityEditor;
|
| | | using System.IO;
|
| | | using System.Text.RegularExpressions;
|
| | | using System.Text;
|
| | | using TableConfig;
|
| | |
|
| | | public class ClientPackage
|
| | | { |
| | | public static readonly string versionsFilePath = Application.dataPath + Path.DirectorySeparatorChar + "Editor/VersionConfigs/Versions.txt"; |
| | | {
|
| | | public static readonly string versionsFilePath = Application.dataPath + Path.DirectorySeparatorChar + "Editor/VersionConfigs/Versions.txt";
|
| | | public static readonly string[] baseLevels = new string[] { "Assets/Resources/Scenes/Launch.unity", "Assets/Resources/Scenes/Empty.unity" };
|
| | |
|
| | | public static string SDK_PLUGIN_PROJECT {
|
| | | public static string SDK_PLUGIN_PROJECT
|
| | | {
|
| | | get { return LocalSave.GetString("SDK_PROJECT_PATH"); }
|
| | | set { LocalSave.SetString("SDK_PROJECT_PATH", value); }
|
| | | } |
| | | |
| | | static string ANDROID_PLUGIN_PATH = Application.dataPath + "/Plugins/Android"; |
| | | |
| | | static int packageIndex {
|
| | | }
|
| | |
|
| | | static string ANDROID_PLUGIN_PATH = Application.dataPath + "/Plugins/Android";
|
| | | static string iOS_PLUGIN_PATH = Application.dataPath + "/Plugins/iOS/The2thWorldSDK";
|
| | |
|
| | | static int packageIndex
|
| | | {
|
| | | get { return LocalSave.GetInt("ClientPackageIndex", 1); }
|
| | | set { LocalSave.SetInt("ClientPackageIndex", value); }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public static void BuildPublishers(string _sdkPath, string _assetBundlePath, string _output, string _publisherString, bool _development, bool _replace)
|
| | | {
|
| | | var publisherIds = new List<string>();
|
| | |
| | | }
|
| | | break;
|
| | | }
|
| | | } |
| | | }
|
| | |
|
| | | var smallPackages = new List<string>();
|
| | | var halfPackages = new List<string>();
|
| | |
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, smallPackages[i], _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(smallPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, smallPackages[i], _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, halfPackages[i], _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(halfPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, halfPackages[i], _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, bigPackages[i], _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(bigPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, bigPackages[i], _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
|
| | | packageIndex++;
|
| | | }
|
| | | |
| | |
|
| | | public static void BuildApk(string _sdkPath, string _output, string _publisher, bool _development)
|
| | | {
|
| | | PreBuild(_publisher);
|
| | |
| | | Directory.Delete(ANDROID_PLUGIN_PATH, true);
|
| | | }
|
| | |
|
| | | Debug.LogFormat("执行Android SDK 文件拷贝,from:{0};to:{1}", StringUtility.Contact(_sdkPath, "/Android/", versionConfig.appId), ANDROID_PLUGIN_PATH);
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Android/", versionConfig.appId), ANDROID_PLUGIN_PATH); |
| | | if (!versionConfig.appId.Equals("test"))
|
| | | {
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/渠道差异/", versionConfig.productName), ANDROID_PLUGIN_PATH);
|
| | | } |
| | | Debug.LogFormat("执行Android SDK 文件拷贝,from:{0};to:{1}", StringUtility.Contact(_sdkPath, "/Android/release"), ANDROID_PLUGIN_PATH);
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Android/release"), ANDROID_PLUGIN_PATH);
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/ChannelDiff/", versionConfig.appId), ANDROID_PLUGIN_PATH);
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | |
|
| | |
| | | var apkName = StringUtility.Contact(_output, "/", versionName, "_", versionConfig.clientPackageFlag, "_v", versionConfig.m_Version, "_", index, ".apk");
|
| | | BuildPipeline.BuildPlayer(baseLevels, apkName, BuildTarget.Android, BuildOptions.None);
|
| | | }
|
| | | } |
| | | |
| | | public static void BuildIpa(string _publisher, bool _replace)
|
| | | }
|
| | |
|
| | | public static void BuildIpa(string _sdkPath, string _publisher, bool _replace)
|
| | | {
|
| | | PreBuild(_publisher);
|
| | |
|
| | | var versionName = string.Empty;
|
| | | var versionConfig = GetVersionConfig(_publisher, out versionName);
|
| | | if (!versionConfig.appId.Equals("test"))
|
| | | {
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/ChannelDiff/", versionConfig.appId), iOS_PLUGIN_PATH);
|
| | | }
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | |
|
| | | PlayerSettings.iOS.buildNumber = VersionConfig.Get().buildIndex.ToString();
|
| | | PlayerSettings.iOS.appleDeveloperTeamID = VersionConfig.Get().appleDeveloperTeamID;
|
| | |
|
| | |
| | | {
|
| | | XCodeProjectMod.BuildIOSProject_Append();
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private static void PreBuild(string _publisher)
|
| | | {
|
| | | try
|
| | |
| | | AssetDatabase.Refresh();
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | static VersionConfig GetVersionConfig(string _publisher, out string _versionName)
|
| | | {
|
| | | var lines = File.ReadAllLines(versionsFilePath);
|
| | |
| | |
|
| | | _versionName = string.Empty;
|
| | | return null;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | static void SetIconAndSplashImage(string _versionName)
|
| | | {
|
| | | var buildTarget = GetBuildTarget();
|
| | |
| | | EditorUtility.SetDirty(textureImporter);
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | static BuildTargetGroup GetBuildTarget()
|
| | | {
|
| | | #if UNITY_ANDROID
|
| | |
| | | #else
|
| | | return BuildTargetGroup.Standalone;
|
| | | #endif
|
| | | } |
| | | |
| | | } |
| | | }
|
| | |
|
| | | }
|