| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | |
|
| | 4 | | namespace DCL |
| | 5 | | { |
| | 6 | | public enum AppMode |
| | 7 | | { |
| | 8 | | DEFAULT, |
| | 9 | | BUILDER_IN_WORLD_EDITION |
| | 10 | | } |
| | 11 | |
|
| | 12 | | public class DataStore |
| | 13 | | { |
| 1 | 14 | | private static DataStore instance = new DataStore(); |
| | 15 | |
|
| 2560 | 16 | | public static DataStore i { get => instance; } |
| | 17 | |
|
| 898 | 18 | | private Dictionary<Type, object> dataStores = new Dictionary<Type, object>(); |
| | 19 | |
|
| | 20 | | public void Set<T>(T data) where T : class |
| | 21 | | { |
| 7102 | 22 | | if (!dataStores.ContainsKey(typeof(T))) |
| 7102 | 23 | | dataStores.Add(typeof(T), data); |
| | 24 | | else |
| 0 | 25 | | dataStores[typeof(T)] = data; |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | public T Get<T>() where T : class, new() |
| | 29 | | { |
| 134257 | 30 | | if (!dataStores.ContainsKey(typeof(T))) |
| 7102 | 31 | | Set(new T()); |
| | 32 | |
|
| 134257 | 33 | | return dataStores[typeof(T)] as T; |
| | 34 | | } |
| | 35 | |
|
| 865 | 36 | | public static void Clear() => instance = new DataStore(); |
| | 37 | |
|
| 20938 | 38 | | public DataStore_Common common => i.Get<DataStore_Common>(); |
| 2544 | 39 | | public DataStore_Realm realm => i.Get<DataStore_Realm>(); |
| 4497 | 40 | | public DebugConfig debugConfig => i.Get<DebugConfig>(); |
| 743 | 41 | | public DataStore_BuilderInWorld builderInWorld => i.Get<DataStore_BuilderInWorld>(); |
| 843 | 42 | | public DataStore_Quests Quests => i.Get<DataStore_Quests>(); |
| 6372 | 43 | | public DataStore_HUDs HUDs => i.Get<DataStore_HUDs>(); |
| 2186 | 44 | | public DataStore_Player player => i.Get<DataStore_Player>(); |
| 54 | 45 | | public DataStore_AvatarsLOD avatarsLOD => i.Get<DataStore_AvatarsLOD>(); |
| 5288 | 46 | | public DataStore_VirtualAudioMixer virtualAudioMixer => i.Get<DataStore_VirtualAudioMixer>(); |
| 8178 | 47 | | public DataStore_Screen screen => i.Get<DataStore_Screen>(); |
| 0 | 48 | | public DataStore_WSCommunication wsCommunication => i.Get<DataStore_WSCommunication>(); |
| 2586 | 49 | | public DataStore_WorldObjects sceneWorldObjects => i.Get<DataStore_WorldObjects>(); |
| 64110 | 50 | | public DataStore_ExploreV2 exploreV2 => i.Get<DataStore_ExploreV2>(); |
| 1521 | 51 | | public DataStore_FeatureFlag featureFlags => i.Get<DataStore_FeatureFlag>(); |
| 10935 | 52 | | public DataStore_Camera camera => i.Get<DataStore_Camera>(); |
| 737 | 53 | | public DataStore_Settings settings => i.Get<DataStore_Settings>(); |
| 58 | 54 | | public DataStore_SkyboxConfig skyboxConfig => i.Get<DataStore_SkyboxConfig>(); |
| 0 | 55 | | public ServerTime.WorldTimer worldTimer => i.Get<ServerTime.WorldTimer>(); |
| 995 | 56 | | public DataStore_Performance performance => i.Get<DataStore_Performance>(); |
| 102 | 57 | | public DataStore_ExperiencesViewer experiencesViewer => i.Get<DataStore_ExperiencesViewer>(); |
| 1304 | 58 | | public DataStore_Emotes emotes => i.Get<DataStore_Emotes>(); |
| | 59 | | } |
| | 60 | | } |