少年修仙传客户端基础资源
client_Wu Xijin
2018-08-13 eebb60c30b2539e9be840dfad6a3697c73a7ada6
更新打包代码。
1个文件已修改
75 ■■■■■ 已修改文件
Assets/Editor/Tool/ClientPackage.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/ClientPackage.cs
@@ -13,21 +13,19 @@
    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 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)
    public static void BuildPublishers(string _sdkPath, string _assetBundlePath, string _output, string _publisherString, bool _development, bool _replace)
    {
        var publisherIds = new List<string>();
        var tempStrings = _publisherString.Split(StringUtility.splitSeparator, StringSplitOptions.RemoveEmptyEntries);
@@ -95,7 +93,7 @@
            for (int i = 0; i < smallPackages.Count; i++)
            {
#if UNITY_ANDROID
                BuildApk(_sdkPath,_output, smallPackages[i], _development);
                BuildApk(_sdkPath, _output, smallPackages[i], _development);
#elif UNITY_IOS
                BuildIpa(smallPackages[i], _replace);
#endif
@@ -277,36 +275,47 @@
    private static void PreBuild(string _publisher)
    {
        var newVersionConfigPath = StringUtility.Contact("Assets/Resources/ScriptableObject/Config/VersionConfig", ".asset");
        var versionName = string.Empty;
        var fromVersionConfig = GetVersionConfig(_publisher, out versionName);
        var newVersionConfig = ScriptableObject.CreateInstance<VersionConfig>();
        if (File.Exists(newVersionConfigPath))
        try
        {
            AssetDatabase.DeleteAsset(newVersionConfigPath);
            var newVersionConfigPath = StringUtility.Contact("Assets/Resources/ScriptableObject/Config/VersionConfig", ".asset");
            var versionName = string.Empty;
            var fromVersionConfig = GetVersionConfig(_publisher, out versionName);
            var newVersionConfig = ScriptableObject.CreateInstance<VersionConfig>();
            if (File.Exists(newVersionConfigPath))
            {
                AssetDatabase.DeleteAsset(newVersionConfigPath);
            }
            VersionConfig.Copy(fromVersionConfig, newVersionConfig);
            newVersionConfig.buildTime = DateTime.Now.ToString("yy/MM/dd--HH:mm");
            newVersionConfig.buildIndex = packageIndex;
            AssetDatabase.CreateAsset(newVersionConfig, newVersionConfigPath);
            EditorUtility.SetDirty(newVersionConfig);
            SetIconAndSplashImage(versionName);
            PlayerSettings.companyName = "TheSecondWorld";
            PlayerSettings.productName = newVersionConfig.productName;
            PlayerSettings.applicationIdentifier = newVersionConfig.bundleIdentifier;
            PlayerSettings.defaultInterfaceOrientation = UIOrientation.AutoRotation;
            PlayerSettings.allowedAutorotateToLandscapeLeft = true;
            PlayerSettings.allowedAutorotateToLandscapeRight = true;
            PlayerSettings.allowedAutorotateToPortrait = false;
            PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
            PlayerSettings.bundleVersion = newVersionConfig.version;
        }
        catch (Exception ex)
        {
            Debug.Log(ex);
        }
        finally
        {
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        VersionConfig.Copy(fromVersionConfig, newVersionConfig);
        newVersionConfig.buildTime = DateTime.Now.ToString("yy/MM/dd--HH:mm");
        newVersionConfig.buildIndex = packageIndex;
        AssetDatabase.CreateAsset(newVersionConfig, newVersionConfigPath);
        EditorUtility.SetDirty(newVersionConfig);
        SetIconAndSplashImage(versionName);
        PlayerSettings.companyName = "TheSecondWorld";
        PlayerSettings.productName = newVersionConfig.productName;
        PlayerSettings.applicationIdentifier = newVersionConfig.bundleIdentifier;
        PlayerSettings.defaultInterfaceOrientation = UIOrientation.AutoRotation;
        PlayerSettings.allowedAutorotateToLandscapeLeft = true;
        PlayerSettings.allowedAutorotateToLandscapeRight = true;
        PlayerSettings.allowedAutorotateToPortrait = false;
        PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
        PlayerSettings.bundleVersion = newVersionConfig.version;
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
    static VersionConfig GetVersionConfig(string _publisher, out string _versionName)