Integration Ideas
If it is your own small game, you can save friends and other information directly on the pro-server, by invoking the API to operate.
Our games only use the SDK communication function, friends and other information stored on their own server.
Users login to the game, through the algorithm with the user's unique ID to the pro-plus SDK. (To log in to the Chat SDK User ID or create a group ID can be used by the user ID/Guild IDs and then transform the algorithm to create one, to avoid duplication)
The game server does not integrate with the Pro SDK, only the front-end integration.
The following SDK refers to the pro-Plus Chat SDK API interface
Server notification front end game login success: front-end-Invoke Chat SDK API login, front-end-get chat room list from server, enter World chat room via SDK, (guild) Chat Group (if there is a guild)
Server notifies front end to create Guild success: Front end-SDK Create (guild) Chat Group
Server notification front end Join Guild success: Frontend-Invoke SDK to enter (guild) Chat Group
The server notifies the front end guild to kick out the player/player Exit Guild Success: Frontend-Invoke SDK exit (guild) Chat Group etc.
Voice API UsageNote: If you test on a PC, send voice, you need to plug in a headset with Mike, or a microphone, to voice success. You must listen for Chatlistener, or you cannot receive a callback.
Create Voice1. Start recording
Api. Starttalk (new Gotyeuser (talktoname), Gotyewhinemode.gotyewhinemodedefault,false,600000 );
2. End Recording
Api. Stoptalk ();
3. In the Stoptalk callback, send the voice
Public void BOOL Realtime, Gotyemessage message) { ///Starttalk If the parameter is real-time voice must be false, otherwise the message is null//Send voice
Api. SendMessage (message);}
Receive voice
Receive messages (text/picture/voice)
Public Override voidonreceivemessage (Gotyemessage message) {if(Message. Type = =gotyemessagetype.text) {}Else if(Message. Type = =gotyemessagetype.audio) {if(File.exists (message. Media.path))//If you have this voice file locally, play this message directly{API. Playmessage (message); } Else { //Download Voice filesAPI. Downloadmediainmessage (message); } } }
Download voice/Picture files and play
Public voidondownloadmediainmessage (gotyestatuscode code, gotyemessage message) {if(Code = =gotyestatuscode.codeok) {if(Message. Type = =gotyemessagetype.image) {Debug.Log ("download the message in the picture successfully!"); } Else if(Message. Type = =gotyemessagetype.audio) {Debug.Log ("the audio in the message was downloaded successfully!"); Gotyemedia Media=message. Media;//Play VoiceAPI. Playmessage (message); } } }
Unity Hand Travel Chat SDK integration and use two