Пример #1
0
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url = domain + PRIVACY_SETTINGS_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;

            for (int tries = 0; tries < 3; tries++)
            {
                bool result = TTPMenu.DownloadConfiguration(url, PRIVACY_SETTINGS_JSON_FN);
                if (result)
                {
                    DownloadLocalConsentForm downloadLocalConsentForm = new DownloadLocalConsentForm();
                    downloadLocalConsentForm.DownloadLocalConsentForms(EditorUserBuildSettings.activeBuildTarget);
                    return;
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unity build returned with error: PrivacySettingsConfigurationDownloader:: DownloadConfiguration: failed to download configuration for privacy settings. retrying.");
                }
            }
            if (UnityEditorInternal.InternalEditorUtility.inBatchMode)
            {
                UnityEngine.Debug.LogError("Unity build returned with error: PrivacySettingsConfigurationDownloader:: DownloadConfiguration: failed to download configuration for privacy settings. failing build");
                EditorApplication.Exit(-1);
            }
        }
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url    = domain + RATEUS_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;
            string output = null;

            if (!TTPMenu.DownloadConfiguration(url, RATEUS_JSON_FN, out output))
            {
                Debug.LogWarning("RateUsConfigurationDownloader:: DownloadConfiguration: failed to download configuration. Wont download app icon");
                return;
            }
#if UNITY_ANDROID
            if (output != null)
            {
                var rateUsJson = SimpleJSON.JSON.Parse(output);
                if (rateUsJson != null)
                {
                    string iconUrl = rateUsJson["iconUrl"];
                    if (iconUrl != null)
                    {
                        string extenstion = iconUrl.Substring(iconUrl.LastIndexOf(".", System.StringComparison.InvariantCultureIgnoreCase) + 1);
                        TTPEditorUtils.DownloadFile(iconUrl, "Assets/StreamingAssets/ttp/rateus/game_icon." + extenstion);
                    }
                }
            }
#endif
        }
Пример #3
0
        private static string url; //static to retain the domain for next use

        void OnGUI()
        {
            GUILayout.Label("Select a custom domain:", EditorStyles.boldLabel);
            url = EditorGUILayout.TextField("Domain", url);
            EditorGUILayout.Space();
            if (GUILayout.Button("Download"))
            {
                TTPMenu.DownloadConfigurations(url);
                this.Close();
            }
        }
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url    = domain + CORE_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;
            bool   result = TTPMenu.DownloadConfiguration(url, CORE_JSON_FN);

            if (!result)
            {
                Debug.LogWarning("CoreConfigurationDownloader:: DownloadConfiguration: failed to download global configuration.");
            }
#if UNITY_ANDROID
            string strictModeConfigUrl = domain + "/" + STRICT_MODE_JSON_FN + "/" + store + "/" + PlayerSettings.applicationIdentifier;
            bool   strictModeResult    = TTPMenu.DownloadConfiguration(strictModeConfigUrl, STRICT_MODE_JSON_FN);
            if (!strictModeResult)
            {
                Debug.LogWarning("CoreConfigurationDownloader:: DownloadConfiguration: failed to download configuration for strict mode android");
            }
#endif
            var additionalConfigUrl    = domain + "/" + ADDITIONAL_CONFIG_JSON_FN + "/" + store + "/" + PlayerSettings.applicationIdentifier;
            var additionalConfigResult = TTPMenu.DownloadConfiguration(additionalConfigUrl, ADDITIONAL_CONFIG_JSON_FN);
            if (!additionalConfigResult)
            {
                Debug.LogWarning("CoreConfigurationDownloader:: DownloadConfiguration: failed to download additional configuration");
            }
            #if UNITY_IOS
            else
            {
                var json = File.ReadAllText(CONFIGURATIONS_PATH + "/" + CORE_JSON_FN + ".json");
                if (json != null)
                {
                    var dict = TTPJson.Deserialize(json) as Dictionary <string, object>;
                    if (dict != null)
                    {
                        var conversionModelType = "A";
                        if (dict.ContainsKey("conversionModelType"))
                        {
                            conversionModelType = dict["conversionModelType"] as string;
                        }
                        var conversionRulesUrl = "http://promo-images.ttpsdk.info/conversionJS/" + conversionModelType + "/conversion.js";
                        TTPEditorUtils.DownloadStringToFile(conversionRulesUrl, "Assets/StreamingAssets/ttp/conversion/conversion.js");
                    }
                }
            }
            #endif
        }
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url    = domain + ANALYTICS_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;
            bool   result = TTPMenu.DownloadConfiguration(url, ANALYTICS_JSON_FN);

            if (!result)
            {
                Debug.LogWarning("PrivacySettingsConfigurationDownloader:: DownloadConfiguration: failed to download configuration for privacy settings.");
            }
        }
