diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/MobaInfoPool.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/MobaInfoPool.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/MobaInfoPool.cs b/Client/Assets/Scripts/XMainClient/MobaInfoPool.cs new file mode 100644 index 00000000..334241eb --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/MobaInfoPool.cs @@ -0,0 +1,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);
+ }
+ }
+ }
+}
|