< 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:304
Uncovered lines:38
Coverable lines:342
Total lines:598
Line coverage:88.8% (304 of 342)
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%330100%
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%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    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);
 46131    }
 132
 133    internal void InitializePlacesAndEventsSection()
 134    {
 1135        if (placesAndEventsSectionController != null)
 0136            return;
 137
 1138        placesAndEventsSectionController = new PlacesAndEventsSectionComponentController(view.currentPlacesAndEventsSect
 1139        placesAndEventsSectionController.OnCloseExploreV2 += OnCloseButtonPressed;
 1140    }
 141
 142    internal void OnSectionOpen(ExploreSection section)
 143    {
 6144        if (section != currentOpenSection)
 5145            exploreV2Analytics.SendStartMenuSectionVisibility(currentOpenSection, false);
 146
 6147        currentOpenSection = section;
 148
 6149        if (currentOpenSection == ExploreSection.Backpack)
 150        {
 1151            view.ConfigureEncapsulatedSection(
 152                ExploreSection.Backpack,
 153                DataStore.i.exploreV2.configureBackpackInFullscreenMenu);
 154        }
 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);
 321
 49322        if (current)
 20323            view.ConfigureEncapsulatedSection(ExploreSection.Map, DataStore.i.exploreV2.configureMapInFullscreenMenu);
 49324    }
 325
 326    internal void NavmapVisibleChanged(bool current, bool previous)
 327    {
 49328        if (!isNavmapInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 28329            return;
 330
 21331        if (current)
 332        {
 2333            if (!isOpen.Get())
 334            {
 2335                SetVisibility(true);
 2336                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 337            }
 338
 2339            view.GoToSection(ExploreSection.Map);
 2340            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, true);
 2341        }
 19342        else if (currentOpenSection == ExploreSection.Map)
 343        {
 1344            if (isOpen.Get())
 345            {
 0346                SetVisibility(false);
 0347                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 348            }
 349
 1350            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Map, false);
 351        }
 19352    }
 353
 354    internal void IsBuilderInitializedChanged(bool current, bool previous)
 355    {
 49356        view.SetSectionActive(ExploreSection.Builder, current);
 357
 49358        if (current)
 41359            view.ConfigureEncapsulatedSection(ExploreSection.Builder, DataStore.i.exploreV2.configureBuilderInFullscreen
 49360    }
 361
 362    internal void BuilderVisibleChanged(bool current, bool previous)
 363    {
 49364        if (!isBuilderInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 7365            return;
 366
 42367        if (current)
 368        {
 2369            if (!isOpen.Get())
 370            {
 2371                SetVisibility(true);
 2372                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 373            }
 374
 2375            view.GoToSection(ExploreSection.Builder);
 2376            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, true);
 2377        }
 40378        else if (currentOpenSection == ExploreSection.Builder)
 379        {
 1380            if (isOpen.Get())
 381            {
 0382                SetVisibility(false);
 0383                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 384            }
 385
 1386            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Builder, false);
 387        }
 40388    }
 389
 390    internal void IsQuestInitializedChanged(bool current, bool previous)
 391    {
 49392        view.SetSectionActive(ExploreSection.Quest, current);
 393
 49394        if (current)
 10395            view.ConfigureEncapsulatedSection(ExploreSection.Quest, DataStore.i.exploreV2.configureQuestInFullscreenMenu
 49396    }
 397
 398    internal void QuestVisibleChanged(bool current, bool previous)
 399    {
 49400        if (!isQuestInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 39401            return;
 402
 10403        if (current)
 404        {
 1405            if (!isOpen.Get())
 406            {
 1407                SetVisibility(true);
 1408                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 409            }
 410
 1411            view.GoToSection(ExploreSection.Quest);
 1412            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, true);
 1413        }
 9414        else if (currentOpenSection == ExploreSection.Quest)
 415        {
 1416            if (isOpen.Get())
 417            {
 0418                SetVisibility(false);
 0419                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 420            }
 421
 1422            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Quest, false);
 423        }
 9424    }
 425
 426    internal void IsSettingsPanelInitializedChanged(bool current, bool previous)
 427    {
 49428        view.SetSectionActive(ExploreSection.Settings, current);
 429
 49430        if (current)
 8431            view.ConfigureEncapsulatedSection(ExploreSection.Settings, DataStore.i.exploreV2.configureSettingsInFullscre
 49432    }
 433
 434    internal void SettingsVisibleChanged(bool current, bool previous)
 435    {
 49436        if (!isSettingsPanelInitialized.Get() || DataStore.i.common.isSignUpFlow.Get())
 41437            return;
 438
 8439        if (current)
 440        {
 1441            if (!isOpen.Get())
 442            {
 1443                SetVisibility(true);
 1444                exploreV2Analytics.SendStartMenuVisibility(true, ExploreUIVisibilityMethod.FromShortcut);
 445            }
 1446            view.GoToSection(ExploreSection.Settings);
 1447            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, true);
 1448        }
 7449        else if (currentOpenSection == ExploreSection.Settings)
 450        {
 1451            if (isOpen.Get())
 452            {
 0453                SetVisibility(false);
 0454                exploreV2Analytics.SendStartMenuVisibility(false, ExploreUIVisibilityMethod.FromShortcut);
 455            }
 1456            exploreV2Analytics.SendStartMenuSectionVisibility(ExploreSection.Settings, false);
 457        }
 7458    }
 459
 460    internal void UpdateRealmInfo(CurrentRealmModel currentRealm, CurrentRealmModel previousRealm)
 461    {
 48462        if (currentRealm == null)
 46463            return;
 464
 465        // Get the name of the current realm
 2466        view.currentRealmViewer.SetRealm(currentRealm.serverName);
 2467        view.currentRealmSelectorModal.SetCurrentRealm(currentRealm.serverName);
 468
 469        // Calculate number of users in the current realm
 2470        List<RealmModel> realmList = DataStore.i.realm.realmsInfo.Get()?.ToList();
 3471        RealmModel currentRealmModel = realmList?.FirstOrDefault(r => r.serverName == currentRealm.serverName);
 2472        int realmUsers = 0;
 2473        if (currentRealmModel != null)
 1474            realmUsers = currentRealmModel.usersCount;
 475
 2476        view.currentRealmViewer.SetNumberOfUsers(realmUsers);
 2477    }
 478
 479    internal void UpdateAvailableRealmsInfo(IEnumerable<RealmModel> currentRealmList)
 480    {
 48481        if (!NeedToRefreshRealms(currentRealmList))
 46482            return;
 483
 2484        currentAvailableRealms.Clear();
 2485        CurrentRealmModel currentRealm = DataStore.i.realm.playerRealm.Get();
 486
 2487        if (currentRealmList != null)
 488        {
 12489            foreach (RealmModel realmModel in currentRealmList)
 490            {
 4491                RealmRowComponentModel realmToAdd = new RealmRowComponentModel
 492                {
 493                    name = realmModel.serverName,
 494                    players = realmModel.usersCount,
 495                    isConnected = realmModel.serverName == currentRealm?.serverName
 496                };
 497
 4498                currentAvailableRealms.Add(realmToAdd);
 499            }
 500        }
 501
 2502        view.currentRealmSelectorModal.SetAvailableRealms(currentAvailableRealms);
 2503    }
 504
 505    internal bool NeedToRefreshRealms(IEnumerable<RealmModel> newRealmList)
 506    {
 48507        if (newRealmList == null)
 0508            return true;
 509
 48510        bool needToRefresh = false;
 48511        if (newRealmList.Count() == currentAvailableRealms.Count)
 512        {
 92513            foreach (RealmModel realm in newRealmList)
 514            {
 0515                if (!currentAvailableRealms.Exists(x => x.name == realm.serverName && x.players == realm.usersCount))
 516                {
 0517                    needToRefresh = true;
 0518                    break;
 519                }
 520            }
 521        }
 522        else
 2523            needToRefresh = true;
 524
 48525        return needToRefresh;
 526    }
 527
 528    internal void UpdateProfileInfo(UserProfile profile)
 529    {
 47530        view.currentProfileCard.SetIsClaimedName(profile.hasClaimedName);
 47531        view.currentProfileCard.SetProfileName(profile.userName);
 47532        view.currentProfileCard.SetProfileAddress(profile.ethAddress);
 47533        view.currentProfileCard.SetProfilePicture(profile.face256SnapshotURL);
 47534    }
 535
 536    internal void OnCloseButtonPressed(bool fromShortcut)
 537    {
 2538        if (!fromShortcut)
 539        {
 1540            SetVisibility(false);
 1541            exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut : Ex
 1542        }
 543        else
 544        {
 1545            if (isOpen.Get())
 546            {
 1547                SetVisibility(false);
 1548                exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut 
 1549            }
 550            else
 551            {
 0552                if (Time.realtimeSinceStartup - controlsHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU
 553                    Time.realtimeSinceStartup - emotesHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU &
 554                    Time.realtimeSinceStartup - playerInfoCardHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_STAR
 555                    Time.realtimeSinceStartup - chatInputHUDCloseTime >= MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MEN
 556                {
 0557                    SetVisibility(true);
 0558                    exploreV2Analytics.SendStartMenuVisibility(true, fromShortcut ? ExploreUIVisibilityMethod.FromShortc
 559                }
 560            }
 561        }
 0562    }
 563
 564    internal void ConfigureOhterUIDependencies()
 565    {
 46566        controlsHUDCloseTime = Time.realtimeSinceStartup;
 46567        controlsVisible.OnChange += (current, old) =>
 568        {
 0569            if (!current)
 0570                controlsHUDCloseTime = Time.realtimeSinceStartup;
 0571        };
 572
 46573        emotesHUDCloseTime = Time.realtimeSinceStartup;
 46574        emotesVisible.OnChange += (current, old) =>
 575        {
 0576            if (!current)
 0577                emotesHUDCloseTime = Time.realtimeSinceStartup;
 0578        };
 579
 46580        chatInputHUDCloseTime = Time.realtimeSinceStartup;
 46581        chatInputVisible.OnChange += (current, old) =>
 582        {
 0583            if (!current)
 0584                chatInputHUDCloseTime = Time.realtimeSinceStartup;
 0585        };
 586
 46587        playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 46588        playerInfoCardVisible.OnChange += (current, old) =>
 589        {
 92590            if (!current)
 46591                playerInfoCardHUDCloseTime = Time.realtimeSinceStartup;
 92592        };
 46593    }
 594
 0595    internal virtual IExploreV2Analytics CreateAnalyticsController() => new ExploreV2Analytics.ExploreV2Analytics();
 596
 0597    protected internal virtual IExploreV2MenuComponentView CreateView() => ExploreV2MenuComponentView.Create();
 598}

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