Unstable 1.1.14.0

This commit is contained in:
Markus Isberg
2023-10-02 16:43:54 +03:00
parent 94f5a93a0c
commit cf8f0de659
606 changed files with 21906 additions and 11456 deletions
+58 -30
View File
@@ -5,6 +5,9 @@ using System.Threading.Tasks;
namespace Steamworks.Data
{
/// <summary>
/// Represents a Steam lobby.
/// </summary>
public struct Lobby
{
public SteamId Id { get; internal set; }
@@ -18,8 +21,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Try to join this room. Will return RoomEnter.Success on success,
/// and anything else is a failure
/// Try to join this room. Will return <see cref="RoomEnter.Success"/> on success,
/// and anything else is a failure.
/// </summary>
public async Task<RoomEnter> Join()
{
@@ -41,9 +44,9 @@ namespace Steamworks.Data
}
/// <summary>
/// Invite another user to the lobby
/// will return true if the invite is successfully sent, whether or not the target responds
/// returns false if the local user is not connected to the Steam servers
/// Invite another user to the lobby.
/// Will return <see langword="true"/> if the invite is successfully sent, whether or not the target responds
/// returns <see langword="false"/> if the local user is not connected to the Steam servers
/// </summary>
public bool InviteFriend( SteamId steamid )
{
@@ -51,12 +54,12 @@ namespace Steamworks.Data
}
/// <summary>
/// returns the number of users in the specified lobby
/// Gets the number of users in this lobby.
/// </summary>
public int MemberCount => SteamMatchmaking.Internal?.GetNumLobbyMembers( Id ) ?? 0;
/// <summary>
/// Returns current members. Need to be in the lobby to see the users.
/// Returns current members in the lobby. The current user must be in the lobby in order to see the users.
/// </summary>
public IEnumerable<Friend> Members
{
@@ -72,7 +75,7 @@ namespace Steamworks.Data
/// <summary>
/// Get data associated with this lobby
/// Get data associated with this lobby.
/// </summary>
public string? GetData( string key )
{
@@ -80,7 +83,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Get data associated with this lobby
/// Set data associated with this lobby.
/// </summary>
public bool SetData( string key, string value )
{
@@ -91,7 +94,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Removes a metadata key from the lobby
/// Removes a metadata key from the lobby.
/// </summary>
public bool DeleteData( string key )
{
@@ -99,7 +102,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Get all data for this lobby
/// Get all data for this lobby.
/// </summary>
public IEnumerable<KeyValuePair<string, string>> Data
{
@@ -119,7 +122,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Gets per-user metadata for someone in this lobby
/// Gets per-user metadata for someone in this lobby.
/// </summary>
public string? GetMemberData( Friend member, string key )
{
@@ -127,7 +130,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Sets per-user metadata (for the local user implicitly)
/// Sets per-user metadata (for the local user implicitly).
/// </summary>
public void SetMemberData( string key, string value )
{
@@ -135,35 +138,44 @@ namespace Steamworks.Data
}
/// <summary>
/// Sends a string to the chat room
/// Sends a string to the chat room.
/// </summary>
public bool SendChatString( string message )
{
var data = System.Text.Encoding.UTF8.GetBytes( message );
//adding null terminator as it's used in Helpers.MemoryToString
var data = System.Text.Encoding.UTF8.GetBytes( message + '\0' );
return SendChatBytes( data );
}
/// <summary>
/// Sends bytes the the chat room
/// this isn't exposed because there's no way to read raw bytes atm,
/// and I figure people can send json if they want something more advanced
/// Sends bytes to the chat room.
/// </summary>
internal unsafe bool SendChatBytes( byte[] data )
public unsafe bool SendChatBytes( byte[] data )
{
fixed ( byte* ptr = data )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, data.Length );
return SendChatBytesUnsafe( ptr, data.Length );
}
}
/// <summary>
/// Sends bytes to the chat room from an unsafe buffer.
/// </summary>
public unsafe bool SendChatBytesUnsafe( byte* ptr, int length )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, length );
}
/// <summary>
/// Refreshes metadata for a lobby you're not necessarily in right now.
/// <para>
/// You never do this for lobbies you're a member of, only if your
/// this will send down all the metadata associated with a lobby.
/// This is an asynchronous call.
/// Returns false if the local user is not connected to the Steam servers.
/// Returns <see langword="false"/> if the local user is not connected to the Steam servers.
/// Results will be returned by a LobbyDataUpdate_t callback.
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false.
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to <see langword="false"/>.
/// </para>
/// </summary>
public bool Refresh()
{
@@ -171,8 +183,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Max members able to join this lobby. Cannot be over 250.
/// Can only be set by the owner
/// Max members able to join this lobby. Cannot be over <c>250</c>.
/// Can only be set by the owner of the lobby.
/// </summary>
public int MaxMembers
{
@@ -180,26 +192,42 @@ namespace Steamworks.Data
set => SteamMatchmaking.Internal?.SetLobbyMemberLimit( Id, value );
}
/// <summary>
/// Sets the lobby as public.
/// </summary>
public bool SetPublic()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Public );
}
/// <summary>
/// Sets the lobby as private.
/// </summary>
public bool SetPrivate()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Private );
}
/// <summary>
/// Sets the lobby as invisible.
/// </summary>
public bool SetInvisible()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Invisible );
}
/// <summary>
/// Sets the lobby as friends only.
/// </summary>
public bool SetFriendsOnly()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.FriendsOnly );
}
/// <summary>
/// Set whether or not the lobby can be joined.
/// </summary>
/// <param name="b">Whether or not the lobby can be joined.</param>
public bool SetJoinable( bool b )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyJoinable( Id, b );
@@ -207,7 +235,7 @@ namespace Steamworks.Data
/// <summary>
/// [SteamID variant]
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Steammatchmaking.OnLobbyGameCreated event.
/// </summary>
public void SetGameServer( SteamId steamServer )
@@ -220,7 +248,7 @@ namespace Steamworks.Data
/// <summary>
/// [IP/Port variant]
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Steammatchmaking.OnLobbyGameCreated event.
/// </summary>
public void SetGameServer( string ip, ushort port )
@@ -232,7 +260,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
/// valid and has a server set, otherwise returns false.
/// </summary>
public bool GetGameServer( ref uint ip, ref ushort port, ref SteamId serverId )
@@ -241,7 +269,7 @@ namespace Steamworks.Data
}
/// <summary>
/// You must be the lobby owner to set the owner
/// Gets or sets the owner of the lobby. You must be the lobby owner to set the owner
/// </summary>
public Friend Owner
{
@@ -250,8 +278,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Check if the specified SteamId owns the lobby
/// Check if the specified SteamId owns the lobby.
/// </summary>
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
}
}
}