C# Class ChatApp, webrtcnetwork

Contains a complete chat example. It can either run in the editor using the old unity network or in the browser as WebGL/HTML5 using WebRtc. The chat app will report during start which system it uses. The user can enter a room name and click the "Open room" button to start a server and wait for incomming connections or use the "Join room" button to join an already existing room. Note: Unity network uses random numbers / guid to idendify a server. The room name entered by the user will be ignored. As the system implements a server/client style connection all messages will first be sent to the server and the server delivers it to each client. The server side ConnectionId is used to idendify a user.
Inheritance: MonoBehaviour
Afficher le fichier Open project: devluz/webrtcnetwork Class Usage Examples

Méthodes publiques

Свойство Type Description
uJoin Button
uMessageField InputField,
uOpenRoom Button
uOutput MessageList,
uRoomName InputField,
uSend Button
uShutdown Button

Méthodes publiques

Méthode Description
Exit ( ) : void

Called if the Exit button is pressed. Quits the scene and shuts everything down.

Join ( ) : void

Join button pressed. Tries to join a room.

OpenRoom ( ) : void

Open room button pressed. Opens a room / starts a server

SendButtonPressed ( ) : void

This is called if the send button

Shutdown ( ) : void

Shutdown button pressed. Shuts the network down.

Private Methods

Méthode Description
Append ( string text ) : void

Adds a new message to the message view

FixedUpdate ( ) : void
HandleIncommingMessage ( NetworkEvent &evt ) : void
HandleNetwork ( ) : void
OnGUI ( ) : void
SendString ( string msg, bool reliable = true ) : void

Sends a string as UTF8 byte array to all connections

SetGuiState ( bool isDisconnected ) : void

Changes the gui depending on if the user is connected or disconnected

Start ( ) : void

Method Details

Exit() public méthode

Called if the Exit button is pressed. Quits the scene and shuts everything down.
public Exit ( ) : void
Résultat void

Join() public méthode

Join button pressed. Tries to join a room.
public Join ( ) : void
Résultat void

OpenRoom() public méthode

Open room button pressed. Opens a room / starts a server
public OpenRoom ( ) : void
Résultat void

SendButtonPressed() public méthode

This is called if the send button
public SendButtonPressed ( ) : void
Résultat void

Shutdown() public méthode

Shutdown button pressed. Shuts the network down.
public Shutdown ( ) : void
Résultat void

Property Details

uJoin public_oe property

Join button to connect to a server.
public Button uJoin
Résultat Button

uMessageField public_oe property

Input field to enter a new message.
public InputField, uMessageField
Résultat InputField,

uOpenRoom public_oe property

Open room button to start a server.
public Button uOpenRoom
Résultat Button

uOutput public_oe property

Output message list to show incomming and sent messages + output messages of the system itself.
public MessageList, uOutput
Résultat MessageList,

uRoomName public_oe property

Input field used to enter the room name.
public InputField, uRoomName
Résultat InputField,

uSend public_oe property

Send button.
public Button uSend
Résultat Button

uShutdown public_oe property

Shutdown button. Disconnects all connections + shuts down the server if started.
public Button uShutdown
Résultat Button