< Summary

Class:DCL.EmotesWheel.EmotesWheelController
Assembly:EmotesWheelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/EmotesWheelHUD/EmotesWheelController.cs
Covered lines:123
Uncovered lines:131
Coverable lines:254
Total lines:481
Line coverage:48.4% (123 of 254)
Covered branches:0
Total branches:0
Covered methods:15
Total methods:29
Method coverage:51.7% (15 of 29)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
EmotesWheelController(...)0%110100%
OnPlayerSet(...)0%3.192033.33%
OnEmoteEquipped(...)0%2100%
SetVisibility(...)0%2100%
OnEmoteVisibleChanged(...)0%110100%
IsStartMenuOpenChanged(...)0%6200%
OnEquippedEmotesSet(...)0%2100%
UpdateEmoteSlots()0%1561200%
RefreshSlotLoadingState(...)0%12300%
<SetVisibility_Internal()0%20400%
SetVisibility_Internal(...)0%20.1710053.33%
Dispose()0%55097.22%
OnEmoteClicked(...)0%2100%
PlayEmote(...)0%2.062075%
ConfigureShortcuts()0%110100%
OnNumericShortcutInputActionTriggered(...)0%52567200%
OnViewClosed()0%2100%
OnAvatarEmoteSet(...)0%110100%
OnCloseWindowPressed(...)0%110100%
OnOpenEmotesCustomizationInputActionTriggered(...)0%6200%
OpenEmotesCustomizationSection()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/EmotesWheelHUD/EmotesWheelController.cs

