summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/MobaInfoPool.cs
blob: 334241ebc4ccbfbb0f6f3308739095e7a4299a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;

namespace XMainClient
{
	public class MobaInfoPool
	{
		private static Queue<MobaReminder> _pool;

		public static void Clear()
		{
			bool flag = MobaInfoPool._pool != null;
			if (flag)
			{
				MobaInfoPool._pool.Clear();
				MobaInfoPool._pool = null;
			}
		}

		public static MobaReminder GetInfo()
		{
			bool flag = MobaInfoPool._pool == null;
			if (flag)
			{
				MobaInfoPool._pool = new Queue<MobaReminder>();
			}
			return (MobaInfoPool._pool.Count > 0) ? MobaInfoPool._pool.Dequeue() : new MobaReminder();
		}

		public static void Recycle(MobaReminder info)
		{
			bool flag = MobaInfoPool._pool == null;
			if (!flag)
			{
				MobaInfoPool._pool.Enqueue(info);
			}
		}
	}
}