예제 #1
0
        void CheckSession(TmEntity entity)
        {
            TmCoolDown cd = entity.GetComponent <TmCoolDown>();

            if (!cd.Counting)
            {
                entity.Dispose();
                //TmTcpSocket.Instance.StartConnect();
            }
            else
            {
                //发送心跳检测(并等待签到,签到入口在TmTcpSession里,双向发向即:客户端向服务端发送,服务端向客户端发送)
                TmParameter mvc = TmParameterTool.ToParameter(TenCode.EessionCD, ElevenCode.Login);
                mvc.Keys.Add(entity.EcsId);
                TmTcpSocket.Instance.Send(mvc);
            }
            Console.WriteLine(TmTimerTool.CurrentTime() + " CdCount:{0}-{1} ", cd.CdCount, cd.MaxCdCount);
            //Debug.Log(TmTimerTool.CurrentTime() + " CdCount:" + cd.CdCount + "-" + cd.MaxCdCount);
        }
예제 #2
0
        void UpdateCoolDown(TmEntity entity)
        {
            TmCoolDown cd = entity.GetComponent <TmCoolDown>();

            if (cd.Counting)
            {
                cd.CdCount += 1;
                if (cd.CdCount >= cd.MaxCdCount)
                {
                    cd.CdCount  = 0;
                    cd.Counting = false;
                }
            }
            if (cd.Timing)
            {
                cd.CdTime += 4;
                if (cd.CdTime >= cd.MaxCdTime)
                {
                    cd.CdTime = 0;
                    cd.Timing = false;
                }
            }
        }