diff --git a/Facepunch.Steamworks/Client/Friends.cs b/Facepunch.Steamworks/Client/Friends.cs index b898e64..068fa6f 100644 --- a/Facepunch.Steamworks/Client/Friends.cs +++ b/Facepunch.Steamworks/Client/Friends.cs @@ -21,6 +21,34 @@ public Friends Friends } } + public class SteamFriend + { + /// + /// Steam Id + /// + public ulong Id { get; internal set; } + + /// + /// Return true if is a friend. Returns false if blocked, request etc. + /// + public bool IsFriend { get; internal set; } + + /// + /// Returns true if this friend is playing a game (and we know about it) + /// + public bool IsPlaying { get; internal set; } + + /// + /// If they're current in a game, what are they playing? + /// + public int CurrentAppId; + + /// + /// Their current display name + /// + public string Name; + } + public class Friends { internal Client client; @@ -36,5 +64,80 @@ public string GetName( ulong steamid ) return client.native.friends.GetFriendPersonaName( steamid ); } + + private List _allFriends; + + public IEnumerable All + { + get + { + if ( _allFriends == null ) + { + _allFriends = new List(); + Refresh(); + } + + return _allFriends; + } + } + + public void Refresh() + { + _allFriends.Clear(); + + //client.native.friends.GetFriendCount( 0 ); + + } + + public enum AvatarSize + { + /// + /// Should be 32x32 - but make sure to check! + /// + Small, + + /// + /// Should be 64x64 - but make sure to check! + /// + Medium, + + /// + /// Should be 184x184 - but make sure to check! + /// + Large + } + + public Image GetAvatar( AvatarSize size, ulong steamid ) + { + var imageid = 0; + + switch ( size ) + { + case AvatarSize.Small: + imageid = client.native.friends.GetSmallFriendAvatar( steamid ); + break; + case AvatarSize.Medium: + imageid = client.native.friends.GetMediumFriendAvatar( steamid ); + break; + case AvatarSize.Large: + imageid = client.native.friends.GetLargeFriendAvatar( steamid ); + break; + } + + uint width = 0; + uint height = 0; + + if ( imageid != 0) + { + client.native.utils.GetImageSize( imageid, ref width, ref height ); + } + + return new Image() + { + Id = imageid, + Width = (int)width, + Height = (int)height + }; + } } } diff --git a/Facepunch.Steamworks/Client/Image.cs b/Facepunch.Steamworks/Client/Image.cs new file mode 100644 index 0000000..ea4f440 --- /dev/null +++ b/Facepunch.Steamworks/Client/Image.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Facepunch.Steamworks +{ + public class Image + { + public int Id { get; internal set; } + public int Width { get; internal set; } + public int Height { get; internal set; } + + + } +} diff --git a/Facepunch.Steamworks/Facepunch.Steamworks.csproj b/Facepunch.Steamworks/Facepunch.Steamworks.csproj index c9525de..b0b1cb0 100644 --- a/Facepunch.Steamworks/Facepunch.Steamworks.csproj +++ b/Facepunch.Steamworks/Facepunch.Steamworks.csproj @@ -122,6 +122,7 @@ +