private void DrawIOSInfoPlistItemsRequiredSection(Module module, Action priorDrawAct = null, Action afterDrawAct = null)
        {
            var modulePlistItems = EM_PluginManager.GetIOSInfoItemsRequiredByModule(module);

            if (modulePlistItems == null || modulePlistItems.Count < 1)
            {
                return;
            }

            DrawUppercaseSection("IOS_USAGE_DESCRIPTIONS_EDITABLE_" + module, "REQUIRED IOS INFO.PLIST KEYS", () =>
            {
                if (priorDrawAct != null)
                {
                    priorDrawAct();
                }

                foreach (var item in modulePlistItems)
                {
                    DrawEditableIOSInfoPlistItem(item);
                }

                if (afterDrawAct != null)
                {
                    afterDrawAct();
                }
            });
        }
Beispiel #2
0
        private void DrawBuildSectionGUI()
        {
            GUILayout.Space(20);

            // Android Permissions GUI.
            DrawUppercaseSection(AndroidPermissionGUIKey, "REQUIRED ANDROID PERMISSIONS", () =>
            {
                EditorGUILayout.HelpBox(AndroidPermissionsIntroMsg, MessageType.Info);

                foreach (var pair in EM_PluginManager.GetAllAndroidPermissionsRequired())
                {
                    DrawAndroidPermissionForModule(pair.Key, pair.Value);
                }
            });

            EditorGUILayout.Space();

            // iOS Usage Descriptions GUI.
            DrawUppercaseSection(IOSUsageDescriptionGUIKey, "REQUIRED IOS INFO.PLIST KEYS", () =>
            {
                EditorGUILayout.HelpBox(iOSInfoPlistKeysIntroMsg, MessageType.Info);

                foreach (var pair in EM_PluginManager.GetAllIOSInfoItemsRequired())
                {
                    DrawReadonlyIOSInfoPlistItemsRequiredForModule(pair.Key, pair.Value);
                }
            });
        }
        private void DrawAndroidPermissionsRequiredSection(Module module, Action priorDrawAct = null, Action afterDrawAct = null)
        {
            var modulePermissions = EM_PluginManager.GetAndroidPermissionsRequiredByModule(module);

            if (modulePermissions == null || modulePermissions.Count < 1)
            {
                return;
            }

            DrawUppercaseSection("ANDROID_PERMISSIONS_MODULE_" + module, "REQUIRED ANDROID PERMISSIONS", () =>
            {
                if (priorDrawAct != null)
                {
                    priorDrawAct();
                }

                foreach (var permission in modulePermissions)
                {
                    DrawAndroidPermission(permission.ElementName, permission.Value);
                }

                if (afterDrawAct != null)
                {
                    afterDrawAct();
                }
            });
        }
        private void DrawBuildSectionGUI()
        {
            GUILayout.Space(20);

            // Auto initialization setting
            DrawUppercaseSection(AndroidPermissionGUIKey, "RUNTIME MANAGER", () =>
            {
                string msg = AutoInitializationOnMsg;
                if (!autoInitializationProperty.boolValue)
                {
                    msg = AutoInitializationOffMsg;
                }
                EditorGUILayout.HelpBox(msg, MessageType.Info);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Auto Runtime Initialization", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(autoInitializationProperty, new GUIContent("Auto Initialization"));
            });
            EditorGUILayout.Space();

            // Android Permissions GUI.
            DrawUppercaseSection(AndroidPermissionGUIKey, "REQUIRED ANDROID PERMISSIONS", () =>
            {
                EditorGUILayout.HelpBox(AndroidPermissionsIntroMsg, MessageType.Info);

                foreach (var pair in EM_PluginManager.GetAllAndroidPermissionsRequired())
                {
                    DrawAndroidPermissionForModule(pair.Key, pair.Value);
                }
            });

            EditorGUILayout.Space();

            // iOS Usage Descriptions GUI.
            DrawUppercaseSection(IOSUsageDescriptionGUIKey, "REQUIRED IOS INFO.PLIST KEYS", () =>
            {
                EditorGUILayout.HelpBox(iOSInfoPlistKeysIntroMsg, MessageType.Info);

                foreach (var pair in EM_PluginManager.GetAllIOSInfoItemsRequired())
                {
                    DrawReadonlyIOSInfoPlistItemsRequiredForModule(pair.Key, pair.Value);
                }
            });
        }
        internal static List <string> GetAndroidManifestTemplatePathsForModule(Module mod)
        {
            var paths   = new List <string>();
            var manager = EM_PluginManager.GetModuleManager(mod);

            if (manager == null)
            {
                return(paths);
            }

            // Is this composite module?
            var compManager = manager as CompositeModuleManager;

            if (compManager != null)    // Is a composite module
            {
                foreach (Submodule submod in compManager.SelfSubmodules)
                {
                    if (EM_Settings.IsSubmoduleEnable(submod))
                    {
                        var submodPaths = compManager.AndroidManifestTemplatePathsForSubmodule(submod);
                        if (submodPaths != null && submodPaths.Count > 0)
                        {
                            paths.AddRange(submodPaths);
                        }
                    }
                }
            }
            else    // Is a normal module
            {
                if (EM_Settings.IsModuleEnable(mod))
                {
                    paths = manager.AndroidManifestTemplatePaths;
                }
            }

            return(paths);
        }
