Ejemplo n.º 1
0
		private void ParseData(JSONObject item) {
			
			var settings = this.socialModule.GetSettings<FBSettings>();
			var mainPhoto = settings.profileMainPhoto;

			var picture = item.GetField("picture");
			if (picture.isContainer == true) {

				picture = picture.GetField("data");
				if (picture.isContainer == true) {

					var url = picture.GetField("url").str;
					this.photoIsDefault = picture.GetField("is_silhouette").b;
					SocialSystem.LoadImage(mainPhoto == "photo_50", this.photo_50 = url, (texture, result) => this.photo_50_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));

				}

			}

			var items = item.GetField("devices");
			if (items != null && items.IsArray == true) {

				this.devices = new List<UserDevice>();
				foreach (var device in items.list) {

					this.devices.Add(new UserDevice(device));

				}

			}

			this.SetSex(item.GetField("gender").str);
			this.SetUserID(item.GetField("id").str);
			this.SetUserName(item.GetField("name").str);

			this.bdate = item.GetField("birthday").str;
			
			this.about = item.GetField("about").str;
			this.bio = item.GetField("bio").str;
			this.installed = item.GetField("installed").b;
			this.is_verified = item.GetField("is_verified").b;
			this.link = item.GetField("link").str;
			this.locale = item.GetField("locale").str;
			this.political = item.GetField("political").str;
			this.relationship_status = item.GetField("relationship_status").str;
			this.religion = item.GetField("religion").str;
			this.quotes = item.GetField("quotes").str;
			this.third_party_id = item.GetField("third_party_id").str;
			this.timezone = item.GetField("timezone").f;
			this.token_for_business = item.GetField("token_for_business").str;
			this.verified = item.GetField("verified").b;
			this.website = item.GetField("website").str;

			this.SetAuthenticated(true);
			this.SetState(UnityEngine.SocialPlatforms.UserState.Online);

		}
		public UserDevice(JSONObject json) {

			this.hardware = json.GetField("hardware").str;
			this.os = json.GetField("os").str;

		}
Ejemplo n.º 3
0
		public override List<ISocialUser> ParseUsers(string inputData) {
			
			var result = new List<ISocialUser>();

			var data = new JSONObject(inputData);

			var field = data.GetField("data");
			if (field.IsArray == true) {

				foreach (var item in field.list) {
					
					var user = new FBLocalUser();
					user.socialModule = this.socialModule;
					user.userData = item.ToString();
					user.ParseData(item);

					result.Add(user);
					
				}

			}

			return result;
			
		}
		public static Keyframe ToKeyframe(JSONObject obj){
			Keyframe k = new Keyframe(obj.HasField("time")? obj.GetField("time").f : 0, obj.HasField("value")? obj.GetField("value").f : 0);
			if(obj.HasField("inTangent")) k.inTangent = obj.GetField("inTangent").f;
			if(obj.HasField("outTangent")) k.outTangent = obj.GetField("outTangent").f;
			if(obj.HasField("tangentMode")) k.tangentMode = (int)obj.GetField("tangentMode").f;
			
			return k;
		}
		public static AnimationCurve ToAnimationCurve(JSONObject obj){
			AnimationCurve a = new AnimationCurve();
			if(obj.HasField("keys")){
				JSONObject keys = obj.GetField("keys");
				for(int i =0; i < keys.list.Count;i++){
					a.AddKey(ToKeyframe(keys[i]));
				}
			}
			if(obj.HasField("preWrapMode"))
				a.preWrapMode = (WrapMode)((int)obj.GetField("preWrapMode").n);
			if(obj.HasField("postWrapMode"))
				a.postWrapMode = (WrapMode)((int)obj.GetField("postWrapMode").n);
			return a;
		}
Ejemplo n.º 6
0
		private void ParseData(JSONObject item) {
			
			this.SetSex((int)item.GetField("sex").n);
			this.SetUserID(item.GetField("uid").d.ToString());
			this.SetUserName(string.Format("{0} {1}", item.GetField("first_name").str, item.GetField("last_name").str));
			
			this.onlineState = (int)item.GetField("online").n;
			
			this.SetAuthenticated(true);
			this.SetState(UnityEngine.SocialPlatforms.UserState.Online);
			
			var settings = this.socialModule.GetSettings<VKSettings>();
			var mainPhoto = settings.profileMainPhoto;
			
			SocialSystem.LoadImage(mainPhoto == "photo_50", this.photo_50 = item.GetField("photo_50").str,				(texture, result) => this.photo_50_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_100", this.photo_100 = item.GetField("photo_100").str,				(texture, result) => this.photo_100_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_200_orig", this.photo_200_orig = item.GetField("photo_200_orig").str,	(texture, result) => this.photo_200_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_200", this.photo_200 = item.GetField("photo_200").str,				(texture, result) => this.photo_200_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_400_orig", this.photo_400_orig = item.GetField("photo_400_orig").str,	(texture, result) => this.photo_400_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_max", this.photo_max = item.GetField("photo_max").str,				(texture, result) => this.photo_max_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));
			SocialSystem.LoadImage(mainPhoto == "photo_max_orig", this.photo_max_orig = item.GetField("photo_max_orig").str,	(texture, result) => this.photo_max_orig_image = texture as Texture2D, (texture) => this.SetImage(texture as Texture2D));

		}
Ejemplo n.º 7
0
		// site	returns a website address from a user profile.
		
		protected override void OnUserParse() {
			
			var data = new JSONObject(this.userData);
			
			var field = data.GetField("response");
			if (field.IsArray == true) {
				
				var item = field.list[0];
				
				this.ParseData(item);
				
			}
			
		}