Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
ConnectionStatus
MultiplayerPeer.swift:30enum ConnectionStatus
Cases
case disconnected
The MultiplayerPeer is disconnected.
case connecting
The MultiplayerPeer is currently connecting to a server.
case connected
This MultiplayerPeer is connected.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (22) members.
Types
class Signal1
Signal support.
class Signal2
Signal support.
enum TransferMode
Type members
static let targetPeerBroadcast: Int
Packets are sent to all connected peers.
static let targetPeerServer: Int
Packets are sent to the remote peer acting as server.
class var godotClassName: StringName
Instance members
var peerConnected: Signal1
Emitted when a remote peer connects.
var peerDisconnected: Signal2
Emitted when a remote peer has disconnected.
var refuseNewConnections: Bool
If
true
, thisMultiplayerPeer
refuses new connections.var transferChannel: Int32
The channel to use to send packets. Many network APIs such as ENet and WebRTC allow the creation of multiple independent channels which behaves, in a way, like separate connections. This means that reliable data will only block delivery of other packets on that channel, and ordering will only be in respect to the channel the packet is being sent on. Using different channels to send different and independent state updates is a common way to optimize network usage and decrease latency in fast-paced games.
var transferMode: MultiplayerPeer.TransferMode
The manner in which to send packets to the target peer. See
TransferMode
, and thesetTargetPeer(id:)
method.func close(
) Immediately close the multiplayer peer returning to the state .connectionDisconnected. Connected peers will be dropped without emitting [signal peer_disconnected].
func disconnectPeer(Int32, force: Bool
) Disconnects the given
peer
from this host. Ifforce
istrue
the [signal peer_disconnected] signal will not be emitted for this peer.func generateUniqueId(
) -> UInt32 Returns a randomly generated integer that can be used as a network unique ID.
func getConnectionStatus(
) -> MultiplayerPeer.ConnectionStatus Returns the current state of the connection. See
ConnectionStatus
.func getPacketChannel(
) -> Int32 Returns the channel over which the next available packet was received. See
getAvailablePacketCount
.func getPacketMode(
) -> MultiplayerPeer.TransferMode Returns the transfer mode the remote peer used to send the next available packet. See
getAvailablePacketCount
.func getPacketPeer(
) -> Int32 Returns the ID of the
MultiplayerPeer
who sent the next available packet. SeegetAvailablePacketCount
.func getUniqueId(
) -> Int32 Returns the ID of this
MultiplayerPeer
.func isServerRelaySupported(
) -> Bool Returns true if the server can act as a relay in the current configuration (i.e. if the higher level
MultiplayerAPI
should notify connected clients of other peers, and implement a relay protocol to allow communication between them).func poll(
) Waits up to 1 second to receive a new network event.
func setTargetPeer(id: Int32
) Sets the peer to which packets will be sent.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.