unity3d 学习日志(一)

Debug.Log(“hello”);

用来输出日志。

建立至server的连接

 

using UnityEngine;
using System.Collections;
using Sfs2X;
using Sfs2X.Logging;
using Sfs2X.Core;
using Sfs2X.Entities;
using Sfs2X.Requests;

public class NewBehaviourScript : MonoBehaviour {
SmartFox sf;

void Start () {
sf = new SmartFox(true);
sf.Debug = true;

Debug.Log(“hello”);

sf.AddEventListener(SFSEvent.CONNECTION, OnConnection);

sf.Connect(“127.0.0.1”,9933);
}
void FixedUpdate()
{
sf.ProcessEvents();// 这里用来处理事件,必不可少
}

// Update is called once per frame
public void OnConnection(BaseEvent evt)
{
Debug.Log(“in onConnection”);
}

}

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>