| | 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 | |
|
| 793569 | 17 | | public static DataStore i { get => instance; } |
| | 18 | |
|
| 974 | 19 | | private Dictionary<Type, object> dataStores = new Dictionary<Type, object>(); |
| | 20 | |
|
| | 21 | | public void Set<T>(T data) where T : class |
| | 22 | | { |
| 9375 | 23 | | if (!dataStores.ContainsKey(typeof(T))) |
| 9375 | 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 | | { |
| 412953 | 31 | | if (!dataStores.ContainsKey(typeof(T))) |
| 9375 | 32 | | Set(new T()); |
| | 33 | |
|
| 412953 | 34 | | return dataStores[typeof(T)] as T; |
| | 35 | | } |
| | 36 | |
|
| 661 | 37 | | public static void Clear() => instance = new DataStore(); |
| | 38 | |
|
| 322 | 39 | | public DataStore_World world => i.Get<DataStore_World>(); |
| 31898 | 40 | | public DataStore_Common common => i.Get<DataStore_Common>(); |
| 3907 | 41 | | public DataStore_Realm realm => i.Get<DataStore_Realm>(); |
| 2513 | 42 | | public DebugConfig debugConfig => i.Get<DebugConfig>(); |
| 605 | 43 | | public DataStore_Quests Quests => i.Get<DataStore_Quests>(); |
| 4842 | 44 | | public DataStore_HUDs HUDs => i.Get<DataStore_HUDs>(); |
| 5530 | 45 | | public DataStore_Player player => i.Get<DataStore_Player>(); |
| 82419 | 46 | | public DataStore_AvatarsLOD avatarsLOD => i.Get<DataStore_AvatarsLOD>(); |
| 3898 | 47 | | public DataStore_VirtualAudioMixer virtualAudioMixer => i.Get<DataStore_VirtualAudioMixer>(); |
| 33755 | 48 | | public DataStore_Screen screen => i.Get<DataStore_Screen>(); |
| 0 | 49 | | public DataStore_WSCommunication wsCommunication => i.Get<DataStore_WSCommunication>(); |
| 2519 | 50 | | public DataStore_WorldObjects sceneWorldObjects => i.Get<DataStore_WorldObjects>(); |
| 179449 | 51 | | public DataStore_ExploreV2 exploreV2 => i.Get<DataStore_ExploreV2>(); |
| 1811 | 52 | | public DataStore_FeatureFlag featureFlags => i.Get<DataStore_FeatureFlag>(); |
| 20881 | 53 | | public DataStore_Camera camera => i.Get<DataStore_Camera>(); |
| 649 | 54 | | public DataStore_Settings settings => i.Get<DataStore_Settings>(); |
| 66 | 55 | | public DataStore_SkyboxConfig skyboxConfig => i.Get<DataStore_SkyboxConfig>(); |
| 0 | 56 | | public WorldTimer worldTimer => i.Get<WorldTimer>(); |
| 107 | 57 | | public DataStore_Performance performance => i.Get<DataStore_Performance>(); |
| 109 | 58 | | public DataStore_ExperiencesViewer experiencesViewer => i.Get<DataStore_ExperiencesViewer>(); |
| 729 | 59 | | public DataStore_Emotes emotes => i.Get<DataStore_Emotes>(); |
| 437 | 60 | | public DataStore_EmotesCustomization emotesCustomization => i.Get<DataStore_EmotesCustomization>(); |
| 265 | 61 | | public DataStore_SceneBoundariesChecker sceneBoundariesChecker => i.Get<DataStore_SceneBoundariesChecker>(); |
| 722 | 62 | | public DataStore_ECS7 ecs7 => i.Get<DataStore_ECS7>(); |
| 1008 | 63 | | public DataStore_VoiceChat voiceChat => i.Get<DataStore_VoiceChat>(); |
| 538 | 64 | | public DataStore_TextureConfig textureConfig => i.Get<DataStore_TextureConfig>(); |
| 53 | 65 | | public DataStore_FriendNotifications friendNotifications => i.Get<DataStore_FriendNotifications>(); |
| 722 | 66 | | public DataStore_AvatarConfig avatarConfig => i.Get<DataStore_AvatarConfig>(); |
| 513 | 67 | | public DataStore_Rpc rpc => i.Get<DataStore_Rpc>(); |
| 289 | 68 | | public DataStore_Channels channels => i.Get<DataStore_Channels>(); |
| 1029 | 69 | | public DataStore_WorldBlockers worldBlockers => i.Get<DataStore_WorldBlockers>(); |
| | 70 | | } |
| | 71 | | } |