From 83aa37ce4f2ec97bbc17b21b6217d0b78b326d3d Mon Sep 17 00:00:00 2001 From: Lukas Kastern Date: Fri, 11 Oct 2019 16:44:27 +0200 Subject: [PATCH] Added SteamFriends.GetFriendsWithFlag Added SteamFriends.GetFriendsWithFlag. Reworked SteamFriends.GetFriends and SteamFriends.GetBlocked to work upon it. I also had to expose the FriendFlags. --- Facepunch.Steamworks/Generated/SteamEnums.cs | 6 +++--- Facepunch.Steamworks/SteamFriends.cs | 18 ++++++++++-------- Generator/Cleanup.cs | 1 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Facepunch.Steamworks/Generated/SteamEnums.cs b/Facepunch.Steamworks/Generated/SteamEnums.cs index 32a5027..262f8a5 100644 --- a/Facepunch.Steamworks/Generated/SteamEnums.cs +++ b/Facepunch.Steamworks/Generated/SteamEnums.cs @@ -580,12 +580,12 @@ public enum FriendState : int LookingToPlay = 6, Invisible = 7, Max = 8, - } + } // // EFriendFlags // - internal enum FriendFlags : int + public enum FriendFlags : int { None = 0, Blocked = 1, @@ -600,7 +600,7 @@ internal enum FriendFlags : int ChatMember = 4096, All = 65535, } - + // // EUserRestriction // diff --git a/Facepunch.Steamworks/SteamFriends.cs b/Facepunch.Steamworks/SteamFriends.cs index 2f3263b..8be5d34 100644 --- a/Facepunch.Steamworks/SteamFriends.cs +++ b/Facepunch.Steamworks/SteamFriends.cs @@ -111,21 +111,23 @@ static unsafe void OnFriendChatMessage( GameConnectedFriendChatMsg_t data ) OnChatMessage( friend, typeName, message ); } } + + public static IEnumerable GetFriendsWithFlag(FriendFlags flag) + { + for ( int i=0; i GetFriends() { - for ( int i=0; i GetBlocked() { - for ( int i = 0; i < Internal.GetFriendCount( (int)FriendFlags.Blocked ); i++ ) - { - yield return new Friend( Internal.GetFriendByIndex( i, (int)FriendFlags.Blocked) ); - } + return GetFriendsWithFlag(FriendFlags.Blocked); } public static IEnumerable GetPlayedWith() diff --git a/Generator/Cleanup.cs b/Generator/Cleanup.cs index 3cd01ed..eecf489 100644 --- a/Generator/Cleanup.cs +++ b/Generator/Cleanup.cs @@ -65,6 +65,7 @@ public static bool ShouldCreate( string type ) internal static string Expose( string name ) { if ( name == "FriendState" ) return "public"; + if (name == "FriendFlags") return "public"; if ( name == "MusicStatus" ) return "public"; if ( name == "ParentalFeature" ) return "public"; if ( name == "AuthResponse" ) return "public";