This is an example that shows P2P between server in <installation folder>/ProudNet/Sample/Chat and C/S & other clients. Please execute ChatUnity after executing the server.
2.1ChatUnity execution order.
First of all, open <installation folder>/ProudNet/Sample/Chat/ChatUnity/Assets/Scenes/logOn.unity.
Please compile PIDL by executing <installation file>/ProudNet/Sample/Chat/ChatUnity/PIDL.bat.
The following window will be shown when executing ChatUnity right after executing server of chat.
logOn Scene. Please set ServerIP & UserName here and if clicking LogOn button, it will try to connect to the server. If connection is successful, it will be converted to the next scene.
globalChat Scene. Please input the required information in the following window and if clicking Send button, chatting with other clients will be allowed. When clicking G_Chat on the top, you can also see this scene.
If clicking UserList on the top, it will be converted to userList Scene. At this scene, you can check other clients that are connected to the server. Click the desired client to check and if clicking Create button, P2P group between clients that have been checked will be created, and then chatting by P2P will be possible. At this time, you will be automatically joined the relevant group.
If clicking Room on the top or Create button at UserList, it will be converted to p2pChatRoom Scene. At this scene, you can check the list of P2PGroup in which the relevant client is joined and if clicking the relevant Group button, it will be converted to P2PChat Scene.
P2PChat Scene. If clicking Send button right after inputting required information in the following window, chat messages will be sent to the relevant P2PGroup. If clicking Back button on the top, you will go back to p2pChatRoom Scene. If clicking Leave Room button, you will go back to p2pChatRoom Scene. You will leave P2PGroup, so you can no longer check the relevant group in p2pChatRoom Scene.
2.2explanation of a script that is used at Unity3D.
Client : It is a client class. It has been made by Singleton Pattern not to be dissipated when being converted. It has actual Nettention.Proud.NetClient and the part of communication has been made in this script.
LogOn : It is a script that is operated in logon Scene. IP address for communication with a server and GUI for username input have been made.
GlobalChat : It is a script that is operated in globalChat Scene. GUI for showing the entire chatting between clients that are connected to a server has been made.
UserList : It is a script that is operated in userlist Scene. GUI for showing the list of clients that are connected to a server has been made.
P2PChatRoom : It is a script that is operated in p2pChatRoom Scene. GUI for showing the list of P2P Group in which the relevant client is included has been made.
P2PChat : It is a script that is operated in p2pChat Scene. GUI for showing chatting between P2P Groups that has been selected from p2pChatRoom Scenehas been made.
Vars : Common part that is used at many scripts & version for server connection & Vars class that includes port have been defined.
_common,_proxy,_stub : This file is the result of PIDL compile. PIDL file that is same as PIDL of <installation folder>/ProudNet/Sample/chat sample has been compiled. Please refer to 9. Include PIDL compiled result .