Пример #1
0
            public void OnRemoteConsentModeReady(string messageStr)
            {
                ConsentFormType consentFormType = ConsentFormType.NONE;

                Debug.Log("TTPPrivacySettings::OnRemoteConsentModeReady jsonMessage: " + messageStr);
                OnRemoteConsentModeReadyEventMessage message = JsonUtilityWrapper.FromJson <OnRemoteConsentModeReadyEventMessage>(messageStr);

                if (message != null && message.consentFormType != null)
                {
                    if (message.consentFormType.Equals("NONE", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        consentFormType = ConsentFormType.NONE;
                    }
                    else if (message.consentFormType.Equals("ANY", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        consentFormType = ConsentFormType.ANY;
                    }
                    else if (message.consentFormType.Equals("NO_PURCHASE", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        consentFormType = ConsentFormType.NO_PURCHASE;
                    }
                }
                else
                {
                    Debug.LogError("TTPPrivacySettings::OnRemoteConsentModeReady failed to serialize message.");
                }
                if (OnRemoteConsentModeReadyEvent != null)
                {
                    OnRemoteConsentModeReadyEvent(consentFormType);
                }
                else
                {
                    Debug.Log("TTPPrivacySettings::OnRemoteConsentModeReadyEvent fired but no one is registered to it.");
                }
            }
Пример #2
0
            public void OnRewardedAdsClosed(string message)
            {
                ((TTPCore.TTPSoundMgr)TTPCore.SoundMgr).PauseGameMusic(false, TTPCore.TTPSoundMgr.Caller.REWARDED_ADS);
                if (message != null)
                {
                    Debug.Log("RewardedAdsDelegate::OnRewardedAdsClosed: " + message);
                    var onClosedMessage = JsonUtilityWrapper.FromJson <OnClosedMessage>(message);
                    var ilrdData        = JsonUtilityWrapper.FromJson <TTPILRDData>(message);
                    if (onClosedMessage != null)
                    {
                        if (_onResultActionILRD != null)
                        {
                            _onResultActionILRD.Invoke(onClosedMessage.shouldReward, ilrdData);
                        }
                        else if (_onResultAction != null)
                        {
                            _onResultAction.Invoke(onClosedMessage.shouldReward);
                        }
                        _onResultAction     = null;
                        _onResultActionILRD = null;

                        if (Impl != null && Impl.GetType() == typeof(EditorImpl) && ((EditorImpl)Impl)._onClosedAction != null)
                        {
                            ((EditorImpl)_impl)._onClosedAction.Invoke();
                        }
                    }
                }
            }
Пример #3
0
            public EditorImpl()
            {
                _consent = StringToConsentType(PlayerPrefs.GetString(PLAYER_PREFS_CONSENT_MODE, "UNKNOWN"));
                _age     = PlayerPrefs.GetInt(PLAYER_PREFS_AGE, -1);
#if UNITY_ANDROID
                //string path = System.IO.Path.Combine("jar:file://" + Application.dataPath + "!", "assets");
                //path = System.IO.Path.Combine(path, "ttp");
                string path = System.IO.Path.Combine("ttp", "configurations");
                path = System.IO.Path.Combine(path, "privacySettings.json");
                Debug.Log("shmulik - " + path);
                string privacySettingsJson = TTPUtils.ReadStreamingAssetsFile(path);
#else
                string path = Application.streamingAssetsPath + "/ttp/configurations/privacySettings.json";
                string privacySettingsJson = System.IO.File.ReadAllText(path);
#endif
                //string privacySettingsJson = System.IO.File.ReadAllText(path);

                if (privacySettingsJson != null)
                {
                    PrivacySettingsData privacySettingsData = JsonUtilityWrapper.FromJson <PrivacySettingsData>(privacySettingsJson);
                    if (privacySettingsData != null)
                    {
                        _audienceMode = StringToAudienceMode(privacySettingsData.audienceMode);
                        if (privacySettingsData.usePSDKGDPRPopups && _consent == ConsentType.UNKNOWN && _audienceMode != AudienceMode.MIXED_UNKNOWN)
                        {
                            ShowConsent();
                        }
                    }
                }
            }
Пример #4
0
            public void OnOpenAdClosed(string message)
            {
                Debug.Log("OpenAdsDelegate::OnOpenAdClosed:message=" + message);
                ((TTPCore.TTPSoundMgr)TTPCore.SoundMgr).PauseGameMusic(false, TTPCore.TTPSoundMgr.Caller.OPEN_ADS);
                var ilrdData = JsonUtilityWrapper.FromJson <TTPILRDData>(message);

                TTPOpenAds.NotifyOpenAdsHasFinished(ilrdData);
            }
Пример #5
0
 public void OnBannersILRD(string message)
 {
     if (message != null)
     {
         var ilrdData = JsonUtilityWrapper.FromJson <TTPILRDData>(message);
         if (OnBannerILRD != null)
         {
             OnBannerILRD.Invoke(ilrdData);
         }
     }
 }
Пример #6
0
        public void DownloadLocalConsentForms(BuildTarget target)
        {
            Debug.Log("DownloadLocalConsentForm");
            string consentFormUrl = null;
            string privacyFormUrl = null;
            string store          = null;
            string jsonFp         = Application.dataPath + STREAMING_ASSETS_PATH_JSON;

            if (File.Exists(jsonFp))
            {
                try
                {
                    string jsonStr = File.ReadAllText(jsonFp);
                    if (jsonStr != null)
                    {
                        PrivacySettingsConfiguration privacySettingsConfiguration = JsonUtilityWrapper.FromJson <PrivacySettingsConfiguration>(jsonStr);
                        if (privacySettingsConfiguration != null)
                        {
                            consentFormUrl = privacySettingsConfiguration.consentFormURL;
                            privacyFormUrl = privacySettingsConfiguration.privacySettingsURL;
                        }
                    }
                }
                catch (System.Exception e)
                {
                    Debug.Log("DownloadLocalConsentForm::OnPreprocessBuild: failed to parse json. exception - " + e.Message);
                }
            }
            if (string.IsNullOrEmpty(consentFormUrl) || string.IsNullOrEmpty(privacyFormUrl))
            {
                Debug.Log("DownloadLocalConsentForm:: consentFormUrl or privacySettingsURL do not exist - aborting.");
            }
            else
            {
                string consentDst = "";
                string privacyDst = "";
                if (target == BuildTarget.Android)
                {
                    consentDst = Application.dataPath + STREAMING_ASSETS_PATH_CONSENT_ANDROID;
                    privacyDst = Application.dataPath + STREAMING_ASSETS_PATH_PRIVACY_ANDROID;
                }
                else if (target == BuildTarget.iOS)
                {
                    consentDst = Application.dataPath + STREAMING_ASSETS_PATH_CONSENT;
                    privacyDst = Application.dataPath + STREAMING_ASSETS_PATH_PRIVACY;
                }
                StartCoroutine(DownloadConsentForms(consentFormUrl, Application.dataPath + STREAMING_ASSETS_PATH_CONSENT_ZIP, consentDst));
                StartCoroutine(DownloadConsentForms(privacyFormUrl, Application.dataPath + STREAMING_ASSETS_PATH_PRIVACY_ZIP, privacyDst));
            }
        }
Пример #7
0
 public void OnInterstitialLoaded(string message)
 {
     if (message != null)
     {
         Debug.Log("InterstitialsDelegate::OnLoaded: " + message);
         OnLoadedMessage onLoadedMessage = JsonUtilityWrapper.FromJson <OnLoadedMessage>(message);
         if (onLoadedMessage != null)
         {
             if (ReadyEvent != null)
             {
                 ReadyEvent(onLoadedMessage.loaded);
             }
         }
     }
 }
Пример #8
0
 public void OnRewardedAdsReady(string message)
 {
     if (message != null)
     {
         Debug.Log("RewardedAdsDelegate::OnRewardedAdsReady: " + message);
         OnLoadedMessage onLoadedMessage = JsonUtilityWrapper.FromJson <OnLoadedMessage>(message);
         if (onLoadedMessage != null)
         {
             if (ReadyEvent != null)
             {
                 ReadyEvent(onLoadedMessage.loaded);
             }
         }
     }
 }
Пример #9
0
 public void OnBannersStatusChange(string message)
 {
     Debug.Log("TTPBanners::BannersDelegate:OnBannersStatusChange:message=" + message);
     if (message != null)
     {
         Debug.Log("TTPBanners::BannersDelegate:OnBannersStatusChange:message is not null");
         OnStatusChangeMessage statusChangeMessage = JsonUtilityWrapper.FromJson <OnStatusChangeMessage>(message);
         Debug.Log("TTPBanners::BannersDelegate:OnBannersStatusChange:OnStatusChangeMessage is created");
         if (statusChangeMessage != null && OnStatusChangeEvent != null)
         {
             Debug.Log("TTPBanners::BannersDelegate:OnBannersStatusChange:OnStatusChangeEvent:before:adHeight=" + statusChangeMessage.adHeight);
             OnStatusChangeEvent(statusChangeMessage.adHeight);
             Debug.Log("TTPBanners::BannersDelegate:OnBannersStatusChange:OnStatusChangeEvent:after");
         }
     }
 }
Пример #10
0
 public void CloseLoadingScreen(string message)
 {
     Debug.Log("OpenAdsDelegate::CloseLoadingScreen:" + message);
     TTPOpenAds.CloseLoadingScreen();
     if (message != null)
     {
         Debug.Log("OpenAdsDelegate::CloseLoadingScreen: " + message);
         var onClosedMessage = JsonUtilityWrapper.FromJson <OnClosedMessage>(message);
         if (onClosedMessage != null)
         {
             if (onClosedMessage.result)
             {
                 TTPOpenAds.NotifyOpenAdsHasFinished(null);
             }
         }
     }
 }