Пример #1
0
        private string GetProfileMetaIOS()
        {
            string result = "";
            Dictionary <string, bool?> state = ProfileSettings.IntegrationState;

            result += ProfileSettings.iTunesAppId + "~";

            foreach (var entry in state)
            {
                Provider targetProvider = Provider.fromString(entry.Key);
                if (entry.Value.HasValue && entry.Value.Value)
                {
                    if (targetProvider == Provider.GOOGLE)
                    {
                        result += entry.Key + "^" + PlayerSettings.bundleIdentifier + "^" + ProfileSettings.GPEnableGS + "^" + ProfileSettings.GPClientId + ";";
                    }
                    else if (targetProvider == Provider.TWITTER)
                    {
                        result += entry.Key + "^" + ProfileSettings.TwitterConsumerKey + ";";
                    }
                    else if (targetProvider == Provider.GAME_CENTER)
                    {
                        result += entry.Key;
                    }
                }
            }

            return(result.ToString());
        }
Пример #2
0
        private static bool IsSocialPlatformDetected(string platform)
        {
            if (Provider.fromString(platform) == Provider.FACEBOOK)
            {
                Type fbType = Type.GetType("FB");
                return(fbType != null);
            }

            return(false);
        }
Пример #3
0
 public Leaderboard(JSONObject jsonLB)
 {
     this.ID       = jsonLB[PJSONConsts.UP_IDENTIFIER].str;
     this.Provider = Provider.fromString(jsonLB[PJSONConsts.UP_PROVIDER].str);
     if (jsonLB[PJSONConsts.UP_NAME] != null && jsonLB[PJSONConsts.UP_NAME].type == JSONObject.Type.STRING)
     {
         this.Name = jsonLB[PJSONConsts.UP_NAME].str;
     }
     else
     {
         this.Name = "";
     }
     if (jsonLB[PJSONConsts.UP_ICON_URL] != null && jsonLB[PJSONConsts.UP_ICON_URL].type == JSONObject.Type.STRING)
     {
         this.IconURL = jsonLB[PJSONConsts.UP_ICON_URL].str;
     }
     else
     {
         this.IconURL = "";
     }
 }
Пример #4
0
        /// <summary>
        /// Constructor.
        /// Generates an instance of <c>UserProfile</c> from the given <c>JSONObject</c>.
        /// </summary>
        /// <param name="jsonUP">A JSONObject representation of the wanted <c>UserProfile</c>.</param>
        public UserProfile(JSONObject jsonUP)
        {
            this.Provider  = Provider.fromString(jsonUP[PJSONConsts.UP_PROVIDER].str);
            this.Username  = jsonUP[PJSONConsts.UP_USERNAME].str;
            this.ProfileId = jsonUP[PJSONConsts.UP_PROFILEID].str;

            if (jsonUP[PJSONConsts.UP_FIRSTNAME])
            {
                this.FirstName = jsonUP[PJSONConsts.UP_FIRSTNAME].str;
            }
            else
            {
                this.FirstName = "";
            }
            if (jsonUP[PJSONConsts.UP_LASTNAME])
            {
                this.LastName = jsonUP[PJSONConsts.UP_LASTNAME].str;
            }
            else
            {
                this.LastName = "";
            }
            if (jsonUP[PJSONConsts.UP_EMAIL])
            {
                this.Email = jsonUP[PJSONConsts.UP_EMAIL].str;
            }
            else
            {
                this.Email = "";
            }
            if (jsonUP[PJSONConsts.UP_AVATAR])
            {
                this.AvatarLink = jsonUP[PJSONConsts.UP_AVATAR].str;
            }
            else
            {
                this.AvatarLink = "";
            }
            if (jsonUP[PJSONConsts.UP_LOCATION])
            {
                this.Location = jsonUP[PJSONConsts.UP_LOCATION].str;
            }
            else
            {
                this.Location = "";
            }
            if (jsonUP[PJSONConsts.UP_GENDER])
            {
                this.Gender = jsonUP[PJSONConsts.UP_GENDER].str;
            }
            else
            {
                this.Gender = "";
            }
            if (jsonUP[PJSONConsts.UP_LANGUAGE])
            {
                this.Language = jsonUP[PJSONConsts.UP_LANGUAGE].str;
            }
            else
            {
                this.Language = "";
            }
            if (jsonUP[PJSONConsts.UP_BIRTHDAY])
            {
                this.Birthday = jsonUP[PJSONConsts.UP_BIRTHDAY].str;
            }
            else
            {
                this.Birthday = "";
            }
            if (jsonUP[PJSONConsts.UP_ACCESSTOKEN])
            {
                this.AccessToken = jsonUP[PJSONConsts.UP_ACCESSTOKEN].str;
            }
            else
            {
                this.AccessToken = "";
            }
            if (jsonUP[PJSONConsts.UP_SECRETKEY])
            {
                this.SecretKey = jsonUP[PJSONConsts.UP_SECRETKEY].str;
            }
            else
            {
                this.SecretKey = "";
            }
        }
