C# Class Luz.ULib.Net.UnityNetwork

This is a helper class for testing only. It implements the same IBasicNetwork interface as WebRTCNetwork but works on all Unity platforms. You can use this class to test your network in Unity without having to build a browser version. This class will be replaced by a C++ WebRTC library in the future, until then you won't be able to connect to browsers from the editor! This class isn't very well designed and uses the old deprecated unity network.
Inheritance: UnityEngine.MonoBehaviour, IBasicNetwork
显示文件 Open project: devluz/webrtcnetwork Class Usage Examples

Public Properties

Property Type Description
UserIdAll int
UserIdError int
sName String
uActualAverageSendRate float
uTargetSendRate float
uUnityConfigSendRate float

Private Properties

Property Type Description
AddClientSide void
AddServerSide void
Awake void
DeliverMessage void
InitializeConnection void
NetworkPlayerToConnectionId ConnectionId
NextConnectionId ConnectionId
OnConnectedToServer void
OnDestroy void
OnDisconnectedFromServer void
OnFailedToConnect void
OnPlayerConnected void
OnPlayerDisconnected void
OnServerInitialized void

Public Methods

Method Description
Connect ( string address ) : ConnectionId
ConnectToGuid ( string guid ) : void
Dequeue ( NetworkEvent &evt ) : bool
Disconnect ( ConnectionId id ) : void
Flush ( ) : void
Get ( ) : UnityNetwork
IsAvailable ( ) : bool
SendData ( ConnectionId userId, byte data, int offset, int length, bool reliable ) : void
Shutdown ( ) : void
SingleEndpoint_OnSerialize ( BitStream stream, NetworkPlayer senderOrReceiver ) : void
StartServer ( ) : void
StartServer ( int port ) : void
TakeSession ( ) : void

Used to initialize the UnityNetwork class after the server was started or the client connected.

Update ( ) : void

Private Methods

Method Description
AddClientSide ( NetworkViewID recieverId, NetworkMessageInfo info ) : void
AddServerSide ( NetworkViewID id, NetworkMessageInfo info ) : void
Awake ( ) : void
DeliverMessage ( byte data, NetworkMessageInfo info ) : void
InitializeConnection ( NetworkPlayer player ) : void
NetworkPlayerToConnectionId ( NetworkPlayer pl ) : ConnectionId
NextConnectionId ( ) : ConnectionId
OnConnectedToServer ( ) : void
OnDestroy ( ) : void
OnDisconnectedFromServer ( NetworkDisconnection info ) : void
OnFailedToConnect ( NetworkConnectionError error ) : void
OnPlayerConnected ( NetworkPlayer player ) : void
OnPlayerDisconnected ( NetworkPlayer player ) : void
OnServerInitialized ( ) : void

Method Details

Connect() public method

public Connect ( string address ) : ConnectionId
address string
return ConnectionId

ConnectToGuid() public method

public ConnectToGuid ( string guid ) : void
guid string
return void

Dequeue() public method

public Dequeue ( NetworkEvent &evt ) : bool
evt NetworkEvent
return bool

Disconnect() public method

public Disconnect ( ConnectionId id ) : void
id ConnectionId
return void

Flush() public method

public Flush ( ) : void
return void

Get() public static method

public static Get ( ) : UnityNetwork
return UnityNetwork

IsAvailable() public static method

public static IsAvailable ( ) : bool
return bool

SendData() public method

public SendData ( ConnectionId userId, byte data, int offset, int length, bool reliable ) : void
userId ConnectionId
data byte
offset int
length int
reliable bool
return void

Shutdown() public method

public Shutdown ( ) : void
return void

SingleEndpoint_OnSerialize() public method

public SingleEndpoint_OnSerialize ( BitStream stream, NetworkPlayer senderOrReceiver ) : void
stream UnityEngine.BitStream
senderOrReceiver UnityEngine.NetworkPlayer
return void

StartServer() public method

public StartServer ( ) : void
return void

StartServer() public method

public StartServer ( int port ) : void
port int
return void

TakeSession() public method

Used to initialize the UnityNetwork class after the server was started or the client connected.
public TakeSession ( ) : void
return void

Update() public method

public Update ( ) : void
return void

Property Details

UserIdAll public_oe static_oe property

public static int UserIdAll
return int

UserIdError public_oe static_oe property

public static int UserIdError
return int

sName public_oe static_oe property

public static String sName
return String

uActualAverageSendRate public_oe property

public float uActualAverageSendRate
return float

uTargetSendRate public_oe property

public float uTargetSendRate
return float

uUnityConfigSendRate public_oe property

public float uUnityConfigSendRate
return float