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 条评论。