Use smartfoxserver in Unity

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.