mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 06:38:01 +03:00
Cleanup
This commit is contained in:
parent
2fef034547
commit
84e38601d6
@ -25,6 +25,10 @@ namespace Facepunch.Steamworks
|
||||
|
||||
internal override bool IsGameServer { get { return true; } }
|
||||
|
||||
public ServerQuery Query;
|
||||
public ServerStats Stats;
|
||||
public ServerAuth Auth;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a Steam Server instance
|
||||
/// </summary>
|
||||
@ -66,6 +70,13 @@ namespace Facepunch.Steamworks
|
||||
BotCount = 0;
|
||||
MapName = "unset";
|
||||
|
||||
//
|
||||
// Child classes
|
||||
//
|
||||
Query = new ServerQuery( this );
|
||||
Stats = new ServerStats( this );
|
||||
Auth = new ServerAuth( this );
|
||||
|
||||
//
|
||||
// Run update, first call does some initialization
|
||||
//
|
||||
@ -238,5 +249,25 @@ namespace Facepunch.Steamworks
|
||||
{
|
||||
get { return native.gameServer.BLoggedOn(); }
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if ( Query != null )
|
||||
{
|
||||
Query = null;
|
||||
}
|
||||
|
||||
if ( Stats != null )
|
||||
{
|
||||
Stats = null;
|
||||
}
|
||||
|
||||
if ( Auth != null )
|
||||
{
|
||||
Auth = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,6 @@ using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Server
|
||||
{
|
||||
ServerAuth _auth;
|
||||
|
||||
public ServerAuth Auth
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _auth == null )
|
||||
_auth = new ServerAuth( this );
|
||||
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ServerAuth
|
||||
{
|
||||
internal Server server;
|
||||
|
@ -6,22 +6,9 @@ using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Server
|
||||
{
|
||||
ServerQuery _query;
|
||||
|
||||
public ServerQuery Query
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _query == null )
|
||||
_query = new ServerQuery( this );
|
||||
|
||||
return _query;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If you're manually processing the server queries, you should use this class.
|
||||
/// </summary>
|
||||
public class ServerQuery
|
||||
{
|
||||
internal Server server;
|
||||
@ -32,20 +19,39 @@ namespace Facepunch.Steamworks
|
||||
server = s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server query packet.
|
||||
/// </summary>
|
||||
public struct Packet
|
||||
{
|
||||
/// <summary>
|
||||
/// Target IP address
|
||||
/// </summary>
|
||||
public uint Address { get; internal set; }
|
||||
public byte[] Data { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Target port
|
||||
/// </summary>
|
||||
public ushort Port { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// This data is pooled. Make a copy if you don't use it immediately.
|
||||
/// This buffer is also quite large - so pay attention to Size.
|
||||
/// </summary>
|
||||
public byte[] Data { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of the data
|
||||
/// </summary>
|
||||
public int Size { get; internal set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true, Steam wants to send a packet. You should respond by sending
|
||||
/// this packet in an unconnected way to the returned Address and Port
|
||||
/// this packet in an unconnected way to the returned Address and Port.
|
||||
/// </summary>
|
||||
/// <param name="packet"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="packet">Packet to send. The Data passed is pooled - so use it immediately.</param>
|
||||
/// <returns>True if we want to send a packet</returns>
|
||||
public unsafe bool GetOutgoingPacket( out Packet packet )
|
||||
{
|
||||
packet = new Packet();
|
||||
|
@ -6,22 +6,6 @@ using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Server
|
||||
{
|
||||
ServerStats _stats;
|
||||
|
||||
public ServerStats Stats
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _stats == null )
|
||||
_stats = new ServerStats( this );
|
||||
|
||||
return _stats;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows getting and setting stats on users from the gameserver. These stats
|
||||
/// should have been set up on the Steamworks website for your app.
|
||||
|
Loading…
x
Reference in New Issue
Block a user