| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using DCL.ServerTime; |
| | 4 | |
|
| | 5 | | namespace DCL |
| | 6 | | { |
| | 7 | | public enum AppMode |
| | 8 | | { |
| | 9 | | DEFAULT, |
| | 10 | | BUILDER_IN_WORLD_EDITION |
| | 11 | | } |
| | 12 | |
|
| | 13 | | public class DataStore |
| | 14 | | { |
| 1 | 15 | | private static DataStore instance = new DataStore(); |
| | 16 | |
|
| 2564 | 17 | | public static DataStore i { get => instance; } |
| | 18 | |
|
| 1043 | 19 | | private Dictionary<Type, object> dataStores = new Dictionary<Type, object>(); |
| | 20 | |
|
| | 21 | | public void Set<T>(T data) where T : class |
| | 22 | | { |
| 10701 | 23 | | if (!dataStores.ContainsKey(typeof(T))) |
| 10701 | 24 | | dataStores.Add(typeof(T), data); |
| | 25 | | else |
| 0 | 26 | | dataStores[typeof(T)] = data; |
| 0 | 27 | | } |
| | 28 | |
|
| | 29 | | public T Get<T>() where T : class, new() |
| | 30 | | { |
| 186034 | 31 | | if (!dataStores.ContainsKey(typeof(T))) |
| 10701 | 32 | | Set(new T()); |
| | 33 | |
|
| 186034 | 34 | | return dataStores[typeof(T)] as T; |
| | 35 | | } |
| | 36 | |
|
| 878 | 37 | | public static void Clear() => instance = new DataStore(); |
| | 38 | |
|
| 468 | 39 | | public DataStore_World world => i.Get<DataStore_World>(); |
| 22577 | 40 | | public DataStore_Common common => i.Get<DataStore_Common>(); |
| 3324 | 41 | | public DataStore_Realm realm => i.Get<DataStore_Realm>(); |
| 3208 | 42 | | public DebugConfig debugConfig => i.Get<DebugConfig>(); |
| 593 | 43 | | public DataStore_BuilderInWorld builderInWorld => i.Get<DataStore_BuilderInWorld>(); |
| 716 | 44 | | public DataStore_Quests Quests => i.Get<DataStore_Quests>(); |
| 4855 | 45 | | public DataStore_HUDs HUDs => i.Get<DataStore_HUDs>(); |
| 7245 | 46 | | public DataStore_Player player => i.Get<DataStore_Player>(); |
| 21087 | 47 | | public DataStore_AvatarsLOD avatarsLOD => i.Get<DataStore_AvatarsLOD>(); |
| 5320 | 48 | | public DataStore_VirtualAudioMixer virtualAudioMixer => i.Get<DataStore_VirtualAudioMixer>(); |
| 26564 | 49 | | public DataStore_Screen screen => i.Get<DataStore_Screen>(); |
| 0 | 50 | | public DataStore_WSCommunication wsCommunication => i.Get<DataStore_WSCommunication>(); |
| 3599 | 51 | | public DataStore_WorldObjects sceneWorldObjects => i.Get<DataStore_WorldObjects>(); |
| 62162 | 52 | | public DataStore_ExploreV2 exploreV2 => i.Get<DataStore_ExploreV2>(); |
| 675 | 53 | | public DataStore_FeatureFlag featureFlags => i.Get<DataStore_FeatureFlag>(); |
| 12668 | 54 | | public DataStore_Camera camera => i.Get<DataStore_Camera>(); |
| 271 | 55 | | public DataStore_Settings settings => i.Get<DataStore_Settings>(); |
| 60 | 56 | | public DataStore_SkyboxConfig skyboxConfig => i.Get<DataStore_SkyboxConfig>(); |
| 0 | 57 | | public WorldTimer worldTimer => i.Get<WorldTimer>(); |
| 121 | 58 | | public DataStore_Performance performance => i.Get<DataStore_Performance>(); |
| 111 | 59 | | public DataStore_ExperiencesViewer experiencesViewer => i.Get<DataStore_ExperiencesViewer>(); |
| 1096 | 60 | | public DataStore_Emotes emotes => i.Get<DataStore_Emotes>(); |
| 437 | 61 | | public DataStore_EmotesCustomization emotesCustomization => i.Get<DataStore_EmotesCustomization>(); |
| 269 | 62 | | public DataStore_SceneBoundariesChecker sceneBoundariesChecker => i.Get<DataStore_SceneBoundariesChecker>(); |
| 904 | 63 | | public DataStore_ECS7 ecs7 => i.Get<DataStore_ECS7>(); |
| 1362 | 64 | | public DataStore_VoiceChat voiceChat => i.Get<DataStore_VoiceChat>(); |
| 590 | 65 | | public DataStore_TextureConfig textureConfig => i.Get<DataStore_TextureConfig>(); |
| 61 | 66 | | public DataStore_FriendNotifications friendNotifications => i.Get<DataStore_FriendNotifications>(); |
| 978 | 67 | | public DataStore_AvatarConfig avatarConfig => i.Get<DataStore_AvatarConfig>(); |
| 10 | 68 | | public DataStore_RpcContext rpcContext => i.Get<DataStore_RpcContext>(); |
| | 69 | | } |
| | 70 | | } |