diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/io/networked_multiplayer_peer.cpp | 5 | ||||
-rw-r--r-- | core/io/networked_multiplayer_peer.h | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp index f172fef570..851064b6e8 100644 --- a/core/io/networked_multiplayer_peer.cpp +++ b/core/io/networked_multiplayer_peer.cpp @@ -12,11 +12,16 @@ void NetworkedMultiplayerPeer::_bind_methods() { ObjectTypeDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll ); + ObjectTypeDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status ); BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE ); BIND_CONSTANT( TRANSFER_MODE_RELIABLE ); BIND_CONSTANT( TRANSFER_MODE_ORDERED ); + BIND_CONSTANT( CONNECTION_DISCONNECTED ); + BIND_CONSTANT( CONNECTION_CONNECTING ); + BIND_CONSTANT( CONNECTION_CONNECTED ); + ADD_SIGNAL( MethodInfo("peer_connected",PropertyInfo(Variant::STRING,"id"))); ADD_SIGNAL( MethodInfo("peer_disconnected",PropertyInfo(Variant::STRING,"id"))); } diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h index 535f20f199..d8143b02c0 100644 --- a/core/io/networked_multiplayer_peer.h +++ b/core/io/networked_multiplayer_peer.h @@ -17,6 +17,12 @@ public: TRANSFER_MODE_ORDERED }; + enum ConnectionStatus { + CONNECTION_DISCONNECTED, + CONNECTION_CONNECTING, + CONNECTION_CONNECTED, + }; + virtual void set_transfer_mode(TransferMode p_mode)=0; virtual void set_target_peer(const StringName& p_peer_id)=0; @@ -26,12 +32,14 @@ public: virtual StringName get_packet_peer() const=0; virtual int get_packet_channel() const=0; - virtual void poll()=0; + virtual ConnectionStatus get_connection_status() const=0; + NetworkedMultiplayerPeer(); }; VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::TransferMode ) +VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::ConnectionStatus ) #endif // NetworkedMultiplayerPeer_H |