コード例 #1
0
ファイル: AssetBuilderWin.cs プロジェクト: qb-lxl/SDKDemo
        public void OnGUI()
        {
            GUILayout.Label("Setting", EditorStyles.boldLabel);
            mBuildPlatform = (BuildPlatform)EditorGUILayout.EnumPopup("  Build Platform: ", mBuildPlatform);
            mAppPlatform   = (AppPlatform)EditorGUILayout.EnumPopup("   App Platform: ", mAppPlatform);
            mAppResSource  = (AppResSource)EditorGUILayout.EnumPopup("   Res Source: ", mAppResSource);
            mAppPackMode   = (AppPackMode)EditorGUILayout.EnumPopup("   Pack Mode: ", mAppPackMode);
            mAppResSize    = (AppResSize)EditorGUILayout.EnumPopup("   Res Size: ", mAppResSize);

#if UNITY_EDITOR_OSX
            mAddGarbageCode = (AddGarbageCode)EditorGUILayout.EnumPopup("   Add Garbage Code: ", mAddGarbageCode);
#endif
            GUIStyle gs = GUI.skin.button;
            gs.alignment = TextAnchor.MiddleLeft;

            //GUILayout.Label("神话专用++++++++++++++++++++++++++++", EditorStyles.largeLabel);
            //if (GUILayout.Button("1 SLua Generate All (生成SLua代码)", gs))
            //{
            //    EditorApplication.delayCall += SLuaGenerateAll;
            //}
            //if (GUILayout.Button("2 Generate AssetBundle(Build 所有资源AB)", gs))
            //{
            //    EditorApplication.delayCall += BuildAssetBundles;
            //}
            //if (GUILayout.Button("3 Build App All (Build 手机包)", gs))
            //{
            //    EditorApplication.delayCall += BuildApp;
            //}

            //if (GUILayout.Button("Generate Script", gs))
            //{
            //    EditorApplication.delayCall += BuildScript;
            //}
            //if (GUILayout.Button("Build App Only", gs))
            //{
            //    EditorApplication.delayCall += BuildAppOnly;
            //}

            //if (GUILayout.Button("Generate AssetBundle and Build App All  (一键打包)", gs))
            //{
            //    EditorApplication.delayCall += GenerateAssetBundleandBuildAppAll;
            //}

            GUILayout.Label("永恒++++++++++++++++++++++++++++", EditorStyles.largeLabel);
            if (GUILayout.Button("导入sdk", gs))
            {
                EditorApplication.delayCall += SetApp;
            }
            if (GUILayout.Button("清空sdk", gs))
            {
                EditorApplication.delayCall += ClearSDK;
            }


            //if (GUILayout.Button("Create Icons"))
            //{
            //    string texPath = "E:\\xx\\icon.png";
            //    AssetBuilderCtrl.CreateIcons(texPath);
            //}
        }
コード例 #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!");
        }
コード例 #3
0
        /// <summary>
        /// 设置安卓app的参数  外部调用
        /// </summary>
        public static void SetAndroidApp(BuildPlatformConfig config, string bundlePath, string appSavePath, string platformName, string packMode, AppResSize resSize = AppResSize.Normal, bool isSplashEnabled = true)
        {
            string gameConfigPath = string.Format(Directory.GetParent(UnityEngine.Application.dataPath) + "/PlatformData/{0}/android/config.game", platformName);

            string        json    = File.ReadAllText(gameConfigPath);
            AppGameConfig gameCfg = AppGameConfig.FromJson(json);

            if (Directory.Exists(SDKStreamingAssetsFull))
            {
                AssetBuilderCtrl.CleanDirectory(SDKStreamingAssetsFull);
            }
            else
            {
                Directory.CreateDirectory(SDKStreamingAssetsFull);
            }

            File.Copy(gameConfigPath, configGame_gameFull);
            AssetDatabase.Refresh();

            CopyAndroidPlugins(config, platformName, packMode);
            ReplaceAndroidManifestPushInfo(config, platformName, gameCfg);

            CopyAndroidAssets(config, platformName, packMode);

            SetAndroidAppBuildSetting(config, appSavePath, platformName, packMode, gameCfg, isSplashEnabled, resSize);
        }