internal static void InstallPlayMakerActions(bool interactive)
 {
     if (!EM_ExternalPluginManager.IsPlayMakerAvail())
     {
         if (EM_EditorUtil.DisplayDialog(
                 "Installing PlayMaker Actions",
                 "Looks like you haven't installed PlayMaker, please install it to use these actions. " +
                 "Note that you also need to install the Unity UI add-on for PlayMaker to run Easy Mobile's PlayMaker demo.",
                 "Continue Anyway",
                 "Cancel"))
         {
             DoInstallPlayMakerActions(interactive);
         }
     }
     else
     {
         if (!EM_ExternalPluginManager.IsPlayMakerUguiAddOnAvail())
         {
             if (EM_EditorUtil.DisplayDialog(
                     "Installing PlayMaker Actions",
                     "Looks like you haven't installed the Unity UI add-on for PlayMaker. " +
                     "Please install it if you want to run Easy Mobile's PlayMaker demo.",
                     "Continue Anyway",
                     "Cancel"))
             {
                 DoInstallPlayMakerActions(interactive);
             }
         }
         else
         {
             DoInstallPlayMakerActions(interactive);
         }
     }
 }
        internal static void EnableAdModule(GameObject mainPrefab)
        {
            EM_EditorUtil.AddModuleToPrefab <AdManager>(mainPrefab);

            // Check ad network plugins' availability and define appropriate scripting symbols.
            List <string> symbols      = new List <string>();
            bool          isAdMobAvail = EM_ExternalPluginManager.IsAdMobAvail();

            if (isAdMobAvail)
            {
                symbols.Add(EM_ScriptingSymbols.AdMob);
            }

            bool isChartboostAvail = EM_ExternalPluginManager.IsChartboostAvail();

            if (isChartboostAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Chartboost);
            }

            bool isHeyzapAvail = EM_ExternalPluginManager.IsHeyzapAvail();

            if (isHeyzapAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Heyzap);
            }

            GlobalDefineManager.SDS_AddDefines(symbols.ToArray(), EditorUserBuildSettings.selectedBuildTargetGroup);
        }
Exemple #3
0
        protected override void InternalEnableModule()
        {
            // Check if UnityIAP is enable and act accordingly.
            if (EM_ExternalPluginManager.IsUnityIAPAvail())
            {
                // Generate dummy AppleTangle and GoogleTangle classes if the "real" ones don't exist, to prevent
                // reference errors in InAppPurchasing receipt validation code.
                // If the actual tangles files are already generated, remove all dummy files if they exist.
                // Note that AppleTangle and GooglePlayTangle only get compiled on following platforms,
                // therefore the compilational condition is needed, otherwise the code will repeat forever.
                #if UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_TVOS
                if (!EM_EditorUtil.AppleTangleClassExists() && !EM_EditorUtil.DummyAppleTangleClassExists())
                {
                    EM_EditorUtil.GenerateDummyAppleTangleClass();
                }
                else if (EM_EditorUtil.AppleTangleClassExists())
                {
                    EM_EditorUtil.RemoveDummyAppleTangleClass();
                }

                if (!EM_EditorUtil.GooglePlayTangleClassExists() && !EM_EditorUtil.DummyGooglePlayTangleExists())
                {
                    EM_EditorUtil.GenerateDummyGooglePlayTangleClass();
                }
                else if (EM_EditorUtil.GooglePlayTangleClassExists())
                {
                    EM_EditorUtil.RemoveDummyGooglePlayTangleClass();
                }
                #endif

                GlobalDefineManager.SDS_AddDefineOnAllPlatforms(EM_ScriptingSymbols.UnityIAP);
            }
        }
        internal static void EnableIAPModule(GameObject mainPrefab)
        {
            EM_EditorUtil.AddModuleToPrefab <IAPManager>(mainPrefab);

            // Check if UnityIAP is enable and act accordingly.
            bool isUnityIAPAvail = EM_ExternalPluginManager.IsUnityIAPAvail();

            if (isUnityIAPAvail)
            {
                // Generate dummy AppleTangle and GoogleTangle classes if they don't exist.
                // Note that AppleTangle and GooglePlayTangle only get compiled on following platforms,
                // therefore the compilational condition is needed, otherwise the code will repeat forever.
                #if UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_TVOS
                if (!EM_EditorUtil.AppleTangleClassExists())
                {
                    EM_EditorUtil.GenerateDummyAppleTangleClass();
                }

                if (!EM_EditorUtil.GooglePlayTangleClassExists())
                {
                    EM_EditorUtil.GenerateDummyGooglePlayTangleClass();
                }
                #endif

                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.UnityIAP, EditorUserBuildSettings.selectedBuildTargetGroup);
            }
        }