#LineLine coverage
 1using AvatarSystem;
 2using Cysharp.Threading.Tasks;
 3using System.Collections.Generic;
 4using DCL.Emotes;
 5using DCL.Helpers;
 6using DCLServices.WearablesCatalogService;
 7using System.Linq;
 8using System.Threading;
 9using UnityEngine;
 10using UnityEngine.Pool;
 11
 12namespace DCL.EmotesWheel
 13{
 14    public class EmotesWheelController : IHUD
 15    {
 16        internal EmotesWheelView view;
 1317        private BaseVariable<bool> emotesVisible => DataStore.i.HUDs.emotesVisible;
 518        private BaseVariable<bool> emoteJustTriggeredFromShortcut => DataStore.i.HUDs.emoteJustTriggeredFromShortcut;
 019        private BaseVariable<bool> isAvatarEditorVisible => DataStore.i.HUDs.avatarEditorVisible;
 420        private BaseVariable<bool> isStartMenuOpen => DataStore.i.exploreV2.isOpen;
 521        private BaseVariable<bool> canStartMenuBeOpened => DataStore.i.exploreV2.isSomeModalOpen;
 022        private bool shortcutsCanBeUsed => !isStartMenuOpen.Get();
 923        private DataStore_EmotesCustomization emotesCustomizationDataStore => DataStore.i.emotesCustomization;
 24
 625        private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile();
 26        private InputAction_Trigger closeWindow;
 27        private InputAction_Hold openEmotesCustomizationInputAction;
 28        private InputAction_Trigger shortcut0InputAction;
 29        private InputAction_Trigger shortcut1InputAction;
 30        private InputAction_Trigger shortcut2InputAction;
 31        private InputAction_Trigger shortcut3InputAction;
 32        private InputAction_Trigger shortcut4InputAction;
 33        private InputAction_Trigger shortcut5InputAction;
 34        private InputAction_Trigger shortcut6InputAction;
 35        private InputAction_Trigger shortcut7InputAction;
 36        private InputAction_Trigger shortcut8InputAction;
 37        private InputAction_Trigger shortcut9InputAction;
 38        private InputAction_Trigger auxShortcut0InputAction;
 39        private InputAction_Trigger auxShortcut1InputAction;
 40        private InputAction_Trigger auxShortcut2InputAction;
 41        private InputAction_Trigger auxShortcut3InputAction;
 42        private InputAction_Trigger auxShortcut4InputAction;
 43        private InputAction_Trigger auxShortcut5InputAction;
 44        private InputAction_Trigger auxShortcut6InputAction;
 45        private InputAction_Trigger auxShortcut7InputAction;
 46        private InputAction_Trigger auxShortcut8InputAction;
 47        private InputAction_Trigger auxShortcut9InputAction;
 48        private readonly UserProfile userProfile;
 49        private readonly IWearablesCatalogService wearablesCatalogService;
 50        private bool ownedWearablesAlreadyRequested;
 351        private readonly BaseDictionary<string, EmoteWheelSlot> slotsInLoadingState = new ();
 352        private CancellationTokenSource cts = new ();
 53        private readonly IEmotesCatalogService emoteCatalog;
 54        private readonly IEmotesService emotesService;
 55        private IAvatar avatar;
 56        private IAvatarEmotesController emotesController;
 57
 358        public EmotesWheelController(
 59            UserProfile userProfile,
 60            IEmotesService emotesService,
 61            IWearablesCatalogService wearablesCatalogService)
 62        {
 363            this.emotesService = emotesService;
 364            closeWindow = Resources.Load<InputAction_Trigger>("CloseWindow");
 365            closeWindow.OnTriggered += OnCloseWindowPressed;
 66
 367            view = EmotesWheelView.Create();
 368            view.OnClose += OnViewClosed;
 369            view.onEmoteClicked += OnEmoteClicked;
 370            view.OnCustomizeClicked += OpenEmotesCustomizationSection;
 71
 372            ownUserProfile.OnAvatarEmoteSet += OnAvatarEmoteSet;
 373            emotesVisible.OnChange += OnEmoteVisibleChanged;
 374            OnEmoteVisibleChanged(emotesVisible.Get(), false);
 75
 376            isStartMenuOpen.OnChange += IsStartMenuOpenChanged;
 77
 378            this.userProfile = userProfile;
 379            this.wearablesCatalogService = wearablesCatalogService;
 380            emotesCustomizationDataStore.equippedEmotes.OnSet += OnEquippedEmotesSet;
 81
 382            ConfigureShortcuts();
 83
 384            emotesCustomizationDataStore.isWheelInitialized.Set(true);
 85
 386            DataStore.i.player.ownPlayer.OnChange += OnPlayerSet;
 387            OnPlayerSet(DataStore.i.player.ownPlayer.Get(), null);
 388        }
 89
 90        private void OnPlayerSet(Player current, Player previous)
 91        {
 692            if (current == null) return;
 093            emotesController = current.avatar.GetEmotesController();
 094            emotesController.OnEmoteEquipped += OnEmoteEquipped;
 095            UpdateEmoteSlots();
 096        }
 97
 98        private void OnEmoteEquipped(string emoteId, IEmoteReference emoteReference)
 99        {
 0100            RefreshSlotLoadingState(emoteId);
 0101        }
 102
 103        public void SetVisibility(bool visible)
 104        {
 105            //TODO once kernel sends visible properly
 106            //expressionsVisible.Set(visible);
 0107        }
 108
 10109        private void OnEmoteVisibleChanged(bool current, bool previous) { SetVisibility_Internal(current); }
 110
 111        private void IsStartMenuOpenChanged(bool current, bool previous)
 112        {
 0113            if (!current)
 0114                return;
 115
 0116            emotesVisible.Set(false);
 0117        }
 118
 0119        private void OnEquippedEmotesSet(IEnumerable<EquippedEmoteData> equippedEmotes) { UpdateEmoteSlots(); }
 120
 121        private void UpdateEmoteSlots()
 122        {
 0123            if (emotesController == null) return;
 0124            List<EmotesWheelView.EmoteSlotData> emotesToSet = new List<EmotesWheelView.EmoteSlotData>();
 125
 0126            var equippedEmotes = ListPool<EquippedEmoteData>.Get();
 0127            equippedEmotes.AddRange(emotesCustomizationDataStore.equippedEmotes.Get());
 128
 0129            foreach (EquippedEmoteData equippedEmoteData in equippedEmotes)
 130            {
 0131                if (equippedEmoteData != null)
 132                {
 0133                    if (emotesController.TryGetEquippedEmote(userProfile.avatar.bodyShape, equippedEmoteData.id, out var
 134                    {
 0135                        var entity = emote?.GetEntity();
 136
 0137                        if (entity == null) // emote exists but its not loaded yet
 138                        {
 0139                            emotesToSet.Add(new EmotesWheelView.EmoteSlotData
 140                            {
 141                                emoteId = equippedEmoteData.id,
 142                                emoteItem = null,
 143                                thumbnailSprite = equippedEmoteData.cachedThumbnail,
 144                            });
 145                        }
 146                        else
 147                        {
 0148                            emotesToSet.Add(new EmotesWheelView.EmoteSlotData
 149                            {
 150                                emoteId = equippedEmoteData.id,
 151                                emoteItem = entity,
 152                                thumbnailSprite = entity.thumbnailSprite != null ? entity.thumbnailSprite : equippedEmot
 153                            });
 154                        }
 155                    }
 156                    else
 0157                        emotesToSet.Add(new EmotesWheelView.EmoteSlotData
 158                        {
 159                            emoteId = equippedEmoteData.id,
 160                            emoteItem = null,
 161                            thumbnailSprite = equippedEmoteData.cachedThumbnail,
 162                        });
 163                } else
 0164                    emotesToSet.Add(null);
 165            }
 166
 0167            ListPool<EquippedEmoteData>.Release(equippedEmotes);
 168
 0169            List<EmoteWheelSlot> updatedWheelSlots = view.SetEmotes(emotesToSet);
 0170            foreach (EmoteWheelSlot slot in updatedWheelSlots)
 171            {
 0172                slot.SetAsLoading(false);
 0173                if (string.IsNullOrEmpty(slot.emoteId))
 174                    continue;
 175
 0176                slotsInLoadingState.Remove(slot.emoteId);
 177
 178
 0179                slot.SetAsLoading(true);
 0180                slotsInLoadingState.Add(slot.emoteId, slot);
 181
 0182                RefreshSlotLoadingState(slot.emoteId);
 183            }
 0184        }
 185
 186        private void RefreshSlotLoadingState(string emoteId)
 187        {
 0188            if (emotesController.TryGetEquippedEmote(userProfile.avatar.bodyShape, emoteId, out var emote))
 189            {
 0190                slotsInLoadingState.TryGetValue(emoteId, out EmoteWheelSlot slot);
 0191                if (slot == null) return;
 0192                var entity = emote.GetEntity();
 0193                view.SetupEmoteWheelSlot(slot, new EmotesWheelView.EmoteSlotData
 194                {
 195                    emoteId = emoteId,
 196                    emoteItem = entity,
 197                    thumbnailSprite = entity.thumbnailSprite,
 198                });
 0199                slot.SetAsLoading(false);
 0200                slotsInLoadingState.Remove(emoteId);
 201            }
 0202        }
 203
 204        public void SetVisibility_Internal(bool visible)
 205        {
 206            async UniTaskVoid RequestOwnedWearablesAsync(CancellationToken ct)
 207            {
 0208                var ownedWearables = await wearablesCatalogService.RequestOwnedWearablesAsync(
 209                    userProfile.userId,
 210                    1,
 211                    int.MaxValue,
 212                    true,
 213                    ct);
 214
 0215                ownedWearablesAlreadyRequested = true;
 0216                userProfile.SetInventory(ownedWearables.wearables.Select(x => x.id));
 0217                UpdateEmoteSlots();
 0218            }
 219
 5220            if (visible && isStartMenuOpen.Get())
 0221                return;
 222
 5223            if (emoteJustTriggeredFromShortcut.Get())
 224            {
 0225                emotesVisible.Set(false);
 0226                return;
 227            }
 228
 5229            view.SetVisiblity(visible);
 230
 5231            if (visible)
 232            {
 1233                Helpers.Utils.UnlockCursor();
 234
 1235                if (userProfile != null &&
 236                    !string.IsNullOrEmpty(userProfile.userId) &&
 237                    !ownedWearablesAlreadyRequested)
 238                {
 0239                    cts?.Cancel();
 0240                    cts?.Dispose();
 0241                    cts = new CancellationTokenSource();
 0242                    RequestOwnedWearablesAsync(cts.Token).Forget();
 243                }
 244            }
 245
 5246            canStartMenuBeOpened.Set(visible);
 5247        }
 248
 249        public void Dispose()
 250        {
 3251            view.OnClose -= OnViewClosed;
 3252            view.onEmoteClicked -= OnEmoteClicked;
 3253            view.OnCustomizeClicked -= OpenEmotesCustomizationSection;
 3254            closeWindow.OnTriggered -= OnCloseWindowPressed;
 3255            ownUserProfile.OnAvatarEmoteSet -= OnAvatarEmoteSet;
 3256            emotesVisible.OnChange -= OnEmoteVisibleChanged;
 3257            emotesCustomizationDataStore.equippedEmotes.OnSet -= OnEquippedEmotesSet;
 3258            shortcut0InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3259            shortcut1InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3260            shortcut2InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3261            shortcut3InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3262            shortcut4InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3263            shortcut5InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3264            shortcut6InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3265            shortcut7InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3266            shortcut8InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3267            shortcut9InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3268            auxShortcut0InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3269            auxShortcut1InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3270            auxShortcut2InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3271            auxShortcut3InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3272            auxShortcut4InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3273            auxShortcut5InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3274            auxShortcut6InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3275            auxShortcut7InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3276            auxShortcut8InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 3277            auxShortcut9InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered;
 278
 3279            if (emotesController != null)
 0280                emotesController.OnEmoteEquipped -= OnEmoteEquipped;
 281
 3282            cts?.Cancel();
 3283            cts?.Dispose();
 3284            cts = null;
 285
 3286            if (view != null)
 287            {
 3288                view.CleanUp();
 3289                Utils.SafeDestroy(view.gameObject);
 290            }
 3291        }
 292
 0293        public void OnEmoteClicked(string id) { PlayEmote(id, UserProfile.EmoteSource.EmotesWheel); }
 294
 295        public void PlayEmote(string id, UserProfile.EmoteSource source)
 296        {
 1297            if (string.IsNullOrEmpty(id))
 0298                return;
 299
 1300            UserProfile.GetOwnUserProfile().SetAvatarExpression(id, source);
 1301        }
 302
 303        private void ConfigureShortcuts()
 304        {
 3305            closeWindow = Resources.Load<InputAction_Trigger>("CloseWindow");
 3306            closeWindow.OnTriggered += OnCloseWindowPressed;
 307
 3308            openEmotesCustomizationInputAction = Resources.Load<InputAction_Hold>("DefaultConfirmAction");
 3309            openEmotesCustomizationInputAction.OnFinished += OnOpenEmotesCustomizationInputActionTriggered;
 310
 3311            shortcut0InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut0");
 3312            shortcut0InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 313
 3314            shortcut1InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut1");
 3315            shortcut1InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 316
 3317            shortcut2InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut2");
 3318            shortcut2InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 319
 3320            shortcut3InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut3");
 3321            shortcut3InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 322
 3323            shortcut4InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut4");
 3324            shortcut4InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 325
 3326            shortcut5InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut5");
 3327            shortcut5InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 328
 3329            shortcut6InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut6");
 3330            shortcut6InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 331
 3332            shortcut7InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut7");
 3333            shortcut7InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 334
 3335            shortcut8InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut8");
 3336            shortcut8InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 337
 3338            shortcut9InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut9");
 3339            shortcut9InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 340
 3341            auxShortcut0InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut0");
 3342            auxShortcut0InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 343
 3344            auxShortcut1InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut1");
 3345            auxShortcut1InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 346
 3347            auxShortcut2InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut2");
 3348            auxShortcut2InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 349
 3350            auxShortcut3InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut3");
 3351            auxShortcut3InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 352
 3353            auxShortcut4InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut4");
 3354            auxShortcut4InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 355
 3356            auxShortcut5InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut5");
 3357            auxShortcut5InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 358
 3359            auxShortcut6InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut6");
 3360            auxShortcut6InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 361
 3362            auxShortcut7InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut7");
 3363            auxShortcut7InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 364
 3365            auxShortcut8InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut8");
 3366            auxShortcut8InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 367
 3368            auxShortcut9InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut9");
 3369            auxShortcut9InputAction.OnTriggered += OnNumericShortcutInputActionTriggered;
 3370        }
 371
 372        private void OnNumericShortcutInputActionTriggered(DCLAction_Trigger action)
 373        {
 0374            if (!shortcutsCanBeUsed)
 0375                return;
 376
 377            switch (action)
 378            {
 379                case DCLAction_Trigger.ToggleEmoteShortcut0:
 0380                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[0]?.id, UserProfile.EmoteSource.Shortcut);
 0381                    emoteJustTriggeredFromShortcut.Set(true);
 0382                    break;
 383                case DCLAction_Trigger.ToggleEmoteShortcut1:
 0384                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[1]?.id, UserProfile.EmoteSource.Shortcut);
 0385                    emoteJustTriggeredFromShortcut.Set(true);
 0386                    break;
 387                case DCLAction_Trigger.ToggleEmoteShortcut2:
 0388                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[2]?.id, UserProfile.EmoteSource.Shortcut);
 0389                    emoteJustTriggeredFromShortcut.Set(true);
 0390                    break;
 391                case DCLAction_Trigger.ToggleEmoteShortcut3:
 0392                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[3]?.id, UserProfile.EmoteSource.Shortcut);
 0393                    emoteJustTriggeredFromShortcut.Set(true);
 0394                    break;
 395                case DCLAction_Trigger.ToggleEmoteShortcut4:
 0396                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[4]?.id, UserProfile.EmoteSource.Shortcut);
 0397                    emoteJustTriggeredFromShortcut.Set(true);
 0398                    break;
 399                case DCLAction_Trigger.ToggleEmoteShortcut5:
 0400                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[5]?.id, UserProfile.EmoteSource.Shortcut);
 0401                    emoteJustTriggeredFromShortcut.Set(true);
 0402                    break;
 403                case DCLAction_Trigger.ToggleEmoteShortcut6:
 0404                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[6]?.id, UserProfile.EmoteSource.Shortcut);
 0405                    emoteJustTriggeredFromShortcut.Set(true);
 0406                    break;
 407                case DCLAction_Trigger.ToggleEmoteShortcut7:
 0408                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[7]?.id, UserProfile.EmoteSource.Shortcut);
 0409                    emoteJustTriggeredFromShortcut.Set(true);
 0410                    break;
 411                case DCLAction_Trigger.ToggleEmoteShortcut8:
 0412                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[8]?.id, UserProfile.EmoteSource.Shortcut);
 0413                    emoteJustTriggeredFromShortcut.Set(true);
 0414                    break;
 415                case DCLAction_Trigger.ToggleEmoteShortcut9:
 0416                    PlayEmote(emotesCustomizationDataStore.equippedEmotes[9]?.id, UserProfile.EmoteSource.Shortcut);
 0417                    emoteJustTriggeredFromShortcut.Set(true);
 0418                    break;
 419                case DCLAction_Trigger.ToggleShortcut0:
 0420                    if (emotesVisible.Get())
 0421                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[0]?.id, UserProfile.EmoteSource.Shortcut);
 0422                    break;
 423                case DCLAction_Trigger.ToggleShortcut1:
 0424                    if (emotesVisible.Get())
 0425                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[1]?.id, UserProfile.EmoteSource.Shortcut);
 0426                    break;
 427                case DCLAction_Trigger.ToggleShortcut2:
 0428                    if (emotesVisible.Get())
 0429                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[2]?.id, UserProfile.EmoteSource.Shortcut);
 0430                    break;
 431                case DCLAction_Trigger.ToggleShortcut3:
 0432                    if (emotesVisible.Get())
 0433                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[3]?.id, UserProfile.EmoteSource.Shortcut);
 0434                    break;
 435                case DCLAction_Trigger.ToggleShortcut4:
 0436                    if (emotesVisible.Get())
 0437                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[4]?.id, UserProfile.EmoteSource.Shortcut);
 0438                    break;
 439                case DCLAction_Trigger.ToggleShortcut5:
 0440                    if (emotesVisible.Get())
 0441                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[5]?.id, UserProfile.EmoteSource.Shortcut);
 0442                    break;
 443                case DCLAction_Trigger.ToggleShortcut6:
 0444                    if (emotesVisible.Get())
 0445                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[6]?.id, UserProfile.EmoteSource.Shortcut);
 0446                    break;
 447                case DCLAction_Trigger.ToggleShortcut7:
 0448                    if (emotesVisible.Get())
 0449                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[7]?.id, UserProfile.EmoteSource.Shortcut);
 0450                    break;
 451                case DCLAction_Trigger.ToggleShortcut8:
 0452                    if (emotesVisible.Get())
 0453                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[8]?.id, UserProfile.EmoteSource.Shortcut);
 0454                    break;
 455                case DCLAction_Trigger.ToggleShortcut9:
 0456                    if (emotesVisible.Get())
 0457                        PlayEmote(emotesCustomizationDataStore.equippedEmotes[9]?.id, UserProfile.EmoteSource.Shortcut);
 458                    break;
 459            }
 0460        }
 461
 0462        private void OnViewClosed() { emotesVisible.Set(false); }
 2463        private void OnAvatarEmoteSet(string id, long timestamp, UserProfile.EmoteSource source) { emotesVisible.Set(fal
 6464        private void OnCloseWindowPressed(DCLAction_Trigger action) { emotesVisible.Set(false); }
 465
 466        private void OnOpenEmotesCustomizationInputActionTriggered(DCLAction_Hold action)
 467        {
 0468            if (!emotesVisible.Get())
 0469                return;
 470
 0471            OpenEmotesCustomizationSection();
 0472        }
 473
 474        private void OpenEmotesCustomizationSection()
 475        {
 0476            emotesVisible.Set(false);
 0477            isAvatarEditorVisible.Set(true);
 0478            emotesCustomizationDataStore.isEmotesCustomizationSelected.Set(true);
 0479        }
 480    }
 481}