mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Added SteamMatchmaking.GetFavoriteServers()
This commit is contained in:
parent
711bc7cb3d
commit
91e9e162f3
@ -143,5 +143,28 @@ static private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callbac
|
||||
return new Lobby { Id = lobby.Value.SteamIDLobby };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of servers that are on your favorites list
|
||||
/// </summary>
|
||||
public static IEnumerable<ServerInfo> GetFavoriteServers()
|
||||
{
|
||||
var count = Internal.GetFavoriteGameCount();
|
||||
|
||||
for( int i=0; i<count; i++ )
|
||||
{
|
||||
uint timeplayed = 0;
|
||||
uint flags = 0;
|
||||
ushort qport = 0;
|
||||
ushort cport = 0;
|
||||
uint ip = 0;
|
||||
AppId appid = default;
|
||||
|
||||
if ( Internal.GetFavoriteGame( i, ref appid, ref ip, ref cport, ref qport, ref flags, ref timeplayed ) )
|
||||
{
|
||||
yield return new ServerInfo( ip, cport, qport, timeplayed );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -78,10 +78,21 @@ internal static ServerInfo From( gameserveritem_t item )
|
||||
};
|
||||
}
|
||||
|
||||
public ServerInfo( uint ip, ushort cport, ushort qport, uint timeplayed ) : this()
|
||||
{
|
||||
AddressRaw = ip;
|
||||
Address = Utility.Int32ToIp( ip );
|
||||
ConnectionPort = cport;
|
||||
QueryPort = qport;
|
||||
LastTimePlayed = timeplayed;
|
||||
}
|
||||
|
||||
internal const uint k_unFavoriteFlagNone = 0x00;
|
||||
internal const uint k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
|
||||
internal const uint k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add this server to our history list
|
||||
/// If we're already in the history list, weill set the last played time to now
|
||||
|
Loading…
Reference in New Issue
Block a user