Exemple #5
0
        public static void InstallPlayMakerActions(bool interactive)
        {
            // First check if the PlayMaker Actions package has been imported.
            if (!FileIO.FileExists(PlayMakerActionsPackagePath))
            {
                if (EM_EditorUtil.DisplayDialog(
                        "PlayMaker Actions Not Found",
                        "Looks like you haven't imported the \"PlayMaker Actions for Easy Mobile Pro\" package. " +
                        "Please download and import it from the Unity Asset Store first.",
                        "Get it now",
                        "Later"))
                {
                    Application.OpenURL(PlayMakerActionsDownloadURL);
                }

                return;
            }

            // Check if PlayMaker itself has been installed.
            if (!EM_ExternalPluginManager.IsPlayMakerAvail())
            {
                if (EM_EditorUtil.DisplayDialog(
                        "Installing PlayMaker Actions",
                        "Looks like you haven't installed PlayMaker, please install it to use these actions.",
                        "Continue Anyway",
                        "Cancel"))
                {
                    DoInstallPlayMakerActions(interactive);
                }
            }
            else
            {
                DoInstallPlayMakerActions(interactive);
            }
        }
        void DrawTapjoySettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("TAPJOY_SETUP_FOLDOUT_KEY", "TAPJOY", () =>
            {
                    #if !EM_TAPJOY
                EditorGUILayout.HelpBox(TapJoyImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download TapJoy Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadTapJoyPlugin();
                }
                    #else
                EditorGUILayout.HelpBox(TapJoyAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download Tapjoy Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadTapJoyPlugin();
                }

                // Default placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.tapjoyDefaultInterstitialAdId.property, AdProperties.tapjoyDefaultInterstitialAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.tapjoyDefaultRewardedAdId.property, AdProperties.tapjoyDefaultRewardedAdId.content, true);
                EditorGUI.indentLevel--;

                // Custom placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.tapjoyCustomInterstitialAdIds.property, AdProperties.tapjoyCustomInterstitialAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.tapjoyCustomRewardedAdIds.property, AdProperties.tapjoyCustomRewardedAdIds.content, true);
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Auto Reconnect Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.tapjoyAutoReconnect.property, AdProperties.tapjoyAutoReconnect.content, true);
                if (AdProperties.tapjoyAutoReconnect.property.boolValue)
                {
                    EditorGUILayout.PropertyField(AdProperties.tapjoyAutoReconnectInterval.property, AdProperties.tapjoyAutoReconnectInterval.content, true);

                    if (AdProperties.tapjoyAutoReconnectInterval.property.floatValue < 0.1)
                    {
                        AdProperties.tapjoyAutoReconnectInterval.property.floatValue = 0.1f;
                    }
                }

                EditorGUILayout.Space();
                if (GUILayout.Button("Open Tapjoy Setup Window"))
                {
                    EditorWindow.GetWindow <TapjoyEditor.TapjoyWindow>().BeginWindows();
                }

                if (GUILayout.Button("Generate Android Manifest"))
                {
                    GenerateTapJoyAndroidManifest();
                }
                    #endif
            });
        }
        void DrawHeyzapSettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("HEYZAP_SETUP_FOLDOUT_KEY", "HEYZAP (FYBER)", () =>
            {
                    #if !EM_HEYZAP
                EditorGUILayout.HelpBox(HeyzapImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadHeyzapPlugin();
                }
                    #else
                EditorGUILayout.HelpBox(HeyzapAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadHeyzapPlugin();
                }
                EditorGUILayout.Space();

                // Publisher ID.
                EditorGUILayout.LabelField("Publisher ID", EditorStyles.boldLabel);
                AdProperties.heyzapPublisherId.property.stringValue = EditorGUILayout.TextField(AdProperties.heyzapPublisherId.content, AdProperties.heyzapPublisherId.property.stringValue);

                // Placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(HeyzapDefaultAdPlacementMsg, MessageType.None);

                // Custom Placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(HeyzapCustomAdPlacementMsg, MessageType.None);

                EditorGUI.indentLevel++;
                if (DrawPropertyAsResizableArray(AdProperties.heyzapCustomInterstitialPlacements.property, AdProperties.heyzapCustomInterstitialPlacements.content, null, null, true))
                {
                    DrawAllElementsInArrayProperty(AdProperties.heyzapCustomInterstitialPlacements.property);
                }
                EditorGUI.indentLevel--;

                EditorGUI.indentLevel++;
                if (DrawPropertyAsResizableArray(AdProperties.heyzapCustomRewardedPlacements.property, AdProperties.heyzapCustomRewardedPlacements.content, null, null, true))
                {
                    DrawAllElementsInArrayProperty(AdProperties.heyzapCustomRewardedPlacements.property);
                }
                EditorGUI.indentLevel--;

                // Test mode.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Test Mode", EditorStyles.boldLabel);
                AdProperties.heyzapShowTestSuite.property.boolValue = EditorGUILayout.Toggle(AdProperties.heyzapShowTestSuite.content, AdProperties.heyzapShowTestSuite.property.boolValue);
                    #endif
            });
        }
        void DrawChartboostSettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("CHARTBOOST_SETUP_FOLDOUT_KEY", "CHARTBOOST", () =>
            {
                    #if !EM_CHARTBOOST
                EditorGUILayout.HelpBox(ChartboostImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadChartboostPlugin();
                }
                    #else
                EditorGUILayout.HelpBox(ChartboostAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadChartboostPlugin();
                }

                // Placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(ChartboostDefaultAdPlacementMsg, MessageType.None);

                // Custom Placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(ChartboostCustomAdPlacementMsg, MessageType.None);

                EditorGUI.indentLevel++;
                if (DrawPropertyAsResizableArray(AdProperties.chartboostCustomInterstitialPlacements.property, AdProperties.chartboostCustomInterstitialPlacements.content, null, null, true))
                {
                    DrawAllElementsInArrayProperty(AdProperties.chartboostCustomInterstitialPlacements.property);
                }
                EditorGUI.indentLevel--;

                EditorGUI.indentLevel++;
                if (DrawPropertyAsResizableArray(AdProperties.chartboostCustomRewardedPlacements.property, AdProperties.chartboostCustomRewardedPlacements.content, null, null, true))
                {
                    DrawAllElementsInArrayProperty(AdProperties.chartboostCustomRewardedPlacements.property);
                }
                EditorGUI.indentLevel--;

                // Setup.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Setup", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("Chartboost can be setup in dedicated window.", MessageType.None);
                if (GUILayout.Button("Setup Chartboost", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    // Open Chartboost settings window.
                    ChartboostSDK.CBSettings.Edit();
                }
                    #endif
            });
        }
        internal static void EnableNotificationModule(GameObject mainPrefab)
        {
            EM_EditorUtil.AddModuleToPrefab <NotificationManager>(mainPrefab);

            // Check if OneSignal is available.
            bool isOneSignalAvail = EM_ExternalPluginManager.IsOneSignalAvail();

            if (isOneSignalAvail)
            {
                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.OneSignal, EditorUserBuildSettings.selectedBuildTargetGroup);
            }
        }
        protected override void InternalEnableModule()
        {
            List <string> symbols = new List <string>();

            if (EM_ExternalPluginManager.IsUsingURP())
            {
                symbols.Add(EM_ScriptingSymbols.UniversalRenderPipeline);
            }

            // Defines all ad symbols on all platforms.
            GlobalDefineManager.SDS_AddDefinesOnAllPlatforms(symbols.ToArray());
        }
        void DrawAudienceNetworkSettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("FACEBOOK_AUDIENCE_NETWORK_SETUP_FOLDOUT_KEY", "AUDIENCE NETWORK", () =>
            {
                    #if !EM_FBAN
                EditorGUILayout.HelpBox(FBAudienceImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download FB Audience Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadFacebookAudiencePlugin();
                }
                    #else
                EditorGUILayout.HelpBox(FBAudienceAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download FB Audience Network Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadFacebookAudiencePlugin();
                }

                // Default placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.fbAudienceDefaultBannerAdId.property, AdProperties.fbAudienceDefaultBannerAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.fbAudienceDefaultInterstitialAdId.property, AdProperties.fbAudienceDefaultInterstitialAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.fbAudienceDefaultRewardedAdId.property, AdProperties.fbAudienceDefaultRewardedAdId.content, true);
                EditorGUI.indentLevel--;

                // Custom placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.fbAudienceCustomBannerAdIds.property, AdProperties.fbAudienceCustomBannerAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.fbAudienceCustomInterstitialAdIds.property, AdProperties.fbAudienceCustomInterstitialAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.fbAudienceCustomRewardedAdIds.property, AdProperties.fbAudienceCustomRewardedAdIds.content, true);
                EditorGUI.indentLevel--;

                // Test mode.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Test Mode", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.fbAudienceEnableTestMode.property, AdProperties.fbAudienceEnableTestMode.content);
                if (AdProperties.fbAudienceEnableTestMode.property.boolValue)
                {
                    DrawPropertyAsResizableArray(AdProperties.fbAudienceTestDeviceIds.property, "Test Device IDs");
                    DrawAllElementsInArrayProperty(AdProperties.fbAudienceTestDeviceIds.property);
                }
                else
                {
                    AdProperties.fbAudienceTestDeviceIds.property.ClearArray();
                }
                    #endif
            });
        }
        void DrawAdColonySettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("ADCOLONY_SETUP_FOLDOUT_KEY", "ADCOLONY", () =>
            {
                    #if !EM_ADCOLONY
                EditorGUILayout.HelpBox(AdColonyImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadAdColonyPlugin();
                }
                    #else
                EditorGUILayout.HelpBox(AdColonyAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadAdColonyPlugin();
                }

                // App ID.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("App ID", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.adColonyAppId.property, AdProperties.adColonyAppId.content, true);
                EditorGUI.indentLevel--;

                // Default Placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.adColonyDefaultInterstitialAdId.property, AdProperties.adColonyDefaultInterstitialAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.adColonyDefaultRewardedAdId.property, AdProperties.adColonyDefaultRewardedAdId.content, true);
                EditorGUI.indentLevel--;

                // Custom placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.adColonyCustomInterstitialAdIds.property, AdProperties.adColonyCustomInterstitialAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.adColonyCustomRewardedAdIds.property, AdProperties.adColonyCustomRewardedAdIds.content, true);
                EditorGUI.indentLevel--;

                // Ad settings.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Ad Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.adColonyAdOrientation.property, AdProperties.adColonyAdOrientation.content);
                EditorGUILayout.PropertyField(AdProperties.adColonyEnableRewardedAdPrePopup.property, AdProperties.adColonyEnableRewardedAdPrePopup.content);
                EditorGUILayout.PropertyField(AdProperties.adColonyEnableRewardedAdPostPopup.property, AdProperties.adColonyEnableRewardedAdPostPopup.content);
                    #endif
            });
        }
        internal static void EnableGameServiceModule()
        {
            // Check if Google Play Games plugin is available.
            bool isGPGSAvail = EM_ExternalPluginManager.IsGPGSAvail();

            if (isGPGSAvail)
            {
                // We won't use Google Play Game Services on iOS, so we'll define NO_GPGS symbol to disable it
                // (if needed, as newer versions of GPGS defines this themselves).
                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.NoGooglePlayGames, BuildTargetGroup.iOS);

                // Define EM_GPGS symbol on Android platform
                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.GooglePlayGames, BuildTargetGroup.Android);
            }
        }
        internal static void EnableGameServiceModule(GameObject mainPrefab)
        {
            EM_EditorUtil.AddModuleToPrefab <GameServiceManager>(mainPrefab);

            // Check if Google Play Games plugin is available.
            bool isGPGSAvail = EM_ExternalPluginManager.IsGPGSAvail();

            if (isGPGSAvail)
            {
                // We won't use Google Play Game Services on iOS, so we'll define NO_GPGS symbol to disable it.
                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.NoGooglePlayGames, BuildTargetGroup.iOS);

                // Define EM_GPGS symbol on Android platform
                GlobalDefineManager.SDS_AddDefine(EM_ScriptingSymbols.GooglePlayGames, BuildTargetGroup.Android);
            }
        }
