示例#1
0
        private void CheckConfig(UnityEditor.BuildTarget platform)
        {
            Debug.Log("TTPPreProcessSettings::CheckConfig: ");
            string configurationJson = ((TTPCore.ITTPCoreInternal)TTPCore.Impl).GetConfigurationJson("global");

            if (!string.IsNullOrEmpty(configurationJson))
            {
                Debug.Log("TTPPreProcessSettings::CheckConfig: configurationJson=" + configurationJson);
                Dictionary <string, object> configuration = TTPJson.Deserialize(configurationJson) as Dictionary <string, object>;
                object storeObj;
                if (configuration.TryGetValue("store", out storeObj))
                {
                    string store = (string)storeObj;
                    Debug.Log("TTPPreProcessSettings::CheckConfig: store=" + store);
                    if (platform == UnityEditor.BuildTarget.iOS && !store.Equals("apple"))
                    {
                        Debug.LogError("Store in global.json does not match current platform:store=" + store + " platform=iOS");
                    }
                    else if (platform == UnityEditor.BuildTarget.Android && !store.Equals("google"))
                    {
                        Debug.LogError("Store in global.json does not match current platform:store=" + store + " platform=Android");
                    }
                }
            }
        }
示例#2
0
 public void AddExtras(IDictionary <string, object> extras)
 {
     if (ServiceJavaObject != null)
     {
         ServiceJavaObject.Call("addExtras", extras != null ? TTPJson.Serialize(extras) : "{}");
     }
 }
示例#3
0
            public void OnDDNALogEventCalled(string message)
            {
                if (message != null)
                {
                    var dict = TTPJson.Deserialize(message) as Dictionary <string, object>;
                    if (dict != null)
                    {
                        string eventName = null;
                        IDictionary <string, object> eventParams = null;
                        if (dict.ContainsKey("eventName"))
                        {
                            eventName = dict["eventName"] as string;
                        }

                        if (dict.ContainsKey("eventParams"))
                        {
                            eventParams = dict["eventParams"] as Dictionary <string, object>;
                        }

                        if (eventName != null && OnDDNALogEvent != null)
                        {
                            OnDDNALogEvent.Invoke(eventName, eventParams);
                        }
                    }
                }
            }
示例#4
0
            public void EndLogEvent(string eventName, IDictionary <string, object> eventParams)
            {
                string paramsStr = "";

                if (eventParams != null && eventParams.Count > 0)
                {
                    paramsStr = TTPJson.Serialize(eventParams);
                }
                Debug.Log("TTPAnalytics::EditorImpl::EndLogEvent: eventName: " + eventName + "\neventParams: " + paramsStr);
            }
示例#5
0
            public void LogEvent(long targets, string eventName, IDictionary <string, object> eventParams, bool timed, bool ttpInternal)
            {
                string paramsStr = "";

                if (eventParams != null && eventParams.Count > 0)
                {
                    paramsStr = TTPJson.Serialize(eventParams);
                }
                Debug.Log("TTPAnalytics::EditorImpl::LogEvent: eventName: " + eventName + "\neventParams: " + paramsStr + "\ntimed: " + timed);
            }
示例#6
0
            public bool CallDecisionPoint(string decisionPoint, Dictionary <string, object> parameters, double timeoutInSecs)
            {
                string paramsStr = "";

                if (parameters != null && parameters.Count > 0)
                {
                    paramsStr = TTPJson.Serialize(parameters);
                }
                Debug.Log("TTPAnalytics::EditorImpl::CallDecisionPoint: decisionPoint: " + decisionPoint + "\nparameters: " + paramsStr);
                return(false);
            }
示例#7
0
 static Dictionary <string, object> OverrideCurrentConfig()
 {
     if (_overrideConfig == null)
     {
         var jsonStr = Impl.GetCurrentConfig();
         if (!string.IsNullOrEmpty(jsonStr))
         {
             _overrideConfig = TTPJson.Deserialize(jsonStr) as Dictionary <string, object>;
         }
     }
     return(_overrideConfig);
 }
示例#8
0
 public static Dictionary <string, object> GetAdditionalParams()
 {
     if (Impl != null)
     {
         var str = Impl.GetAdditionalParams();
         if (str != null)
         {
             return(TTPJson.Deserialize(str) as Dictionary <string, object>);
         }
     }
     return(null);
 }
示例#9
0
            public void onRequestValueDictionaryComplete(string messageDictionaryStr)
            {
                Debug.Log("TTPAnalytics::AnalyticsDelegate::OnRequestValueResponse: " + messageDictionaryStr);
                if (messageDictionaryStr != null)
                {
                    Dictionary <string, object> dictionary = TTPJson.Deserialize(messageDictionaryStr) as Dictionary <string, object>;

                    if (_onRequestValueDictionaryResponseAction != null && dictionary != null)
                    {
                        _onRequestValueDictionaryResponseAction.Invoke(dictionary);
                        _onRequestValueDictionaryResponseAction = null;
                    }
                }
            }
        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
        }
示例#11
0
 public void EndLogEvent(string eventName, IDictionary <string, object> eventParams)
 {
     if (ServiceJavaObject != null)
     {
         ServiceJavaObject.Call("endLogEvent", eventName, eventParams != null ? TTPJson.Serialize(eventParams) : "{}");
     }
 }
示例#12
0
 public void LogEvent(long targets, string eventName, IDictionary <string, object> eventParams, bool timed, bool ttpInternal)
 {
     if (ServiceJavaObject != null)
     {
         ServiceJavaObject.Call("logEvent", targets, eventName, eventParams != null ? TTPJson.Serialize(eventParams) : "{}", timed, ttpInternal);
     }
 }
示例#13
0
 public void AddExtras(IDictionary <string, object> extras)
 {
     ttpAddExtras(extras != null ? TTPJson.Serialize(extras) : "{}");
 }
示例#14
0
 public bool GetRemoteDictionary(IList <string> keys, double timeoutInSecs)
 {
     return(ttpGetRemoteDictionary(keys != null ? TTPJson.Serialize(keys): "[]", timeoutInSecs));
 }
示例#15
0
 public void EndLogEvent(string eventName, IDictionary <string, object> eventParams)
 {
     ttpEndLogEvent(eventName, eventParams != null ? TTPJson.Serialize(eventParams) : "{}");
 }
示例#16
0
 public void LogEvent(long targets, string eventName, IDictionary <string, object> eventParams, bool timed, bool ttpInternal)
 {
     ttpLogEvent(targets, eventName, eventParams != null ? TTPJson.Serialize(eventParams) : "{}", timed, ttpInternal);
 }