C# 클래스 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.
상속: MonoBehaviour
파일 보기 프로젝트 열기: devluz/webrtcnetwork 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
uJoin Button
uMessageField InputField,
uOpenRoom Button
uOutput MessageList,
uRoomName InputField,
uSend Button
uShutdown Button

공개 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
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

메소드 상세

Exit() 공개 메소드

Called if the Exit button is pressed. Quits the scene and shuts everything down.
public Exit ( ) : void
리턴 void

Join() 공개 메소드

Join button pressed. Tries to join a room.
public Join ( ) : void
리턴 void

OpenRoom() 공개 메소드

Open room button pressed. Opens a room / starts a server
public OpenRoom ( ) : void
리턴 void

SendButtonPressed() 공개 메소드

This is called if the send button
public SendButtonPressed ( ) : void
리턴 void

Shutdown() 공개 메소드

Shutdown button pressed. Shuts the network down.
public Shutdown ( ) : void
리턴 void

프로퍼티 상세

uJoin 공개적으로 프로퍼티

Join button to connect to a server.
public Button uJoin
리턴 Button

uMessageField 공개적으로 프로퍼티

Input field to enter a new message.
public InputField, uMessageField
리턴 InputField,

uOpenRoom 공개적으로 프로퍼티

Open room button to start a server.
public Button uOpenRoom
리턴 Button

uOutput 공개적으로 프로퍼티

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

uRoomName 공개적으로 프로퍼티

Input field used to enter the room name.
public InputField, uRoomName
리턴 InputField,

uSend 공개적으로 프로퍼티

Send button.
public Button uSend
리턴 Button

uShutdown 공개적으로 프로퍼티

Shutdown button. Disconnects all connections + shuts down the server if started.
public Button uShutdown
리턴 Button