Ejemplo n.º 1
0
        /// <summary>
        /// 发送数据包
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="socketType">socket类型</param>
        /// <param name="channel">通信协议[PID]</param>
        /// <param name="type">内容的类型,0-Protobuf1,Json</param>
        /// <param name="tbuff">传递的内容</param>
        /// <param name="offCheckTimeOut">是否超时</param>
        public void SendBuff <T>(SocketType socketType, int channel, int type, T tbuff, bool offCheckTimeOut = false)
        {
            SendMsgVO msgVO = new SendMsgVO();

            msgVO.socketType      = socketType;
            msgVO.channel         = channel;
            msgVO.type            = type;
            msgVO.tbuff           = tbuff;
            msgVO.offCheckTimeOut = offCheckTimeOut;
            GameMgr.Instance.SendMsgPool.Enqueue(msgVO);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 发送数据包
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="socketType">socket类型</param>
        /// <param name="channel">通信协议[PID]</param>
        /// <param name="type">内容的类型,0-Protobuf1,Json</param>
        /// <param name="tbuff">传递的内容</param>
        /// <param name="offCheckTimeOut">是否忽略超时</param>
        public void SendBuff <T>(SocketType socketType, int channel, int type, T tbuff, bool offCheckTimeOut = false)
        {
            SendMsgVO msgVO = new SendMsgVO();

            msgVO.socketType      = socketType;
            msgVO.channel         = channel;
            msgVO.msgType         = type;
            msgVO.tbuff           = tbuff;
            msgVO.offCheckTimeOut = offCheckTimeOut;
            GameMgr.Instance.SendMsgPool.Enqueue(msgVO);

            if (!offCheckTimeOut)
            {
                waitMsgList.Add(channel);
                Timer.Instance.AddTimer(0, 1, 0, () => {
                    UIManager.Instance.SetWaitIconActive(waitMsgList.Count > 0);
                });
            }
        }