Class SteamTransport
Transport for PurrNet integration.
Inheritance
Namespace: KaijuSolutions.SteamMultiplayerEngine.PurrNet
Syntax
public sealed class SteamTransport : GenericTransport
Fields
autoConnect
If we want to automatically connect with PurrNetwhen we join a lobby. Disabling could be used to implement a waiting room where players could choose characters or ready up before starting the actual game.
Declaration
public bool autoConnect
Field Value
Type | Description |
---|---|
System.Boolean |
autoDisconnect
If we want to automatically disconnect from the lobby when PurrNetdisconnects. Disabling could allow you to implement a character select screen or ready up screen you can return to or attempt to create custom host migration.
Declaration
public bool autoDisconnect
Field Value
Type | Description |
---|---|
System.Boolean |
PurrNetIdKey
Lobby member data key to sync the PurrNet ID. Note that as this is not directly part of the core library, there are no blocks stopping you from manually setting this elsewhere; you must ensure that yourself.
Declaration
public const string PurrNetIdKey = "_i"
Field Value
Type | Description |
---|---|
System.String |
Properties
Channel
What channel to send and receive messages on. Ensure this is different from the lifetime channel and the voice channel on the SteamManager.
Declaration
public int Channel { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
clientState
The state the client is in. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public ConnectionState clientState { get; }
Property Value
Type | Description |
---|---|
ConnectionState |
connections
The connections. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public IReadOnlyList<Connection> connections { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Connection> |
isSupported
Returns true if the transport is supported on the current platform. For example, WebGL does not support UDP or SteamTransport. This will return false if the transport is not supported. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override bool isSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Lifetime
What channel to use for connection and disconnect messages. Ensure this is different from the data channel and the voice channel on the SteamManager.
Declaration
public int Lifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
listenerState
The state the server is in. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public ConnectionState listenerState { get; }
Property Value
Type | Description |
---|---|
ConnectionState |
transport
Access the underlying transport interface. This is used for low-level operations and should not be used directly. Unless you know what you are doing. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override ITransport transport { get; }
Property Value
Type | Description |
---|---|
ITransport |
Methods
Assign()
Assign this as the transport.
Declaration
public bool Assign()
Returns
Type | Description |
---|---|
System.Boolean | If this was assigned or already was assigned. |
AssignBindable()
Assign this as the transport.
Declaration
public void AssignBindable()
CloseConnection(Connection)
Close a connection. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void CloseConnection(Connection conn)
Parameters
Type | Name | Description |
---|---|---|
Connection | conn | The connection to close. |
Connect()
Handle manually starting PurrNetif auto connect is disabled.
Declaration
public static bool Connect()
Returns
Type | Description |
---|---|
System.Boolean | If the networking was started or was already running. |
Connect(String, UInt16)
Start connecting as a client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void Connect(string ip, ushort port)
Parameters
Type | Name | Description |
---|---|---|
System.String | ip | The unused IP address. |
System.UInt16 | port | The unused port. |
ConnectBindable()
Handle manually starting PurrNetif auto connect is disabled.
Declaration
public static void ConnectBindable()
Disconnect()
Disconnect as a client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void Disconnect()
Listen(UInt16)
Start listening as the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void Listen(ushort port)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | port | The unused port. |
PurrNetToSteam(UInt64)
Get the corresponding Steam ID for a PurrNet ID.
Declaration
public static ulong PurrNetToSteam(ulong purr)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | purr | The PurrNet ID. |
Returns
Type | Description |
---|---|
System.UInt64 | The associated Steam ID or zero if there is no match. |
RaiseDataReceived(Connection, ByteData, Boolean)
Handle when data has been received. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void RaiseDataReceived(Connection conn, ByteData data, bool asServer)
Parameters
Type | Name | Description |
---|---|---|
Connection | conn | The connection the data was received from. |
ByteData | data | The received data. |
System.Boolean | asServer | If this is as the server or as a client. |
RaiseDataSent(Connection, ByteData, Boolean)
Handle when data has been sent. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void RaiseDataSent(Connection conn, ByteData data, bool asServer)
Parameters
Type | Name | Description |
---|---|---|
Connection | conn | The connection the data was sent to. |
ByteData | data | The sent data. |
System.Boolean | asServer | If this is as the server or as a client. |
ReceiveMessages(Single)
Listen to receive any messages. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void ReceiveMessages(float delta)
Parameters
Type | Name | Description |
---|---|---|
System.Single | delta | The unused time since messages were last received. |
SendMessages(Single)
Send any messages. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void SendMessages(float delta)
Parameters
Type | Name | Description |
---|---|---|
System.Single | delta | The time since messages were last sent. |
SendToClient(Connection, ByteData, Channel)
Send data to a client from the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void SendToClient(Connection target, ByteData data, Channel method = null)
Parameters
Type | Name | Description |
---|---|---|
Connection | target | The client to send to. |
ByteData | data | The data to send. |
Channel | method | The mode to send in. |
SendToServer(ByteData, Channel)
Send data from a client to the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void SendToServer(ByteData data, Channel method = null)
Parameters
Type | Name | Description |
---|---|---|
ByteData | data | The data to send. |
Channel | method | The mode to send in. |
Shutdown()
Handle manually stopping PurrNet.
Declaration
public void Shutdown()
StartClientInternal()
Start the client.
Declaration
protected override void StartClientInternal()
StartServerInternal()
Start the server.
Declaration
protected override void StartServerInternal()
SteamToPurrNet(UInt64)
Get the corresponding PurrNet ID for a Steam ID.
Declaration
public static ulong SteamToPurrNet(ulong steam)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | steam | The Steam ID. |
Returns
Type | Description |
---|---|
System.UInt64 | The associated PurrNet ID or the max value if there is no match. |
StopListening()
Stop listening as the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public void StopListening()
Events
onConnected
Callback for when a connection has been established. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public event OnConnected onConnected
Event Type
Type | Description |
---|---|
OnConnected |
onConnectionState
Callback for when the connection state has changed. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public event OnConnectionState onConnectionState
Event Type
Type | Description |
---|---|
OnConnectionState |
onDataReceived
Callback for when data has been received. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public event OnDataReceived onDataReceived
Event Type
Type | Description |
---|---|
OnDataReceived |
onDataSent
Callback for when data has been sent. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public event OnDataSent onDataSent
Event Type
Type | Description |
---|---|
OnDataSent |
onDisconnected
Callback for when a disconnection has happened. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public event OnDisconnected onDisconnected
Event Type
Type | Description |
---|---|
OnDisconnected |
OnStarted
Callback for when the PurrNet instance has started.
Declaration
public static event SteamManager.EmptyEventHandler OnStarted
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |
OnStopped
Callback for when the PurrNet instance has stopped.
Declaration
public static event SteamManager.EmptyEventHandler OnStopped
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |
OnStopping
Callback for when the networking is shutting down in case data needs to be serialized for host migration.
Declaration
public static event SteamManager.EmptyEventHandler OnStopping
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |