-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackOpeningQueue.cs
More file actions
27 lines (23 loc) · 859 Bytes
/
PackOpeningQueue.cs
File metadata and controls
27 lines (23 loc) · 859 Bytes
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
using System.Collections.Generic;
namespace TCGStreamPacks;
public class PackOpeningQueue
{
private readonly Dictionary<ECollectionPackType, Queue<string>> _packTypeQueues = new();
public string CurrentPackOpener { get; private set; }
public void EnqueuePackOpening(ECollectionPackType packType, string username)
{
if (!_packTypeQueues.ContainsKey(packType))
_packTypeQueues[packType] = new Queue<string>();
_packTypeQueues[packType].Enqueue(username);
}
public string DequeuePackOpening(ECollectionPackType packType)
{
if (_packTypeQueues.ContainsKey(packType) && _packTypeQueues[packType].Count > 0)
{
CurrentPackOpener = _packTypeQueues[packType].Dequeue();
return CurrentPackOpener;
}
CurrentPackOpener = null;
return null;
}
}