Exemplo n.º 1
0
        /// <summary>
        /// 修改AndroidManifest.xml,可通用
        /// </summary>
        private static void ReplaceAndroidManifestPushInfo(BuildPlatformConfig config, string platformName, AppGameConfig gameCfg)
        {
            return;

            string tempContent = string.Empty;
            string filePath    = Application.dataPath + config.pluginPath.Replace("Assets", "") + "AndroidManifest.xml";

            if (!File.Exists(filePath))
            {
                return;
            }

            string            packConfigPath = string.Format(Directory.GetParent(UnityEngine.Application.dataPath) + "/PlatformData/{0}/android/default.pack", platformName);
            string            packCfgJson    = File.ReadAllText(packConfigPath);
            AndroidPackConfig packCfg        = AndroidPackConfig.FromJson(packCfgJson);

            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                using (StreamReader sr = new StreamReader(fs))
                {
                    tempContent = sr.ReadToEnd();
                    tempContent = tempContent.Replace("__your_package_name", packCfg.PackageName);
                }
            }

            using (StreamWriter sw = new StreamWriter(filePath))
            {
                sw.Write(tempContent);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置打包时unity的所有参数
        /// </summary>
        private static void SetAndroidAppBuildSetting(BuildPlatformConfig config, string appSavePath, string platformName, string packMode, AppGameConfig gameCfg, bool isSplashEnabled, AppResSize resSize)
        {
            gameCfg.ResetAppVersion();
            switch (resSize)
            {
            case AppResSize.Mini:
                gameCfg.DownloadPriority = 9800;
                break;

            case AppResSize.Mini_1:
                gameCfg.DownloadPriority = 9800;
                break;

            case AppResSize.Mini_2:
                gameCfg.DownloadPriority = 9000;
                break;

            case AppResSize.Mini_3:
                gameCfg.DownloadPriority = 7400;
                break;

            case AppResSize.Normal:
                gameCfg.DownloadPriority = 1000;
                break;

            default:
                break;
            }

            // load pack config
            string            packConfigPath = string.Format(Directory.GetParent(UnityEngine.Application.dataPath) + "/PlatformData/{0}/android/default.pack", platformName);
            string            packCfgJson    = File.ReadAllText(packConfigPath);
            AndroidPackConfig packCfg        = AndroidPackConfig.FromJson(packCfgJson);

            //设置安卓icon,动画
            SetAndroidSpalshIcon(platformName, gameCfg);
            AssetDatabase.Refresh();

            // save game config  永恒不save,全部由表自己控制
            //File.WriteAllText(configGame_gameFull, gameCfg.ToJson());
            //AssetDatabase.Refresh();

            // build app
            SetAndroidBuildSetting(packCfg, gameCfg, packMode);
            AssetDatabase.Refresh();

            Debug.LogWarning("Set AndroidApp BuildSetting success!");
        }