Exemplo n.º 1
0
        public void Register <T>(int responseId, Action <T> handler)
            where T : class, DataObject, new()
        {
            var nrcb = new NetRecivedCallBack <T>(handler);

            handlerDic.Add(responseId, nrcb);
        }
Exemplo n.º 2
0
        public void Unregister(Proto proto, Action <DDNode> handler)
        {
            var hl = TryGetHandlerList(proto.route);

            if (hl != null)
            {
                var nrcb = new NetRecivedCallBack(proto.s2cdt, handler);
                if (!hl.Remove(nrcb))
                {
                    Logger.Error("Unregister failed! , Not Existed Callback");
                }
            }
            else
            {
                Logger.Error("Unregister failed!");
            }
        }
Exemplo n.º 3
0
        internal void Unregister <T>(string route, Action <T> handler)
            where T : class, DataObject, new()
        {
            var hl = TryGetHandlerList(route);

            if (hl != null)
            {
                var nrcb = new NetRecivedCallBack <T>(handler);
                if (!hl.Remove(nrcb))
                {
                    Logger.Error("Unregister failed! , Not Existed Callback");
                }
            }
            else
            {
                Logger.Error("Unregister failed!");
            }
        }
Exemplo n.º 4
0
        public void Register(Proto proto, Action <DDNode> handler)
        {
            var hl = TryGetHandlerList(proto.route);

            if (hl == null)
            {
                hl = new List <INetRecivedCallBack>();
                pushHandlerDic.Add(proto.route, hl);
            }
            var nrcb = new NetRecivedCallBack(proto.s2cdt, handler);

            if (hl.Contains(nrcb))
            {
                Logger.Error("Register Duplicate!");
            }
            else
            {
                hl.Add(nrcb);
            }
        }
Exemplo n.º 5
0
        internal void Register <T>(string route, Action <T> handler)
            where T : class, DataObject, new()
        {
            var hl = TryGetHandlerList(route);

            if (hl == null)
            {
                hl = new List <INetRecivedCallBack>();
                pushHandlerDic.Add(route, hl);
            }
            var nrcb = new NetRecivedCallBack <T>(handler);

            if (hl.Contains(nrcb))
            {
                Logger.Error("Register Duplicate!");
            }
            else
            {
                hl.Add(nrcb);
            }
        }
Exemplo n.º 6
0
        public void Register(int responseId, Proto proto, Action <DDNode> handler)
        {
            var nrcb = new NetRecivedCallBack(proto.s2cdt, handler);

            handlerDic.Add(responseId, nrcb);
        }