Beispiel #1
0
        public override void Init()
        {
            base.Init();

            if (!data.ContainsKey("id"))
            {
                data.Add("id", null);
            }

#if PREVENT_READ_PHONE_STATE
            if (!data.ContainsKey("deviceId"))
            {
                data.Add("deviceId", UnityEngine.Random.Range(100000000, 999999999).ToString());
            }
#else
            if (!data.ContainsKey("deviceId"))
            {
                data.Add("deviceId", SystemInfo.deviceUniqueIdentifier);
            }
#endif

            if (!data.ContainsKey("facebookId"))
            {
                data.Add("facebookId", null);
            }
            if (!data.ContainsKey("email"))
            {
                data.Add("email", null);
            }
            if (!data.ContainsKey("name"))
            {
                data.Add("name", null);
            }
            if (!data.ContainsKey("firstName"))
            {
                data.Add("firstName", null);
            }
            if (!data.ContainsKey("lastName"))
            {
                data.Add("lastName", null);
            }
            if (!data.ContainsKey("gender"))
            {
                data.Add("gender", 0);
            }

            if (!data.ContainsKey("socialName"))
            {
                data.Add("socialName", null);
            }
            if (!data.ContainsKey("gameCenterId"))
            {
                data.Add("gameCenterId", null);
            }
            if (!data.ContainsKey("googleGamesId"))
            {
                data.Add("googleGamesId", null);
            }

            if (!data.ContainsKey("status"))
            {
                data.Add("status", 0);
            }

            if (!data.ContainsKey("revenue"))
            {
                data.Add("revenue", 0.0f);
            }

            if (!data.ContainsKey("version"))
            {
                data.Add("version", build.version);
            }
            if (version != build.version)
            {
                data["version"] = build.version;
            }

            if (!data.ContainsKey("deviceInfo"))
            {
                data.Add("deviceInfo", Json.Serialize(SG_Utils.deviceInfo));
            }

            if (!data.ContainsKey("firstDate"))
            {
                data.Add("firstDate", SG_Utils.dateNowFormated);
            }

            if (!data.ContainsKey("firstVersion"))
            {
                data.Add("firstVersion", build.version);
            }

            TutorialLoad();

            //if (!data.ContainsKey("invitedBy")) data.Add("invitedBy", null);

            Analytic.SetUserProperties(new Dictionary <string, object>()
            {
                { "firstDate", firstDate },
                { "firstVersion", firstVersion },
                { "version", version },
            });

            StartCoroutine(SyncCoroutine());
        }