Exemple #15
0
        // Check if a *different* (maybe an older one is being imported!) version has been imported.
        // If yes, import the native package and update the version keys stored in settings file.
        internal static void VersionCheck()
        {
            int savedVersion = EM_ProjectSettings.Instance.GetInt(EM_Constants.PSK_EMVersionInt, -1);

            if (savedVersion != EM_Constants.versionInt)
            {
                // New version detected!
                EM_ProjectSettings.Instance.Set(EM_Constants.PSK_EMVersionString, EM_Constants.versionString);
                EM_ProjectSettings.Instance.Set(EM_Constants.PSK_EMVersionInt, EM_Constants.versionInt);

                // Import the Google Play Services Resolver
                EM_ExternalPluginManager.ImportPlayServicesResolver(false);
            }
            else if (!EM_ExternalPluginManager.IsPlayServicesResolverImported())
            {
                EM_ExternalPluginManager.ImportPlayServicesResolver(false);
            }
        }
Exemple #16
0
        internal static void EnableAdModule(GameObject mainPrefab)
        {
            EM_EditorUtil.AddModuleToPrefab <Advertising>(mainPrefab);

            // Check ad network plugins' availability and define appropriate scripting symbols.
            // Note that UnityAds symbol is added automatically by Unity engine.
            List <string> symbols = new List <string>();

            // AdColony
            bool isAdColonyAvail = EM_ExternalPluginManager.IsAdColonyAvail();

            if (isAdColonyAvail)
            {
                symbols.Add(EM_ScriptingSymbols.AdColony);
            }

            // AdMob
            bool isAdMobAvail = EM_ExternalPluginManager.IsAdMobAvail();

            if (isAdMobAvail)
            {
                symbols.Add(EM_ScriptingSymbols.AdMob);
            }

            // Chartboost
            bool isChartboostAvail = EM_ExternalPluginManager.IsChartboostAvail();

            if (isChartboostAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Chartboost);
            }

            // Heyzap
            bool isHeyzapAvail = EM_ExternalPluginManager.IsHeyzapAvail();

            if (isHeyzapAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Heyzap);
            }

            GlobalDefineManager.SDS_AddDefines(symbols.ToArray(), EditorUserBuildSettings.selectedBuildTargetGroup);
        }
        internal static void EnableNotificationModule()
        {
            // Define related symbols.
            var symbols = new List <string>();

            // Check if OneSignal is available.
            if (EM_ExternalPluginManager.IsOneSignalAvail())
            {
                symbols.Add(EM_ScriptingSymbols.OneSignal);
            }

            // Check if Firebase Messaging is available.
            if (EM_ExternalPluginManager.IsFirebaseMessagingAvail())
            {
                symbols.Add(EM_ScriptingSymbols.FirebaseMessaging);
            }

            // Define the symbols on all platforms.
            GlobalDefineManager.SDS_AddDefinesOnAllPlatforms(symbols.ToArray());
        }
        protected override void InternalEnableModule()
        {
            // Check if UnityIAP is enable and act accordingly.
            if (EM_ExternalPluginManager.IsUnityIAPAvail())
            {
                // Generate dummy AppleTangle and GoogleTangle classes if they don't exist.
                // Note that AppleTangle and GooglePlayTangle only get compiled on following platforms,
                // therefore the compilational condition is needed, otherwise the code will repeat forever.
                #if UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_TVOS
                if (!EM_EditorUtil.AppleTangleClassExists())
                {
                    EM_EditorUtil.GenerateDummyAppleTangleClass();
                }

                if (!EM_EditorUtil.GooglePlayTangleClassExists())
                {
                    EM_EditorUtil.GenerateDummyGooglePlayTangleClass();
                }
                #endif

                GlobalDefineManager.SDS_AddDefineOnAllPlatforms(EM_ScriptingSymbols.UnityIAP);
            }
        }
        void DrawMopubSettings()
        {
            EditorGUILayout.Space();
            DrawUppercaseSection("MOPUB_ADS_SETUP_FOLDOUT_KEY", "MOPUB ADS", () =>
            {
                    #if !EM_MOPUB
                EditorGUILayout.HelpBox(MoPubImportInstruction, MessageType.Warning);
                if (GUILayout.Button("Download MoPub Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadMoPubPlugin();
                }
                    #else
                EditorGUILayout.HelpBox(MoPubAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download MoPub Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadMoPubPlugin();
                }

                // Default placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.mopubDefaultBannerAdId.property, AdProperties.mopubDefaultBannerAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.mopubDefaultInterstitialAdId.property, AdProperties.mopubDefaultInterstitialAdId.content, true);
                EditorGUILayout.PropertyField(AdProperties.mopubDefaultRewardedAdId.property, AdProperties.mopubDefaultRewardedAdId.content, true);
                EditorGUI.indentLevel--;

                // Custom placements.
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.mopubCustomBannerAdIds.property, AdProperties.mopubCustomBannerAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.mopubCustomInterstitialAdIds.property, AdProperties.mopubCustomInterstitialAdIds.content, true);
                EditorGUILayout.PropertyField(AdProperties.mopubCustomRewardedAdIds.property, AdProperties.mopubCustomRewardedAdIds.content, true);
                EditorGUI.indentLevel--;

                if (AdProperties.mopubReportAppOpen.property.boolValue)
                {
                    /// We only need to provide app ID on IOS,
                    /// on Android the report app open feature can be called without any parameter.
                        #if UNITY_IOS
                    EditorGUILayout.PropertyField(AdProperties.mopubITuneAppID.property, AdProperties.mopubITuneAppID.content, true);
                        #else
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.LabelField("App ID is only required on iOS.", EditorStyles.miniBoldLabel);
                    EditorGUILayout.EndVertical();
                        #endif
                    EditorGUILayout.Space();
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Advanced Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.mopubEnableLocationPassing.property, AdProperties.mopubEnableLocationPassing.content);

                EditorGUILayout.PropertyField(AdProperties.mopubEnableAdvancedSetting.property, AdProperties.mopubEnableAdvancedSetting.content);
                if (AdProperties.mopubEnableAdvancedSetting.property.boolValue)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    DrawEnumArrayProperty(AdProperties.mopubInitNetworks.property, typeof(MoPubSettings.MoPubInitNetwork), "Initialize Networks");
                    DrawEnumArrayProperty(AdProperties.mopubAdvancedBidders.property, typeof(MoPubSettings.MoPubAdvancedBidder), "Advanced Bidders");
                    DrawMediationSettingProperty(AdProperties.mopubMediationSettings.property, "Mediation Settings");
                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("GDPR Consent", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(AdProperties.mopubAutoRequestConsent.property, AdProperties.mopubAutoRequestConsent.content);
                EditorGUILayout.PropertyField(AdProperties.mopubForceGdprApplicable.property, AdProperties.mopubForceGdprApplicable.content);
                    #endif
            });
        }
Exemple #20
0
        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_Manager.DisableGameServiceModule(prefab);
                }
                else
                {
                    EM_Manager.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("[ANDROID] GOOGLE PLAY GAMES SETUP", EditorStyles.boldLabel);

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

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

                // Draw text area inside a scroll view.
                androidResourcesTextAreaScroll = GUILayout.BeginScrollView(androidResourcesTextAreaScroll, false, false, GUILayout.Height(EditorGUIUtility.singleLineHeight * 10));
                GameServiceProperties.androidXmlResources.property.stringValue = EditorGUILayout.TextArea(
                    GameServiceProperties.androidXmlResources.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)))
                {
                    string webClientId        = null;                                                           // Web ClientId, not required for Games Services.
                    string folder             = EM_Constants.GeneratedFolder;                                   // Folder to contain the generated id constant class.
                    string className          = EM_Constants.AndroidGPGSConstantClassName;                      // Name of the generated id constant class.
                    string resourceXmlData    = GameServiceProperties.androidXmlResources.property.stringValue; // The xml resources inputted.
                    string nearbySvcId        = null;                                                           // Nearby Connection Id, not supported by us.
                    bool   requiresGooglePlus = false;                                                          // Not required Google+ API.

                    try
                    {
                        if (GPGSUtil.LooksLikeValidPackageName(className))
                        {
                            SetupAndroidGPGS(webClientId, folder, className, resourceXmlData, nearbySvcId, requiresGooglePlus);
                        }
                    }
                    catch (System.Exception e)
                    {
                        GPGSUtil.Alert(
                            GPGSStrings.Error,
                            "Invalid classname: " + e.Message);
                    }
                }
                #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);
                }

                // 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 CLASS 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();
        }
        protected override void InternalEnableModule()
        {
            // Check ad network plugins' availability and define appropriate scripting symbols.
            // Note that UnityAds symbol is added automatically by Unity engine.
            List <string> symbols = new List <string>();

            // AdColony
            if (EM_ExternalPluginManager.IsAdColonyAvail())
            {
                symbols.Add(EM_ScriptingSymbols.AdColony);
            }

            // AdMob
            if (EM_ExternalPluginManager.IsAdMobAvail())
            {
                symbols.Add(EM_ScriptingSymbols.AdMob);
            }

            // AdMob
            if (EM_ExternalPluginManager.IsAppLovinAvail())
            {
                symbols.Add(EM_ScriptingSymbols.AppLovin);
            }

            // FB Audience
            if (EM_ExternalPluginManager.IsFBAudienceAvail())
            {
                symbols.Add(EM_ScriptingSymbols.FBAudience);
            }

            // Chartboost
            if (EM_ExternalPluginManager.IsChartboostAvail())
            {
                symbols.Add(EM_ScriptingSymbols.Chartboost);
            }

            // FairBid
            if (EM_ExternalPluginManager.IsFairBidAvail())
            {
                symbols.Add(EM_ScriptingSymbols.FairBid);
            }

            // IronSource
            if (EM_ExternalPluginManager.IsIronSourceAvail())
            {
                symbols.Add(EM_ScriptingSymbols.IronSource);
            }

            // MoPub
            if (EM_ExternalPluginManager.IsMoPubAvail())
            {
                symbols.Add(EM_ScriptingSymbols.MoPub);
            }

            // TapJoy
            if (EM_ExternalPluginManager.IsTapJoyAvail())
            {
                symbols.Add(EM_ScriptingSymbols.TapJoy);
            }

            // Unity Monetization
            if (EM_ExternalPluginManager.IsUnityMonetizationAvail())
            {
                symbols.Add(EM_ScriptingSymbols.UnityMonetization);
            }

            // Unity Ads
            if (EM_ExternalPluginManager.IsUnityAdAvail())
            {
                symbols.Add(EM_ScriptingSymbols.UnityAds);
            }

            // Vungle
            if (EM_ExternalPluginManager.IsVungleAvail())
            {
                symbols.Add(EM_ScriptingSymbols.Vungle);
            }

            // Defines all ad symbols on all platforms.
            GlobalDefineManager.SDS_AddDefinesOnAllPlatforms(symbols.ToArray());
        }
