< 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:297
Uncovered lines:38
Coverable lines:335
Total lines:578
Line coverage:88.6% (297 of 335)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ExploreV2MenuComponentController()0%110100%
Initialize()0%550100%
InitializePlacesAndEventsSection()0%2.032080%
OnSectionOpen(...)0%220100%
Dispose()0%770100%
SetVisibility(...)0%110100%
IsOpenChanged(...)0%110100%
CurrentSectionIndexChanged(...)0%4.594066.67%
SetVisibility_Internal(...)0%6.016094.12%
OnAfterShowAnimation()0%2100%
IsPlacesAndEventsSectionInitializedChanged(...)0%2.062075%
PlacesAndEventsVisibleChanged(...)0%7.127086.67%
IsAvatarEditorInitializedChanged(...)0%110100%
AvatarEditorVisibleChanged(...)0%7.127086.67%
IsNavMapInitializedChanged(...)0%110100%
NavmapVisibleChanged(...)0%7.127086.67%
IsBuilderInitializedChanged(...)0%110100%
BuilderVisibleChanged(...)0%7.127086.67%
IsQuestInitializedChanged(...)0%110100%
QuestVisibleChanged(...)0%7.127086.67%
IsSettingsPanelInitializedChanged(...)0%110100%
SettingsVisibleChanged(...)0%7.127086.67%
UpdateRealmInfo(...)0%770100%
UpdateAvailableRealmsInfo(...)0%770100%
NeedToRefreshRealms(...)0%8.66058.33%
UpdateProfileInfo(...)0%110100%
OnCloseButtonPressed(...)0%8.068090%
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    internal MouseCatcher mouseCatcher;
 60
 61    public void Initialize()
 62    {
 4663        mouseCatcher = SceneReferences.i?.mouseCatcher;
 4664        exploreV2Analytics = CreateAnalyticsController();
 4665        view = CreateView();
 4666        SetVisibility(false);
 67
 4668        DataStore.i.realm.playerRealm.OnChange += UpdateRealmInfo;
 4669        UpdateRealmInfo(DataStore.i.realm.playerRealm.Get(), null);
 70
 4671        DataStore.i.realm.realmsInfo.OnSet += UpdateAvailableRealmsInfo;
 4672        UpdateAvailableRealmsInfo(DataStore.i.realm.realmsInfo.Get());
 73
 4674        ownUserProfile.OnUpdate += UpdateProfileInfo;
 4675        UpdateProfileInfo(ownUserProfile);
 4676        view.currentProfileCard.onClick?.AddListener(() => { profileCardIsOpen.Set(!profileCardIsOpen.Get()); });
 4677        view.currentRealmViewer.onLogoClick?.AddListener(view.ShowRealmSelectorModal);
 4678        view.OnCloseButtonPressed += OnCloseButtonPressed;
 4679        view.OnAfterShowAnimation += OnAfterShowAnimation;
 80
 4681        DataStore.i.exploreV2.topMenuTooltipReference.Set(topMenuTooltipReference);
 4682        DataStore.i.exploreV2.placesAndEventsTooltipReference.Set(placesAndEventsTooltipReference);
 4683        DataStore.i.exploreV2.backpackTooltipReference.Set(backpackTooltipReference);
 4684        DataStore.i.exploreV2.mapTooltipReference.Set(mapTooltipReference);
 4685        DataStore.i.exploreV2.builderTooltipReference.Set(builderTooltipReference);
 4686        DataStore.i.exploreV2.questTooltipReference.Set(questTooltipReference);
 4687        DataStore.i.exploreV2.settingsTooltipReference.Set(settingsTooltipReference);
 4688        DataStore.i.exploreV2.profileCardTooltipReference.Set(profileCardTooltipReference);
 89
 4690        view.OnSectionOpen += OnSectionOpen;
 91
 4692        isOpen.OnChange += IsOpenChanged;
 4693        IsOpenChanged(isOpen.Get(), false);
 94
 4695        currentSectionIndex.OnChange += CurrentSectionIndexChanged;
 4696        CurrentSectionIndexChanged(currentSectionIndex.Get(), 0);
 97
 4698        isPlacesAndEventsSectionInitialized.OnChange += IsPlacesAndEventsSectionInitializedChanged;
 4699        IsPlacesAndEventsSectionInitializedChanged(isPlacesAndEventsSectionInitialized.Get(), false);
 46100        placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged;
 46101        PlacesAndEventsVisibleChanged(placesAndEventsVisible.Get(), false);
 102
 46103        isAvatarEditorInitialized.OnChange += IsAvatarEditorInitializedChanged;
 46104        IsAvatarEditorInitializedChanged(isAvatarEditorInitialized.Get(), false);
 46105        avatarEditorVisible.OnChange += AvatarEditorVisibleChanged;
 46106        AvatarEditorVisibleChanged(avatarEditorVisible.Get(), false);
 107
 46108        isNavmapInitialized.OnChange += IsNavMapInitializedChanged;
 46109        IsNavMapInitializedChanged(isNavmapInitialized.Get(), false);
 46110        navmapVisible.OnChange += NavmapVisibleChanged;
 46111        NavmapVisibleChanged(navmapVisible.Get(), false);
 112
 46113        isBuilderInitialized.OnChange += IsBuilderInitializedChanged;
 46114        IsBuilderInitializedChanged(isBuilderInitialized.Get(), false);
 46115        builderVisible.OnChange += BuilderVisibleChanged;
 46116        BuilderVisibleChanged(builderVisible.Get(), false);
 117
 46118        isQuestInitialized.OnChange += IsQuestInitializedChanged;
 46119        IsQuestInitializedChanged(isQuestInitialized.Get(), false);
 46120        questVisible.OnChange += QuestVisibleChanged;
 46121        QuestVisibleChanged(questVisible.Get(), false);
 122
 46123        isSettingsPanelInitialized.OnChange += IsSettingsPanelInitializedChanged;
 46124        IsSettingsPanelInitializedChanged(isSettingsPanelInitialized.Get(), false);
 46125        settingsVisible.OnChange += SettingsVisibleChanged;
 46126        SettingsVisibleChanged(settingsVisible.Get(), false);
 127
 46128        ConfigureOhterUIDependencies();
 129
 46130        isInitialized.Set(true);
 131
 46132        view.ConfigureEncapsulatedSection(ExploreSection.Backpack, DataStore.i.exploreV2.configureBackpackInFullscreenMe
 46133        view.ConfigureEncapsulatedSection(ExploreSection.Map, DataStore.i.exploreV2.configureMapInFullscreenMenu);
 46134        view.ConfigureEncapsulatedSection(ExploreSection.Builder, DataStore.i.exploreV2.configureBuilderInFullscreenMenu
 46135        view.ConfigureEncapsulatedSection(ExploreSection.Quest, DataStore.i.exploreV2.configureQuestInFullscreenMenu);
 46136        view.ConfigureEncapsulatedSection(ExploreSection.Settings, DataStore.i.exploreV2.configureSettingsInFullscreenMe
 137
 46138    }
 139
 140    internal void InitializePlacesAndEventsSection()
 141    {
 1142        if (placesAndEventsSectionController != null)
 0143            return;
 144
 1145        placesAndEventsSectionController = new PlacesAndEventsSectionComponentController(view.currentPlacesAndEventsSect
 1146        placesAndEventsSectionController.OnCloseExploreV2 += OnCloseButtonPressed;
 1147    }
 148
 149    internal void OnSectionOpen(ExploreSection section)
 150    {
 6151        if (section != currentOpenSection)
 5152            exploreV2Analytics.SendStartMenuSectionVisibility(currentOpenSection, false);
 153
 6154        currentOpenSection = section;
 155
 6156        placesAndEventsVisible.Set(currentOpenSection == ExploreSection.Explore);
 6157        avatarEditorVisible.Set(currentOpenSection == ExploreSection.Backpack);
 6158        navmapVisible.Set(currentOpenSection == ExploreSection.Map);
 6159        builderVisible.Set(currentOpenSection == ExploreSection.Builder);
 6160        questVisible.Set(currentOpenSection == ExploreSection.Quest);
 6161        settingsVisible.Set(currentOpenSection == ExploreSection.Settings);
 6162        profileCardIsOpen.Set(false);
 6163    }
 164
 165    public void Dispose()
 166    {
 46167        DataStore.i.realm.playerRealm.OnChange -= UpdateRealmInfo;
 46168        DataStore.i.realm.realmsInfo.OnSet -= UpdateAvailableRealmsInfo;
 46169        ownUserProfile.OnUpdate -= UpdateProfileInfo;
 46170        view?.currentProfileCard.onClick?.RemoveAllListeners();
 46171        isOpen.OnChange -= IsOpenChanged;
 46172        currentSectionIndex.OnChange -= CurrentSectionIndexChanged;
 46173        isPlacesAndEventsSectionInitialized.OnChange -= IsPlacesAndEventsSectionInitializedChanged;
 46174        placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged;
 46175        isAvatarEditorInitialized.OnChange -= IsAvatarEditorInitializedChanged;
 46176        avatarEditorVisible.OnChange -= AvatarEditorVisibleChanged;
 46177        isNavmapInitialized.OnChange -= IsNavMapInitializedChanged;
 46178        navmapVisible.OnChange -= NavmapVisibleChanged;
 46179        isBuilderInitialized.OnChange -= IsBuilderInitializedChanged;
 46180        builderVisible.OnChange -= BuilderVisibleChanged;
 46181        isQuestInitialized.OnChange -= IsQuestInitializedChanged;
 46182        questVisible.OnChange -= QuestVisibleChanged;
 46183        isSettingsPanelInitialized.OnChange -= IsSettingsPanelInitializedChanged;
 46184        settingsVisible.OnChange -= SettingsVisibleChanged;
 185
 46186        if (view != null)
 187        {
 46188            view.currentProfileCard.onClick?.RemoveAllListeners();
 46189            view.currentRealmViewer.onLogoClick?.RemoveAllListeners();
 46190            view.OnCloseButtonPressed -= OnCloseButtonPressed;
 46191            view.OnAfterShowAnimation -= OnAfterShowAnimation;
 46192            view.OnSectionOpen -= OnSectionOpen;
 46193            view.Dispose();
 194        }
 195
 46196        if (placesAndEventsSectionController != null)
 197        {
 1198            placesAndEventsSectionController.OnCloseExploreV2 -= OnCloseButtonPressed;
 1199            placesAndEventsSectionController.Dispose();
 200        }
 46201    }
 202
 120203    public void SetVisibility(bool visible) { isOpen.Set(visible); }
 204
 130205    internal void IsOpenChanged(bool current, bool previous) { SetVisibility_Internal(current); }
 206
 207    internal void CurrentSectionIndexChanged(int current, int previous)
 208    {
 350209        if (DataStore.i.exploreV2.isInShowAnimationTransiton.Get())
 0210            return;
 211
 350212        if (Enum.IsDefined(typeof(ExploreSection), current))
 213        {
 297214            if (!view.IsSectionActive((ExploreSection)current))
 297215                CurrentSectionIndexChanged(current + 1, current);
 216            else
 0217                view.GoToSection((ExploreSection)current);
 0218        }
 219        else
 53220            view.GoToSection(0);
 53221    }
 222
 223    internal void SetVisibility_Internal(bool visible)
 224    {
 65225        if (view == null || DataStore.i.common.isSignUpFlow.Get())
 0226            return;
 227
 65228        if (visible)
 229        {
 15230            mouseCatcher?.UnlockCursor();
 231
 15232            if (DataStore.i.common.isTutorialRunning.Get())
 1233                view.GoToSection(ExploreV2MenuComponentView.DEFAULT_SECTION);
 1234        }
 235        else
 236        {
 50237            CommonScriptableObjects.isFullscreenHUDOpen.Set(false);
 50238            placesAndEventsVisible.Set(false);
 50239            avatarEditorVisible.Set(false);
 50240            profileCardIsOpen.Set(false);
 50241            navmapVisible.Set(false);
 50242            builderVisible.Set(false);
 50243            questVisible.Set(false);
 50244            settingsVisible.Set(false);
 245        }
 246
 65247        view.SetVisible(visible);
 65248    }
 249
 0250    internal void OnAfterShowAnimation() { CommonScriptableObjects.isFullscreenHUDOpen.Set(true); }
 251
 252    internal void IsPlacesAndEventsSectionInitializedChanged(bool current, bool previous)
 253    {
 46254        view.SetSectionActive(ExploreSection.Explore, current);
 255
 46256        if (current)
 0257            InitializePlacesAndEventsSection();
 46258    }
 259
 260    internal void PlacesAndEventsVisibleChanged(bool current, bool previous)
 261    {
 49262        if (!isInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 1263            return;
 264
 48265        if (current)
 266        {
 2267            if (!isOpen.Get())
 268            {
 2269                SetVisibility(true);
 2270                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 271            }
 272
 2273            view.GoToSection(ExploreSection.Explore);
 2274            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, true);
 2275        }
 46276        else if (currentOpenSection == ExploreSection.Explore)
 277        {
 46278            if (isOpen.Get())
 279            {
 0280                SetVisibility(false);
 0281                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 282            }
 283
 46284            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Explore, false);
 285        }
 46286    }
 287
 98288    internal void IsAvatarEditorInitializedChanged(bool current, bool previous) { view.SetSectionActive(ExploreSection.B
 289
 290    internal void AvatarEditorVisibleChanged(bool current, bool previous)
 291    {
 49292        if (!isAvatarEditorInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 5293            return;
 294
 44295        if (current)
 296        {
 2297            if (!isOpen.Get())
 298            {
 2299                SetVisibility(true);
 2300                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 301            }
 302
 2303            view.GoToSection(ExploreSection.Backpack);
 2304            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, true);
 2305        }
 42306        else if (currentOpenSection == ExploreSection.Backpack)
 307        {
 1308            if (isOpen.Get())
 309            {
 0310                SetVisibility(false);
 0311                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 312            }
 313
 1314            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Backpack, false);
 315        }
 42316    }
 317
 318    internal void IsNavMapInitializedChanged(bool current, bool previous)
 319    {
 49320        view.SetSectionActive(ExploreSection.Map, current);
 49321    }
 322
 323    internal void NavmapVisibleChanged(bool current, bool previous)
 324    {
 49325        if (!isNavmapInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 28326            return;
 327
 21328        if (current)
 329        {
 2330            if (!isOpen.Get())
 331            {
 2332                SetVisibility(true);
 2333                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 334            }
 335
 2336            view.GoToSection(ExploreSection.Map);
 2337            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, true);
 2338        }
 19339        else if (currentOpenSection == ExploreSection.Map)
 340        {
 1341            if (isOpen.Get())
 342            {
 0343                SetVisibility(false);
 0344                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 345            }
 346
 1347            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, false);
 348        }
 19349    }
 350
 351    internal void IsBuilderInitializedChanged(bool current, bool previous)
 352    {
 49353        view.SetSectionActive(ExploreSection.Builder, current);
 49354    }
 355
 356    internal void BuilderVisibleChanged(bool current, bool previous)
 357    {
 49358        if (!isBuilderInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 7359            return;
 360
 42361        if (current)
 362        {
 2363            if (!isOpen.Get())
 364            {
 2365                SetVisibility(true);
 2366                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 367            }
 368
 2369            view.GoToSection(ExploreSection.Builder);
 2370            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, true);
 2371        }
 40372        else if (currentOpenSection == ExploreSection.Builder)
 373        {
 1374            if (isOpen.Get())
 375            {
 0376                SetVisibility(false);
 0377                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 378            }
 379
 1380            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, false);
 381        }
 40382    }
 383
 384    internal void IsQuestInitializedChanged(bool current, bool previous)
 385    {
 49386        view.SetSectionActive(ExploreSection.Quest, current);
 49387    }
 388
 389    internal void QuestVisibleChanged(bool current, bool previous)
 390    {
 49391        if (!isQuestInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 39392            return;
 393
 10394        if (current)
 395        {
 1396            if (!isOpen.Get())
 397            {
 1398                SetVisibility(true);
 1399                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 400            }
 401
 1402            view.GoToSection(ExploreSection.Quest);
 1403            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, true);
 1404        }
 9405        else if (currentOpenSection == ExploreSection.Quest)
 406        {
 1407            if (isOpen.Get())
 408            {
 0409                SetVisibility(false);
 0410                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 411            }
 412
 1413            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, false);
 414        }
 9415    }
 416
 417    internal void IsSettingsPanelInitializedChanged(bool current, bool previous)
 418    {
 49419        view.SetSectionActive(ExploreSection.Settings, current);
 49420    }
 421
 422    internal void SettingsVisibleChanged(bool current, bool previous)
 423    {
 49424        if (!isSettingsPanelInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 41425            return;
 426
 8427        if (current)
 428        {
 1429            if (!isOpen.Get())
 430            {
 1431                SetVisibility(true);
 1432                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 433            }
 1434            view.GoToSection(ExploreSection.Settings);
 1435            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, true);
 1436        }
 7437        else if (currentOpenSection == ExploreSection.Settings)
 438        {
 1439            if (isOpen.Get())
 440            {
 0441                SetVisibility(false);
 0442                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 443            }
 1444            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, false);
 445        }
 7446    }
 447
 448    internal void UpdateRealmInfo(CurrentRealmModel currentRealm, CurrentRealmModel previousRealm)
 449    {
 48450        if (currentRealm == null)
 46451            return;
 452
 453        // Get the name of the current realm
 2454        view.currentRealmViewer.SetRealm(currentRealm.serverName);
 2455        view.currentRealmSelectorModal.SetCurrentRealm(currentRealm.serverName);
 456
 457        // Calculate number of users in the current realm
 2458        List<RealmModel> realmList = DataStore.i.realm.realmsInfo.Get()?.ToList();
 3459        RealmModel currentRealmModel = realmList?.FirstOrDefault(r => r.serverName == currentRealm.serverName);
 2460        int realmUsers = 0;
 2461        if (currentRealmModel != null)
 1462            realmUsers = currentRealmModel.usersCount;
 463
 2464        view.currentRealmViewer.SetNumberOfUsers(realmUsers);
 2465    }
 466
 467    internal void UpdateAvailableRealmsInfo(IEnumerable<RealmModel> currentRealmList)
 468    {
 48469        if (!NeedToRefreshRealms(currentRealmList))
 46470            return;
 471
 2472        currentAvailableRealms.Clear();
 2473        CurrentRealmModel currentRealm = DataStore.i.realm.playerRealm.Get();
 474
 2475        if (currentRealmList != null)
 476        {
 12477            foreach (RealmModel realmModel in currentRealmList)
 478            {
 4479                RealmRowComponentModel realmToAdd = new RealmRowComponentModel
 480                {
 481                    name = realmModel.serverName,
 482                    players = realmModel.usersCount,
 483                    isConnected = realmModel.serverName == currentRealm?.serverName
 484                };
 485
 4486                currentAvailableRealms.Add(realmToAdd);
 487            }
 488        }
 489
 2490        view.currentRealmSelectorModal.SetAvailableRealms(currentAvailableRealms);
 2491    }
 492
 493    internal bool NeedToRefreshRealms(IEnumerable<RealmModel> newRealmList)
 494    {
 48495        if (newRealmList == null)
 0496            return true;
 497
 48498        bool needToRefresh = false;
 48499        if (newRealmList.Count() == currentAvailableRealms.Count)
 500        {
 92501            foreach (RealmModel realm in newRealmList)
 502            {
 0503                if (!currentAvailableRealms.Exists(x => x.name == realm.serverName && x.players == realm.usersCount))
 504                {
 0505                    needToRefresh = true;
 0506                    break;
 507                }
 508            }
 509        }
 510        else
 2511            needToRefresh = true;
 512
 48513        return needToRefresh;
 514    }
 515
 516    internal void UpdateProfileInfo(UserProfile profile)
 517    {
 47518        view.currentProfileCard.SetIsClaimedName(profile.hasClaimedName);
 47519        view.currentProfileCard.SetProfileName(profile.userName);
 47520        view.currentProfileCard.SetProfileAddress(profile.ethAddress);
 47521        view.currentProfileCard.SetProfilePicture(profile.face256SnapshotURL);
 47522    }
 523
 524    internal void OnCloseButtonPressed(bool fromShortcut)
 525    {
 2526        if(DataStore.i.builderInWorld.areShortcutsBlocked.Get())
 0527            return;
 528
 2529        if (!fromShortcut)
 530        {
 1531            SetVisibility(false);
 1532            exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut : Ex
 1533        }
 534        else
 535        {
 1536            if (isOpen.Get())
 537            {
 1538                SetVisibility(false);
 1539                exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut 
 540            }
 541        }
 1542    }
 543
 544    internal void ConfigureOhterUIDependencies()
 545    {
 46546        controlsHUDCloseTime = Time.realtimeSinceStartup;
 46547        controlsVisible.OnChange += (current, old) =>
 548        {
 0549            if (!current)
 0550                controlsHUDCloseTime = Time.realtimeSinceStartup;
 0551        };
 552
 46553        emotesHUDCloseTime = Time.realtimeSinceStartup;
 46554        emotesVisible.OnChange += (current, old) =>
 555        {
 0556            if (!current)
 0557                emotesHUDCloseTime = Time.realtimeSinceStartup;
 0558        };
 559
 46560        chatInputHUDCloseTime = Time.realtimeSinceStartup;
 46561        chatInputVisible.OnChange += (current, old) =>
 562        {
 0563            if (!current)
 0564                chatInputHUDCloseTime = Time.realtimeSinceStartup;
 0565        };
 566
 46567        playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 46568        playerInfoCardVisible.OnChange += (current, old) =>
 569        {
 0570            if (!current)
 0571                playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 0572        };
 46573    }
 574
 0575    internal virtual IExploreV2Analytics CreateAnalyticsController() => new ExploreV2Analytics.ExploreV2Analytics();
 576
 0577    protected internal virtual IExploreV2MenuComponentView CreateView() => ExploreV2MenuComponentView.Create();
 578}

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()