| | 1 | | using DCL; |
| | 2 | | using DCL.Helpers; |
| | 3 | | using ExploreV2Analytics; |
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.Linq; |
| | 7 | | using UnityEngine; |
| | 8 | | using Variables.RealmsInfo; |
| | 9 | |
|
| | 10 | | /// <summary> |
| | 11 | | /// Main controller for the feature "Explore V2". |
| | 12 | | /// </summary> |
| | 13 | | public class ExploreV2MenuComponentController : IExploreV2MenuComponentController |
| | 14 | | { |
| 135 | 15 | | internal UserProfile ownUserProfile => UserProfile.GetOwnUserProfile(); |
| 45 | 16 | | internal RectTransform topMenuTooltipReference { get => view.currentTopMenuTooltipReference; } |
| 45 | 17 | | internal RectTransform placesAndEventsTooltipReference { get => view.currentPlacesAndEventsTooltipReference; } |
| 45 | 18 | | internal RectTransform backpackTooltipReference { get => view.currentBackpackTooltipReference; } |
| 45 | 19 | | internal RectTransform mapTooltipReference { get => view.currentMapTooltipReference; } |
| 45 | 20 | | internal RectTransform builderTooltipReference { get => view.currentBuilderTooltipReference; } |
| 45 | 21 | | internal RectTransform questTooltipReference { get => view.currentQuestTooltipReference; } |
| 45 | 22 | | internal RectTransform settingsTooltipReference { get => view.currentSettingsTooltipReference; } |
| 45 | 23 | | internal RectTransform profileCardTooltipReference { get => view.currentProfileCardTooltipReference; } |
| | 24 | |
|
| | 25 | | internal IExploreV2MenuComponentView view; |
| | 26 | | internal IPlacesAndEventsSectionComponentController placesAndEventsSectionController; |
| | 27 | | internal IExploreV2Analytics exploreV2Analytics; |
| | 28 | | internal ExploreSection currentOpenSection; |
| | 29 | |
|
| 90 | 30 | | internal RendererState rendererState => CommonScriptableObjects.rendererState; |
| 248 | 31 | | internal BaseVariable<bool> isOpen => DataStore.i.exploreV2.isOpen; |
| 135 | 32 | | internal BaseVariable<int> currentSectionIndex => DataStore.i.exploreV2.currentSectionIndex; |
| 62 | 33 | | internal BaseVariable<bool> profileCardIsOpen => DataStore.i.exploreV2.profileCardIsOpen; |
| 95 | 34 | | internal BaseVariable<bool> isInitialized => DataStore.i.exploreV2.isInitialized; |
| 135 | 35 | | internal BaseVariable<bool> isPlacesAndEventsSectionInitialized => DataStore.i.exploreV2.isPlacesAndEventsSectionIni |
| 197 | 36 | | internal BaseVariable<bool> placesAndEventsVisible => DataStore.i.exploreV2.placesAndEventsVisible; |
| 185 | 37 | | internal BaseVariable<bool> isAvatarEditorInitialized => DataStore.i.HUDs.isAvatarEditorInitialized; |
| 197 | 38 | | internal BaseVariable<bool> avatarEditorVisible => DataStore.i.HUDs.avatarEditorVisible; |
| 185 | 39 | | internal BaseVariable<bool> isNavmapInitialized => DataStore.i.HUDs.isNavMapInitialized; |
| 197 | 40 | | internal BaseVariable<bool> navmapVisible => DataStore.i.HUDs.navmapVisible; |
| 185 | 41 | | internal BaseVariable<bool> isBuilderInitialized => DataStore.i.builderInWorld.isInitialized; |
| 197 | 42 | | internal BaseVariable<bool> builderVisible => DataStore.i.HUDs.builderProjectsPanelVisible; |
| 185 | 43 | | internal BaseVariable<bool> isQuestInitialized => DataStore.i.Quests.isInitialized; |
| 197 | 44 | | internal BaseVariable<bool> questVisible => DataStore.i.HUDs.questsPanelVisible; |
| 185 | 45 | | internal BaseVariable<bool> isSettingsPanelInitialized => DataStore.i.settings.isInitialized; |
| 197 | 46 | | internal BaseVariable<bool> settingsVisible => DataStore.i.settings.settingsPanelVisible; |
| | 47 | |
|
| | 48 | | public void Initialize() |
| | 49 | | { |
| | 50 | | // It waits for the world is up before starting to initialize the Start Menu |
| 0 | 51 | | rendererState.OnChange += Initialize_Internal; |
| 0 | 52 | | Initialize_Internal(rendererState.Get(), false); |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | internal void Initialize_Internal(bool currentRendererState, bool previousRendererState) |
| | 56 | | { |
| 45 | 57 | | if (!currentRendererState) |
| 0 | 58 | | return; |
| | 59 | |
|
| 45 | 60 | | rendererState.OnChange -= Initialize_Internal; |
| | 61 | |
|
| 45 | 62 | | exploreV2Analytics = CreateAnalyticsController(); |
| 45 | 63 | | view = CreateView(); |
| 45 | 64 | | SetVisibility(false); |
| | 65 | |
|
| 45 | 66 | | DataStore.i.realm.playerRealm.OnChange += UpdateRealmInfo; |
| 45 | 67 | | UpdateRealmInfo(DataStore.i.realm.playerRealm.Get(), null); |
| | 68 | |
|
| 45 | 69 | | ownUserProfile.OnUpdate += UpdateProfileInfo; |
| 45 | 70 | | UpdateProfileInfo(ownUserProfile); |
| 45 | 71 | | view.currentProfileCard.onClick?.AddListener(() => { profileCardIsOpen.Set(!profileCardIsOpen.Get()); }); |
| 45 | 72 | | view.OnCloseButtonPressed += OnCloseButtonPressed; |
| 45 | 73 | | view.OnAfterShowAnimation += OnAfterShowAnimation; |
| | 74 | |
|
| 45 | 75 | | DataStore.i.exploreV2.topMenuTooltipReference.Set(topMenuTooltipReference); |
| 45 | 76 | | DataStore.i.exploreV2.placesAndEventsTooltipReference.Set(placesAndEventsTooltipReference); |
| 45 | 77 | | DataStore.i.exploreV2.backpackTooltipReference.Set(backpackTooltipReference); |
| 45 | 78 | | DataStore.i.exploreV2.mapTooltipReference.Set(mapTooltipReference); |
| 45 | 79 | | DataStore.i.exploreV2.builderTooltipReference.Set(builderTooltipReference); |
| 45 | 80 | | DataStore.i.exploreV2.questTooltipReference.Set(questTooltipReference); |
| 45 | 81 | | DataStore.i.exploreV2.settingsTooltipReference.Set(settingsTooltipReference); |
| 45 | 82 | | DataStore.i.exploreV2.profileCardTooltipReference.Set(profileCardTooltipReference); |
| | 83 | |
|
| 45 | 84 | | view.OnSectionOpen += OnSectionOpen; |
| | 85 | |
|
| 45 | 86 | | isOpen.OnChange += IsOpenChanged; |
| 45 | 87 | | IsOpenChanged(isOpen.Get(), false); |
| | 88 | |
|
| 45 | 89 | | currentSectionIndex.OnChange += CurrentSectionIndexChanged; |
| 45 | 90 | | CurrentSectionIndexChanged(currentSectionIndex.Get(), 0); |
| | 91 | |
|
| 45 | 92 | | isPlacesAndEventsSectionInitialized.OnChange += IsPlacesAndEventsSectionInitializedChanged; |
| 45 | 93 | | IsPlacesAndEventsSectionInitializedChanged(isPlacesAndEventsSectionInitialized.Get(), false); |
| 45 | 94 | | placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged; |
| 45 | 95 | | PlacesAndEventsVisibleChanged(placesAndEventsVisible.Get(), false); |
| | 96 | |
|
| 45 | 97 | | isAvatarEditorInitialized.OnChange += IsAvatarEditorInitializedChanged; |
| 45 | 98 | | IsAvatarEditorInitializedChanged(isAvatarEditorInitialized.Get(), false); |
| 45 | 99 | | avatarEditorVisible.OnChange += AvatarEditorVisibleChanged; |
| 45 | 100 | | AvatarEditorVisibleChanged(avatarEditorVisible.Get(), false); |
| | 101 | |
|
| 45 | 102 | | isNavmapInitialized.OnChange += IsNavMapInitializedChanged; |
| 45 | 103 | | IsNavMapInitializedChanged(isNavmapInitialized.Get(), false); |
| 45 | 104 | | navmapVisible.OnChange += NavmapVisibleChanged; |
| 45 | 105 | | NavmapVisibleChanged(navmapVisible.Get(), false); |
| | 106 | |
|
| 45 | 107 | | isBuilderInitialized.OnChange += IsBuilderInitializedChanged; |
| 45 | 108 | | IsBuilderInitializedChanged(isBuilderInitialized.Get(), false); |
| 45 | 109 | | builderVisible.OnChange += BuilderVisibleChanged; |
| 45 | 110 | | BuilderVisibleChanged(builderVisible.Get(), false); |
| | 111 | |
|
| 45 | 112 | | isQuestInitialized.OnChange += IsQuestInitializedChanged; |
| 45 | 113 | | IsQuestInitializedChanged(isQuestInitialized.Get(), false); |
| 45 | 114 | | questVisible.OnChange += QuestVisibleChanged; |
| 45 | 115 | | QuestVisibleChanged(questVisible.Get(), false); |
| | 116 | |
|
| 45 | 117 | | isSettingsPanelInitialized.OnChange += IsSettingsPanelInitializedChanged; |
| 45 | 118 | | IsSettingsPanelInitializedChanged(isSettingsPanelInitialized.Get(), false); |
| 45 | 119 | | settingsVisible.OnChange += SettingsVisibleChanged; |
| 45 | 120 | | SettingsVisibleChanged(settingsVisible.Get(), false); |
| | 121 | |
|
| 45 | 122 | | isInitialized.Set(true); |
| 45 | 123 | | } |
| | 124 | |
|
| | 125 | | internal void InitializePlacesAndEventsSection() |
| | 126 | | { |
| 1 | 127 | | if (placesAndEventsSectionController != null) |
| 0 | 128 | | return; |
| | 129 | |
|
| 1 | 130 | | placesAndEventsSectionController = new PlacesAndEventsSectionComponentController(view.currentPlacesAndEventsSect |
| 1 | 131 | | placesAndEventsSectionController.OnCloseExploreV2 += OnCloseButtonPressed; |
| 1 | 132 | | } |
| | 133 | |
|
| | 134 | | internal void OnSectionOpen(ExploreSection section) |
| | 135 | | { |
| 6 | 136 | | if (section != currentOpenSection) |
| 5 | 137 | | exploreV2Analytics.SendStartMenuSectionVisibility(currentOpenSection, false); |
| | 138 | |
|
| 6 | 139 | | currentOpenSection = section; |
| | 140 | |
|
| 6 | 141 | | if (currentOpenSection == ExploreSection.Backpack) |
| | 142 | | { |
| 1 | 143 | | view.ConfigureEncapsulatedSection( |
| | 144 | | ExploreSection.Backpack, |
| | 145 | | DataStore.i.exploreV2.configureBackpackInFullscreenMenu); |
| | 146 | | } |
| | 147 | |
|
| 6 | 148 | | placesAndEventsVisible.Set(currentOpenSection == ExploreSection.Explore); |
| 6 | 149 | | avatarEditorVisible.Set(currentOpenSection == ExploreSection.Backpack); |
| 6 | 150 | | navmapVisible.Set(currentOpenSection == ExploreSection.Map); |
| 6 | 151 | | builderVisible.Set(currentOpenSection == ExploreSection.Builder); |
| 6 | 152 | | questVisible.Set(currentOpenSection == ExploreSection.Quest); |
| 6 | 153 | | settingsVisible.Set(currentOpenSection == ExploreSection.Settings); |
| 6 | 154 | | profileCardIsOpen.Set(false); |
| 6 | 155 | | } |
| | 156 | |
|
| | 157 | | public void Dispose() |
| | 158 | | { |
| 45 | 159 | | rendererState.OnChange -= Initialize_Internal; |
| 45 | 160 | | DataStore.i.realm.playerRealm.OnChange -= UpdateRealmInfo; |
| 45 | 161 | | ownUserProfile.OnUpdate -= UpdateProfileInfo; |
| 45 | 162 | | view?.currentProfileCard.onClick?.RemoveAllListeners(); |
| 45 | 163 | | isOpen.OnChange -= IsOpenChanged; |
| 45 | 164 | | currentSectionIndex.OnChange -= CurrentSectionIndexChanged; |
| 45 | 165 | | isPlacesAndEventsSectionInitialized.OnChange -= IsPlacesAndEventsSectionInitializedChanged; |
| 45 | 166 | | placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged; |
| 45 | 167 | | isAvatarEditorInitialized.OnChange -= IsAvatarEditorInitializedChanged; |
| 45 | 168 | | avatarEditorVisible.OnChange -= AvatarEditorVisibleChanged; |
| 45 | 169 | | isNavmapInitialized.OnChange -= IsNavMapInitializedChanged; |
| 45 | 170 | | navmapVisible.OnChange -= NavmapVisibleChanged; |
| 45 | 171 | | isBuilderInitialized.OnChange -= IsBuilderInitializedChanged; |
| 45 | 172 | | builderVisible.OnChange -= BuilderVisibleChanged; |
| 45 | 173 | | isQuestInitialized.OnChange -= IsQuestInitializedChanged; |
| 45 | 174 | | questVisible.OnChange -= QuestVisibleChanged; |
| 45 | 175 | | isSettingsPanelInitialized.OnChange -= IsSettingsPanelInitializedChanged; |
| 45 | 176 | | settingsVisible.OnChange -= SettingsVisibleChanged; |
| | 177 | |
|
| 45 | 178 | | if (view != null) |
| | 179 | | { |
| 45 | 180 | | view.OnCloseButtonPressed -= OnCloseButtonPressed; |
| 45 | 181 | | view.OnAfterShowAnimation -= OnAfterShowAnimation; |
| 45 | 182 | | view.OnSectionOpen -= OnSectionOpen; |
| 45 | 183 | | view.Dispose(); |
| | 184 | | } |
| | 185 | |
|
| 45 | 186 | | if (placesAndEventsSectionController != null) |
| | 187 | | { |
| 1 | 188 | | placesAndEventsSectionController.OnCloseExploreV2 -= OnCloseButtonPressed; |
| 1 | 189 | | placesAndEventsSectionController.Dispose(); |
| | 190 | | } |
| 45 | 191 | | } |
| | 192 | |
|
| 218 | 193 | | public void SetVisibility(bool visible) { isOpen.Set(visible); } |
| | 194 | |
|
| 128 | 195 | | internal void IsOpenChanged(bool current, bool previous) { SetVisibility_Internal(current); } |
| | 196 | |
|
| | 197 | | internal void CurrentSectionIndexChanged(int current, int previous) |
| | 198 | | { |
| 343 | 199 | | if (DataStore.i.exploreV2.isInShowAnimationTransiton.Get()) |
| 0 | 200 | | return; |
| | 201 | |
|
| 343 | 202 | | if (Enum.IsDefined(typeof(ExploreSection), current)) |
| | 203 | | { |
| 291 | 204 | | if (!view.IsSectionActive((ExploreSection)current)) |
| 291 | 205 | | CurrentSectionIndexChanged(current + 1, current); |
| | 206 | | else |
| 0 | 207 | | view.GoToSection((ExploreSection)current); |
| 0 | 208 | | } |
| | 209 | | else |
| 52 | 210 | | view.GoToSection(0); |
| 52 | 211 | | } |
| | 212 | |
|
| | 213 | | internal void SetVisibility_Internal(bool visible) |
| | 214 | | { |
| 64 | 215 | | if (view == null || DataStore.i.common.isSignUpFlow.Get()) |
| 0 | 216 | | return; |
| | 217 | |
|
| 64 | 218 | | if (visible) |
| | 219 | | { |
| 15 | 220 | | Utils.UnlockCursor(); |
| | 221 | |
|
| 15 | 222 | | if (DataStore.i.common.isTutorialRunning.Get()) |
| 1 | 223 | | view.GoToSection(ExploreV2MenuComponentView.DEFAULT_SECTION); |
| 1 | 224 | | } |
| | 225 | | else |
| | 226 | | { |
| 49 | 227 | | CommonScriptableObjects.isFullscreenHUDOpen.Set(false); |
| 49 | 228 | | placesAndEventsVisible.Set(false); |
| 49 | 229 | | avatarEditorVisible.Set(false); |
| 49 | 230 | | profileCardIsOpen.Set(false); |
| 49 | 231 | | navmapVisible.Set(false); |
| 49 | 232 | | builderVisible.Set(false); |
| 49 | 233 | | questVisible.Set(false); |
| 49 | 234 | | settingsVisible.Set(false); |
| | 235 | | } |
| | 236 | |
|
| 64 | 237 | | view.SetVisible(visible); |
| 64 | 238 | | } |
| | 239 | |
|
| 0 | 240 | | internal void OnAfterShowAnimation() { CommonScriptableObjects.isFullscreenHUDOpen.Set(true); } |
| | 241 | |
|
| | 242 | | internal void IsPlacesAndEventsSectionInitializedChanged(bool current, bool previous) |
| | 243 | | { |
| 45 | 244 | | view.SetSectionActive(ExploreSection.Explore, current); |
| | 245 | |
|
| 45 | 246 | | if (current) |
| 0 | 247 | | InitializePlacesAndEventsSection(); |
| 45 | 248 | | } |
| | 249 | |
|
| | 250 | | internal void PlacesAndEventsVisibleChanged(bool current, bool previous) |
| | 251 | | { |
| 48 | 252 | | if (!isInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 1 | 253 | | return; |
| | 254 | |
|
| 47 | 255 | | if (current) |
| | 256 | | { |
| 2 | 257 | | SetVisibility(true); |
| 2 | 258 | | view.GoToSection(ExploreSection.Explore); |
| 2 | 259 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, true); |
| 2 | 260 | | } |
| 45 | 261 | | else if (currentOpenSection == ExploreSection.Explore) |
| | 262 | | { |
| 45 | 263 | | SetVisibility(false); |
| 45 | 264 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, false); |
| | 265 | | } |
| 45 | 266 | | } |
| | 267 | |
|
| 96 | 268 | | internal void IsAvatarEditorInitializedChanged(bool current, bool previous) { view.SetSectionActive(ExploreSection.B |
| | 269 | |
|
| | 270 | | internal void AvatarEditorVisibleChanged(bool current, bool previous) |
| | 271 | | { |
| 48 | 272 | | if (!isAvatarEditorInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 5 | 273 | | return; |
| | 274 | |
|
| 43 | 275 | | if (current) |
| | 276 | | { |
| 2 | 277 | | SetVisibility(true); |
| 2 | 278 | | view.GoToSection(ExploreSection.Backpack); |
| 2 | 279 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, true); |
| 2 | 280 | | } |
| 41 | 281 | | else if (currentOpenSection == ExploreSection.Backpack) |
| | 282 | | { |
| 1 | 283 | | SetVisibility(false); |
| 1 | 284 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, false); |
| | 285 | | } |
| 41 | 286 | | } |
| | 287 | |
|
| | 288 | | internal void IsNavMapInitializedChanged(bool current, bool previous) |
| | 289 | | { |
| 48 | 290 | | view.SetSectionActive(ExploreSection.Map, current); |
| | 291 | |
|
| 48 | 292 | | if (current) |
| 19 | 293 | | view.ConfigureEncapsulatedSection(ExploreSection.Map, DataStore.i.exploreV2.configureMapInFullscreenMenu); |
| 48 | 294 | | } |
| | 295 | |
|
| | 296 | | internal void NavmapVisibleChanged(bool current, bool previous) |
| | 297 | | { |
| 48 | 298 | | if (!isNavmapInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 28 | 299 | | return; |
| | 300 | |
|
| 20 | 301 | | if (current) |
| | 302 | | { |
| 2 | 303 | | SetVisibility(true); |
| 2 | 304 | | view.GoToSection(ExploreSection.Map); |
| 2 | 305 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, true); |
| 2 | 306 | | } |
| 18 | 307 | | else if (currentOpenSection == ExploreSection.Map) |
| | 308 | | { |
| 1 | 309 | | SetVisibility(false); |
| 1 | 310 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, false); |
| | 311 | | } |
| 18 | 312 | | } |
| | 313 | |
|
| | 314 | | internal void IsBuilderInitializedChanged(bool current, bool previous) |
| | 315 | | { |
| 48 | 316 | | view.SetSectionActive(ExploreSection.Builder, current); |
| | 317 | |
|
| 48 | 318 | | if (current) |
| 40 | 319 | | view.ConfigureEncapsulatedSection(ExploreSection.Builder, DataStore.i.exploreV2.configureBuilderInFullscreen |
| 48 | 320 | | } |
| | 321 | |
|
| | 322 | | internal void BuilderVisibleChanged(bool current, bool previous) |
| | 323 | | { |
| 48 | 324 | | if (!isBuilderInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 7 | 325 | | return; |
| | 326 | |
|
| 41 | 327 | | if (current) |
| | 328 | | { |
| 2 | 329 | | SetVisibility(true); |
| 2 | 330 | | view.GoToSection(ExploreSection.Builder); |
| 2 | 331 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, true); |
| 2 | 332 | | } |
| 39 | 333 | | else if (currentOpenSection == ExploreSection.Builder) |
| | 334 | | { |
| 1 | 335 | | SetVisibility(false); |
| 1 | 336 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, false); |
| | 337 | | } |
| 39 | 338 | | } |
| | 339 | |
|
| | 340 | | internal void IsQuestInitializedChanged(bool current, bool previous) |
| | 341 | | { |
| 48 | 342 | | view.SetSectionActive(ExploreSection.Quest, current); |
| | 343 | |
|
| 48 | 344 | | if (current) |
| 9 | 345 | | view.ConfigureEncapsulatedSection(ExploreSection.Quest, DataStore.i.exploreV2.configureQuestInFullscreenMenu |
| 48 | 346 | | } |
| | 347 | |
|
| | 348 | | internal void QuestVisibleChanged(bool current, bool previous) |
| | 349 | | { |
| 48 | 350 | | if (!isQuestInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 39 | 351 | | return; |
| | 352 | |
|
| 9 | 353 | | if (current) |
| | 354 | | { |
| 1 | 355 | | SetVisibility(true); |
| 1 | 356 | | view.GoToSection(ExploreSection.Quest); |
| 1 | 357 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, true); |
| 1 | 358 | | } |
| 8 | 359 | | else if (currentOpenSection == ExploreSection.Quest) |
| | 360 | | { |
| 1 | 361 | | SetVisibility(false); |
| 1 | 362 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, false); |
| | 363 | | } |
| 8 | 364 | | } |
| | 365 | |
|
| | 366 | | internal void IsSettingsPanelInitializedChanged(bool current, bool previous) |
| | 367 | | { |
| 48 | 368 | | view.SetSectionActive(ExploreSection.Settings, current); |
| | 369 | |
|
| 48 | 370 | | if (current) |
| 7 | 371 | | view.ConfigureEncapsulatedSection(ExploreSection.Settings, DataStore.i.exploreV2.configureSettingsInFullscre |
| 48 | 372 | | } |
| | 373 | |
|
| | 374 | | internal void SettingsVisibleChanged(bool current, bool previous) |
| | 375 | | { |
| 48 | 376 | | if (!isSettingsPanelInitialized.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 41 | 377 | | return; |
| | 378 | |
|
| 7 | 379 | | if (current) |
| | 380 | | { |
| 1 | 381 | | SetVisibility(true); |
| 1 | 382 | | view.GoToSection(ExploreSection.Settings); |
| 1 | 383 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, true); |
| 1 | 384 | | } |
| 6 | 385 | | else if (currentOpenSection == ExploreSection.Settings) |
| | 386 | | { |
| 1 | 387 | | SetVisibility(false); |
| 1 | 388 | | exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, false); |
| | 389 | | } |
| 6 | 390 | | } |
| | 391 | |
|
| | 392 | | internal void UpdateRealmInfo(CurrentRealmModel currentRealm, CurrentRealmModel previousRealm) |
| | 393 | | { |
| | 394 | | // Get the name of the current realm |
| 47 | 395 | | string currentRealmServer = currentRealm?.serverName; |
| 47 | 396 | | string currentRealmLayer = currentRealm?.layer; |
| 47 | 397 | | string formattedRealmName = currentRealmServer; |
| 47 | 398 | | if (!string.IsNullOrEmpty(currentRealmLayer)) |
| | 399 | | { |
| 2 | 400 | | formattedRealmName = $"{formattedRealmName}-{currentRealmLayer}"; |
| | 401 | | } |
| | 402 | |
|
| 47 | 403 | | view.currentRealmViewer.SetRealm(formattedRealmName); |
| | 404 | |
|
| | 405 | | // Calculate number of users in the current realm |
| 47 | 406 | | List<RealmModel> realmList = DataStore.i.realm.realmsInfo.Get()?.ToList(); |
| 48 | 407 | | RealmModel currentRealmModel = realmList?.FirstOrDefault(r => r.serverName == currentRealmServer && (r.layer == |
| 47 | 408 | | int realmUsers = 0; |
| 47 | 409 | | if (currentRealmModel != null) |
| 1 | 410 | | realmUsers = currentRealmModel.usersCount; |
| | 411 | |
|
| 47 | 412 | | view.currentRealmViewer.SetNumberOfUsers(realmUsers); |
| 47 | 413 | | } |
| | 414 | |
|
| | 415 | | internal void UpdateProfileInfo(UserProfile profile) |
| | 416 | | { |
| 46 | 417 | | view.currentProfileCard.SetProfileName(profile.userName); |
| 46 | 418 | | view.currentProfileCard.SetProfileAddress(profile.ethAddress); |
| 46 | 419 | | view.currentProfileCard.SetProfilePicture(profile.face128SnapshotURL); |
| 46 | 420 | | } |
| | 421 | |
|
| | 422 | | internal void OnCloseButtonPressed(bool fromShortcut) |
| | 423 | | { |
| 2 | 424 | | if (isOpen.Get()) |
| 2 | 425 | | exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut : Ex |
| | 426 | |
|
| 2 | 427 | | SetVisibility(false); |
| 2 | 428 | | } |
| | 429 | |
|
| 0 | 430 | | internal virtual IExploreV2Analytics CreateAnalyticsController() => new ExploreV2Analytics.ExploreV2Analytics(); |
| | 431 | |
|
| 0 | 432 | | internal virtual IExploreV2MenuComponentView CreateView() => ExploreV2MenuComponentView.Create(); |
| | 433 | | } |