Exemplo n.º 1
0
		public override object parseDataRespone(object result) 
		{
			Dictionary<string, object> data = (Dictionary<string, object>)result;
			List<object> list = (List<object>) data[GameConstants.RESPONE_KEY_LIST];
			
			List<FriendEntity> resultData = new List<FriendEntity>();
			
			foreach (object obj in list)
			{
				Dictionary<string, object> friend = (Dictionary<string, object>)obj;
				
				string avt = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_AVATAR]);
				string name = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_DISPLAYNAME]);
				string userId = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_USER_ID]);
				string level = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_LEVEL]);
				string score = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_SCORE]);
				string fbId = Helpers.GetStringNotNull (friend [GameConstants.RESPONE_KEY_FB_ID]);

				FriendEntity entity = new FriendEntity();
				entity.Avatar = avt;
				entity.Name = name;
				entity.UserId = userId;
				entity.Level = int.Parse(level);
				entity.Score = score;
				entity.FBId = fbId;

				resultData.Add(entity);
			}
			
			return resultData;
		}
Exemplo n.º 2
0
 public int CompareTo(FriendEntity other)
 {
     // Alphabetic sort if salary is equal. [A to Z]
     if (this.UserId == other.UserId)
     {
         return(0);
     }
     // Default to salary sort. [High to low]
     return(-1);
 }
Exemplo n.º 3
0
		public int CompareTo(FriendEntity other)
		{
			// Alphabetic sort if salary is equal. [A to Z]
			if (this.UserId == other.UserId)
			{
				return 0;
			}
			// Default to salary sort. [High to low]
			return -1;
		}
Exemplo n.º 4
0
	public void Init(FriendEntity friend)
	{
		NameLabel.text = friend.Name;
		StartCoroutine ( UserImage(friend.Avatar,Avatar));
	}
Exemplo n.º 5
0
	void getFriends (object obj)
	{
		lock (singletonLock)
		{
			try
			{
				Action<DBCallback> callback = (Action<DBCallback>)obj;

				List<FriendEntity> friends = new List<FriendEntity>();
				IEnumerable<FriendTable> dataTable = connection.Table<FriendTable>();

				foreach (FriendTable item in dataTable)
				{
					FriendEntity friend = new FriendEntity();
					friend.UserId = item.UserId;
					friend.Name = item.DisplayName;
					friend.Avatar = item.Avatar;
					friend.Gender = item.Gender;
					friend.Level = item.Level;
					friend.Score = item.Score;
					friend.FBId = item.FbId;

					friends.Add(friend);
			   } 
				DBCallback dbCallback = new DBCallback ();
				dbCallback.Data = friends;
				dbCallback.completedCallback = callback;
				DBCallbackDispatcher.Singleton.requests.Enqueue (dbCallback);
				Debug.Log("Completed: "+friends.Count);
			}
			catch(Exception ex)
			{
				Debug.LogWarning (ex.Message);
			}
		}
	}