| | 1 | | using UnityEngine; |
| | 2 | | using Variables.RealmsInfo; |
| | 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(); |
| 806 | 15 | | public static DataStore i { get => instance; } |
| 832 | 16 | | public static void Clear() => instance = new DataStore(); |
| | 17 | |
|
| 833 | 18 | | public readonly CurrentRealmVariable playerRealm = new CurrentRealmVariable(); |
| 833 | 19 | | public readonly RealmsVariable realmsInfo = new RealmsVariable(); |
| 833 | 20 | | public readonly DebugConfig debugConfig = new DebugConfig(); |
| 833 | 21 | | public readonly BaseVariable<bool> isSignUpFlow = new BaseVariable<bool>(); |
| 833 | 22 | | public readonly BaseDictionary<string, WearableItem> wearables = new BaseDictionary<string, WearableItem>(); |
| 833 | 23 | | public readonly DataStore_BuilderInWorld builderInWorld = new DataStore_BuilderInWorld(); |
| 833 | 24 | | public readonly DataStore_Quests Quests = new DataStore_Quests(); |
| 833 | 25 | | public readonly DataStore_HUDs HUDs = new DataStore_HUDs(); |
| 833 | 26 | | public readonly BaseVariable<bool> isPlayerRendererLoaded = new BaseVariable<bool>(); |
| 833 | 27 | | public readonly BaseVariable<AppMode> appMode = new BaseVariable<AppMode>(); |
| 833 | 28 | | public readonly DataStore_Player player = new DataStore_Player(); |
| 833 | 29 | | public readonly BaseVariable<NFTPromptModel> onOpenNFTPrompt = new BaseVariable<NFTPromptModel>(); |
| 833 | 30 | | public readonly DataStore_AvatarsLOD avatarsLOD = new DataStore_AvatarsLOD(); |
| 833 | 31 | | public readonly DataStore_VirtualAudioMixer virtualAudioMixer = new DataStore_VirtualAudioMixer(); |
| 833 | 32 | | public readonly DataStore_Screen screen = new DataStore_Screen(); |
| 833 | 33 | | public readonly DataStore_WSCommunication wsCommunication = new DataStore_WSCommunication(); |
| 833 | 34 | | public readonly DataStore_WorldObjects sceneWorldObjects = new DataStore_WorldObjects(); |
| 833 | 35 | | public readonly DataStore_ExploreV2 exploreV2 = new DataStore_ExploreV2(); |
| 833 | 36 | | public readonly DataStore_Taskbar taskbar = new DataStore_Taskbar(); |
| 833 | 37 | | public readonly DataStore_FeatureFlag featureFlags = new DataStore_FeatureFlag(); |
| 833 | 38 | | public readonly DataStore_Camera camera = new DataStore_Camera(); |
| | 39 | |
|
| | 40 | | public class DataStore_WorldObjects |
| | 41 | | { |
| | 42 | | public class SceneData |
| | 43 | | { |
| 416 | 44 | | public readonly BaseDictionary<Mesh, int> refCountedMeshes = new BaseDictionary<Mesh, int>(); |
| 416 | 45 | | public readonly BaseHashSet<Rendereable> renderedObjects = new BaseHashSet<Rendereable>(); |
| | 46 | | } |
| | 47 | |
|
| 833 | 48 | | public readonly BaseDictionary<string, SceneData> sceneData = new BaseDictionary<string, SceneData>(); |
| | 49 | | } |
| | 50 | |
|
| | 51 | | public class DataStore_BuilderInWorld |
| | 52 | | { |
| 833 | 53 | | public readonly BaseDictionary<string, CatalogItem> catalogItemDict = new BaseDictionary<string, CatalogItem |
| 833 | 54 | | public readonly BaseDictionary<string, CatalogItem> currentSceneCatalogItemDict = new BaseDictionary<string, |
| 833 | 55 | | public readonly BaseDictionary<string, CatalogItemPack> catalogItemPackDict = new BaseDictionary<string, Cat |
| 833 | 56 | | public readonly BaseVariable<PublishSceneResultPayload> unpublishSceneResult = new BaseVariable<PublishScene |
| 833 | 57 | | public readonly BaseVariable<bool> showTaskBar = new BaseVariable<bool>(); |
| 833 | 58 | | public readonly BaseVariable<LandWithAccess[]> landsWithAccess = new BaseVariable<LandWithAccess[]>(); |
| | 59 | | } |
| | 60 | |
|
| | 61 | | public class DataStore_Quests |
| | 62 | | { |
| 833 | 63 | | public readonly BaseDictionary<string, QuestModel> quests = new BaseDictionary<string, QuestModel>(); |
| 833 | 64 | | public readonly BaseCollection<string> pinnedQuests = new BaseCollection<string>(); |
| | 65 | | } |
| | 66 | |
|
| | 67 | | public class DataStore_HUDs |
| | 68 | | { |
| 833 | 69 | | public readonly BaseVariable<bool> questsPanelVisible = new BaseVariable<bool>(false); |
| 833 | 70 | | public readonly BaseVariable<bool> builderProjectsPanelVisible = new BaseVariable<bool>(false); |
| 833 | 71 | | public readonly BaseVariable<bool> signupVisible = new BaseVariable<bool>(false); |
| 833 | 72 | | public readonly BaseVariable<bool> avatarNamesVisible = new BaseVariable<bool>(true); |
| 833 | 73 | | public readonly BaseVariable<float> avatarNamesOpacity = new BaseVariable<float>(1); |
| 833 | 74 | | public readonly LoadingHUD loadingHUD = new LoadingHUD(); |
| | 75 | |
|
| | 76 | | public class LoadingHUD |
| | 77 | | { |
| 833 | 78 | | public readonly BaseVariable<bool> visible = new BaseVariable<bool>(false); |
| 833 | 79 | | public readonly BaseVariable<string> message = new BaseVariable<string>(null); |
| 833 | 80 | | public readonly BaseVariable<float> percentage = new BaseVariable<float>(0); |
| 833 | 81 | | public readonly BaseVariable<bool> showWalletPrompt = new BaseVariable<bool>(false); |
| 833 | 82 | | public readonly BaseVariable<bool> showTips = new BaseVariable<bool>(false); |
| | 83 | | } |
| | 84 | | } |
| | 85 | |
|
| | 86 | | public class DataStore_Player |
| | 87 | | { |
| | 88 | | // NOTE: set when character is teleported (DCLCharacterController - Teleport) |
| 833 | 89 | | public readonly BaseVariable<Vector3> lastTeleportPosition = new BaseVariable<Vector3>(Vector3.zero); |
| 833 | 90 | | public readonly BaseDictionary<string, Player> otherPlayers = new BaseDictionary<string, Player>(); |
| | 91 | | } |
| | 92 | |
|
| | 93 | | public class DataStore_AvatarsLOD |
| | 94 | | { |
| | 95 | | public const int DEFAULT_MAX_AVATAR = 50; |
| | 96 | | public const int DEFAULT_MAX_IMPOSTORS = 70; |
| | 97 | |
|
| 833 | 98 | | public readonly BaseVariable<float> simpleAvatarDistance = new BaseVariable<float>(15f); |
| 833 | 99 | | public readonly BaseVariable<float> LODDistance = new BaseVariable<float>(30f); |
| 833 | 100 | | public readonly BaseVariable<int> maxAvatars = new BaseVariable<int>(DEFAULT_MAX_AVATAR); |
| 833 | 101 | | public readonly BaseVariable<int> maxImpostors = new BaseVariable<int>(DEFAULT_MAX_IMPOSTORS); |
| | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> |
| | 105 | | /// An "audio mixer" that handles muting/fading when entering special states like Avatar Editor, Tutorial, Build |
| | 106 | | /// </summary> |
| | 107 | | public class DataStore_VirtualAudioMixer |
| | 108 | | { |
| 833 | 109 | | public readonly BaseVariable<float> musicVolume = new BaseVariable<float>(1f); |
| 833 | 110 | | public readonly BaseVariable<float> sceneSFXVolume = new BaseVariable<float>(1f); |
| 833 | 111 | | public readonly BaseVariable<float> voiceChatVolume = new BaseVariable<float>(1f); |
| 833 | 112 | | public readonly BaseVariable<float> uiSFXVolume = new BaseVariable<float>(1f); |
| 833 | 113 | | public readonly BaseVariable<float> avatarSFXVolume = new BaseVariable<float>(1f); |
| | 114 | | } |
| | 115 | |
|
| | 116 | | public class DataStore_Screen |
| | 117 | | { |
| 833 | 118 | | public readonly BaseVariable<Vector2Int> size = new BaseVariable<Vector2Int>(Vector2Int.zero); |
| | 119 | | } |
| | 120 | |
|
| | 121 | | public class DataStore_WSCommunication |
| | 122 | | { |
| | 123 | | [System.NonSerialized] |
| 833 | 124 | | public string url = "ws://localhost:5000/"; |
| | 125 | |
|
| 833 | 126 | | public readonly BaseVariable<bool> communicationEstablished = new BaseVariable<bool>(); |
| 833 | 127 | | public readonly BaseVariable<bool> communicationReady = new BaseVariable<bool>(); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | public class DataStore_ExploreV2 |
| | 131 | | { |
| 833 | 132 | | public readonly BaseVariable<bool> isInitialized = new BaseVariable<bool>(false); |
| 833 | 133 | | public readonly BaseVariable<bool> isOpen = new BaseVariable<bool>(false); |
| | 134 | | } |
| | 135 | |
|
| | 136 | | public class DataStore_Taskbar |
| | 137 | | { |
| 0 | 138 | | public readonly BaseVariable<bool> isExploreV2Enabled = new BaseVariable<bool>(false); |
| | 139 | | } |
| | 140 | |
|
| | 141 | | public class DataStore_FeatureFlag |
| | 142 | | { |
| 833 | 143 | | public readonly BaseVariable<FeatureFlag> flags = new BaseVariable<FeatureFlag>(new FeatureFlag()); |
| | 144 | | } |
| | 145 | |
|
| | 146 | | public class DataStore_Camera |
| | 147 | | { |
| 0 | 148 | | public readonly BaseVariable<Quaternion> rotation = new BaseVariable<Quaternion>(); |
| | 149 | | } |
| | 150 | | } |
| | 151 | | } |