Пример #5
0
        /// <summary>
        /// Constructor.
        /// Generates an instance of <c>UserProfile</c> from the given <c>JSONObject</c>.
        /// </summary>
        /// <param name="jsonUP">A JSONObject representation of the wanted <c>UserProfile</c>.</param>
        public UserProfile(JSONObject jsonUP)
        {
            this.Provider  = Provider.fromString(jsonUP[PJSONConsts.UP_PROVIDER].str);
            this.Username  = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_USERNAME].str);
            this.ProfileId = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_PROFILEID].str);

            if (jsonUP[PJSONConsts.UP_FIRSTNAME] != null && jsonUP[PJSONConsts.UP_FIRSTNAME].type == JSONObject.Type.STRING)
            {
                this.FirstName = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_FIRSTNAME].str);
            }
            else
            {
                this.FirstName = "";
            }
            if (jsonUP[PJSONConsts.UP_LASTNAME] != null && jsonUP[PJSONConsts.UP_LASTNAME].type == JSONObject.Type.STRING)
            {
                this.LastName = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_LASTNAME].str);
            }
            else
            {
                this.LastName = "";
            }
            if (jsonUP[PJSONConsts.UP_EMAIL] != null && jsonUP[PJSONConsts.UP_EMAIL].type == JSONObject.Type.STRING)
            {
                this.Email = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_EMAIL].str);
            }
            else
            {
                this.Email = "";
            }
            if (jsonUP[PJSONConsts.UP_AVATAR] != null && jsonUP[PJSONConsts.UP_AVATAR].type == JSONObject.Type.STRING)
            {
                this.AvatarLink = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_AVATAR].str);
            }
            else
            {
                this.AvatarLink = "";
            }
            if (jsonUP[PJSONConsts.UP_LOCATION] != null && jsonUP[PJSONConsts.UP_LOCATION].type == JSONObject.Type.STRING)
            {
                this.Location = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_LOCATION].str);
            }
            else
            {
                this.Location = "";
            }
            if (jsonUP[PJSONConsts.UP_GENDER] != null && jsonUP[PJSONConsts.UP_GENDER].type == JSONObject.Type.STRING)
            {
                this.Gender = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_GENDER].str);
            }
            else
            {
                this.Gender = "";
            }
            if (jsonUP[PJSONConsts.UP_LANGUAGE] != null && jsonUP[PJSONConsts.UP_LANGUAGE].type == JSONObject.Type.STRING)
            {
                this.Language = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_LANGUAGE].str);
            }
            else
            {
                this.Language = "";
            }
            if (jsonUP[PJSONConsts.UP_BIRTHDAY] != null && jsonUP[PJSONConsts.UP_BIRTHDAY].type == JSONObject.Type.STRING)
            {
                this.Birthday = JSONObject.DecodeJsString(jsonUP[PJSONConsts.UP_BIRTHDAY].str);
            }
            else
            {
                this.Birthday = "";
            }
            this.Extra = new Dictionary <String, JSONObject>();
            if (jsonUP[PJSONConsts.UP_EXTRA] != null && jsonUP[PJSONConsts.UP_EXTRA].type == JSONObject.Type.OBJECT)
            {
                foreach (String key in jsonUP[PJSONConsts.UP_EXTRA].keys)
                {
                    this.Extra.Add(key, jsonUP[PJSONConsts.UP_EXTRA][key]);
                }
            }
        }
Пример #6
0
        void IntegrationGUI()
        {
            EditorGUILayout.LabelField("Social Platforms:", EditorStyles.boldLabel);

            ReadSocialIntegrationState(socialIntegrationState);

            EditorGUI.BeginChangeCheck();

            Dictionary <string, bool?> .KeyCollection keys = socialIntegrationState.Keys;
            for (int i = 0; i < keys.Count; i++)
            {
                string socialPlatform      = keys.ElementAt(i);
                bool?  socialPlatformState = socialIntegrationState[socialPlatform];

                EditorGUILayout.BeginHorizontal();

                bool update       = false;
                bool doIntegrate  = false;
                bool toggleResult = false;
                if (socialPlatformState != null)
                {
                    toggleResult = EditorGUILayout.Toggle(Provider.fromString(socialPlatform).DisplayName, socialPlatformState.Value);
                    if (toggleResult != socialPlatformState.Value)
                    {
                        socialIntegrationState[socialPlatform] = toggleResult;
                        doIntegrate = toggleResult;
                        update      = true;
                    }
                }
                else
                {
                    doIntegrate  = IsSocialPlatformDetected(socialPlatform);
                    toggleResult = EditorGUILayout.Toggle(socialPlatform, doIntegrate);

                    // User changed automatic value
                    if (doIntegrate != toggleResult)
                    {
                        doIntegrate = toggleResult;
                        socialIntegrationState[socialPlatform] = doIntegrate;
                        update = true;
                    }
                }

                if (update)
                {
                    ApplyIntegrationState(socialPlatform, doIntegrate);
                }

                EditorGUILayout.EndHorizontal();
                DrawPlatformParams(socialPlatform, !toggleResult);
                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();

            if (EditorGUI.EndChangeCheck())
            {
                WriteSocialIntegrationState();
            }
        }
Пример #7
0
 public Leaderboard(JSONObject jsonLB)
 {
     this.ID       = jsonLB[JSONConsts.SOOM_ENTITY_ID].str;
     this.Provider = Provider.fromString(jsonLB[PJSONConsts.UP_PROVIDER].str);
 }