예제 #1
0
        //直接发送心跳,有的地方有这种需求
        public void SendHeartMsgDirect()
        {
            //Log.info(this, "Send HeartMsg");
            var msdata = new MemoryStream();

            Module_1.write_1_0(msdata);
            AppNet.gameNet.send(msdata, 1, 0);
            lastSendTime = RealTime.time;
            sendCount++;
        }
예제 #2
0
        /**发送心跳**/

        public void SendHeartMsg()
        {
            float time = RealTime.time;

            if (heartGap == 0)
            {
                heartGap = 5;
            }

            if (sendCount == reciveCount && time - lastSendTime >= heartGap)
            {
                Log.info(this, "Send HeartMsg");
                var msdata = new MemoryStream();
                Module_1.write_1_0(msdata);
                AppNet.gameNet.send(msdata, 1, 0);
                lastSendTime = time;
                sendCount++;
            }
            else if (lastSendTime > time)
            {
                lastSendTime = time;
            }
        }