Exemple #22
0
 public static void InstallPlayMakerActions()
 {
     EditorApplication.delayCall += () => EM_ExternalPluginManager.InstallPlayMakerActions(true);
 }
Exemple #23
0
 public static void ReimportNativePackage()
 {
     EM_ExternalPluginManager.ImportPlayServicesResolver(true);
 }
        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();
        }
Exemple #25
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_Manager.DisableNotificationModule(prefab);
                }
                else
                {
                    EM_Manager.EnableNotificationModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isNotificationModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(NotificationModuleIntro, MessageType.Info);
            }
            else
            {
                #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();
                EditorGUILayout.LabelField("ONESIGNAL SETUP", EditorStyles.boldLabel);
                NotificationProperties.oneSignalAppId.property.stringValue = EditorGUILayout.TextField(NotificationProperties.oneSignalAppId.content, NotificationProperties.oneSignalAppId.property.stringValue);

                // Auto-init 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);
                }
                #endif
            }

            EditorGUILayout.EndVertical();
        }
        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_Manager.DisableAdModule(prefab);
                }
                else
                {
                    EM_Manager.EnableAdModule(prefab);
                }
            }

            // Now draw the GUI.
            if (!isAdModuleEnable.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox(AdModuleIntro, MessageType.Info);
            }
            else
            {
                // 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();
                }
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AdProperties.iosAdMobConfig.property, AdProperties.iosAdMobConfig.content, true);
                EditorGUILayout.PropertyField(AdProperties.androidAdMobConfig.property, AdProperties.androidAdMobConfig.content, true);
                EditorGUI.indentLevel--;
                #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();
        }