Пример #6
0
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url = domain + URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;

            Debug.Log("RewardedInterstitialsConfigurationDownloader:url=" + url);
            bool result = TTPMenu.DownloadConfiguration(url, JSON_FN);

            if (!result)
            {
                Debug.LogWarning("RewardedInterstitialsConfigurationDownloader:: DownloadConfiguration: failed to download configuration.");
            }
        }
Пример #7
0
 public void OnPreprocessBuild(BuildTarget target, string path)
 {
     string[] args = System.Environment.GetCommandLineArgs();
     for (int i = 0; i < args.Length; i++)
     {
         Debug.Log("ARG " + i + ": " + args[i]);
         if (args[i] == "-configEnv")
         {
             string input = args[i + 1];
             if (!input.StartsWith("-", StringComparison.InvariantCultureIgnoreCase))
             {
                 Debug.Log("TTPMenu: detected batch mode configEnv. will download configurations. env - " + input);
                 TTPMenu.DownloadConfigurations(MakeUrl(input));
             }
             else
             {
                 Debug.Log("TTPMenu: detected batch mode configEnv, but env is not mentioned. param after configEnv - " + input);
             }
         }
     }
 }
Пример #8
0
        private static void DownloadConfiguration(string domain)
        {
            string store = "google";

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                store = "apple";
            }
            string url = domain + BANNERS_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;

            Debug.Log("BannersConfigurationDownloader:: DownloadConfiguration: download config from url: " + url);

            bool result = TTPMenu.DownloadConfiguration(url, BANNERS_JSON_FN);

            if (!result)
            {
                Debug.LogWarning("BannersConfigurationDownloader:: DownloadConfiguration: failed to download configuration.");
            }

            string houseAdsConfigUrl = domain + BANNERS_HOUSE_ADS_URL_ADDITION + store + "/" + PlayerSettings.applicationIdentifier;

            Debug.Log("BannersConfigurationDownloader:: DownloadConfiguration: houseAdsConfigUrl: " + houseAdsConfigUrl);
            string houseAdsJson = null;

            if (TTPEditorUtils.DownloadStringToFile(houseAdsConfigUrl, BANNERS_HOUSE_ADS_FP, out houseAdsJson))
            {
                var houseAdsConfig = JSON.Parse(houseAdsJson);
                if (houseAdsConfig != null)
                {
                    var apps = houseAdsConfig["apps"];
                    if (apps != null)
                    {
                        if (System.IO.File.Exists("Assets/StreamingAssets/ttp/houseads/houseads.zip"))
                        {
                            System.IO.File.Delete("Assets/StreamingAssets/ttp/houseads/houseads.zip");
                        }

                        foreach (var app in apps.Values)
                        {
                            string thumbnailUrl = app["thumbnail"];
                            if (thumbnailUrl != null)
                            {
                                Debug.Log("BannersConfigurationDownloader:: DownloadConfiguration: download thumbnail form url: " + thumbnailUrl);
                                string fn = thumbnailUrl.Substring(thumbnailUrl.LastIndexOf("/") + 1);
                                if (TTPEditorUtils.DownloadFile(thumbnailUrl, "Assets/StreamingAssets/ttp/houseads/" + fn))
                                {
                                    app["thumbnail"] = System.IO.Path.GetFileName(thumbnailUrl);
                                }
                            }
                        }
                        System.IO.File.WriteAllText(BANNERS_HOUSE_ADS_FP, houseAdsConfig.ToString());

                        string[] files = ZipUtil.ZipDirectoryContents(BANNER_ZIP_PATH, "Assets/StreamingAssets/ttp/houseads");
                        if (files != null)
                        {
                            foreach (string path in files)
                            {
                                Debug.Log("BannersConfigurationDownloader:: DownloadConfiguration: delete file from path: " + path);
                                System.IO.File.Delete(path);
                            }
                        }
                        else
                        {
                            Debug.LogWarning("BannersConfigurationDownloader:: DownloadConfiguration: NO files in houseads dir.");
                        }
                    }
                    else
                    {
                        Debug.LogWarning("BannersConfigurationDownloader:: DownloadConfiguration: there're NO apps in JSON.");
                    }
                }
                else
                {
                    Debug.LogWarning("BannersConfigurationDownloader:: DownloadConfiguration: JSON parse of houseAdsConfig failed.");
                }
            }
        }