예제 #1
0
    private IEnumerator AddFriend(string userID, string friendID, Result <bool> result)
    {
        Result <StorageAccountInfo> res = new Result <StorageAccountInfo>(this);

        yield return(StartCoroutine(storage.GetAccountByUserID(userID, res)));

        var user   = res.Value;
        var friend = res.Value;

        if (user != null && friend != null)
        {
            Result <LobbyUserGroupInfo> r = new Result <LobbyUserGroupInfo>(this);
            yield return(StartCoroutine(storage.GetFriends(user.userID, r)));

            var friendsList = r.Value;
            friendsList.members.Add(friend.userID);
            Result <bool> rr = new Result <bool>(this);
            yield return(StartCoroutine(storage.SetFriends(user.userID, friendsList, rr)));

            result.SetValue(rr.Value);
            yield break;
        }
        result.SetValue(false);
        yield break;
    }