forked from nt153133/__LlamaLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourceManager.cs
30 lines (27 loc) · 1.31 KB
/
ResourceManager.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
using System;
using System.Collections.Generic;
using LlamaLibrary.JsonObjects;
using LlamaLibrary.Properties;
using LlamaLibrary.Retainers;
using Newtonsoft.Json;
namespace LlamaLibrary
{
public static class ResourceManager
{
public static readonly Lazy<Dictionary<int, List<MateriaItem>>> MateriaList;
public static readonly Lazy<SortedDictionary<int, StoredHuntLocation>> DailyHunts;
public static readonly Lazy<List<RetainerTaskData>> VentureData;
public static readonly Lazy<List<CustomDeliveryNpc>> CustomDeliveryNpcs;
static ResourceManager()
{
VentureData = new Lazy<List<RetainerTaskData>>(() => LoadResource<List<RetainerTaskData>>(Resources.Ventures));
MateriaList = new Lazy<Dictionary<int, List<MateriaItem>>>(() => LoadResource<Dictionary<int, List<MateriaItem>>>(Resources.Materia));
DailyHunts = new Lazy<SortedDictionary<int, StoredHuntLocation>>(() => LoadResource<SortedDictionary<int, StoredHuntLocation>>(Resources.AllHunts));
CustomDeliveryNpcs = new Lazy<List<CustomDeliveryNpc>>(() => LoadResource<List<CustomDeliveryNpc>>(Resources.CustomDeliveryNpcs));
}
public static T LoadResource<T>(string text)
{
return JsonConvert.DeserializeObject<T>(text);
}
}
}