示例#1
0
        public static void onDataPushMessage(string _serialized)
        {
            Dictionary <string, object> dict = (Dictionary <string, object>)MiniJSON.Json.Deserialize(_serialized);
            string category = null;
            string body     = null;
            bool   isBase64 = (bool)dict ["isBase64"];

            if (dict["category"] != null)
            {
                category = WWW.UnEscapeURL(dict["category"].ToString(), System.Text.Encoding.UTF8);
            }

            EngagementAgent.Logging("DataPushReceived, category: " + category + ", isBase64:" + isBase64);

            if (isBase64 == false)
            {
                body = WWW.UnEscapeURL(dict["body"].ToString(), System.Text.Encoding.UTF8);
                onDataPushString(category, body);
            }
            else
            {
                body = dict ["body"].ToString();
                byte[] data = Convert.FromBase64String(body);
                onDataPushBase64(category, data, body);
            }
        }
        public static void getStatus()
        {
            Dictionary <string, object> status = new Dictionary <string, object>();

            status.Add("deviceId", "UnityEditor");
            status.Add("pluginVersion", EngagementAgent.PLUGIN_VERSION);
            status.Add("nativeVersion", "0");
            status.Add("isEnabled", false);
            string serialized = MiniJSON.Json.Serialize(status);

            EngagementAgent.Instance().onStatusReceived(serialized);
        }
示例#3
0
 public static void onDataPushBase64(string _category, byte [] _data, string _body)
 {
     EngagementAgent.Logging("onDataPushBase64, category:" + _category);
     if (Base64DataPushReceived != null)
     {
         Base64DataPushReceived(_category, _data, _body);
     }
     else
     {
         EngagementAgent.Logging("WARNING: unitialized Base64DataPushReceived");
     }
 }
示例#4
0
        // Delegates from Native

        public static void onDataPushString(string _category, string _body)
        {
            EngagementAgent.Logging("onDataPushString, category:" + _category);
            if (StringDataPushReceived != null)
            {
                StringDataPushReceived(_category, _body);
            }
            else
            {
                EngagementAgent.Logging("WARNING: unitialized StringDataPushReceived");
            }
        }
示例#5
0
 public static void onHandleURLMessage(string _url)
 {
     EngagementAgent.Logging("OnHandleURL: " + _url);
     if (HandleURL != null)
     {
         HandleURL(_url);
     }
     else
     {
         EngagementAgent.Logging("WARNING: unitialized HandleURL");
     }
 }
 public static EngagementAgent Instance()
 {
     if (null == _instance)
     {
         _instance = (EngagementAgent)GameObject.FindObjectOfType(typeof(EngagementAgent));
         if (null == _instance)
         {
             GameObject go = new GameObject("EngagementAgentObj");
             _instance = go.AddComponent(typeof(EngagementAgent)) as EngagementAgent;
             Logging("Initializing EngagementAgent v" + PLUGIN_VERSION);
         }
     }
     return(_instance);
 }
示例#7
0
        public static void Initialize( )
        {
            EngagementAgent.Logging("Initializing Reach");

            if (EngagementConfiguration.ENABLE_REACH == false)
            {
                Debug.LogError("Reach must be enabled in configuration first");
                return;
            }

            if (EngagementAgent.hasBeenInitialized == false)
            {
                Debug.LogError("Agent must be initialized before initializing Reach");
                return;
            }
#if UNITY_WSA && !UNITY_EDITOR
#else
            EngagementWrapper.initializeReach();
#endif
        }