Beispiel #6
0
 public static void MenuInstallPlayMakerActions()
 {
     EM_PluginManager.InstallPlayMakerActions(true);
 }
Beispiel #7
0
 public static void MenuReimportNativePackage()
 {
     EM_PluginManager.ImportPlayServicesResolver(true);
 }
Beispiel #8
0
 public static void MenuCreateMainPrefab()
 {
     EM_BuiltinObjectCreator.CreateEasyMobilePrefab(true);
     EM_PluginManager.CheckModules();
 }
Beispiel #9
0
        void IAPModuleGUI()
        {
            EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box"));

            EditorGUI.BeginChangeCheck();
            isIAPModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isIAPModuleEnable.boolValue, IAPModuleLabel);
            if (EditorGUI.EndChangeCheck())
            {
                GameObject prefab = EM_EditorUtil.GetMainPrefab();

                if (!isIAPModuleEnable.boolValue)
                {
                    EM_PluginManager.DisableIAPModule(prefab);
                }
                else
                {
                    EM_PluginManager.EnableIAPModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isIAPModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(IAPModuleIntro, MessageType.Info);
            }
            else
            {
                #if !EM_UIAP
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(UnityIAPEnableInstruction, MessageType.Error);
                #else
                // Select target Android store, like using the Window > Unity IAP > Android > Target ... menu item.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("[ANDROID] TARGET STORE", EditorStyles.boldLabel);

                EditorGUI.BeginChangeCheck();
                IAPProperties.targetAndroidStore.property.enumValueIndex = EditorGUILayout.Popup(
                    IAPProperties.targetAndroidStore.content.text,
                    IAPProperties.targetAndroidStore.property.enumValueIndex,
                    IAPProperties.targetAndroidStore.property.enumDisplayNames
                    );
                if (EditorGUI.EndChangeCheck())
                {
                    SetTargetAndroidStore((IAPAndroidStore)IAPProperties.targetAndroidStore.property.enumValueIndex);
                }

                // Receipt validation
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("RECEIPT VALIDATION", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("Unity IAP offers local receipt validation for extra security. Apple stores and Google Play store only.", MessageType.None);

                // iOS store.
                EditorGUI.BeginDisabledGroup(!isAppleTangleValid);
                IAPProperties.validateAppleReceipt.property.boolValue = EditorGUILayout.Toggle(IAPProperties.validateAppleReceipt.content, IAPProperties.validateAppleReceipt.property.boolValue);
                EditorGUI.EndDisabledGroup();

                // Always disable the option if AppleTangle is not valid.
                if (!isAppleTangleValid)
                {
                    IAPProperties.validateAppleReceipt.property.boolValue = false;
                }

                // Google Play store.
                bool isTargetingGooglePlay = IAPProperties.targetAndroidStore.property.enumValueIndex == (int)IAPAndroidStore.GooglePlay;
                EditorGUI.BeginDisabledGroup(!isGooglePlayTangleValid);
                IAPProperties.validateGooglePlayReceipt.property.boolValue = EditorGUILayout.Toggle(IAPProperties.validateGooglePlayReceipt.content, IAPProperties.validateGooglePlayReceipt.property.boolValue);
                EditorGUI.EndDisabledGroup();

                // Always disable the option if GooglePlayTangle is not valid.
                if (!isGooglePlayTangleValid)
                {
                    IAPProperties.validateGooglePlayReceipt.property.boolValue = false;
                }

                if (!isAppleTangleValid || (!isGooglePlayTangleValid && isTargetingGooglePlay))
                {
                    string rvMsg = "Please go to Window > Unity IAP > IAP Receipt Validation Obfuscator and create obfuscated secrets to enable receipt validation for Apple stores and Google Play store.";

                    if (!isAppleTangleValid)
                    {
                        rvMsg += " Note that you don't need to provide a Google Play public key if you're only targeting Apple stores.";
                    }
                    else
                    {
                        rvMsg = rvMsg.Replace("Apple stores and ", "");
                    }

                    if (isGooglePlayTangleValid || !isTargetingGooglePlay)
                    {
                        rvMsg = rvMsg.Replace(" and Google Play store", "");
                    }

                    EditorGUILayout.HelpBox(rvMsg, MessageType.Warning);
                }

                // Product list
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("PRODUCTS", EditorStyles.boldLabel);

                EMProperty products = IAPProperties.products;

                if (products.property.arraySize > 0)
                {
                    EditorGUI.indentLevel++;
                    isIAPProductsFoldout = EditorGUILayout.Foldout(isIAPProductsFoldout, products.property.arraySize + " " + products.content.text);
                    EditorGUI.indentLevel--;

                    if (isIAPProductsFoldout)
                    {
                        // Draw the array of IAP products.
                        DrawArrayProperty(products.property, DrawIAPProduct);

                        // Detect duplicate product names.
                        string duplicateName = EM_EditorUtil.FindDuplicateFieldInArrayProperty(products.property, IAPProduct_NameProperty);
                        if (!string.IsNullOrEmpty(duplicateName))
                        {
                            EditorGUILayout.Space();
                            EditorGUILayout.HelpBox("Found duplicate name of \"" + duplicateName + "\".", MessageType.Warning);
                        }
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No products added.", MessageType.None);
                }

                EditorGUILayout.Space();
                if (GUILayout.Button("Add New Product", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    // Add new IAP product.
                    AddNewProduct(products.property);

                    // Open the foldout if it's closed.
                    isIAPProductsFoldout = true;
                }

                // Constant generation.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(IAPConstantGenerationIntro, MessageType.None);

                EditorGUILayout.Space();
                if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    GenerateIAPConstants();
                }
                #endif
            }

            EditorGUILayout.EndVertical();
        }
Beispiel #10
0
        void NotificationModuleGUI()
        {
            EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box"));

            EditorGUI.BeginChangeCheck();
            isNotificationModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isNotificationModuleEnable.boolValue, NotificationModuleLabel);
            if (EditorGUI.EndChangeCheck())
            {
                // Update the main prefab according to the toggle state.
                GameObject prefab = EM_EditorUtil.GetMainPrefab();

                if (!isNotificationModuleEnable.boolValue)
                {
                    EM_PluginManager.DisableNotificationModule(prefab);
                }
                else
                {
                    EM_PluginManager.EnableNotificationModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isNotificationModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(NotificationModuleIntro, MessageType.Info);
            }
            else
            {
                // Initialization setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel);
                NotificationProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(NotificationProperties.autoInit.content, NotificationProperties.autoInit.property.boolValue);

                // Auto init delay
                EditorGUI.BeginDisabledGroup(!NotificationProperties.autoInit.property.boolValue);
                NotificationProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(NotificationProperties.autoInitDelay.content, NotificationProperties.autoInitDelay.property.floatValue);
                EditorGUI.EndDisabledGroup();

                // Init tip
                if (!NotificationProperties.autoInit.property.boolValue)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(NotificationManualInitInstruction, MessageType.Info);
                }

                //--------------------------------------------------------------
                // Uncomment to expose the iOSAuthOptions setting.
                //--------------------------------------------------------------

                /*
                 * // iOS authorization options
                 * EditorGUILayout.PropertyField(NotificationProperties.iosAuthOptions.property, NotificationProperties.iosAuthOptions.content);
                 */

                // Remote notification setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("REMOTE NOTIFICATION SETUP", EditorStyles.boldLabel);

                // Push Notification Service
                EditorGUILayout.PropertyField(NotificationProperties.pushNotificationService.property, NotificationProperties.pushNotificationService.content);

                // If using OneSignal...
                if (NotificationProperties.pushNotificationService.property.enumValueIndex == (int)PushNotificationProvider.OneSignal)
                {
                    #if !EM_ONESIGNAL
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(OneSignalImportInstruction, MessageType.Error);
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadOneSignalPlugin();
                    }
                    #else
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(OneSignalAvailMsg, MessageType.Info);
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadOneSignalPlugin();
                    }

                    // OneSignal setup
                    EditorGUILayout.Space();
                    NotificationProperties.oneSignalAppId.property.stringValue = EditorGUILayout.TextField(NotificationProperties.oneSignalAppId.content, NotificationProperties.oneSignalAppId.property.stringValue);
                    #endif
                }

                // Android Resources Setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("ANDROID NOTIFICATION RESOURCES", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(NotificationAndroidResourcesIntro, MessageType.None);
                EditorGUILayout.Space();

                if (GUILayout.Button("Open Android Notification Icon Generator", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    Application.OpenURL(NotificationAndroidIconGeneratorUrl);
                }

                if (GUILayout.Button("Import Res Folder", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EditorApplication.delayCall += ImportAndroidNotificationResFolder;
                }

                // Category groups
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CATEGORY GROUPS", EditorStyles.boldLabel);
                DrawNotificationCategoryGroupsArray(NotificationProperties.categoryGroups, ref notificationIsCategoryGroupsFoldout);

                // Update the list of category group IDs.
                notificationCatGroupIDs = BuildListOfNotificationCategoryGroupIDs();

                // Categories
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CATEGORIES", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(NotificationCategoryIntro, MessageType.Info);

                // Draw the default category
                EditorGUILayout.LabelField("Default Category", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(NotificationDefaultCategoryIntro, MessageType.None);
                DrawNotificationCategory(NotificationProperties.defaultCategory.property);

                if (string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.name) ||
                    string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.id))
                {
                    EditorGUILayout.HelpBox("Default category must have non-empty name and ID.", MessageType.Warning);
                }
                else
                {
                    foreach (var category in EM_Settings.Notifications.UserCategories)
                    {
                        if (!string.IsNullOrEmpty(category.id) && category.id.Equals(EM_Settings.Notifications.DefaultCategory.id))
                        {
                            EditorGUILayout.HelpBox("Default category cannot share the same ID " + category.id + " with another user category.", MessageType.Warning);
                            break;
                        }
                    }
                }

                // Draw user categories
                EditorGUILayout.LabelField("User Categories", EditorStyles.boldLabel);
                DrawNotificationCategoriesArray(NotificationProperties.userCategories, ref notificationIsUserCategoriesFoldout);

                // Constant generation.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(NotificationConstantGenerationIntro, MessageType.None);

                EditorGUILayout.Space();
                if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    GenerateNotificationConstants();
                }
            }

            EditorGUILayout.EndVertical();
        }
        void GameServiceModuleGUI()
        {
            EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box"));

            EditorGUI.BeginChangeCheck();

            isGameServiceModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isGameServiceModuleEnable.boolValue, GameServiceModuleLabel);

            // Update the main prefab according to the toggle state.
            if (EditorGUI.EndChangeCheck())
            {
                GameObject prefab = EM_EditorUtil.GetMainPrefab();

                if (!isGameServiceModuleEnable.boolValue)
                {
                    EM_PluginManager.DisableGameServiceModule(prefab);
                }
                else
                {
                    EM_PluginManager.EnableGameServiceModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isGameServiceModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(GameServiceModuleIntro, MessageType.Info);
            }
            else
            {
                #if UNITY_ANDROID && !EM_GPGS
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(AndroidGPGSImportInstruction, MessageType.Error);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin();
                }
                #elif UNITY_ANDROID && EM_GPGS
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(AndroidGPGSAvailMsg, MessageType.Info);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin();
                }

                // Android Google Play Games setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("GOOGLE PLAY GAMES SETUP", EditorStyles.boldLabel);

                // GPGPS debug log
                GameServiceProperties.gpgsDebugLog.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.gpgsDebugLog.content, GameServiceProperties.gpgsDebugLog.property.boolValue);

                // GPGS (optional) Web App Client ID.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Web App Client ID (Optional)", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("The web app client ID is needed to access the user's ID token and call other APIs on behalf of the user. It is not required for Game Services. " +
                                        "Enter your oauth2 client ID below. To obtain this ID, generate a web linked app in Developer Console.\n" +
                                        "Example: 123456789012-abcdefghijklm.apps.googleusercontent.com", MessageType.None);
                sGPGSWebClientId = EditorGUILayout.TextField("Web Client Id", sGPGSWebClientId);

                // Text area to input the Android Xml resource.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(GameServiceProperties.gpgsXmlResources.content, EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(AndroidGPGPSSetupInstruction, MessageType.None);

                // Draw text area inside a scroll view.
                androidResourcesTextAreaScroll = GUILayout.BeginScrollView(androidResourcesTextAreaScroll, false, false, GUILayout.Height(EditorGUIUtility.singleLineHeight * 10));
                GameServiceProperties.gpgsXmlResources.property.stringValue = EditorGUILayout.TextArea(
                    GameServiceProperties.gpgsXmlResources.property.stringValue,
                    GUILayout.Height(EditorGUIUtility.singleLineHeight * 100),
                    GUILayout.ExpandHeight(true));
                EditorGUILayout.EndScrollView();

                EditorGUILayout.Space();

                // Replicate the "Setup" button within the Android GPGS setup window.
                if (GUILayout.Button("Setup Google Play Games", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EditorApplication.delayCall += SetupAndroidGPGSButtonHandler;
                }
                #endif

                #if !UNITY_ANDROID || (UNITY_ANDROID && EM_GPGS)
                // Auto-init config
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("AUTO-INIT CONFIG", EditorStyles.boldLabel);
                GameServiceProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.autoInit.content, GameServiceProperties.autoInit.property.boolValue);

                EditorGUI.BeginDisabledGroup(!GameServiceProperties.autoInit.property.boolValue);
                GameServiceProperties.autoInitDelay.property.floatValue = EditorGUILayout.FloatField(GameServiceProperties.autoInitDelay.content, GameServiceProperties.autoInitDelay.property.floatValue);
                EditorGUI.EndDisabledGroup();

                GameServiceProperties.androidMaxLoginRequest.property.intValue = EditorGUILayout.IntField(GameServiceProperties.androidMaxLoginRequest.content, GameServiceProperties.androidMaxLoginRequest.property.intValue);
                if (!GameServiceProperties.autoInit.property.boolValue)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(GameServiceManualInitInstruction, MessageType.Info);
                }

                // Saved Games config.
                #if EASY_MOBILE_PRO
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("SAVED GAMES CONFIG", EditorStyles.boldLabel);
                GameServiceProperties.enableSavedGames.property.boolValue = EditorGUILayout.Toggle(GameServiceProperties.enableSavedGames.content, GameServiceProperties.enableSavedGames.property.boolValue);

                if (GameServiceProperties.enableSavedGames.property.boolValue)
                {
                    EditorGUILayout.PropertyField(GameServiceProperties.autoConflictResolutionStrategy.property,
                                                  GameServiceProperties.autoConflictResolutionStrategy.content);

                    EditorGUILayout.PropertyField(GameServiceProperties.gpgsDataSource.property,
                                                  GameServiceProperties.gpgsDataSource.content);
                }
                #endif

                // Leaderboard setup.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("LEADERBOARD SETUP", EditorStyles.boldLabel);
                DrawGameServiceItemArray("Leaderboard", GameServiceProperties.leaderboards, ref isLeadeboardsFoldout);

                // Achievement setup.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("ACHIEVEMENT SETUP", EditorStyles.boldLabel);
                DrawGameServiceItemArray("Achievement", GameServiceProperties.achievements, ref isAchievementsFoldout);

                // Constant generation.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CONSTANTS GENERATION", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(GameServiceConstantGenerationIntro, MessageType.None);

                EditorGUILayout.Space();
                if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    GenerateGameServiceConstants();
                }
                #endif
            }

            EditorGUILayout.EndVertical();
        }
