mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-14 15:48:06 +03:00
NumericalFilter struct and suggested changes
Added NumericalFilter struct, changed the dictionary for numerical filters into a list of the struct, removed IsOwner from Friend and SteamClient and added IsOwnedBy( SteamId ) to Lobby
This commit is contained in:
parent
db41c0f407
commit
9442689b02
@ -170,11 +170,6 @@ namespace Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static AppId AppId { get; internal set; }
|
public static AppId AppId { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if this SteamClient owns the specified lobby
|
|
||||||
/// </summary>
|
|
||||||
public static bool OwnsLobby( Lobby k ) => k.Owner.Id == SteamId;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't
|
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't
|
||||||
/// this returns true then it starts the Steam client if required and launches your game again through it,
|
/// this returns true then it starts the Steam client if required and launches your game again through it,
|
||||||
|
@ -71,11 +71,6 @@ namespace Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSnoozing => State == FriendState.Snooze;
|
public bool IsSnoozing => State == FriendState.Snooze;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if this Friend owns the specified lobby
|
|
||||||
/// </summary>
|
|
||||||
public bool OwnsLobby( Lobby k ) => k.Owner.Id == this.Id;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Relationship Relationship => SteamFriends.Internal.GetFriendRelationship( Id );
|
public Relationship Relationship => SteamFriends.Internal.GetFriendRelationship( Id );
|
||||||
|
@ -210,5 +210,9 @@ namespace Steamworks.Data
|
|||||||
set => SteamMatchmaking.Internal.SetLobbyOwner( Id, value.Id );
|
set => SteamMatchmaking.Internal.SetLobbyOwner( Id, value.Id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the specified SteamId owns the lobby
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,7 +64,7 @@ namespace Steamworks.Data
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Numerical filters
|
#region Numerical filters
|
||||||
internal Dictionary<KeyValuePair<string, int>, LobbyComparison> numericalFilters;
|
internal List<NumericalFilter> numericalFilters;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numerical filter where value is less than the value provided
|
/// Numerical filter where value is less than the value provided
|
||||||
@ -114,9 +114,9 @@ namespace Steamworks.Data
|
|||||||
throw new System.ArgumentException( $"Key length is longer than {SteamMatchmaking.MaxLobbyKeyLength}", nameof( key ) );
|
throw new System.ArgumentException( $"Key length is longer than {SteamMatchmaking.MaxLobbyKeyLength}", nameof( key ) );
|
||||||
|
|
||||||
if ( numericalFilters == null )
|
if ( numericalFilters == null )
|
||||||
numericalFilters = new Dictionary<KeyValuePair<string, int>, LobbyComparison>();
|
numericalFilters = new List<NumericalFilter>();
|
||||||
|
|
||||||
numericalFilters.Add( new KeyValuePair<string, int>( key, value ), compare );
|
numericalFilters.Add( new NumericalFilter( key, value, compare ) );
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ namespace Steamworks.Data
|
|||||||
{
|
{
|
||||||
foreach ( var n in numericalFilters )
|
foreach ( var n in numericalFilters )
|
||||||
{
|
{
|
||||||
SteamMatchmaking.Internal.AddRequestLobbyListNumericalFilter( n.Key.Key, n.Key.Value, n.Value );
|
SteamMatchmaking.Internal.AddRequestLobbyListNumericalFilter( n.Key, n.Value, n.Comparer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
Facepunch.Steamworks/Structs/NumericalFilter.cs
Normal file
20
Facepunch.Steamworks/Structs/NumericalFilter.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Steamworks.Data
|
||||||
|
{
|
||||||
|
struct NumericalFilter
|
||||||
|
{
|
||||||
|
public string Key { get; internal set; }
|
||||||
|
public int Value { get; internal set; }
|
||||||
|
public LobbyComparison Comparer { get; internal set; }
|
||||||
|
|
||||||
|
internal NumericalFilter ( string k, int v, LobbyComparison c )
|
||||||
|
{
|
||||||
|
Key = k;
|
||||||
|
Value = v;
|
||||||
|
Comparer = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user