Beispiel #2
0
        public virtual void SetFacebookData(IDictionary <string, object> facebookData)
        {
            if (facebookData == null)
            {
                return;
            }

            object temp;

            bool isFirstTimeFacebookLogin = string.IsNullOrEmpty(facebookId);

            if (facebookData.TryGetValue("id", out temp))
            {
                facebookId = (string)temp;
            }
            if (facebookData.TryGetValue("name", out temp))
            {
                fullName = (string)temp;
            }
            if (facebookData.TryGetValue("first_name", out temp))
            {
                firstName = (string)temp;
            }
            if (facebookData.TryGetValue("last_name", out temp))
            {
                lastName = (string)temp;
            }
            if (facebookData.TryGetValue("email", out temp))
            {
                email = (string)temp;
            }
            if (facebookData.TryGetValue("gender", out temp))
            {
                gender = (string)temp == "male" ? Gender.Male : Gender.Female;
            }

            if (isFirstTimeFacebookLogin)
            {
                Analytic.SetUserProperties(new Dictionary <string, object>()
                {
                    { "facebookId", facebookId },
                    { "fullName", fullName },
                    { "email", email },
                    { "gender", gender.ToString() },
                });
            }

            //        {
            //  "id": "10204916518582922",
            //  "first_name": "Sergey",
            //  "last_name": "Kopov",
            //  "gender": "male",
            //  "age_range": {
            //    "min": 21
            //  },
            //  "email": "*****@*****.**",
            //  "friends": {
            //    "data": [
            //      {
            //        "first_name": "Nadia",
            //        "id": "10152536787152921",
            //        "picture": {
            //          "data": {
            //            "height": 200,
            //            "is_silhouette": false,
            //            "url": "https://scontent.xx.fbcdn.net/hprofile-xtp1/v/t1.0-1/c3.0.200.200/p200x200/12644751_10153453883592921_1769918035433820971_n.jpg?oh=ae9422673558c11eaad585a82de045cf&oe=573DE034",
            //            "width": 200
            //          }
            //        }
            //      },
            //      {
            //        "first_name": "Cassy",
            //        "id": "10154104640055550",
            //        "picture": {
            //          "data": {
            //            "height": 200,
            //            "is_silhouette": false,
            //            "url": "https://scontent.xx.fbcdn.net/hprofile-xlp1/v/t1.0-1/c0.0.200.200/p200x200/10427686_10154497538070550_3539351136513485076_n.jpg?oh=1a4559e9d234287f48671a833b2f0083&oe=573BC92F",
            //            "width": 200
            //          }
            //        }
            //      }
            //    ],
            //    "paging": {
            //      "next": "https://graph.facebook.com/v2.5/10204916518582922/friends?limit=2&fields=first_name,id,picture.width%28200%29.height%28200%29&access_token=CAALCpbbMpiMBAEusGokZAW2MglA6eo7hOOr0Bte0iGUeP2HmA4aUuApcBGt0MuK9dzmfLtezVgvRm6Lawe1lzFkME2FdTppzObiKX8cZASVeIohXHrg8IskTJ2Vba5hHnEbbgDYi5YxkYf1X1KHPzqdauU7bI2Jzsd4nyawtPZCwyyRSCRvndYP0ZAY7dTAT0WPgYO1YQThjOtWHiyRt&offset=2&__after_id=enc_AdCcdnvoxFY4TsuUZBK9NZBDuNXorDAxRY7WslZCiOZAhZBFZCwwJ0ohRCuTXWZAtmSFkCXdXMZD"
            //    },
            //    "summary": {
            //      "total_count": 905
            //    }
            //  },
            //  "invitable_friends": {
            //    "data": [
            //      {
            //        "first_name": "Александр",
            //        "picture": {
            //          "data": {
            //            "height": 200,
            //            "is_silhouette": false,
            //            "url": "https://scontent.xx.fbcdn.net/hprofile-xpl1/v/t1.0-1/p200x200/12688194_948009925247283_7846382134337642944_n.jpg?oh=ef70ffec6fc5dfbec6ed3e7253dc5b6b&oe=576C6440",
            //            "width": 200
            //          }
            //        },
            //        "id": "AVmIeKb_xKyqoqtwSoN34bz8KTNtizuCKdCEZSdXxPrunRHVdE5oYKYNWjvhblCTfGwj7BiW-EuqRXspVpzelG37fiy3fpQRt3FNz-mKJeTr-A"
            //      },
            //      {
            //        "first_name": "Aleksey",
            //        "picture": {
            //          "data": {
            //            "height": 200,
            //            "is_silhouette": false,
            //            "url": "https://scontent.xx.fbcdn.net/hprofile-xta1/v/t1.0-1/p200x200/10406801_10205409122241644_5094310415932755059_n.jpg?oh=b21d13d5389a85f96c0b62b2522f1323&oe=572DAF99",
            //            "width": 200
            //          }
            //        },
            //        "id": "AVnm11pdjHBaxE0x0yyVAVZMTy6dRekqtVWTT5YkGJ0m9k9tMwu_2Ow8Dskm2BE-7JmPvKUKpl84HyB5Oo1VMYHa2gPBttc9yYS742OF9e0jvw"
            //      }
            //    ],
            //    "paging": {
            //      "cursors": {
            //        "before": "QVZAraThVa2ozSDNQdnV1N1F1SWM5VFhHLTZAGaU1XdVBSQUpoMGRyaEYyZAm15bC0yWF9CcVNvY1VONGp6Q2h6c0xWQUFKM0FCckljcmYwVzZArQ0ZABdUdlM2EyaDlyWXkwbUQzMTZAaYkloeWRaRVEZD",
            //        "after": "QVZAtRzR2andlT19xMjZAIX1plMTYxTk5DZAHRuNE8wV1RuYXFKUmotYTF5d19UQkxrSFAwZAmtTRmF6ZAzh6aGhwM0UxelhJUmcyVFhrVEZAhYXMtQl9jWkp5anZAwRWNiSWh4a2RvZAVpVRV9sWkx4dmcZD"
            //      },
            //      "next": "https://graph.facebook.com/v2.5/10204916518582922/invitable_friends?access_token=CAALCpbbMpiMBAEusGokZAW2MglA6eo7hOOr0Bte0iGUeP2HmA4aUuApcBGt0MuK9dzmfLtezVgvRm6Lawe1lzFkME2FdTppzObiKX8cZASVeIohXHrg8IskTJ2Vba5hHnEbbgDYi5YxkYf1X1KHPzqdauU7bI2Jzsd4nyawtPZCwyyRSCRvndYP0ZAY7dTAT0WPgYO1YQThjOtWHiyRt&pretty=0&fields=first_name%2Cpicture.width%28200%29.height%28200%29&limit=2&after=QVZAtRzR2andlT19xMjZAIX1plMTYxTk5DZAHRuNE8wV1RuYXFKUmotYTF5d19UQkxrSFAwZAmtTRmF6ZAzh6aGhwM0UxelhJUmcyVFhrVEZAhYXMtQl9jWkp5anZAwRWNiSWh4a2RvZAVpVRV9sWkx4dmcZD"
            //    }
            //  }
            //}
        }