Beispiel #12
0
        void AdModuleGUI()
        {
            EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box"));

            EditorGUI.BeginChangeCheck();
            isAdModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isAdModuleEnable.boolValue, AdModuleLabel);
            if (EditorGUI.EndChangeCheck())
            {
                GameObject prefab = EM_EditorUtil.GetMainPrefab();

                if (!isAdModuleEnable.boolValue)
                {
                    EM_PluginManager.DisableAdModule(prefab);
                }
                else
                {
                    EM_PluginManager.EnableAdModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isAdModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(AdModuleIntro, MessageType.Info);
            }
            else
            {
                // AdColony setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("ADCOLONY SETUP", EditorStyles.boldLabel);

                #if !EM_ADCOLONY
                EditorGUILayout.HelpBox(AdColonyImportInstruction, MessageType.Warning);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadAdColonyPlugin();
                }
                #else
                EditorGUILayout.HelpBox(AdColonyAvailMsg, MessageType.Info);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadAdColonyPlugin();
                }
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("AdColony IDs", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.iosAdColonyConfig.property, AdProperties.iosAdColonyConfig.content, true);
                EditorGUILayout.PropertyField(AdProperties.androidAdColonyConfig.property, AdProperties.androidAdColonyConfig.content, true);
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Ad Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.adColonyShowRewardedAdPrePopup.property, AdProperties.adColonyShowRewardedAdPrePopup.content);
                EditorGUILayout.PropertyField(AdProperties.adColonyShowRewardedAdPostPopup.property, AdProperties.adColonyShowRewardedAdPostPopup.content);
                EditorGUILayout.PropertyField(AdProperties.adColonyAdOrientation.property, AdProperties.adColonyAdOrientation.content);
                #endif

                // AdMob setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("ADMOB SETUP", EditorStyles.boldLabel);

                #if !EM_ADMOB
                EditorGUILayout.HelpBox(AdMobImportInstruction, MessageType.Warning);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin();
                }
                #else
                EditorGUILayout.HelpBox(AdMobAvailMsg, MessageType.Info);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin();
                }

                // IDs.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("AdMob IDs", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.iosAdMobConfig.property, AdProperties.iosAdMobConfig.content, true);
                EditorGUILayout.PropertyField(AdProperties.androidAdMobConfig.property, AdProperties.androidAdMobConfig.content, true);
                EditorGUI.indentLevel--;

                // Ad targeting settings.
                EditorGUILayout.Space();
                DrawAdMobTargetingSettings(AdProperties.admobTargeting.property, AdProperties.admobTargeting.content);

                // Test mode.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Test Mode", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.admobEnableTestMode.property, AdProperties.admobEnableTestMode.content);
                if (AdProperties.admobEnableTestMode.property.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(AdProperties.admobTestDeviceIds.property, AdProperties.admobTestDeviceIds.content, true);
                    EditorGUI.indentLevel--;
                }
                else
                {
                    // Clear test device IDs when test mode is disable for safety.
                    AdProperties.admobTestDeviceIds.property.ClearArray();
                }
                #endif

                // Chartboost setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("CHARTBOOST SETUP", EditorStyles.boldLabel);

                #if !EM_CHARTBOOST
                EditorGUILayout.HelpBox(ChartboostImportInstruction, MessageType.Warning);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadChartboostPlugin();
                }
                #else
                EditorGUILayout.HelpBox(ChartboostAvailMsg, MessageType.Info);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadChartboostPlugin();
                }
                if (GUILayout.Button("Setup Chartboost", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    // Open Chartboost settings window.
                    ChartboostSDK.CBSettings.Edit();
                }
                #endif

                // Heyzap setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("HEYZAP SETUP", EditorStyles.boldLabel);

                #if !EM_HEYZAP
                EditorGUILayout.HelpBox(HeyzapImportInstruction, MessageType.Warning);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadHeyzapPlugin();
                }
                #else
                EditorGUILayout.HelpBox(HeyzapAvailMsg, MessageType.Info);
                EditorGUILayout.Space();
                if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadHeyzapPlugin();
                }
                EditorGUILayout.Space();
                AdProperties.heyzapPublisherId.property.stringValue = EditorGUILayout.TextField(AdProperties.heyzapPublisherId.content, AdProperties.heyzapPublisherId.property.stringValue);
                AdProperties.heyzapShowTestSuite.property.boolValue = EditorGUILayout.Toggle(AdProperties.heyzapShowTestSuite.content, AdProperties.heyzapShowTestSuite.property.boolValue);
                #endif

                // UnityAds setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("UNITY ADS SETUP", EditorStyles.boldLabel);

                #if !UNITY_ADS
                EditorGUILayout.HelpBox(UnityAdsUnvailableWarning, MessageType.Warning);
                #else
                EditorGUILayout.HelpBox(UnityAdsAvailableMsg, MessageType.Info);
                #endif

                // Ads auto-load setup
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("AUTO AD-LOADING CONFIG", EditorStyles.boldLabel);
                AdProperties.autoLoadDefaultAds.property.boolValue  = EditorGUILayout.Toggle(AdProperties.autoLoadDefaultAds.content, AdProperties.autoLoadDefaultAds.property.boolValue);
                AdProperties.adCheckingInterval.property.floatValue = EditorGUILayout.FloatField(AdProperties.adCheckingInterval.content, AdProperties.adCheckingInterval.property.floatValue);
                AdProperties.adLoadingInterval.property.floatValue  = EditorGUILayout.FloatField(AdProperties.adLoadingInterval.content, AdProperties.adLoadingInterval.property.floatValue);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("DEFAULT AD NETWORKS", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.iosDefaultAdNetworks.property, AdProperties.iosDefaultAdNetworks.content, true);
                EditorGUILayout.PropertyField(AdProperties.androidDefaultAdNetworks.property, AdProperties.androidDefaultAdNetworks.content, true);
                EditorGUI.indentLevel--;

                // Now check if there's any default ad network that doesn't have plugin imported and show warnings.
                AdSettings.DefaultAdNetworks iosDefault     = EM_Settings.Advertising.IosDefaultAdNetworks;
                AdSettings.DefaultAdNetworks androidDefault = EM_Settings.Advertising.AndroidDefaultAdNetworks;
                List <AdNetwork>             usedNetworks   = new List <AdNetwork>();
                AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.bannerAdNetwork);
                AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.interstitialAdNetwork);
                AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.rewardedAdNetwork);
                AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.bannerAdNetwork);
                AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.interstitialAdNetwork);
                AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.rewardedAdNetwork);

                bool addedSpace = false;

                foreach (AdNetwork network in usedNetworks)
                {
                    if (!IsPluginAvail(network))
                    {
                        if (!addedSpace)
                        {
                            EditorGUILayout.Space();
                            addedSpace = true;
                        }
                        EditorGUILayout.HelpBox("Default ad network " + network.ToString() + " has no SDK. Please import its plugin.", MessageType.Warning);
                    }
                }
            }

            EditorGUILayout.EndVertical();
        }