| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using DCL; |
| | 5 | | using Decentraland.Bff; |
| | 6 | | using ExploreV2Analytics; |
| | 7 | | using UnityEngine; |
| | 8 | | using Variables.RealmsInfo; |
| | 9 | |
|
| | 10 | | /// <summary> |
| | 11 | | /// Main controller for the feature "Explore V2". |
| | 12 | | /// </summary> |
| | 13 | | public class ExploreV2MenuComponentController : IExploreV2MenuComponentController |
| | 14 | | { |
| | 15 | | internal const ExploreSection DEFAULT_SECTION = ExploreSection.Explore; |
| | 16 | |
|
| | 17 | | internal const float MIN_TIME_AFTER_CLOSE_OTHER_UI_TO_OPEN_START_MENU = 0.1f; |
| 51 | 18 | | internal readonly List<RealmRowComponentModel> currentAvailableRealms = new List<RealmRowComponentModel>(); |
| | 19 | | internal float chatInputHUDCloseTime = 0f; |
| | 20 | | internal float controlsHUDCloseTime = 0f; |
| | 21 | | internal ExploreSection currentOpenSection; |
| | 22 | | internal float emotesHUDCloseTime = 0f; |
| | 23 | | internal IExploreV2Analytics exploreV2Analytics; |
| | 24 | | internal MouseCatcher mouseCatcher; |
| | 25 | | internal IPlacesAndEventsSectionComponentController placesAndEventsSectionController; |
| | 26 | | internal float playerInfoCardHUDCloseTime = 0f; |
| | 27 | | private Dictionary<BaseVariable<bool>, ExploreSection> sectionsByInitVar; |
| | 28 | | internal Dictionary<BaseVariable<bool>, ExploreSection> sectionsByVisiblityVar; |
| | 29 | |
|
| | 30 | | private Dictionary<ExploreSection, (BaseVariable<bool> initVar, BaseVariable<bool> visibilityVar)> sectionsVariables |
| | 31 | |
|
| | 32 | | internal IExploreV2MenuComponentView view; |
| | 33 | |
|
| 153 | 34 | | internal UserProfile ownUserProfile => UserProfile.GetOwnUserProfile(); |
| 51 | 35 | | internal RectTransform topMenuTooltipReference => view.currentTopMenuTooltipReference; |
| 51 | 36 | | internal RectTransform placesAndEventsTooltipReference => view.currentPlacesAndEventsTooltipReference; |
| 51 | 37 | | internal RectTransform backpackTooltipReference => view.currentBackpackTooltipReference; |
| 51 | 38 | | internal RectTransform mapTooltipReference => view.currentMapTooltipReference; |
| 51 | 39 | | internal RectTransform questTooltipReference => view.currentQuestTooltipReference; |
| 51 | 40 | | internal RectTransform settingsTooltipReference => view.currentSettingsTooltipReference; |
| 51 | 41 | | internal RectTransform profileCardTooltipReference => view.currentProfileCardTooltipReference; |
| | 42 | |
|
| 301 | 43 | | internal BaseVariable<bool> isOpen => DataStore.i.exploreV2.isOpen; |
| 235 | 44 | | internal BaseVariable<int> currentSectionIndex => DataStore.i.exploreV2.currentSectionIndex; |
| 71 | 45 | | internal BaseVariable<bool> profileCardIsOpen => DataStore.i.exploreV2.profileCardIsOpen; |
| 106 | 46 | | internal BaseVariable<bool> isInitialized => DataStore.i.exploreV2.isInitialized; |
| 51 | 47 | | internal BaseVariable<bool> isPlacesAndEventsSectionInitialized => DataStore.i.exploreV2.isPlacesAndEventsSectionIni |
| 57 | 48 | | internal BaseVariable<bool> placesAndEventsVisible => DataStore.i.exploreV2.placesAndEventsVisible; |
| 53 | 49 | | internal BaseVariable<bool> isAvatarEditorInitialized => DataStore.i.HUDs.isAvatarEditorInitialized; |
| 57 | 50 | | internal BaseVariable<bool> avatarEditorVisible => DataStore.i.HUDs.avatarEditorVisible; |
| 53 | 51 | | internal BaseVariable<bool> isNavmapInitialized => DataStore.i.HUDs.isNavMapInitialized; |
| 57 | 52 | | internal BaseVariable<bool> navmapVisible => DataStore.i.HUDs.navmapVisible; |
| 0 | 53 | | internal BaseVariable<bool> builderVisible => DataStore.i.HUDs.builderProjectsPanelVisible; |
| 53 | 54 | | internal BaseVariable<bool> isQuestInitialized => DataStore.i.Quests.isInitialized; |
| 57 | 55 | | internal BaseVariable<bool> questVisible => DataStore.i.HUDs.questsPanelVisible; |
| 53 | 56 | | internal BaseVariable<bool> isSettingsPanelInitialized => DataStore.i.settings.isInitialized; |
| 57 | 57 | | internal BaseVariable<bool> settingsVisible => DataStore.i.settings.settingsPanelVisible; |
| | 58 | |
|
| 51 | 59 | | internal BaseVariable<bool> controlsVisible => DataStore.i.HUDs.controlsVisible; |
| 51 | 60 | | internal BaseVariable<bool> emotesVisible => DataStore.i.HUDs.emotesVisible; |
| 51 | 61 | | internal BaseVariable<bool> chatInputVisible => DataStore.i.HUDs.chatInputVisible; |
| 51 | 62 | | internal BooleanVariable playerInfoCardVisible => CommonScriptableObjects.playerInfoCardVisibleState; |
| 23 | 63 | | internal BaseVariable<bool> isPromoteChannelsToastVisible => DataStore.i.channels.isPromoteToastVisible; |
| | 64 | |
|
| | 65 | | public void Initialize() |
| | 66 | | { |
| 51 | 67 | | sectionsVariables = new Dictionary<ExploreSection, (BaseVariable<bool>, BaseVariable<bool>)> |
| | 68 | | { |
| | 69 | | { ExploreSection.Explore, (isPlacesAndEventsSectionInitialized, placesAndEventsVisible) }, |
| | 70 | | { ExploreSection.Backpack, (isAvatarEditorInitialized, avatarEditorVisible) }, |
| | 71 | | { ExploreSection.Map, (isNavmapInitialized, navmapVisible) }, |
| | 72 | | { ExploreSection.Quest, (isQuestInitialized, questVisible) }, |
| | 73 | | { ExploreSection.Settings, (isSettingsPanelInitialized, settingsVisible) }, |
| | 74 | | }; |
| 561 | 75 | | sectionsByInitVar = sectionsVariables.ToDictionary(pair => pair.Value.initVar, pair => pair.Key); |
| 561 | 76 | | sectionsByVisiblityVar = sectionsVariables.ToDictionary(pair => pair.Value.visibilityVar, pair => pair.Key); |
| | 77 | |
|
| 51 | 78 | | mouseCatcher = SceneReferences.i?.mouseCatcher; |
| 51 | 79 | | exploreV2Analytics = CreateAnalyticsController(); |
| 51 | 80 | | view = CreateView(); |
| 51 | 81 | | SetVisibility(false); |
| | 82 | |
|
| 51 | 83 | | DataStore.i.realm.realmName.OnChange += UpdateRealmInfo; |
| 51 | 84 | | UpdateRealmInfo( DataStore.i.realm.realmName.Get()); |
| | 85 | |
|
| 51 | 86 | | DataStore.i.realm.realmsInfo.OnSet += UpdateAvailableRealmsInfo; |
| 51 | 87 | | UpdateAvailableRealmsInfo(DataStore.i.realm.realmsInfo.Get()); |
| | 88 | |
|
| 51 | 89 | | ownUserProfile.OnUpdate += UpdateProfileInfo; |
| 51 | 90 | | UpdateProfileInfo(ownUserProfile); |
| 51 | 91 | | view.currentProfileCard.onClick?.AddListener(() => { profileCardIsOpen.Set(!profileCardIsOpen.Get()); }); |
| 51 | 92 | | view.currentRealmViewer.onLogoClick?.AddListener(view.ShowRealmSelectorModal); |
| 51 | 93 | | view.OnCloseButtonPressed += OnCloseButtonPressed; |
| 51 | 94 | | view.OnAfterShowAnimation += OnAfterShowAnimation; |
| | 95 | |
|
| 51 | 96 | | DataStore.i.exploreV2.topMenuTooltipReference.Set(topMenuTooltipReference); |
| 51 | 97 | | DataStore.i.exploreV2.placesAndEventsTooltipReference.Set(placesAndEventsTooltipReference); |
| 51 | 98 | | DataStore.i.exploreV2.backpackTooltipReference.Set(backpackTooltipReference); |
| 51 | 99 | | DataStore.i.exploreV2.mapTooltipReference.Set(mapTooltipReference); |
| 51 | 100 | | DataStore.i.exploreV2.questTooltipReference.Set(questTooltipReference); |
| 51 | 101 | | DataStore.i.exploreV2.settingsTooltipReference.Set(settingsTooltipReference); |
| 51 | 102 | | DataStore.i.exploreV2.profileCardTooltipReference.Set(profileCardTooltipReference); |
| | 103 | |
|
| 51 | 104 | | view.OnSectionOpen += OnSectionOpen; |
| | 105 | |
|
| 51 | 106 | | isOpen.OnChange += SetVisibilityOnOpenChanged; |
| 51 | 107 | | SetVisibilityOnOpenChanged(isOpen.Get()); |
| | 108 | |
|
| 51 | 109 | | currentSectionIndex.OnChange += CurrentSectionIndexChanged; |
| 51 | 110 | | CurrentSectionIndexChanged(currentSectionIndex.Get(), 0); |
| | 111 | |
|
| 612 | 112 | | foreach (var sectionsVariables in sectionsVariables.Values) |
| | 113 | | { |
| 255 | 114 | | sectionsVariables.initVar.OnChangeWithSenderInfo += OnSectionInitializedChanged; |
| 255 | 115 | | OnSectionInitializedChanged(sectionsVariables.initVar, sectionsVariables.initVar.Get()); |
| | 116 | |
|
| 255 | 117 | | sectionsVariables.visibilityVar.OnChangeWithSenderInfo += OnSectionVisiblityChanged; |
| 255 | 118 | | OnSectionVisiblityChanged(sectionsVariables.visibilityVar, sectionsVariables.visibilityVar.Get()); |
| | 119 | | } |
| | 120 | |
|
| 51 | 121 | | ConfigureOtherUIDependencies(); |
| | 122 | |
|
| 51 | 123 | | isInitialized.Set(true); |
| | 124 | |
|
| 51 | 125 | | currentSectionIndex.Set((int)DEFAULT_SECTION, false); |
| | 126 | |
|
| | 127 | | //view.ConfigureEncapsulatedSection(ExploreSection.Backpack, DataStore.i.exploreV2.configureBackpackInFullscreen |
| 51 | 128 | | view.ConfigureEncapsulatedSection(ExploreSection.Map, DataStore.i.exploreV2.configureMapInFullscreenMenu); |
| 51 | 129 | | view.ConfigureEncapsulatedSection(ExploreSection.Quest, DataStore.i.exploreV2.configureQuestInFullscreenMenu); |
| 51 | 130 | | view.ConfigureEncapsulatedSection(ExploreSection.Settings, DataStore.i.exploreV2.configureSettingsInFullscreenMe |
| 51 | 131 | | } |
| | 132 | |
|
| | 133 | | public void Dispose() |
| | 134 | | { |
| 51 | 135 | | DataStore.i.realm.realmName.OnChange -= UpdateRealmInfo; |
| 51 | 136 | | DataStore.i.realm.realmsInfo.OnSet -= UpdateAvailableRealmsInfo; |
| | 137 | |
|
| 51 | 138 | | ownUserProfile.OnUpdate -= UpdateProfileInfo; |
| 51 | 139 | | view?.currentProfileCard.onClick?.RemoveAllListeners(); |
| | 140 | |
|
| 51 | 141 | | isOpen.OnChange -= SetVisibilityOnOpenChanged; |
| 51 | 142 | | currentSectionIndex.OnChange -= CurrentSectionIndexChanged; |
| | 143 | |
|
| 612 | 144 | | foreach (var sectionsVariables in sectionsVariables.Values) |
| | 145 | | { |
| 255 | 146 | | sectionsVariables.initVar.OnChangeWithSenderInfo -= OnSectionInitializedChanged; |
| 255 | 147 | | sectionsVariables.visibilityVar.OnChangeWithSenderInfo -= OnSectionVisiblityChanged; |
| | 148 | | } |
| | 149 | |
|
| 51 | 150 | | if (placesAndEventsSectionController != null) |
| | 151 | | { |
| 1 | 152 | | placesAndEventsSectionController.OnCloseExploreV2 -= OnCloseButtonPressed; |
| 1 | 153 | | placesAndEventsSectionController.Dispose(); |
| | 154 | | } |
| | 155 | |
|
| 51 | 156 | | if (view != null) |
| | 157 | | { |
| 51 | 158 | | view.currentProfileCard.onClick?.RemoveAllListeners(); |
| 51 | 159 | | view.currentRealmViewer.onLogoClick?.RemoveAllListeners(); |
| 51 | 160 | | view.OnCloseButtonPressed -= OnCloseButtonPressed; |
| 51 | 161 | | view.OnAfterShowAnimation -= OnAfterShowAnimation; |
| 51 | 162 | | view.OnSectionOpen -= OnSectionOpen; |
| 51 | 163 | | view.Dispose(); |
| | 164 | | } |
| 51 | 165 | | } |
| | 166 | |
|
| 73 | 167 | | public void SetVisibility(bool visible) => isOpen.Set(visible); |
| | 168 | |
|
| | 169 | | private void OnSectionInitializedChanged(BaseVariable<bool> initVar, bool initialized, bool _ = false) => |
| 259 | 170 | | SectionInitializedChanged(sectionsByInitVar[initVar], initialized); |
| | 171 | |
|
| | 172 | | internal void SectionInitializedChanged(ExploreSection section, bool initialized, bool _ = false) |
| | 173 | | { |
| 267 | 174 | | view.SetSectionActive(section, initialized); |
| | 175 | |
|
| 267 | 176 | | if (section == ExploreSection.Explore && initialized) |
| 0 | 177 | | InitializePlacesAndEventsSection(); |
| 267 | 178 | | } |
| | 179 | |
|
| | 180 | | private void OnSectionVisiblityChanged(BaseVariable<bool> visibilityVar, bool visible, bool previous = false) |
| | 181 | | { |
| 265 | 182 | | ExploreSection section = sectionsByVisiblityVar[visibilityVar]; |
| 265 | 183 | | BaseVariable<bool> initVar = section == ExploreSection.Explore ? isInitialized : sectionsVariables[section].init |
| | 184 | |
|
| 265 | 185 | | if (!initVar.Get() || DataStore.i.common.isSignUpFlow.Get()) |
| 120 | 186 | | return; |
| | 187 | |
|
| 145 | 188 | | SetMenuTargetVisibility(sectionsByVisiblityVar[visibilityVar], visible); |
| 145 | 189 | | } |
| | 190 | |
|
| | 191 | | internal void InitializePlacesAndEventsSection() |
| | 192 | | { |
| 1 | 193 | | if (placesAndEventsSectionController != null) |
| 0 | 194 | | return; |
| | 195 | |
|
| 1 | 196 | | placesAndEventsSectionController = new PlacesAndEventsSectionComponentController(view.currentPlacesAndEventsSect |
| 1 | 197 | | placesAndEventsSectionController.OnCloseExploreV2 += OnCloseButtonPressed; |
| 1 | 198 | | } |
| | 199 | |
|
| | 200 | | internal void OnSectionOpen(ExploreSection section) |
| | 201 | | { |
| 10 | 202 | | if (section != currentOpenSection) |
| 9 | 203 | | exploreV2Analytics.SendStartMenuSectionVisibility(currentOpenSection, false); |
| | 204 | |
|
| 10 | 205 | | currentOpenSection = section; |
| | 206 | |
|
| 10 | 207 | | if (currentOpenSection == ExploreSection.Backpack) |
| 2 | 208 | | view.ConfigureEncapsulatedSection(ExploreSection.Backpack, DataStore.i.exploreV2.configureBackpackInFullscre |
| | 209 | |
|
| 120 | 210 | | foreach (var visibilityVar in sectionsByVisiblityVar.Keys) |
| 50 | 211 | | visibilityVar.Set(currentOpenSection == sectionsByVisiblityVar[visibilityVar]); |
| | 212 | |
|
| 10 | 213 | | profileCardIsOpen.Set(false); |
| 10 | 214 | | } |
| | 215 | |
|
| 78 | 216 | | internal void SetVisibilityOnOpenChanged(bool open, bool _ = false) => SetVisibility_Internal(open); |
| | 217 | |
|
| | 218 | | internal void CurrentSectionIndexChanged(int current, int previous) |
| | 219 | | { |
| 346 | 220 | | if (DataStore.i.exploreV2.isInShowAnimationTransiton.Get()) |
| 0 | 221 | | return; |
| | 222 | |
|
| 346 | 223 | | if (Enum.IsDefined(typeof(ExploreSection), current)) |
| | 224 | | { |
| 274 | 225 | | if (!view.IsSectionActive((ExploreSection)current)) |
| 274 | 226 | | CurrentSectionIndexChanged(current + 1, current); |
| | 227 | | else |
| 0 | 228 | | view.GoToSection((ExploreSection)current); |
| | 229 | | } |
| | 230 | | else |
| 72 | 231 | | view.GoToSection(0); |
| 72 | 232 | | } |
| | 233 | |
|
| | 234 | | internal void SetVisibility_Internal(bool visible) |
| | 235 | | { |
| 78 | 236 | | if (view == null || DataStore.i.common.isSignUpFlow.Get()) |
| 0 | 237 | | return; |
| | 238 | |
|
| 78 | 239 | | if (visible) |
| | 240 | | { |
| 23 | 241 | | mouseCatcher?.UnlockCursor(); |
| | 242 | |
|
| 23 | 243 | | if (DataStore.i.common.isTutorialRunning.Get()) |
| 1 | 244 | | view.GoToSection(DEFAULT_SECTION); |
| | 245 | |
|
| 23 | 246 | | isPromoteChannelsToastVisible.Set(false); |
| | 247 | | } |
| | 248 | | else |
| | 249 | | { |
| 55 | 250 | | CommonScriptableObjects.isFullscreenHUDOpen.Set(false); |
| | 251 | |
|
| 660 | 252 | | foreach (var sectionsVariables in sectionsVariables.Values) |
| 275 | 253 | | sectionsVariables.visibilityVar.Set(false); |
| | 254 | |
|
| 55 | 255 | | profileCardIsOpen.Set(false); |
| | 256 | | } |
| | 257 | |
|
| 78 | 258 | | view.SetVisible(visible); |
| 78 | 259 | | } |
| | 260 | |
|
| 0 | 261 | | internal void OnAfterShowAnimation() => CommonScriptableObjects.isFullscreenHUDOpen.Set(true); |
| | 262 | |
|
| | 263 | | internal void SetMenuTargetVisibility(ExploreSection section, bool toVisible, bool _ = false) |
| | 264 | | { |
| 160 | 265 | | if (toVisible) |
| | 266 | | { |
| 18 | 267 | | if (currentSectionIndex.Get() != (int)section) |
| 13 | 268 | | currentSectionIndex.Set((int)section); |
| | 269 | |
|
| 18 | 270 | | SetSectionTargetVisibility(section, toVisible: true); |
| 18 | 271 | | view.GoToSection(section); |
| | 272 | | } |
| 142 | 273 | | else if (currentOpenSection == section) |
| | 274 | | { |
| 55 | 275 | | SetSectionTargetVisibility(section, toVisible: false); |
| | 276 | | } |
| 142 | 277 | | } |
| | 278 | |
|
| | 279 | | private void SetSectionTargetVisibility(ExploreSection section, bool toVisible) |
| | 280 | | { |
| 73 | 281 | | bool wasInTargetVisibility = toVisible ^ isOpen.Get(); |
| | 282 | |
|
| 73 | 283 | | if (wasInTargetVisibility) |
| | 284 | | { |
| 18 | 285 | | SetVisibility(toVisible); |
| 18 | 286 | | exploreV2Analytics.SendStartMenuVisibility(toVisible, ExploreUIVisibilityMethod.FromShortcut); |
| | 287 | | } |
| 73 | 288 | | exploreV2Analytics.SendStartMenuSectionVisibility(section, toVisible); |
| 73 | 289 | | } |
| | 290 | |
|
| | 291 | | private void UpdateRealmInfo(string current, string previous) |
| | 292 | | { |
| 0 | 293 | | if (string.IsNullOrEmpty(current)) |
| 0 | 294 | | return; |
| | 295 | |
|
| 0 | 296 | | UpdateRealmInfo(current); |
| 0 | 297 | | } |
| | 298 | |
|
| | 299 | | internal void UpdateRealmInfo(string realmName) |
| | 300 | | { |
| 52 | 301 | | if (string.IsNullOrEmpty(realmName)) |
| 51 | 302 | | return; |
| | 303 | |
|
| | 304 | | // Get the name of the current realm |
| 1 | 305 | | view.currentRealmViewer.SetRealm(realmName); |
| 1 | 306 | | view.currentRealmSelectorModal.SetCurrentRealm(realmName); |
| | 307 | |
|
| | 308 | | // Calculate number of users in the current realm |
| 1 | 309 | | List<RealmModel> realmList = DataStore.i.realm.realmsInfo.Get()?.ToList(); |
| 2 | 310 | | RealmModel currentRealmModel = realmList?.FirstOrDefault(r => r.serverName == realmName); |
| 1 | 311 | | int realmUsers = 0; |
| 1 | 312 | | if (currentRealmModel != null) |
| 1 | 313 | | realmUsers = currentRealmModel.usersCount; |
| | 314 | |
|
| 1 | 315 | | view.currentRealmViewer.SetNumberOfUsers(realmUsers); |
| 1 | 316 | | } |
| | 317 | |
|
| | 318 | | internal void UpdateAvailableRealmsInfo(IEnumerable<RealmModel> currentRealmList) |
| | 319 | | { |
| 53 | 320 | | List<RealmModel> realmList = currentRealmList?.ToList(); |
| | 321 | |
|
| 53 | 322 | | if (!NeedToRefreshRealms(realmList)) |
| 51 | 323 | | return; |
| | 324 | |
|
| 2 | 325 | | currentAvailableRealms.Clear(); |
| | 326 | |
|
| 2 | 327 | | if (realmList != null) |
| | 328 | | { |
| 2 | 329 | | string serverName = ServerNameForCurrentRealm(); |
| 12 | 330 | | foreach (RealmModel realmModel in realmList) |
| | 331 | | { |
| 4 | 332 | | currentAvailableRealms.Add(new RealmRowComponentModel |
| | 333 | | { |
| | 334 | | name = realmModel.serverName, |
| | 335 | | players = realmModel.usersCount, |
| | 336 | | isConnected = realmModel.serverName == serverName |
| | 337 | | }); |
| | 338 | | } |
| | 339 | | } |
| | 340 | |
|
| 2 | 341 | | view.currentRealmSelectorModal.SetAvailableRealms(currentAvailableRealms); |
| 2 | 342 | | } |
| | 343 | |
|
| | 344 | | private string ServerNameForCurrentRealm() |
| | 345 | | { |
| 2 | 346 | | if (DataStore.i.realm.playerRealm.Get() != null) |
| 1 | 347 | | return DataStore.i.realm.playerRealm.Get().serverName; |
| 1 | 348 | | if(DataStore.i.realm.playerRealmAboutConfiguration.Get() != null) |
| 0 | 349 | | return DataStore.i.realm.playerRealmAboutConfiguration.Get().RealmName; |
| 1 | 350 | | return ""; |
| | 351 | | } |
| | 352 | |
|
| | 353 | | internal bool NeedToRefreshRealms(IEnumerable<RealmModel> newRealmList) |
| | 354 | | { |
| 53 | 355 | | if (newRealmList == null) |
| 0 | 356 | | return true; |
| | 357 | |
|
| 53 | 358 | | bool needToRefresh = false; |
| 53 | 359 | | if (newRealmList.Count() == currentAvailableRealms.Count) |
| | 360 | | { |
| 102 | 361 | | foreach (RealmModel realm in newRealmList) |
| | 362 | | { |
| 0 | 363 | | if (!currentAvailableRealms.Exists(x => x.name == realm.serverName && x.players == realm.usersCount)) |
| | 364 | | { |
| 0 | 365 | | needToRefresh = true; |
| 0 | 366 | | break; |
| | 367 | | } |
| | 368 | | } |
| | 369 | | } |
| | 370 | | else |
| 2 | 371 | | needToRefresh = true; |
| | 372 | |
|
| 53 | 373 | | return needToRefresh; |
| | 374 | | } |
| | 375 | |
|
| | 376 | | internal void UpdateProfileInfo(UserProfile profile) |
| | 377 | | { |
| 52 | 378 | | view.currentProfileCard.SetIsClaimedName(profile.hasClaimedName); |
| 52 | 379 | | view.currentProfileCard.SetProfileName(profile.userName); |
| 52 | 380 | | view.currentProfileCard.SetProfileAddress(profile.ethAddress); |
| 52 | 381 | | view.currentProfileCard.SetProfilePicture(profile.face256SnapshotURL); |
| 52 | 382 | | } |
| | 383 | |
|
| | 384 | | internal void OnCloseButtonPressed(bool fromShortcut) |
| | 385 | | { |
| 2 | 386 | | SetVisibility(false); |
| 2 | 387 | | exploreV2Analytics.SendStartMenuVisibility(false, fromShortcut ? ExploreUIVisibilityMethod.FromShortcut : Explor |
| 2 | 388 | | } |
| | 389 | |
|
| | 390 | | internal void ConfigureOtherUIDependencies() |
| | 391 | | { |
| 51 | 392 | | controlsHUDCloseTime = Time.realtimeSinceStartup; |
| 51 | 393 | | controlsVisible.OnChange += (current, _) => |
| | 394 | | { |
| 0 | 395 | | if (!current) |
| 0 | 396 | | controlsHUDCloseTime = Time.realtimeSinceStartup; |
| 0 | 397 | | }; |
| | 398 | |
|
| 51 | 399 | | emotesHUDCloseTime = Time.realtimeSinceStartup; |
| 51 | 400 | | emotesVisible.OnChange += (current, _) => |
| | 401 | | { |
| 0 | 402 | | if (!current) |
| 0 | 403 | | emotesHUDCloseTime = Time.realtimeSinceStartup; |
| 0 | 404 | | }; |
| | 405 | |
|
| 51 | 406 | | chatInputHUDCloseTime = Time.realtimeSinceStartup; |
| 51 | 407 | | chatInputVisible.OnChange += (current, _) => |
| | 408 | | { |
| 0 | 409 | | if (!current) |
| 0 | 410 | | chatInputHUDCloseTime = Time.realtimeSinceStartup; |
| 0 | 411 | | }; |
| | 412 | |
|
| 51 | 413 | | playerInfoCardHUDCloseTime = Time.realtimeSinceStartup; |
| 51 | 414 | | playerInfoCardVisible.OnChange += (current, _) => |
| | 415 | | { |
| 0 | 416 | | if (!current) |
| 0 | 417 | | playerInfoCardHUDCloseTime = Time.realtimeSinceStartup; |
| 0 | 418 | | }; |
| 51 | 419 | | } |
| | 420 | |
|
| 0 | 421 | | internal virtual IExploreV2Analytics CreateAnalyticsController() => new ExploreV2Analytics.ExploreV2Analytics(); |
| | 422 | |
|
| 0 | 423 | | protected internal virtual IExploreV2MenuComponentView CreateView() => ExploreV2MenuComponentView.Create(); |
| | 424 | | } |