< Summary

Class:ExploreV2MenuComponentController
Assembly:ExploreV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/MainMenu/ExploreV2Menu/ExploreV2MenuComponentController.cs
Covered lines:303
Uncovered lines:38
Coverable lines:341
Total lines:596
Line coverage:88.8% (303 of 341)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ExploreV2MenuComponentController()0%110100%
Initialize()0%330100%
InitializePlacesAndEventsSection()0%2.032080%
OnSectionOpen(...)0%330100%
Dispose()0%770100%
SetVisibility(...)0%110100%
IsOpenChanged(...)0%110100%
CurrentSectionIndexChanged(...)0%4.594066.67%
SetVisibility_Internal(...)0%5.015094.12%
OnAfterShowAnimation()0%2100%
IsPlacesAndEventsSectionInitializedChanged(...)0%2.062075%
PlacesAndEventsVisibleChanged(...)0%7.127086.67%
IsAvatarEditorInitializedChanged(...)0%110100%
AvatarEditorVisibleChanged(...)0%7.127086.67%
IsNavMapInitializedChanged(...)0%220100%
NavmapVisibleChanged(...)0%7.127086.67%
IsBuilderInitializedChanged(...)0%220100%
BuilderVisibleChanged(...)0%7.127086.67%
IsQuestInitializedChanged(...)0%220100%
QuestVisibleChanged(...)0%7.127086.67%
IsSettingsPanelInitializedChanged(...)0%220100%
SettingsVisibleChanged(...)0%7.127086.67%
UpdateRealmInfo(...)0%770100%
UpdateAvailableRealmsInfo(...)0%770100%
NeedToRefreshRealms(...)0%8.66058.33%
UpdateProfileInfo(...)0%110100%
OnCloseButtonPressed(...)0%19.2613066.67%
ConfigureOhterUIDependencies()0%110100%
CreateAnalyticsController()0%2100%
CreateView()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/MainMenu/ExploreV2Menu/ExploreV2MenuComponentController.cs

