diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index 929a4e9..d56c596 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -16,7 +16,7 @@ namespace Facepunch.Steamworks public ulong SteamId { get; private set; } /// - /// Current Beta name, if ser + /// Current Beta name, if we're using a beta branch. /// public string BetaName { get; private set; } @@ -36,12 +36,6 @@ namespace Facepunch.Steamworks 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 @@ namespace Facepunch.Steamworks 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 @@ namespace Facepunch.Steamworks base.Update(); } + /// + /// Call when finished to shut down the Steam client. + /// public override void Dispose() { if ( Voice != null ) diff --git a/Facepunch.Steamworks/Server.cs b/Facepunch.Steamworks/Server.cs index 6b5824e..c3c3392 100644 --- a/Facepunch.Steamworks/Server.cs +++ b/Facepunch.Steamworks/Server.cs @@ -6,6 +6,11 @@ using System.Runtime.InteropServices; namespace Facepunch.Steamworks { + /// + /// Initialize this class for Game Servers. + /// + /// Game servers offer a limited amount of Steam functionality - and don't require the Steam client. + /// public partial class Server : BaseSteamworks { /// @@ -20,6 +25,15 @@ namespace Facepunch.Steamworks internal override bool IsGameServer { get { return true; } } + /// + /// Initialize a Steam Server instance + /// + /// You game's AppId + /// The IP Address to bind to. Can be 0 to mean "any". + /// The port you game listens to for connections. + /// The port Steam should use for server queries. + /// True if you want to use VAC + /// A string defining version, ie "1001" public Server( uint appId, uint IpAddress, ushort GamePort, ushort QueryPort, bool Secure, string VersionString ) { native = new Interop.NativeInterface(); @@ -34,14 +48,6 @@ namespace Facepunch.Steamworks 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 @@ namespace Facepunch.Steamworks /// /// 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. /// 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 @@ namespace Facepunch.Steamworks private string _modDir = ""; /// - /// Gets or sets the current Product + /// Gets or sets the current product. This isn't really used. /// public string Product { @@ -173,7 +177,7 @@ namespace Facepunch.Steamworks private string _serverName = ""; /// - /// Gets or sets the current Passworded + /// Set whether the server should report itself as passworded /// public bool Passworded { @@ -183,7 +187,8 @@ namespace Facepunch.Steamworks private bool _passworded; /// - /// 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. /// public string GameTags { @@ -193,7 +198,7 @@ namespace Facepunch.Steamworks private string _gametags = ""; /// - /// Log onto Steam anonymously + /// Log onto Steam anonymously. /// public void LogOnAnonymous() { @@ -203,7 +208,10 @@ namespace Facepunch.Steamworks Dictionary KeyValue = new Dictionary(); /// - /// 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. /// public void SetKey( string Key, string Value ) { @@ -222,11 +230,20 @@ namespace Facepunch.Steamworks native.gameServer.SetKeyValue( Key, Value ); } + /// + /// 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. + /// public void UpdatePlayer( ulong steamid, string name, int score ) { native.gameServer.BUpdateUserData( steamid, name, (uint) score ); } + /// + /// Returns true if the server is connected and registered with the Steam master server + /// You should have called LogOnAnonymous etc on startup. + /// public bool LoggedOn { get { return native.gameServer.BLoggedOn(); }