Пример #1
0
        /**注册回调**/

        public void addCMD(String cmd, NetMsgCallback callback)
        {
            if (callback == null)
            {
                return;
            }
            if (StringUtils.isEmpty(cmd))
            {
                return;
            }
            handlerList[cmd] = callback;
        }
Пример #2
0
    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"));
        }
    }
Пример #3
0
    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"));
        }
    }
Пример #4
0
 //消息监听
 public void msgListenner(NetMsgCallback listener)
 {
     msgCallback = listener;
 }