-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStorage.cs
34 lines (30 loc) · 816 Bytes
/
Storage.cs
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
using System.Collections.Generic;
namespace ChusanExplorer
{
public class IDObject
{
public int id;
}
public class IDStorage<T> : Dictionary<int, T> where T : IDObject
{
public void Push(T obj)
{
if (ContainsKey(obj.id))
{
// TODO log override
}
this[obj.id] = obj;
}
public T TryGet(int id)
{
TryGetValue(id, out T res);
return res;
}
}
public static partial class Storage
{
public static IDStorage<Character> Characters = new IDStorage<Character>();
public static IDStorage<CharaImageGroup> DDSChara = new IDStorage<CharaImageGroup>();
public static IDStorage<Music> Music = new IDStorage<Music>();
}
}