/**注册回调**/ public void addCMD(String cmd, NetMsgCallback callback) { if (callback == null) { return; } if (StringUtils.isEmpty(cmd)) { return; } handlerList[cmd] = callback; }
static int set_onMsg(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetSocket obj = (NetSocket)o; NetMsgCallback arg0 = (NetMsgCallback)ToLua.CheckDelegate <NetMsgCallback>(L, 2); obj.onMsg = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onMsg on a nil value")); } }
static int get_onMsg(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetSocket obj = (NetSocket)o; NetMsgCallback ret = obj.onMsg; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onMsg on a nil value")); } }
//消息监听 public void msgListenner(NetMsgCallback listener) { msgCallback = listener; }