Пример #1
0
        private void SaveAssets(BuildConfig buildConfig, BuildTargetGroup targetGroup)
        {
#if UNITY_ANDROID
            BuildTool.SetupAchitecture(buildConfig);
#endif
            AssetDatabase.SaveAssets();
        }
Пример #2
0
        private void BuildIosTab()
        {
            EditorGUILayout.LabelField("Basic ", EditorStyles.boldLabel);

            EditorGUILayout.PropertyField(serializedObject.FindProperty("iOsIl2CppForRelease"), new GUIContent("Il2CPP Release Build"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("developOptions"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("productionOptions"));

            GUILayout.Space(20);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("iOSTargetDevice"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("iOSSdkVersion"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("iOSTargetOSVersion"));

            var iconKey          = "iOSIcon";
            var splashBackground = "iOsSplashBackground";
            var splashLogo       = "iOsSplashLogo";

            DrawIconSetup(iconKey, splashBackground, splashLogo);

            if (GUILayout.Button("Save"))
            {
                SaveAssets(buildConfig, BuildTargetGroup.iOS);
            }

            GUILayout.Space(20);
            EditorGUILayout.LabelField("Build", EditorStyles.boldLabel);
            this.BeginHorizontal(() => {
                if (GUILayout.Button("Build Dev") && CheckBeforeBuildIos())
                {
                    BuildTool.BuildIos(buildConfig, new BuildConfig.Options {
                        isDevelop = true, autoOpen = true
                    });
                }

                if (GUILayout.Button("Build Release") && CheckBeforeBuildIos())
                {
                    EditorUtility.RevealInFinder(BuildTool.BuildIos(buildConfig, BuildConfig.DefaultOpenOptions));
                }
            });

            GUILayout.Space(20);
            EditorGUILayout.LabelField("Open Folder", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Open Build Folder"))
            {
                OpenBuildFolder();
            }


            EditorGUILayout.EndHorizontal();
        }
Пример #3
0
        private void OnEnable()
        {
            buildConfig      = BuildTool.LoadOrCreateBuildConfig();
            serializedObject = new SerializedObject(buildConfig);
            currentTab       = EditorPrefs.GetInt(keyGemmobBuildToolTab, currentTab);
            reorderableList  = new ReorderableList(serializedObject, serializedObject.FindProperty("scriptingDefines"), true, true, true, true)
            {
                drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Scripting Define Environment"); }
            };
            reorderableList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
                var element = reorderableList.serializedProperty.GetArrayElementAtIndex(index);
                rect.y += 2;

                var labelWidth    = 50;
                var checkboxWidth = 18;
                var targetWidth   = 70;
                var oldWidth      = rect.x;
                EditorGUI.PropertyField(new Rect(oldWidth, rect.y, checkboxWidth + labelWidth, EditorGUIUtility.singleLineHeight),
                                        element.FindPropertyRelative("develop"), GUIContent.none);
                oldWidth += checkboxWidth;

                EditorGUI.LabelField(
                    new Rect(oldWidth, rect.y, labelWidth, EditorGUIUtility.singleLineHeight)
                    ,
                    "develop");
                oldWidth += labelWidth;

                EditorGUI.PropertyField(new Rect(oldWidth, rect.y, checkboxWidth + labelWidth, EditorGUIUtility.singleLineHeight),
                                        element.FindPropertyRelative("release"), GUIContent.none);
                oldWidth += checkboxWidth;

                EditorGUI.LabelField(new Rect(oldWidth, rect.y, labelWidth, EditorGUIUtility.singleLineHeight), "release");
                oldWidth += labelWidth;

                var targetProperty = element.FindPropertyRelative("target");
                targetProperty.intValue = (int)(BuildConfig.CustomBuildTarget)EditorGUI.EnumFlagsField(
                    new Rect(oldWidth, rect.y, targetWidth, EditorGUIUtility.singleLineHeight),
                    (BuildConfig.CustomBuildTarget)targetProperty.intValue);
                oldWidth += 80;


                EditorGUI.PropertyField(new Rect(oldWidth + 10, rect.y, rect.width - oldWidth - 10, EditorGUIUtility.singleLineHeight),
                                        element.FindPropertyRelative("key"), GUIContent.none);
                oldWidth += checkboxWidth;
            };
        }
Пример #4
0
        private void PrintDefines(BuildConfig.CustomBuildTarget buildTarget, bool isDevelop)
        {
            EditorGUILayout.BeginVertical("Box");
            var label = buildTarget + (isDevelop ? " [Develop]" : " [Release]");

            EditorGUILayout.LabelField(label + (isDevelop == Build.IsDebug ? " [CURRENT]" : ""));
            var buildDefines =
                BuildTool.GetBuildDefines(isDevelop, buildTarget, buildConfig, ScriptingDefine.GetBuildTargetGroup());

            if (buildDefines != null)
            {
                using (new EditorGUI.DisabledGroupScope(true)) {
                    foreach (var buildDefine in buildDefines)
                    {
                        EditorGUILayout.LabelField(buildDefine);
                    }
                }
            }

            EditorGUILayout.EndVertical();
        }
Пример #5
0
        private void ModuleConfigTab()
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("enableIap"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("enableAds"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("enableFirebase"));
            EditorGUILayout.Separator();
            reorderableList.DoLayoutList();

            if (GUILayout.Button("Save"))
            {
                BuildTool.ValidModuleScriptingDefine(Build.IsDebug,
                                                     BuildTool.GetFromUnityBuildTarget(ScriptingDefine.GetBuildTargetGroup()), buildConfig,
                                                     ScriptingDefine.GetBuildTargetGroup());
            }

            GUILayout.Space(20);
            this.BeginScrollView(ref configScrollPos, () => {
                currentTargetGroupTab = GUILayout.Toolbar(currentTargetGroupTab, targetGroupLabels);
                switch (currentTargetGroupTab)
                {
                case 0:
                    EditorGUILayout.BeginHorizontal();
                    PrintDefines(BuildConfig.CustomBuildTarget.Android, true);
                    PrintDefines(BuildConfig.CustomBuildTarget.Android, false);
                    EditorGUILayout.EndHorizontal();
                    break;

                case 1:
                    EditorGUILayout.BeginHorizontal();
                    PrintDefines(BuildConfig.CustomBuildTarget.iOS, true);
                    PrintDefines(BuildConfig.CustomBuildTarget.iOS, false);
                    EditorGUILayout.EndHorizontal();
                    break;
                }
            });

            serializedObject.ApplyModifiedProperties();
        }
Пример #6
0
 private static void OpenBuildFolder()
 {
     EditorUtility.RevealInFinder(BuildTool.GetBuildFolder());
 }
Пример #7
0
        private void BuildAndroidTab()
        {
            EditorGUILayout.LabelField("Compression ", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("developOptions"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("productionOptions"));

            GUILayout.Space(20);
            EditorGUILayout.LabelField("AAB Config ", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("AndroidIl2CppForRelease"), new GUIContent("Il2CPP Release Build"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("achitecture"), new GUIContent("Build Achitecture"));

            GUILayout.Space(20);
            this.BeginHorizontal(() => {
                this.BeginVertical(() => {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("BuildVersion"), new GUIContent("Build Version (a.b.c)"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("BuildVerCode"), new GUIContent("Build Vercode (abc)"));
                });

                this.BeginVertical(() => {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("KeyStorePass"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("keyAliasName"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("keyAliasPass"));
                });
            });

            GUILayout.Space(20);
            var iconKey          = "androidIcon";
            var splashBackground = "androidSplashBackground";
            var splashLogo       = "androidSplashLogo";

            DrawIconSetup(iconKey, splashBackground, splashLogo);

            if (GUILayout.Button("Save"))
            {
                SaveAssets(buildConfig, BuildTargetGroup.Android);
            }

            GUILayout.Space(20);
            EditorGUILayout.LabelField("Build", EditorStyles.boldLabel);
            this.BeginHorizontal(() => {
                if (GUILayout.Button("Build Dev APK v7"))
                {
                    BuildTool.BuildAndroidDevAPK();
                    OpenBuildFolder();
                }

                if (GUILayout.Button("Build Dev AAB"))
                {
                    BuildTool.BuildAndroidDevAAB();
                    OpenBuildFolder();
                }

                if (GUILayout.Button("Build Release (aab)"))
                {
                    BuildTool.BuildAndroidRelease();
                    OpenBuildFolder();
                }
            });

            GUILayout.Space(20);
            EditorGUILayout.LabelField("Open Folder", EditorStyles.boldLabel);
            this.BeginHorizontal(() => {
                if (GUILayout.Button("Open Build Folder"))
                {
                    OpenBuildFolder();
                }

                if (GUILayout.Button("Generate KeyStore") && BuildTool.CheckKeyStore(buildConfig))
                {
                    ShowNotification(
                        new GUIContent(string.Format("Key đã được tạo {0}", BuildTool.GetKeyStorePath())));
                }

                if (GUILayout.Button("Open KeyStore"))
                {
                    EditorUtility.RevealInFinder(BuildTool.GetKeyStorePath());
                }
            });
        }