#LineLine coverage
 1using DCL;
 2using DCL.Helpers;
 3using ExploreV2Analytics;
 4using System;
 5using System.Collections;
 6using System.Collections.Generic;
 7using System.Linq;
 8using UnityEngine;
 9using Variables.RealmsInfo;
 10
 11/// <summary>
 12/// Main controller for the feature "Explore V2".
 13/// </summary>
 14public class ExploreV2MenuComponentController : IExploreV2MenuComponentController
 15{
 16    internal const float MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU = 0.1f;
 17
 13818    internal UserProfile ownUserProfile => UserProfile.GetOwnUserProfile();
 4619    internal RectTransform topMenuTooltipReference { get => view.currentTopMenuTooltipReference; }
 4620    internal RectTransform placesAndEventsTooltipReference { get => view.currentPlacesAndEventsTooltipReference; }
 4621    internal RectTransform backpackTooltipReference { get => view.currentBackpackTooltipReference; }
 4622    internal RectTransform mapTooltipReference { get => view.currentMapTooltipReference; }
 4623    internal RectTransform builderTooltipReference { get => view.currentBuilderTooltipReference; }
 4624    internal RectTransform questTooltipReference { get => view.currentQuestTooltipReference; }
 4625    internal RectTransform settingsTooltipReference { get => view.currentSettingsTooltipReference; }
 4626    internal RectTransform profileCardTooltipReference { get => view.currentProfileCardTooltipReference; }
 27
 28    internal IExploreV2MenuComponentView view;
 29    internal IPlacesAndEventsSectionComponentController placesAndEventsSectionController;
 30    internal IExploreV2Analytics exploreV2Analytics;
 31    internal ExploreSection currentOpenSection;
 32    internal float controlsHUDCloseTime = 0f;
 33    internal float emotesHUDCloseTime = 0f;
 34    internal float playerInfoCardHUDCloseTime = 0f;
 35    internal float chatInputHUDCloseTime = 0f;
 4636    internal List<RealmRowComponentModel> currentAvailableRealms = new List<RealmRowComponentModel>();
 37
 26238    internal BaseVariable<bool> isOpen => DataStore.i.exploreV2.isOpen;
 13839    internal BaseVariable<int> currentSectionIndex => DataStore.i.exploreV2.currentSectionIndex;
 6340    internal BaseVariable<bool> profileCardIsOpen => DataStore.i.exploreV2.profileCardIsOpen;
 9741    internal BaseVariable<bool> isInitialized => DataStore.i.exploreV2.isInitialized;
 13842    internal BaseVariable<bool> isPlacesAndEventsSectionInitialized => DataStore.i.exploreV2.isPlacesAndEventsSectionIni
 20143    internal BaseVariable<bool> placesAndEventsVisible => DataStore.i.exploreV2.placesAndEventsVisible;
 18944    internal BaseVariable<bool> isAvatarEditorInitialized => DataStore.i.HUDs.isAvatarEditorInitialized;
 20145    internal BaseVariable<bool> avatarEditorVisible => DataStore.i.HUDs.avatarEditorVisible;
 18946    internal BaseVariable<bool> isNavmapInitialized => DataStore.i.HUDs.isNavMapInitialized;
 20147    internal BaseVariable<bool> navmapVisible => DataStore.i.HUDs.navmapVisible;
 18948    internal BaseVariable<bool> isBuilderInitialized => DataStore.i.builderInWorld.isInitialized;
 20149    internal BaseVariable<bool> builderVisible => DataStore.i.HUDs.builderProjectsPanelVisible;
 18950    internal BaseVariable<bool> isQuestInitialized => DataStore.i.Quests.isInitialized;
 20151    internal BaseVariable<bool> questVisible => DataStore.i.HUDs.questsPanelVisible;
 18952    internal BaseVariable<bool> isSettingsPanelInitialized => DataStore.i.settings.isInitialized;
 20153    internal BaseVariable<bool> settingsVisible => DataStore.i.settings.settingsPanelVisible;
 54
 4655    internal BaseVariable<bool> controlsVisible => DataStore.i.HUDs.controlsVisible;
 4656    internal BaseVariable<bool> emotesVisible => DataStore.i.HUDs.emotesVisible;
 4657    internal BaseVariable<bool> chatInputVisible => DataStore.i.HUDs.chatInputVisible;
 4658    internal BooleanVariable playerInfoCardVisible => CommonScriptableObjects.playerInfoCardVisibleState;
 59
 60    public void Initialize()
 61    {
 4662        exploreV2Analytics = CreateAnalyticsController();
 4663        view = CreateView();
 4664        SetVisibility(false);
 65
 4666        DataStore.i.realm.playerRealm.OnChange += UpdateRealmInfo;
 4667        UpdateRealmInfo(DataStore.i.realm.playerRealm.Get(), null);
 68
 4669        DataStore.i.realm.realmsInfo.OnSet += UpdateAvailableRealmsInfo;
 4670        UpdateAvailableRealmsInfo(DataStore.i.realm.realmsInfo.Get());
 71
 4672        ownUserProfile.OnUpdate += UpdateProfileInfo;
 4673        UpdateProfileInfo(ownUserProfile);
 4674        view.currentProfileCard.onClick?.AddListener(() => { profileCardIsOpen.Set(!profileCardIsOpen.Get()); });
 4675        view.currentRealmViewer.onLogoClick?.AddListener(view.ShowRealmSelectorModal);
 4676        view.OnCloseButtonPressed += OnCloseButtonPressed;
 4677        view.OnAfterShowAnimation += OnAfterShowAnimation;
 78
 4679        DataStore.i.exploreV2.topMenuTooltipReference.Set(topMenuTooltipReference);
 4680        DataStore.i.exploreV2.placesAndEventsTooltipReference.Set(placesAndEventsTooltipReference);
 4681        DataStore.i.exploreV2.backpackTooltipReference.Set(backpackTooltipReference);
 4682        DataStore.i.exploreV2.mapTooltipReference.Set(mapTooltipReference);
 4683        DataStore.i.exploreV2.builderTooltipReference.Set(builderTooltipReference);
 4684        DataStore.i.exploreV2.questTooltipReference.Set(questTooltipReference);
 4685        DataStore.i.exploreV2.settingsTooltipReference.Set(settingsTooltipReference);
 4686        DataStore.i.exploreV2.profileCardTooltipReference.Set(profileCardTooltipReference);
 87
 4688        view.OnSectionOpen += OnSectionOpen;
 89
 4690        isOpen.OnChange += IsOpenChanged;
 4691        IsOpenChanged(isOpen.Get(), false);
 92
 4693        currentSectionIndex.OnChange += CurrentSectionIndexChanged;
 4694        CurrentSectionIndexChanged(currentSectionIndex.Get(), 0);
 95
 4696        isPlacesAndEventsSectionInitialized.OnChange += IsPlacesAndEventsSectionInitializedChanged;
 4697        IsPlacesAndEventsSectionInitializedChanged(isPlacesAndEventsSectionInitialized.Get(), false);
 4698        placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged;
 4699        PlacesAndEventsVisibleChanged(placesAndEventsVisible.Get(), false);
 100
 46101        isAvatarEditorInitialized.OnChange += IsAvatarEditorInitializedChanged;
 46102        IsAvatarEditorInitializedChanged(isAvatarEditorInitialized.Get(), false);
 46103        avatarEditorVisible.OnChange += AvatarEditorVisibleChanged;
 46104        AvatarEditorVisibleChanged(avatarEditorVisible.Get(), false);
 105
 46106        isNavmapInitialized.OnChange += IsNavMapInitializedChanged;
 46107        IsNavMapInitializedChanged(isNavmapInitialized.Get(), false);
 46108        navmapVisible.OnChange += NavmapVisibleChanged;
 46109        NavmapVisibleChanged(navmapVisible.Get(), false);
 110
 46111        isBuilderInitialized.OnChange += IsBuilderInitializedChanged;
 46112        IsBuilderInitializedChanged(isBuilderInitialized.Get(), false);
 46113        builderVisible.OnChange += BuilderVisibleChanged;
 46114        BuilderVisibleChanged(builderVisible.Get(), false);
 115
 46116        isQuestInitialized.OnChange += IsQuestInitializedChanged;
 46117        IsQuestInitializedChanged(isQuestInitialized.Get(), false);
 46118        questVisible.OnChange += QuestVisibleChanged;
 46119        QuestVisibleChanged(questVisible.Get(), false);
 120
 46121        isSettingsPanelInitialized.OnChange += IsSettingsPanelInitializedChanged;
 46122        IsSettingsPanelInitializedChanged(isSettingsPanelInitialized.Get(), false);
 46123        settingsVisible.OnChange += SettingsVisibleChanged;
 46124        SettingsVisibleChanged(settingsVisible.Get(), false);
 125
 46126        ConfigureOhterUIDependencies();
 127
 46128        isInitialized.Set(true);
 46129    }
 130
 131    internal void InitializePlacesAndEventsSection()
 132    {
 1133        if (placesAndEventsSectionController != null)
 0134            return;
 135
 1136        placesAndEventsSectionController = new PlacesAndEventsSectionComponentController(view.currentPlacesAndEventsSect
 1137        placesAndEventsSectionController.OnCloseExploreV2 += OnCloseButtonPressed;
 1138    }
 139
 140    internal void OnSectionOpen(ExploreSection section)
 141    {
 6142        if (section != currentOpenSection)
 5143            exploreV2Analytics.SendStartMenuSectionVisibility(currentOpenSection, false);
 144
 6145        currentOpenSection = section;
 146
 6147        if (currentOpenSection == ExploreSection.Backpack)
 148        {
 1149            view.ConfigureEncapsulatedSection(
 150                ExploreSection.Backpack,
 151                DataStore.i.exploreV2.configureBackpackInFullscreenMenu);
 152        }
 153
 6154        placesAndEventsVisible.Set(currentOpenSection == ExploreSection.Explore);
 6155        avatarEditorVisible.Set(currentOpenSection == ExploreSection.Backpack);
 6156        navmapVisible.Set(currentOpenSection == ExploreSection.Map);
 6157        builderVisible.Set(currentOpenSection == ExploreSection.Builder);
 6158        questVisible.Set(currentOpenSection == ExploreSection.Quest);
 6159        settingsVisible.Set(currentOpenSection == ExploreSection.Settings);
 6160        profileCardIsOpen.Set(false);
 6161    }
 162
 163    public void Dispose()
 164    {
 46165        DataStore.i.realm.playerRealm.OnChange -= UpdateRealmInfo;
 46166        DataStore.i.realm.realmsInfo.OnSet -= UpdateAvailableRealmsInfo;
 46167        ownUserProfile.OnUpdate -= UpdateProfileInfo;
 46168        view?.currentProfileCard.onClick?.RemoveAllListeners();
 46169        isOpen.OnChange -= IsOpenChanged;
 46170        currentSectionIndex.OnChange -= CurrentSectionIndexChanged;
 46171        isPlacesAndEventsSectionInitialized.OnChange -= IsPlacesAndEventsSectionInitializedChanged;
 46172        placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged;
 46173        isAvatarEditorInitialized.OnChange -= IsAvatarEditorInitializedChanged;
 46174        avatarEditorVisible.OnChange -= AvatarEditorVisibleChanged;
 46175        isNavmapInitialized.OnChange -= IsNavMapInitializedChanged;
 46176        navmapVisible.OnChange -= NavmapVisibleChanged;
 46177        isBuilderInitialized.OnChange -= IsBuilderInitializedChanged;
 46178        builderVisible.OnChange -= BuilderVisibleChanged;
 46179        isQuestInitialized.OnChange -= IsQuestInitializedChanged;
 46180        questVisible.OnChange -= QuestVisibleChanged;
 46181        isSettingsPanelInitialized.OnChange -= IsSettingsPanelInitializedChanged;
 46182        settingsVisible.OnChange -= SettingsVisibleChanged;
 183
 46184        if (view != null)
 185        {
 46186            view.currentProfileCard.onClick?.RemoveAllListeners();
 46187            view.currentRealmViewer.onLogoClick?.RemoveAllListeners();
 46188            view.OnCloseButtonPressed -= OnCloseButtonPressed;
 46189            view.OnAfterShowAnimation -= OnAfterShowAnimation;
 46190            view.OnSectionOpen -= OnSectionOpen;
 46191            view.Dispose();
 192        }
 193
 46194        if (placesAndEventsSectionController != null)
 195        {
 1196            placesAndEventsSectionController.OnCloseExploreV2 -= OnCloseButtonPressed;
 1197            placesAndEventsSectionController.Dispose();
 198        }
 46199    }
 200
 120201    public void SetVisibility(bool visible) { isOpen.Set(visible); }
 202
 130203    internal void IsOpenChanged(bool current, bool previous) { SetVisibility_Internal(current); }
 204
 205    internal void CurrentSectionIndexChanged(int current, int previous)
 206    {
 350207        if (DataStore.i.exploreV2.isInShowAnimationTransiton.Get())
 0208            return;
 209
 350210        if (Enum.IsDefined(typeof(ExploreSection), current))
 211        {
 297212            if (!view.IsSectionActive((ExploreSection)current))
 297213                CurrentSectionIndexChanged(current + 1, current);
 214            else
 0215                view.GoToSection((ExploreSection)current);
 0216        }
 217        else
 53218            view.GoToSection(0);
 53219    }
 220
 221    internal void SetVisibility_Internal(bool visible)
 222    {
 65223        if (view == null || DataStore.i.common.isSignUpFlow.Get())
 0224            return;
 225
 65226        if (visible)
 227        {
 15228            Utils.UnlockCursor();
 229
 15230            if (DataStore.i.common.isTutorialRunning.Get())
 1231                view.GoToSection(ExploreV2MenuComponentView.DEFAULT_SECTION);
 1232        }
 233        else
 234        {
 50235            CommonScriptableObjects.isFullscreenHUDOpen.Set(false);
 50236            placesAndEventsVisible.Set(false);
 50237            avatarEditorVisible.Set(false);
 50238            profileCardIsOpen.Set(false);
 50239            navmapVisible.Set(false);
 50240            builderVisible.Set(false);
 50241            questVisible.Set(false);
 50242            settingsVisible.Set(false);
 243        }
 244
 65245        view.SetVisible(visible);
 65246    }
 247
 0248    internal void OnAfterShowAnimation() { CommonScriptableObjects.isFullscreenHUDOpen.Set(true); }
 249
 250    internal void IsPlacesAndEventsSectionInitializedChanged(bool current, bool previous)
 251    {
 46252        view.SetSectionActive(ExploreSection.Explore, current);
 253
 46254        if (current)
 0255            InitializePlacesAndEventsSection();
 46256    }
 257
 258    internal void PlacesAndEventsVisibleChanged(bool current, bool previous)
 259    {
 49260        if (!isInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 1261            return;
 262
 48263        if (current)
 264        {
 2265            if (!isOpen.Get())
 266            {
 2267                SetVisibility(true);
 2268                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 269            }
 270
 2271            view.GoToSection(ExploreSection.Explore);
 2272            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, true);
 2273        }
 46274        else if (currentOpenSection == ExploreSection.Explore)
 275        {
 46276            if (isOpen.Get())
 277            {
 0278                SetVisibility(false);
 0279                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 280            }
 281
 46282            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, false);
 283        }
 46284    }
 285
 98286    internal void IsAvatarEditorInitializedChanged(bool current, bool previous) { view.SetSectionActive(ExploreSection.B
 287
 288    internal void AvatarEditorVisibleChanged(bool current, bool previous)
 289    {
 49290        if (!isAvatarEditorInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 5291            return;
 292
 44293        if (current)
 294        {
 2295            if (!isOpen.Get())
 296            {
 2297                SetVisibility(true);
 2298                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 299            }
 300
 2301            view.GoToSection(ExploreSection.Backpack);
 2302            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, true);
 2303        }
 42304        else if (currentOpenSection == ExploreSection.Backpack)
 305        {
 1306            if (isOpen.Get())
 307            {
 0308                SetVisibility(false);
 0309                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 310            }
 311
 1312            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, false);
 313        }
 42314    }
 315
 316    internal void IsNavMapInitializedChanged(bool current, bool previous)
 317    {
 49318        view.SetSectionActive(ExploreSection.Map, current);
 319
 49320        if (current)
 20321            view.ConfigureEncapsulatedSection(ExploreSection.Map, DataStore.i.exploreV2.configureMapInFullscreenMenu);
 49322    }
 323
 324    internal void NavmapVisibleChanged(bool current, bool previous)
 325    {
 49326        if (!isNavmapInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 28327            return;
 328
 21329        if (current)
 330        {
 2331            if (!isOpen.Get())
 332            {
 2333                SetVisibility(true);
 2334                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 335            }
 336
 2337            view.GoToSection(ExploreSection.Map);
 2338            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, true);
 2339        }
 19340        else if (currentOpenSection == ExploreSection.Map)
 341        {
 1342            if (isOpen.Get())
 343            {
 0344                SetVisibility(false);
 0345                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 346            }
 347
 1348            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, false);
 349        }
 19350    }
 351
 352    internal void IsBuilderInitializedChanged(bool current, bool previous)
 353    {
 49354        view.SetSectionActive(ExploreSection.Builder, current);
 355
 49356        if (current)
 41357            view.ConfigureEncapsulatedSection(ExploreSection.Builder, DataStore.i.exploreV2.configureBuilderInFullscreen
 49358    }
 359
 360    internal void BuilderVisibleChanged(bool current, bool previous)
 361    {
 49362        if (!isBuilderInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 7363            return;
 364
 42365        if (current)
 366        {
 2367            if (!isOpen.Get())
 368            {
 2369                SetVisibility(true);
 2370                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 371            }
 372
 2373            view.GoToSection(ExploreSection.Builder);
 2374            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, true);
 2375        }
 40376        else if (currentOpenSection == ExploreSection.Builder)
 377        {
 1378            if (isOpen.Get())
 379            {
 0380                SetVisibility(false);
 0381                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 382            }
 383
 1384            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, false);
 385        }
 40386    }
 387
 388    internal void IsQuestInitializedChanged(bool current, bool previous)
 389    {
 49390        view.SetSectionActive(ExploreSection.Quest, current);
 391
 49392        if (current)
 10393            view.ConfigureEncapsulatedSection(ExploreSection.Quest, DataStore.i.exploreV2.configureQuestInFullscreenMenu
 49394    }
 395
 396    internal void QuestVisibleChanged(bool current, bool previous)
 397    {
 49398        if (!isQuestInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 39399            return;
 400
 10401        if (current)
 402        {
 1403            if (!isOpen.Get())
 404            {
 1405                SetVisibility(true);
 1406                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 407            }
 408
 1409            view.GoToSection(ExploreSection.Quest);
 1410            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, true);
 1411        }
 9412        else if (currentOpenSection == ExploreSection.Quest)
 413        {
 1414            if (isOpen.Get())
 415            {
 0416                SetVisibility(false);
 0417                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 418            }
 419
 1420            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, false);
 421        }
 9422    }
 423
 424    internal void IsSettingsPanelInitializedChanged(bool current, bool previous)
 425    {
 49426        view.SetSectionActive(ExploreSection.Settings, current);
 427
 49428        if (current)
 8429            view.ConfigureEncapsulatedSection(ExploreSection.Settings, DataStore.i.exploreV2.configureSettingsInFullscre
 49430    }
 431
 432    internal void SettingsVisibleChanged(bool current, bool previous)
 433    {
 49434        if (!isSettingsPanelInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 41435            return;
 436
 8437        if (current)
 438        {
 1439            if (!isOpen.Get())
 440            {
 1441                SetVisibility(true);
 1442                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 443            }
 1444            view.GoToSection(ExploreSection.Settings);
 1445            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, true);
 1446        }
 7447        else if (currentOpenSection == ExploreSection.Settings)
 448        {
 1449            if (isOpen.Get())
 450            {
 0451                SetVisibility(false);
 0452                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 453            }
 1454            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, false);
 455        }
 7456    }
 457
 458    internal void UpdateRealmInfo(CurrentRealmModel currentRealm, CurrentRealmModel previousRealm)
 459    {
 48460        if (currentRealm == null)
 46461            return;
 462
 463        // Get the name of the current realm
 2464        view.currentRealmViewer.SetRealm(currentRealm.serverName);
 2465        view.currentRealmSelectorModal.SetCurrentRealm(currentRealm.serverName);
 466
 467        // Calculate number of users in the current realm
 2468        List<RealmModel> realmList = DataStore.i.realm.realmsInfo.Get()?.ToList();
 3469        RealmModel currentRealmModel = realmList?.FirstOrDefault(r => r.serverName == currentRealm.serverName);
 2470        int realmUsers = 0;
 2471        if (currentRealmModel != null)
 1472            realmUsers = currentRealmModel.usersCount;
 473
 2474        view.currentRealmViewer.SetNumberOfUsers(realmUsers);
 2475    }
 476
 477    internal void UpdateAvailableRealmsInfo(IEnumerable<RealmModel> currentRealmList)
 478    {
 48479        if (!NeedToRefreshRealms(currentRealmList))
 46480            return;
 481
 2482        currentAvailableRealms.Clear();
 2483        CurrentRealmModel currentRealm = DataStore.i.realm.playerRealm.Get();
 484
 2485        if (currentRealmList != null)
 486        {
 12487            foreach (RealmModel realmModel in currentRealmList)
 488            {
 4489                RealmRowComponentModel realmToAdd = new RealmRowComponentModel
 490                {
 491                    name = realmModel.serverName,
 492                    players = realmModel.usersCount,
 493                    isConnected = realmModel.serverName == currentRealm?.serverName
 494                };
 495
 4496                currentAvailableRealms.Add(realmToAdd);
 497            }
 498        }
 499
 2500        view.currentRealmSelectorModal.SetAvailableRealms(currentAvailableRealms);
 2501    }
 502
 503    internal bool NeedToRefreshRealms(IEnumerable<RealmModel> newRealmList)
 504    {
 48505        if (newRealmList == null)
 0506            return true;
 507
 48508        bool needToRefresh = false;
 48509        if (newRealmList.Count() == currentAvailableRealms.Count)
 510        {
 92511            foreach (RealmModel realm in newRealmList)
 512            {
 0513                if (!currentAvailableRealms.Exists(x => x.name == realm.serverName && x.players == realm.usersCount))
 514                {
 0515                    needToRefresh = true;
 0516                    break;
 517                }
 518            }
 519        }
 520        else
 2521            needToRefresh = true;
 522
 48523        return needToRefresh;
 524    }
 525
 526    internal void UpdateProfileInfo(UserProfile profile)
 527    {
 47528        view.currentProfileCard.SetIsClaimedName(profile.hasClaimedName);
 47529        view.currentProfileCard.SetProfileName(profile.userName);
 47530        view.currentProfileCard.SetProfileAddress(profile.ethAddress);
 47531        view.currentProfileCard.SetProfilePicture(profile.face256SnapshotURL);
 47532    }
 533
 534    internal void OnCloseButtonPressed(bool fromShortcut)
 535    {
 2536        if (!fromShortcut)
 537        {
 1538            SetVisibility(false);
 1539            exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut : Ex
 1540        }
 541        else
 542        {
 1543            if (isOpen.Get())
 544            {
 1545                SetVisibility(false);
 1546                exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut 
 1547            }
 548            else
 549            {
 0550                if (Time.realtimeSinceStartup - controlsHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU
 551                    Time.realtimeSinceStartup - emotesHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU &
 552                    Time.realtimeSinceStartup - playerInfoCardHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_STAR
 553                    Time.realtimeSinceStartup - chatInputHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MEN
 554                {
 0555                    SetVisibility(true);
 0556                    exploreV2Analytics.SendStartMenuVisibility(true, fromShortcut ? ExploreUIVisibilityMethod.FromShortc
 557                }
 558            }
 559        }
 0560    }
 561
 562    internal void ConfigureOhterUIDependencies()
 563    {
 46564        controlsHUDCloseTime = Time.realtimeSinceStartup;
 46565        controlsVisible.OnChange += (current, old) =>
 566        {
 0567            if (!current)
 0568                controlsHUDCloseTime = Time.realtimeSinceStartup;
 0569        };
 570
 46571        emotesHUDCloseTime = Time.realtimeSinceStartup;
 46572        emotesVisible.OnChange += (current, old) =>
 573        {
 0574            if (!current)
 0575                emotesHUDCloseTime = Time.realtimeSinceStartup;
 0576        };
 577
 46578        chatInputHUDCloseTime = Time.realtimeSinceStartup;
 46579        chatInputVisible.OnChange += (current, old) =>
 580        {
 0581            if (!current)
 0582                chatInputHUDCloseTime = Time.realtimeSinceStartup;
 0583        };
 584
 46585        playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 46586        playerInfoCardVisible.OnChange += (current, old) =>
 587        {
 92588            if (!current)
 46589                playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 92590        };
 46591    }
 592
 0593    internal virtual IExploreV2Analytics CreateAnalyticsController() => new ExploreV2Analytics.ExploreV2Analytics();
 594
 0595    internal virtual IExploreV2MenuComponentView CreateView() => ExploreV2MenuComponentView.Create();
 596}

Methods/Properties

ownUserProfile()
topMenuTooltipReference()
placesAndEventsTooltipReference()
backpackTooltipReference()
mapTooltipReference()
builderTooltipReference()
questTooltipReference()
settingsTooltipReference()
profileCardTooltipReference()
ExploreV2MenuComponentController()
isOpen()
currentSectionIndex()
profileCardIsOpen()
isInitialized()
isPlacesAndEventsSectionInitialized()
placesAndEventsVisible()
isAvatarEditorInitialized()
avatarEditorVisible()
isNavmapInitialized()
navmapVisible()
isBuilderInitialized()
builderVisible()
isQuestInitialized()
questVisible()
isSettingsPanelInitialized()
settingsVisible()
controlsVisible()
emotesVisible()
chatInputVisible()
playerInfoCardVisible()
Initialize()
InitializePlacesAndEventsSection()
OnSectionOpen(ExploreSection)
Dispose()
SetVisibility(System.Boolean)
IsOpenChanged(System.Boolean, System.Boolean)
CurrentSectionIndexChanged(System.Int32, System.Int32)
SetVisibility_Internal(System.Boolean)
OnAfterShowAnimation()
IsPlacesAndEventsSectionInitializedChanged(System.Boolean, System.Boolean)
PlacesAndEventsVisibleChanged(System.Boolean, System.Boolean)
IsAvatarEditorInitializedChanged(System.Boolean, System.Boolean)
AvatarEditorVisibleChanged(System.Boolean, System.Boolean)
IsNavMapInitializedChanged(System.Boolean, System.Boolean)
NavmapVisibleChanged(System.Boolean, System.Boolean)
IsBuilderInitializedChanged(System.Boolean, System.Boolean)
BuilderVisibleChanged(System.Boolean, System.Boolean)
IsQuestInitializedChanged(System.Boolean, System.Boolean)
QuestVisibleChanged(System.Boolean, System.Boolean)
IsSettingsPanelInitializedChanged(System.Boolean, System.Boolean)
SettingsVisibleChanged(System.Boolean, System.Boolean)
UpdateRealmInfo(Variables.RealmsInfo.CurrentRealmModel, Variables.RealmsInfo.CurrentRealmModel)
UpdateAvailableRealmsInfo(System.Collections.Generic.IEnumerable[RealmModel])
NeedToRefreshRealms(System.Collections.Generic.IEnumerable[RealmModel])
UpdateProfileInfo(UserProfile)
OnCloseButtonPressed(System.Boolean)
ConfigureOhterUIDependencies()
CreateAnalyticsController()
CreateView()