示例#1
0
        static void GetFriends(Client client)
        {
            var response = Friends.Get(client, 0);

            if (response == null)
            {
                Console.WriteLine("response is null!");
                return;
            }

            if (response.GetType() == typeof(Friends))
            {
                var friends = (Friends)response;
                foreach (var friend in friends.Data)
                {
                    Console.WriteLine(friend.Name);
                }
            }
            else if (response.GetType() == typeof(Error))
            {
                Console.WriteLine(((Error)response).Message);
            }
            else
            {
                Console.WriteLine("Incorrect type:" + response.GetType());
            }
        }
        public void GetFriends()
        {
            Debug.Log("GetFriends. Click to see source.");

            Friends.Get(friends => {
                if (friends == null)
                {
                    AddConsoleLine("GetFriends failed (are you signed in?)");
                }
                else
                {
                    AddConsoleLine("You have {0} friends.", friends.Length);
                    foreach (var friend in friends)
                    {
                        PrintUserInfo(friend);
                    }
                }
            });
        }