Beispiel #1
0
        public bool RunFrameData(NetChannelType channel, int frameIndex)
        {
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return(false);
            }
            return(netChannel.RunFrameData(frameIndex));
        }
Beispiel #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));
        }
Beispiel #3
0
        public void DisConnect(NetChannelType channel)
        {
            NetChannel netChannel = GetChannel(channel);

            if (netChannel == null)
            {
                return;
            }
            netChannel.DisConnect();
        }
Beispiel #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);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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);
        }
Beispiel #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;
        }