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);
            }
        }
Beispiel #2
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);
            }
        }
        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);
            }
        }