mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-04-26 23:09:37 +03:00
Fix #523: Make Lobby.SendChatBytes public.
Also add a unsafe variant that would require zero copies to a managed array.
This commit is contained in:
parent
47b9aca324
commit
27a0048c0e
@ -140,17 +140,23 @@ namespace Steamworks.Data
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends bytes the the chat room
|
/// 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
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal unsafe bool SendChatBytes( byte[] data )
|
public unsafe bool SendChatBytes( byte[] data )
|
||||||
{
|
{
|
||||||
fixed ( byte* ptr = data )
|
fixed ( byte* ptr = data )
|
||||||
{
|
{
|
||||||
return SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, data.Length );
|
return SendChatBytesUnsafe( ptr, data.Length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends bytes the the chat room from a unsafe buffer
|
||||||
|
/// </summary>
|
||||||
|
public unsafe bool SendChatBytesUnsafe( byte* ptr, int length )
|
||||||
|
{
|
||||||
|
return SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, length );
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refreshes metadata for a lobby you're not necessarily in right now
|
/// Refreshes metadata for a lobby you're not necessarily in right now
|
||||||
/// you never do this for lobbies you're a member of, only if your
|
/// you never do this for lobbies you're a member of, only if your
|
||||||
@ -202,7 +208,7 @@ namespace Steamworks.Data
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [SteamID variant]
|
/// [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.
|
/// Steammatchmaking.OnLobbyGameCreated event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetGameServer( SteamId steamServer )
|
public void SetGameServer( SteamId steamServer )
|
||||||
@ -215,7 +221,7 @@ namespace Steamworks.Data
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [IP/Port variant]
|
/// [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.
|
/// Steammatchmaking.OnLobbyGameCreated event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetGameServer( string ip, ushort port )
|
public void SetGameServer( string ip, ushort port )
|
||||||
@ -227,7 +233,7 @@ namespace Steamworks.Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// valid and has a server set, otherwise returns false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool GetGameServer( ref uint ip, ref ushort port, ref SteamId serverId )
|
public bool GetGameServer( ref uint ip, ref ushort port, ref SteamId serverId )
|
||||||
@ -249,4 +255,4 @@ namespace Steamworks.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
|
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user