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