| | 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(); |
| 224 | 15 | | public static DataStore i { get => instance; } |
| 70 | 16 | | public static void Clear() => instance = new DataStore(); |
| | 17 | |
|
| 71 | 18 | | public readonly CurrentRealmVariable playerRealm = new CurrentRealmVariable(); |
| 71 | 19 | | public readonly RealmsVariable realmsInfo = new RealmsVariable(); |
| 71 | 20 | | public readonly DebugConfig debugConfig = new DebugConfig(); |
| 71 | 21 | | public readonly BaseVariable<bool> isSignUpFlow = new BaseVariable<bool>(); |
| 71 | 22 | | public readonly BaseDictionary<string, WearableItem> wearables = new BaseDictionary<string, WearableItem>(); |
| 71 | 23 | | public readonly DataStore_BuilderInWorld builderInWorld = new DataStore_BuilderInWorld(); |
| 71 | 24 | | public readonly DataStore_Quests Quests = new DataStore_Quests(); |
| 71 | 25 | | public readonly DataStore_HUDs HUDs = new DataStore_HUDs(); |
| 71 | 26 | | public readonly BaseVariable<bool> isPlayerRendererLoaded = new BaseVariable<bool>(); |
| 71 | 27 | | public readonly BaseVariable<AppMode> appMode = new BaseVariable<AppMode>(); |
| 71 | 28 | | public readonly DataStore_Player player = new DataStore_Player(); |
| 71 | 29 | | public readonly BaseVariable<NFTPromptModel> onOpenNFTPrompt = new BaseVariable<NFTPromptModel>(); |
| 71 | 30 | | public readonly DataStore_AvatarsLOD avatarsLOD = new DataStore_AvatarsLOD(); |
| 71 | 31 | | public readonly DataStore_VirtualAudioMixer virtualAudioMixer = new DataStore_VirtualAudioMixer(); |
| 71 | 32 | | public readonly DataStore_Screen screen = new DataStore_Screen(); |
| 71 | 33 | | public readonly DataStore_WSCommunication wsCommunication = new DataStore_WSCommunication(); |
| | 34 | |
|
| | 35 | | public class DataStore_BuilderInWorld |
| | 36 | | { |
| 71 | 37 | | public readonly BaseDictionary<string, CatalogItem> catalogItemDict = new BaseDictionary<string, CatalogItem |
| 71 | 38 | | public readonly BaseDictionary<string, CatalogItem> currentSceneCatalogItemDict = new BaseDictionary<string, |
| 71 | 39 | | public readonly BaseDictionary<string, CatalogItemPack> catalogItemPackDict = new BaseDictionary<string, Cat |
| 71 | 40 | | public readonly BaseVariable<PublishSceneResultPayload> unpublishSceneResult = new BaseVariable<PublishScene |
| 71 | 41 | | public readonly BaseVariable<bool> showTaskBar = new BaseVariable<bool>(); |
| 71 | 42 | | public readonly BaseVariable<LandWithAccess[]> landsWithAccess = new BaseVariable<LandWithAccess[]>(); |
| | 43 | | } |
| | 44 | |
|
| | 45 | | public class DataStore_Quests |
| | 46 | | { |
| 71 | 47 | | public readonly BaseDictionary<string, QuestModel> quests = new BaseDictionary<string, QuestModel>(); |
| 71 | 48 | | public readonly BaseCollection<string> pinnedQuests = new BaseCollection<string>(); |
| | 49 | | } |
| | 50 | |
|
| | 51 | | public class DataStore_HUDs |
| | 52 | | { |
| 71 | 53 | | public readonly BaseVariable<bool> questsPanelVisible = new BaseVariable<bool>(false); |
| 71 | 54 | | public readonly BaseVariable<bool> builderProjectsPanelVisible = new BaseVariable<bool>(false); |
| 71 | 55 | | public readonly BaseVariable<bool> signupVisible = new BaseVariable<bool>(false); |
| 71 | 56 | | public readonly LoadingHUD loadingHUD = new LoadingHUD(); |
| | 57 | |
|
| | 58 | | public class LoadingHUD |
| | 59 | | { |
| 71 | 60 | | public readonly BaseVariable<bool> visible = new BaseVariable<bool>(false); |
| 71 | 61 | | public readonly BaseVariable<string> message = new BaseVariable<string>(null); |
| 71 | 62 | | public readonly BaseVariable<float> percentage = new BaseVariable<float>(0); |
| 71 | 63 | | public readonly BaseVariable<bool> showWalletPrompt = new BaseVariable<bool>(false); |
| 71 | 64 | | public readonly BaseVariable<bool> showTips = new BaseVariable<bool>(false); |
| | 65 | | } |
| | 66 | | } |
| | 67 | |
|
| | 68 | | public class DataStore_Player |
| | 69 | | { |
| | 70 | | // NOTE: set when character is teleported (DCLCharacterController - Teleport) |
| 71 | 71 | | public readonly BaseVariable<Vector3> lastTeleportPosition = new BaseVariable<Vector3>(Vector3.zero); |
| 71 | 72 | | public readonly BaseDictionary<string, Player> otherPlayers = new BaseDictionary<string, Player>(); |
| | 73 | | } |
| | 74 | |
|
| | 75 | | public class DataStore_AvatarsLOD |
| | 76 | | { |
| | 77 | | public const int DEFAULT_MAX_AVATAR = 50; |
| | 78 | | public const int DEFAULT_MAX_IMPOSTORS = 70; |
| | 79 | |
|
| 71 | 80 | | public readonly BaseVariable<float> simpleAvatarDistance = new BaseVariable<float>(15f); |
| 71 | 81 | | public readonly BaseVariable<float> LODDistance = new BaseVariable<float>(30f); |
| 71 | 82 | | public readonly BaseVariable<int> maxAvatars = new BaseVariable<int>(DEFAULT_MAX_AVATAR); |
| 71 | 83 | | public readonly BaseVariable<int> maxImpostors = new BaseVariable<int>(DEFAULT_MAX_IMPOSTORS); |
| | 84 | | } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// An "audio mixer" that handles muting/fading when entering special states like Avatar Editor, Tutorial, Build |
| | 88 | | /// </summary> |
| | 89 | | public class DataStore_VirtualAudioMixer |
| | 90 | | { |
| 71 | 91 | | public readonly BaseVariable<float> musicVolume = new BaseVariable<float>(1f); |
| 71 | 92 | | public readonly BaseVariable<float> sceneSFXVolume = new BaseVariable<float>(1f); |
| 71 | 93 | | public readonly BaseVariable<float> voiceChatVolume = new BaseVariable<float>(1f); |
| 71 | 94 | | public readonly BaseVariable<float> uiSFXVolume = new BaseVariable<float>(1f); |
| 71 | 95 | | public readonly BaseVariable<float> avatarSFXVolume = new BaseVariable<float>(1f); |
| | 96 | | } |
| | 97 | |
|
| | 98 | | public class DataStore_Screen |
| | 99 | | { |
| 71 | 100 | | public readonly BaseVariable<Vector2Int> size = new BaseVariable<Vector2Int>(Vector2Int.zero); |
| | 101 | | } |
| | 102 | |
|
| | 103 | | public class DataStore_WSCommunication |
| | 104 | | { |
| | 105 | | [System.NonSerialized] |
| 71 | 106 | | public string url = "ws://localhost:5000/"; |
| | 107 | |
|
| 71 | 108 | | public readonly BaseVariable<bool> communicationEstablished = new BaseVariable<bool>(); |
| 71 | 109 | | public readonly BaseVariable<bool> communicationReady = new BaseVariable<bool>(); |
| | 110 | | } |
| | 111 | | } |
| | 112 | | } |