More comments

This commit is contained in:
Garry Newman 2016-11-03 13:49:32 +00:00
parent 11733c48e7
commit c27df08194
2 changed files with 37 additions and 26 deletions

View File

@ -16,7 +16,7 @@ public partial class Client : BaseSteamworks
public ulong SteamId { get; private set; }
/// <summary>
/// Current Beta name, if ser
/// Current Beta name, if we're using a beta branch.
/// </summary>
public string BetaName { get; private set; }
@ -36,12 +36,6 @@ public Client( uint appId )
return;
}
//
// Set up warning hook callback
//
// SteamAPIWarningMessageHook ptr = InternalOnWarning;
// native.client.SetWarningMessageHook( Marshal.GetFunctionPointerForDelegate( ptr ) );
//
// Setup interfaces that client and server both have
//
@ -69,9 +63,6 @@ public Client( uint appId )
Update();
}
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
public delegate void SteamAPIWarningMessageHook( int nSeverity, System.Text.StringBuilder pchDebugText );
private void InternalOnWarning( int nSeverity, System.Text.StringBuilder text )
{
if ( OnMessage != null )
@ -94,6 +85,9 @@ public override void Update()
base.Update();
}
/// <summary>
/// Call when finished to shut down the Steam client.
/// </summary>
public override void Dispose()
{
if ( Voice != null )

View File

@ -6,6 +6,11 @@
namespace Facepunch.Steamworks
{
/// <summary>
/// Initialize this class for Game Servers.
///
/// Game servers offer a limited amount of Steam functionality - and don't require the Steam client.
/// </summary>
public partial class Server : BaseSteamworks
{
/// <summary>
@ -20,6 +25,15 @@ public partial class Server : BaseSteamworks
internal override bool IsGameServer { get { return true; } }
/// <summary>
/// Initialize a Steam Server instance
/// </summary>
/// <param name="appId">You game's AppId</param>
/// <param name="IpAddress">The IP Address to bind to. Can be 0 to mean "any".</param>
/// <param name="GamePort">The port you game listens to for connections.</param>
/// <param name="QueryPort">The port Steam should use for server queries.</param>
/// <param name="Secure">True if you want to use VAC</param>
/// <param name="VersionString">A string defining version, ie "1001"</param>
public Server( uint appId, uint IpAddress, ushort GamePort, ushort QueryPort, bool Secure, string VersionString )
{
native = new Interop.NativeInterface();
@ -34,14 +48,6 @@ public Server( uint appId, uint IpAddress, ushort GamePort, ushort QueryPort, bo
return;
}
//
// Set up warning hook callback
//
// SteamAPIWarningMessageHook ptr = InternalOnWarning;
// var d = Marshal.GetFunctionPointerForDelegate( ptr );
// var rr = GCHandle.Alloc( d );
// native.utils.SetWarningMessageHook( d );
//
// Setup interfaces that client and server both have
//
@ -68,15 +74,13 @@ public Server( uint appId, uint IpAddress, ushort GamePort, ushort QueryPort, bo
/// <summary>
/// Initialize a server - query port will use the same as GamePort (MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE)
/// This means you'll need to detect and manually process and reply to server queries.
/// </summary>
public Server( uint appId, uint IpAddress, ushort GamePort, bool Secure, string VersionString ) : this( appId, IpAddress, GamePort, 0xFFFF, Secure, VersionString )
{
}
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
public delegate void SteamAPIWarningMessageHook( int nSeverity, string pchDebugText );
private void InternalOnWarning( int nSeverity, string text )
{
if ( OnMessage != null )
@ -143,7 +147,7 @@ public string ModDir
private string _modDir = "";
/// <summary>
/// Gets or sets the current Product
/// Gets or sets the current product. This isn't really used.
/// </summary>
public string Product
{
@ -173,7 +177,7 @@ public string ServerName
private string _serverName = "";
/// <summary>
/// Gets or sets the current Passworded
/// Set whether the server should report itself as passworded
/// </summary>
public bool Passworded
{
@ -183,7 +187,8 @@ public bool Passworded
private bool _passworded;
/// <summary>
/// Gets or sets the current GameTags
/// Gets or sets the current GameTags. This is a comma seperated list of tags for this server.
/// When querying the server list you can filter by these tags.
/// </summary>
public string GameTags
{
@ -193,7 +198,7 @@ public string GameTags
private string _gametags = "";
/// <summary>
/// Log onto Steam anonymously
/// Log onto Steam anonymously.
/// </summary>
public void LogOnAnonymous()
{
@ -203,7 +208,10 @@ public void LogOnAnonymous()
Dictionary<string, string> KeyValue = new Dictionary<string, string>();
/// <summary>
/// Sets a Key Value
/// Sets a Key Value. These can be anything you like, and are accessible
/// when querying servers from the server list.
///
/// Information describing gamemodes are common here.
/// </summary>
public void SetKey( string Key, string Value )
{
@ -222,11 +230,20 @@ public void SetKey( string Key, string Value )
native.gameServer.SetKeyValue( Key, Value );
}
/// <summary>
/// Update this connected player's information. You should really call this
/// any time a player's name or score changes. This keeps the information shown
/// to server queries up to date.
/// </summary>
public void UpdatePlayer( ulong steamid, string name, int score )
{
native.gameServer.BUpdateUserData( steamid, name, (uint) score );
}
/// <summary>
/// Returns true if the server is connected and registered with the Steam master server
/// You should have called LogOnAnonymous etc on startup.
/// </summary>
public bool LoggedOn
{
get { return native.gameServer.BLoggedOn(); }