The following content assumes that smartfoxsever has been successfully started.
For how to configure smartfoxserver and how to implement the extension of smartfoxserver, see http://www.smartfoxserver.com/docs/index.htm.
About how the client connects to and communicates with smartfoxserver. The official website of smartfoxserver also provides relevant information. See:
Http://www.smartfoxserver.com/labs/API/
This page provides all languages and platforms supported by the smartfoxserver client.
IPhone/iPod API
. Net/MONO/Unity 3D
Silverlight API
Java EE/SE/android
Director/Shockwave
Ajax
You can
Download http://download.csdn.net/detail/huangxiansheng1980/3596419to your desired database.
In unity, we can select C # and Java, but because unity supports C # rather than Java, we choose C #.
Download the corresponding library from the following URL, which also contains detailed examples, including how to connect to smartfoxserver.
There will be a DLL file located in./API/binaries/. All the things that directly interact with smartfoxserver are in this DLL. Copy this DLL file (smartfoxclient. dll) to the Plugins file under the assets file of Your Unity project. If you do not have this folder, create one manually.
Then, add:
Using smartfoxclientapi;
You can use the class. The simplest way is to connect the client to smartfoxserver:
Private string IP = "127.0.0.1 ";
Private int Port = 9339;
Private string statusmessage = "";
//----------------------------------------------------------
// Called when program starts
//----------------------------------------------------------
Void start ()
{
Smartfoxclient smartfox = new smartfoxclient ();
Sfsevent. onconnection + = handleconnection;
Smartfox. Connect (IP, Port );
}
For more details, see the example in the downloaded package and the official website of smartfoxserver: www.smartfoxserver.com.