/// <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); }
/// <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); }
/// <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; }