コード例 #1
0
 public void Replace(FriendCollection other)
 {
     this.id = other.id;
     this.friends.Clear();
     foreach (var f in other.friends)
     {
         this.friends.Add(f);
     }
 }
コード例 #2
0
        private void AddFriend(INetUser user, INetUser targetUser, Action <FriendCollection> onSuccess, Action <INetError> onError)
        {
            WWWForm form = new WWWForm();

            form.AddField("op", "add_friend");
            form.AddField("user_id", user.id);
            form.AddField("target_user_id", targetUser.id);
            MakeRequest(form, json => {
                Dictionary <string, object> dict = MiniJSON.Json.Deserialize(json) as Dictionary <string, object>;
                if (dict == null)
                {
                    onError?.Invoke(errorFactory.Create(NetErrorCode.json, string.Empty));
                }
                else
                {
                    FriendCollection friendCollection = new FriendCollection(dict, resourceService);
                    onSuccess?.Invoke(friendCollection);
                }
            }, onError);
        }