예제 #1
0
        /// <summary>
        /// 从缓冲池里获得一个对象
        /// </summary>
        /// <returns></returns>
        public static NetTask AcquireContent(ushort packetId)
        {
            var ret = TaskPool.AcquireContent();

            ret.isRelease   = false;
            ret.TaskProfile = NetTaskProfile.GetNetTaskProfile(packetId);
            ret.RecvTime    = OneServer.NowTime;
            ret._packetId   = packetId;
            return(ret);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public static NetTaskProfile GetNetTaskProfile(ushort packageId)
        {
            NetTaskProfile ret;

            if (Map.TryGetValue(packageId, out ret))
            {
                return(ret);
            }

            //  新建一个包处理,然后
            ret = new NetTaskProfile(packageId);
            Map.TryAdd(packageId, ret);

            return(ret);
        }
예제 #3
0
파일: NetTask.cs 프로젝트: RainsSoft/DogSE
        /// <summary>
        /// 
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public static NetTaskProfile GetNetTaskProfile(ushort packageId)
        {
            NetTaskProfile ret;
            if (Map.TryGetValue(packageId, out ret))
            {
                return ret;
            }

            //  新建一个包处理,然后
            ret = new NetTaskProfile(packageId);
            Map.TryAdd(packageId, ret);

            return ret;
        }