SFS可以连接但是不能登陆zone问题

在sfs的面板上面新建立一个zone,如果ZoneExtension中加入自定义的扩展,那么当unity客户端要登陆zone时,必须在扩展中加入addEventHandler(SFSEventType.USER_LOGIN, LoginEventHandler.class);

LoginEventHandler里面可以什么都不写,但是必须添加这个监听,否则无法登陆zone的。蛋疼的问题纠结了快一个小时。

import com.smartfoxserver.v2.core.SFSEventType;
import com.smartfoxserver.v2.extensions.SFSExtension;

public class Main extends SFSExtension{

@Override
public void init() {
// TODO Auto-generated method stub
trace("hello,我是服务端");
System.out.println("我是服务端");
addEventHandler(SFSEventType.USER_LOGIN, LoginEventHandler.class);
}

}


LoginEventHandler:
package com.magicbone.clan;

import com.smartfoxserver.v2.core.ISFSEvent;
import com.smartfoxserver.v2.exceptions.SFSException;
import com.smartfoxserver.v2.extensions.BaseServerEventHandler;

public class LoginEventHandler extends BaseServerEventHandler{

@Override
public void handleServerEvent(ISFSEvent arg0) throws SFSException {
// TODO Auto-generated method stub

}

}



猜你喜欢

转载自hougenit.iteye.com/blog/1849285