From 6e807c8e4d8710501b3d960e4b873756fc609ab2 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 6 Dec 2017 11:58:36 +0000 Subject: [PATCH] Added Friend.GetAvatar( size ) --- Facepunch.Steamworks.Test/Client/FriendsTest.cs | 2 ++ Facepunch.Steamworks/Client/Friends.cs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Facepunch.Steamworks.Test/Client/FriendsTest.cs b/Facepunch.Steamworks.Test/Client/FriendsTest.cs index fdc8292..e039980 100644 --- a/Facepunch.Steamworks.Test/Client/FriendsTest.cs +++ b/Facepunch.Steamworks.Test/Client/FriendsTest.cs @@ -24,6 +24,8 @@ public void FriendList() foreach ( var friend in client.Friends.All ) { Console.WriteLine( "{0}: {1} (Friend:{2}) (Blocked:{3})", friend.Id, friend.Name, friend.IsFriend, friend.IsBlocked ); + + Assert.IsNotNull(friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium )); } } } diff --git a/Facepunch.Steamworks/Client/Friends.cs b/Facepunch.Steamworks/Client/Friends.cs index d0eaa55..38f318c 100644 --- a/Facepunch.Steamworks/Client/Friends.cs +++ b/Facepunch.Steamworks/Client/Friends.cs @@ -127,6 +127,15 @@ public void Refresh() Client.native.friends.RequestFriendRichPresence( Id ); } + + /// + /// This will return null if you don't have the target user's avatar in your cache. + /// Which usually happens for people not on your friends list. + /// + public Image GetAvatar( Friends.AvatarSize size ) + { + return Client.Friends.GetCachedAvatar( size, Id ); + } } ///