Exemplo n.º 1
0
        public bool RunFrameData(NetChannelType channel, int frameIndex)
        {
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return(false);
            }
            return(netChannel.RunFrameData(frameIndex));
        }
Exemplo n.º 2
0
        public bool BeginConnect(NetChannelType channel, string ip, int port, Action <bool, NetChannelType> callback = null)
        {
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return(false);
            }
            return(netChannel.BeginConnect(ip, port, callback));
        }
Exemplo n.º 3
0
        public void DisConnect(NetChannelType channel)
        {
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return;
            }
            netChannel.DisConnect();
        }
Exemplo n.º 4
0
 public void RemoveMsgCallback(NetChannelType channel, short receiveOpcode, MsgCallback callback)
 {
     if (callback != null)
     {
         NetChannel netChannel = GetChannel(channel);
         if (netChannel == null)
         {
             return;
         }
         netChannel.RemoveMsgCallback(receiveOpcode, callback);
     }
 }
Exemplo n.º 5
0
 public void AddMsgCallback(NetChannelType channel, short receiveOpcode, MsgCallback callback, bool once = false)
 {
     if (callback != null)
     {
         NetChannel netChannel = GetChannel(channel);
         if (netChannel == null)
         {
             return;
         }
         netChannel.AddMsgCallback(receiveOpcode, callback, once);
     }
 }
Exemplo n.º 6
0
        //不监听回复消息
        public void SendMsg(NetChannelType channel, short sendOpcode, object data)
        {
            NetSendData sendData;

            sendData.sendOpcode = sendOpcode;
            sendData.data       = data;
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return;
            }
            netChannel.SendMsg(sendData);
        }
Exemplo n.º 7
0
        public void CreateChannel(NetChannelType channel, NetChannelModeType channelMode)
        {
            var curChannel = GetChannel(channel);

            if (curChannel != null)
            {
                curChannel.DisConnect();
            }
            curChannel = null;
            switch (channelMode)
            {
            case NetChannelModeType.Tcp:
                curChannel = new NetChannel(channel, new TCPSocketClient());
                break;

            case NetChannelModeType.StandAlone:
                curChannel = new NetChannel(channel, new StandAloneSocketClient());
                break;
            }
            m_arrChannel[(int)channel] = curChannel;
        }