Exemple #27
0
        void NotificationModuleGUI()
        {
            DrawModuleHeader();

            // Now draw the GUI.
            if (!isNotificationModuleEnable.boolValue)
            {
                return;
            }

            DrawAndroidPermissionsRequiredSection(Module.Notifications);
            EditorGUILayout.Space();
            DrawIOSInfoPlistItemsRequiredSection(Module.Notifications);

            // Remote notification setup
            EditorGUILayout.Space();
            DrawUppercaseSection("REMOTE_NOTIFICATION_SETUP_FOLDOUT_KEY", "REMOTE NOTIFICATIONS", () =>
            {
                // Push Notification Service
                EditorGUILayout.LabelField("Remote Notification Service", EditorStyles.boldLabel);
                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);
                    if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadOneSignalPlugin();
                    }
                        #else
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(OneSignalAvailMsg, MessageType.Info);
                    if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadOneSignalPlugin();
                    }

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

                if (NotificationProperties.pushNotificationService.property.enumValueIndex == (int)PushNotificationProvider.Firebase)
                {
                        #if !EM_FIR_MESSAGING
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(FirebaseImportInstruction, MessageType.Error);
                    if (GUILayout.Button("Download Firebase Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadFirebasePlugin();
                    }
                        #else
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox(FirebaseAvailMsg, MessageType.Info);
                    if (GUILayout.Button("Download Firebase Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                    {
                        EM_ExternalPluginManager.DownloadFirebasePlugin();
                    }

                    /// Firebase setup
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Firebase Setup", EditorStyles.boldLabel);
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Default Firebase Topics");

                    /// Draw plus and minus button.
                    GUIContent plusContent  = EditorGUIUtility.IconContent("Toolbar Plus");
                    GUIContent minusContent = EditorGUIUtility.IconContent("Toolbar Minus");
                    GUIStyle buttonStyle    = new GUIStyle(GUIStyle.none)
                    {
                        fixedHeight = EM_GUIStyleManager.smallButtonHeight,
                        fixedWidth  = EM_GUIStyleManager.smallButtonWidth
                    };

                    if (GUILayout.Button(plusContent, buttonStyle))
                    {
                        var p = NotificationProperties.firebaseTopics.property;
                        p.arraySize++;
                        p.GetArrayElementAtIndex(p.arraySize - 1).stringValue = string.Empty;
                    }

                    bool canDelete = NotificationProperties.firebaseTopics.property.arraySize > 0;
                    EditorGUI.BeginDisabledGroup(!canDelete);
                    if (GUILayout.Button(minusContent, buttonStyle))
                    {
                        NotificationProperties.firebaseTopics.property.arraySize--;
                    }
                    EditorGUI.EndDisabledGroup();

                    EditorGUILayout.EndHorizontal();

                    /// Draw all available topics.
                    EditorGUI.indentLevel++;
                    for (int i = 0; i < NotificationProperties.firebaseTopics.property.arraySize; i++)
                    {
                        EditorGUILayout.PropertyField(NotificationProperties.firebaseTopics.property.GetArrayElementAtIndex(i));
                    }
                    EditorGUI.indentLevel--;
                        #endif
                }
            });

            // Initialization setup
            EditorGUILayout.Space();
            DrawUppercaseSection("PRIVACY_AUTO_INIT_CONFIG_FOLDOUT_KEY", "AUTO INITIALIZATION", () =>
            {
                NotificationProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(NotificationProperties.autoInit.content, NotificationProperties.autoInit.property.boolValue);

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

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

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

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

            // Android Resources Setup
            EditorGUILayout.Space();
            DrawUppercaseSection("ANDROID_NOTIFICATION_RESOURCES_FOLDOUT_KEY", "ANDROID NOTIFICATION RESOURCES", () =>
            {
                EditorGUILayout.HelpBox(NotificationAndroidResourcesIntro, MessageType.None);

                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();
            DrawUppercaseSection("CATEGORY_GROUP_FOLDOUT_KEY", "CATEGORY GROUP", () =>
            {
                DrawNotificationCategoryGroupsArray(NotificationProperties.categoryGroups, ref notificationIsCategoryGroupsFoldout);

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

            // Categories
            EditorGUILayout.Space();
            DrawUppercaseSection("CATEGORIES_FOLDOUT_KEY", "CATEGORIES", () =>
            {
                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();
            DrawUppercaseSection("NOTIFICATIONS_CONSTANTS_GENERATION_FOLDOUT_KEY", "CONTANTS GENERATION", () =>
            {
                EditorGUILayout.HelpBox(NotificationConstantGenerationIntro, MessageType.None);

                if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    GenerateNotificationConstants();
                }
            });
        }
        void GameServiceModuleGUI()
        {
            DrawModuleHeader();

            // Now draw the GUI.
            if (!isGameServiceModuleEnable.boolValue)
            {
                return;
            }

            #if UNITY_ANDROID && !EM_GPGS
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(EM_GUIStyleManager.UppercaseSectionBox);
            EditorGUILayout.HelpBox(AndroidGPGSImportInstruction, MessageType.Error);
            if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
            {
                EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin();
            }
            EditorGUILayout.EndVertical();
            #elif UNITY_ANDROID && EM_GPGS
            EditorGUILayout.Space();
            DrawUppercaseSection("GAMESERVICES_DOWNLOAD_PLUGIN_FOLDOUT_KEY", "DOWNLOAD GPGS PLUGIN", () =>
            {
                EditorGUILayout.HelpBox(AndroidGPGSAvailMsg, MessageType.Info);
                if (GUILayout.Button("Download Google Play Games Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    EM_ExternalPluginManager.DownloadGooglePlayGamesPlugin();
                }
            });

            // Android Google Play Games setup
            EditorGUILayout.Space();
            DrawUppercaseSection("GOOGLE_PLAY_GAMES_SETUP_FOLDOUT_KEY", "GOOGLE PLAY GAMES SETUP", () =>
            {
                // GPGPS debug log.
                EditorGUILayout.PropertyField(GameServiceProperties.gpgsDebugLog.property, GameServiceProperties.gpgsDebugLog.content);

                // GPGS popup gravity.
                EditorGUILayout.PropertyField(GameServiceProperties.gpgsPopupGravity.property, GameServiceProperties.gpgsPopupGravity.content);

                // 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.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();
            DrawUppercaseSection("GAMESERVICES_AUTO_INIT_CONFIG", "AUTO INITIALIZATION", () =>
            {
                EditorGUILayout.PropertyField(GameServiceProperties.autoInit.property, GameServiceProperties.autoInit.content);

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

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

            // Saved Games config.
            #if EASY_MOBILE_PRO
            EditorGUILayout.Space();
            DrawUppercaseSection("SAVED_GAMES_CONFIG_FOLDOUT_KEY", "SAVED GAMES", () =>
            {
                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();
            DrawUppercaseSection("LEADERBOARD_SETUP_FOLDOUT_KEY", "LEADERBOARDS", () =>
            {
                DrawGameServiceItemArray("Leaderboard", GameServiceProperties.leaderboards, ref isLeadeboardsFoldout);
            });

            // Achievement setup.
            EditorGUILayout.Space();
            DrawUppercaseSection("ACHIVEMENT_SETUP_FOLDOUT_KEY", "ACHIEVEMENTS", () =>
            {
                DrawGameServiceItemArray("Achievement", GameServiceProperties.achievements, ref isAchievementsFoldout);
            });

            // Constant generation.
            EditorGUILayout.Space();
            DrawUppercaseSection("GAMESERVICES_CONTANTS_GENERATION_FOLDOUT_KEY", "CONSTANTS GENERATION", () =>
            {
                EditorGUILayout.HelpBox(GameServiceConstantGenerationIntro, MessageType.None);
                if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight)))
                {
                    GenerateGameServiceConstants();
                }
            });
            #endif
        }
Exemple #29
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();
        }
        internal static void EnableAdModule()
        {
            // Check ad network plugins' availability and define appropriate scripting symbols.
            // Note that UnityAds symbol is added automatically by Unity engine.
            List <string> symbols = new List <string>();

            // AdColony
            bool isAdColonyAvail = EM_ExternalPluginManager.IsAdColonyAvail();

            if (isAdColonyAvail)
            {
                symbols.Add(EM_ScriptingSymbols.AdColony);
            }

            // AdMob
            bool isAdMobAvail = EM_ExternalPluginManager.IsAdMobAvail();

            if (isAdMobAvail)
            {
                symbols.Add(EM_ScriptingSymbols.AdMob);
            }

            // Chartboost
            bool isChartboostAvail = EM_ExternalPluginManager.IsChartboostAvail();

            if (isChartboostAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Chartboost);
            }

            // FB Audience
            if (EM_ExternalPluginManager.IsFBAudienceAvail())
            {
                symbols.Add(EM_ScriptingSymbols.FBAudience);
            }

            // IronSource
            if (EM_ExternalPluginManager.IsIronSourceAvail())
            {
                symbols.Add(EM_ScriptingSymbols.IronSource);
            }

            // Heyzap
            bool isHeyzapAvail = EM_ExternalPluginManager.IsHeyzapAvail();

            if (isHeyzapAvail)
            {
                symbols.Add(EM_ScriptingSymbols.Heyzap);
            }

            // MoPub
            if (EM_ExternalPluginManager.IsMoPubAvail())
            {
                symbols.Add(EM_ScriptingSymbols.MoPub);
            }

            // TapJoy
            if (EM_ExternalPluginManager.IsTapJoyAvail())
            {
                symbols.Add(EM_ScriptingSymbols.TapJoy);
            }

            // Unity Ads defines a symbol themselves.

            // Defines all ad symbols on all platforms.
            GlobalDefineManager.SDS_AddDefinesOnAllPlatforms(symbols.ToArray());
        }