| | 1 | | using System.Collections.Generic; |
| | 2 | | using System.Linq; |
| | 3 | | using DCL.Emotes; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.EmotesWheel |
| | 7 | | { |
| | 8 | | public class EmotesWheelController : IHUD |
| | 9 | | { |
| | 10 | | internal EmotesWheelView view; |
| 13 | 11 | | private BaseVariable<bool> emotesVisible => DataStore.i.HUDs.emotesVisible; |
| 5 | 12 | | private BaseVariable<bool> emoteJustTriggeredFromShortcut => DataStore.i.HUDs.emoteJustTriggeredFromShortcut; |
| 0 | 13 | | private BaseVariable<bool> isAvatarEditorVisible => DataStore.i.HUDs.avatarEditorVisible; |
| 8 | 14 | | private BaseVariable<bool> isStartMenuOpen => DataStore.i.exploreV2.isOpen; |
| 5 | 15 | | private BaseVariable<bool> canStartMenuBeOpened => DataStore.i.exploreV2.isSomeModalOpen; |
| 0 | 16 | | private bool shortcutsCanBeUsed => !isStartMenuOpen.Get(); |
| 15 | 17 | | private DataStore_EmotesCustomization emotesCustomizationDataStore => DataStore.i.emotesCustomization; |
| 6 | 18 | | private BaseDictionary<(string bodyshapeId, string emoteId), EmoteClipData> emoteAnimations => DataStore.i.emote |
| | 19 | |
|
| 6 | 20 | | private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile(); |
| | 21 | | private InputAction_Trigger closeWindow; |
| | 22 | | private InputAction_Hold openEmotesCustomizationInputAction; |
| | 23 | | private InputAction_Trigger shortcut0InputAction; |
| | 24 | | private InputAction_Trigger shortcut1InputAction; |
| | 25 | | private InputAction_Trigger shortcut2InputAction; |
| | 26 | | private InputAction_Trigger shortcut3InputAction; |
| | 27 | | private InputAction_Trigger shortcut4InputAction; |
| | 28 | | private InputAction_Trigger shortcut5InputAction; |
| | 29 | | private InputAction_Trigger shortcut6InputAction; |
| | 30 | | private InputAction_Trigger shortcut7InputAction; |
| | 31 | | private InputAction_Trigger shortcut8InputAction; |
| | 32 | | private InputAction_Trigger shortcut9InputAction; |
| | 33 | | private InputAction_Trigger auxShortcut0InputAction; |
| | 34 | | private InputAction_Trigger auxShortcut1InputAction; |
| | 35 | | private InputAction_Trigger auxShortcut2InputAction; |
| | 36 | | private InputAction_Trigger auxShortcut3InputAction; |
| | 37 | | private InputAction_Trigger auxShortcut4InputAction; |
| | 38 | | private InputAction_Trigger auxShortcut5InputAction; |
| | 39 | | private InputAction_Trigger auxShortcut6InputAction; |
| | 40 | | private InputAction_Trigger auxShortcut7InputAction; |
| | 41 | | private InputAction_Trigger auxShortcut8InputAction; |
| | 42 | | private InputAction_Trigger auxShortcut9InputAction; |
| | 43 | | private UserProfile userProfile; |
| | 44 | | private BaseDictionary<string, WearableItem> catalog; |
| | 45 | | private readonly IEmotesCatalogService emoteCatalog; |
| | 46 | | private bool ownedWearablesAlreadyRequested = false; |
| 3 | 47 | | private BaseDictionary<string, EmoteWheelSlot> slotsInLoadingState = new BaseDictionary<string, EmoteWheelSlot>( |
| | 48 | |
|
| 3 | 49 | | public EmotesWheelController(UserProfile userProfile, BaseDictionary<string, WearableItem> catalog, IEmotesCatal |
| | 50 | | { |
| 3 | 51 | | closeWindow = Resources.Load<InputAction_Trigger>("CloseWindow"); |
| 3 | 52 | | closeWindow.OnTriggered += OnCloseWindowPressed; |
| | 53 | |
|
| 3 | 54 | | view = EmotesWheelView.Create(); |
| 3 | 55 | | view.OnClose += OnViewClosed; |
| 3 | 56 | | view.onEmoteClicked += OnEmoteClicked; |
| 3 | 57 | | view.OnCustomizeClicked += OpenEmotesCustomizationSection; |
| | 58 | |
|
| 3 | 59 | | ownUserProfile.OnAvatarEmoteSet += OnAvatarEmoteSet; |
| 3 | 60 | | emotesVisible.OnChange += OnEmoteVisibleChanged; |
| 3 | 61 | | OnEmoteVisibleChanged(emotesVisible.Get(), false); |
| | 62 | |
|
| 3 | 63 | | isStartMenuOpen.OnChange += IsStartMenuOpenChanged; |
| | 64 | |
|
| 3 | 65 | | this.userProfile = userProfile; |
| 3 | 66 | | this.catalog = catalog; |
| 3 | 67 | | this.emoteCatalog = emoteCatalog; |
| 3 | 68 | | emotesCustomizationDataStore.equippedEmotes.OnSet += OnEquippedEmotesSet; |
| 3 | 69 | | OnEquippedEmotesSet(emotesCustomizationDataStore.equippedEmotes.Get()); |
| 3 | 70 | | emoteAnimations.OnAdded += OnAnimationAdded; |
| | 71 | |
|
| 3 | 72 | | ConfigureShortcuts(); |
| | 73 | |
|
| 3 | 74 | | emotesCustomizationDataStore.isWheelInitialized.Set(true); |
| 3 | 75 | | } |
| | 76 | |
|
| | 77 | | public void SetVisibility(bool visible) |
| | 78 | | { |
| | 79 | | //TODO once kernel sends visible properly |
| | 80 | | //expressionsVisible.Set(visible); |
| 0 | 81 | | } |
| | 82 | |
|
| 10 | 83 | | private void OnEmoteVisibleChanged(bool current, bool previous) { SetVisibility_Internal(current); } |
| | 84 | |
|
| | 85 | | private void IsStartMenuOpenChanged(bool current, bool previous) |
| | 86 | | { |
| 0 | 87 | | if (!current) |
| 0 | 88 | | return; |
| | 89 | |
|
| 0 | 90 | | emotesVisible.Set(false); |
| 0 | 91 | | } |
| | 92 | |
|
| 6 | 93 | | private void OnEquippedEmotesSet(IEnumerable<EquippedEmoteData> equippedEmotes) { UpdateEmoteSlots(); } |
| | 94 | |
|
| | 95 | | private void UpdateEmoteSlots() |
| | 96 | | { |
| 3 | 97 | | List<EmotesWheelView.EmoteSlotData> emotesToSet = new List<EmotesWheelView.EmoteSlotData>(); |
| 66 | 98 | | foreach (EquippedEmoteData equippedEmoteData in emotesCustomizationDataStore.equippedEmotes.Get()) |
| | 99 | | { |
| 30 | 100 | | if (equippedEmoteData != null) |
| | 101 | | { |
| 0 | 102 | | emoteCatalog.TryGetLoadedEmote(equippedEmoteData.id, out var emoteItem); |
| | 103 | |
|
| 0 | 104 | | if (emoteItem != null) |
| | 105 | | { |
| 0 | 106 | | emotesToSet.Add(new EmotesWheelView.EmoteSlotData |
| | 107 | | { |
| | 108 | | emoteItem = emoteItem, |
| | 109 | | thumbnailSprite = emoteItem.thumbnailSprite != null ? emoteItem.thumbnailSprite : equippedEm |
| | 110 | | }); |
| 0 | 111 | | } |
| | 112 | | else |
| | 113 | | { |
| 0 | 114 | | emotesToSet.Add(null); |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | | else |
| | 118 | | { |
| 30 | 119 | | emotesToSet.Add(null); |
| | 120 | | } |
| | 121 | | } |
| | 122 | |
|
| 3 | 123 | | List<EmoteWheelSlot> updatedWheelSlots = view.SetEmotes(emotesToSet); |
| 66 | 124 | | foreach (EmoteWheelSlot slot in updatedWheelSlots) |
| | 125 | | { |
| 30 | 126 | | slot.SetAsLoading(false); |
| 30 | 127 | | if (string.IsNullOrEmpty(slot.emoteId)) |
| | 128 | | continue; |
| | 129 | |
|
| 0 | 130 | | slotsInLoadingState.Remove(slot.emoteId); |
| | 131 | |
|
| | 132 | |
|
| 0 | 133 | | slot.SetAsLoading(true); |
| 0 | 134 | | slotsInLoadingState.Add(slot.emoteId, slot); |
| | 135 | |
|
| 0 | 136 | | RefreshSlotLoadingState(slot.emoteId); |
| | 137 | | } |
| 3 | 138 | | } |
| | 139 | |
|
| 0 | 140 | | private void OnAnimationAdded((string bodyshapeId, string emoteId) values, EmoteClipData emoteClipData) { Refres |
| | 141 | |
|
| | 142 | | private void RefreshSlotLoadingState(string emoteId) |
| | 143 | | { |
| 0 | 144 | | if (emoteAnimations.ContainsKey((userProfile.avatar.bodyShape, emoteId))) |
| | 145 | | { |
| 0 | 146 | | slotsInLoadingState.TryGetValue(emoteId, out EmoteWheelSlot slot); |
| 0 | 147 | | if (slot != null) |
| | 148 | | { |
| 0 | 149 | | slot.SetAsLoading(false); |
| 0 | 150 | | slotsInLoadingState.Remove(emoteId); |
| | 151 | | } |
| | 152 | | } |
| 0 | 153 | | } |
| | 154 | |
|
| | 155 | | public void SetVisibility_Internal(bool visible) |
| | 156 | | { |
| 5 | 157 | | if (isStartMenuOpen.Get()) |
| 0 | 158 | | return; |
| | 159 | |
|
| 5 | 160 | | if (emoteJustTriggeredFromShortcut.Get()) |
| | 161 | | { |
| 0 | 162 | | emotesVisible.Set(false); |
| 0 | 163 | | return; |
| | 164 | | } |
| | 165 | |
|
| 5 | 166 | | view.SetVisiblity(visible); |
| | 167 | |
|
| 5 | 168 | | if (visible) |
| | 169 | | { |
| 1 | 170 | | DCL.Helpers.Utils.UnlockCursor(); |
| | 171 | |
|
| 1 | 172 | | if (userProfile != null && |
| | 173 | | !string.IsNullOrEmpty(userProfile.userId) && |
| | 174 | | !ownedWearablesAlreadyRequested) |
| | 175 | | { |
| 0 | 176 | | CatalogController.RequestOwnedWearables(userProfile.userId) |
| | 177 | | .Then((ownedWearables) => |
| | 178 | | { |
| 0 | 179 | | ownedWearablesAlreadyRequested = true; |
| 0 | 180 | | userProfile.SetInventory(ownedWearables.Select(x => x.id).ToArray()); |
| 0 | 181 | | UpdateEmoteSlots(); |
| 0 | 182 | | }); |
| | 183 | | } |
| | 184 | | } |
| | 185 | |
|
| 5 | 186 | | canStartMenuBeOpened.Set(visible); |
| 5 | 187 | | } |
| | 188 | |
|
| | 189 | | public void Dispose() |
| | 190 | | { |
| 3 | 191 | | view.OnClose -= OnViewClosed; |
| 3 | 192 | | view.onEmoteClicked -= OnEmoteClicked; |
| 3 | 193 | | view.OnCustomizeClicked -= OpenEmotesCustomizationSection; |
| 3 | 194 | | closeWindow.OnTriggered -= OnCloseWindowPressed; |
| 3 | 195 | | ownUserProfile.OnAvatarEmoteSet -= OnAvatarEmoteSet; |
| 3 | 196 | | emotesVisible.OnChange -= OnEmoteVisibleChanged; |
| 3 | 197 | | emotesCustomizationDataStore.equippedEmotes.OnSet -= OnEquippedEmotesSet; |
| 3 | 198 | | emoteAnimations.OnAdded -= OnAnimationAdded; |
| 3 | 199 | | shortcut0InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 200 | | shortcut1InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 201 | | shortcut2InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 202 | | shortcut3InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 203 | | shortcut4InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 204 | | shortcut5InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 205 | | shortcut6InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 206 | | shortcut7InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 207 | | shortcut8InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 208 | | shortcut9InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 209 | | auxShortcut0InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 210 | | auxShortcut1InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 211 | | auxShortcut2InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 212 | | auxShortcut3InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 213 | | auxShortcut4InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 214 | | auxShortcut5InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 215 | | auxShortcut6InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 216 | | auxShortcut7InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 217 | | auxShortcut8InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| 3 | 218 | | auxShortcut9InputAction.OnTriggered -= OnNumericShortcutInputActionTriggered; |
| | 219 | |
|
| 3 | 220 | | if (view != null) |
| | 221 | | { |
| 3 | 222 | | view.CleanUp(); |
| 3 | 223 | | UnityEngine.Object.Destroy(view.gameObject); |
| | 224 | | } |
| 3 | 225 | | } |
| | 226 | |
|
| 0 | 227 | | public void OnEmoteClicked(string id) { PlayEmote(id, UserProfile.EmoteSource.EmotesWheel); } |
| | 228 | |
|
| | 229 | | public void PlayEmote(string id, UserProfile.EmoteSource source) |
| | 230 | | { |
| 1 | 231 | | if (string.IsNullOrEmpty(id)) |
| 0 | 232 | | return; |
| | 233 | |
|
| 1 | 234 | | UserProfile.GetOwnUserProfile().SetAvatarExpression(id, source); |
| 1 | 235 | | } |
| | 236 | |
|
| | 237 | | private void ConfigureShortcuts() |
| | 238 | | { |
| 3 | 239 | | closeWindow = Resources.Load<InputAction_Trigger>("CloseWindow"); |
| 3 | 240 | | closeWindow.OnTriggered += OnCloseWindowPressed; |
| | 241 | |
|
| 3 | 242 | | openEmotesCustomizationInputAction = Resources.Load<InputAction_Hold>("DefaultConfirmAction"); |
| 3 | 243 | | openEmotesCustomizationInputAction.OnFinished += OnOpenEmotesCustomizationInputActionTriggered; |
| | 244 | |
|
| 3 | 245 | | shortcut0InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut0"); |
| 3 | 246 | | shortcut0InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 247 | |
|
| 3 | 248 | | shortcut1InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut1"); |
| 3 | 249 | | shortcut1InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 250 | |
|
| 3 | 251 | | shortcut2InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut2"); |
| 3 | 252 | | shortcut2InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 253 | |
|
| 3 | 254 | | shortcut3InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut3"); |
| 3 | 255 | | shortcut3InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 256 | |
|
| 3 | 257 | | shortcut4InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut4"); |
| 3 | 258 | | shortcut4InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 259 | |
|
| 3 | 260 | | shortcut5InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut5"); |
| 3 | 261 | | shortcut5InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 262 | |
|
| 3 | 263 | | shortcut6InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut6"); |
| 3 | 264 | | shortcut6InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 265 | |
|
| 3 | 266 | | shortcut7InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut7"); |
| 3 | 267 | | shortcut7InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 268 | |
|
| 3 | 269 | | shortcut8InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut8"); |
| 3 | 270 | | shortcut8InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 271 | |
|
| 3 | 272 | | shortcut9InputAction = Resources.Load<InputAction_Trigger>("ToggleEmoteShortcut9"); |
| 3 | 273 | | shortcut9InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 274 | |
|
| 3 | 275 | | auxShortcut0InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut0"); |
| 3 | 276 | | auxShortcut0InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 277 | |
|
| 3 | 278 | | auxShortcut1InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut1"); |
| 3 | 279 | | auxShortcut1InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 280 | |
|
| 3 | 281 | | auxShortcut2InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut2"); |
| 3 | 282 | | auxShortcut2InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 283 | |
|
| 3 | 284 | | auxShortcut3InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut3"); |
| 3 | 285 | | auxShortcut3InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 286 | |
|
| 3 | 287 | | auxShortcut4InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut4"); |
| 3 | 288 | | auxShortcut4InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 289 | |
|
| 3 | 290 | | auxShortcut5InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut5"); |
| 3 | 291 | | auxShortcut5InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 292 | |
|
| 3 | 293 | | auxShortcut6InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut6"); |
| 3 | 294 | | auxShortcut6InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 295 | |
|
| 3 | 296 | | auxShortcut7InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut7"); |
| 3 | 297 | | auxShortcut7InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 298 | |
|
| 3 | 299 | | auxShortcut8InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut8"); |
| 3 | 300 | | auxShortcut8InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| | 301 | |
|
| 3 | 302 | | auxShortcut9InputAction = Resources.Load<InputAction_Trigger>("ToggleShortcut9"); |
| 3 | 303 | | auxShortcut9InputAction.OnTriggered += OnNumericShortcutInputActionTriggered; |
| 3 | 304 | | } |
| | 305 | |
|
| | 306 | | private void OnNumericShortcutInputActionTriggered(DCLAction_Trigger action) |
| | 307 | | { |
| 0 | 308 | | if (!shortcutsCanBeUsed) |
| 0 | 309 | | return; |
| | 310 | |
|
| | 311 | | switch (action) |
| | 312 | | { |
| | 313 | | case DCLAction_Trigger.ToggleEmoteShortcut0: |
| 0 | 314 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[0]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 315 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 316 | | break; |
| | 317 | | case DCLAction_Trigger.ToggleEmoteShortcut1: |
| 0 | 318 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[1]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 319 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 320 | | break; |
| | 321 | | case DCLAction_Trigger.ToggleEmoteShortcut2: |
| 0 | 322 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[2]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 323 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 324 | | break; |
| | 325 | | case DCLAction_Trigger.ToggleEmoteShortcut3: |
| 0 | 326 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[3]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 327 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 328 | | break; |
| | 329 | | case DCLAction_Trigger.ToggleEmoteShortcut4: |
| 0 | 330 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[4]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 331 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 332 | | break; |
| | 333 | | case DCLAction_Trigger.ToggleEmoteShortcut5: |
| 0 | 334 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[5]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 335 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 336 | | break; |
| | 337 | | case DCLAction_Trigger.ToggleEmoteShortcut6: |
| 0 | 338 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[6]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 339 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 340 | | break; |
| | 341 | | case DCLAction_Trigger.ToggleEmoteShortcut7: |
| 0 | 342 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[7]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 343 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 344 | | break; |
| | 345 | | case DCLAction_Trigger.ToggleEmoteShortcut8: |
| 0 | 346 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[8]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 347 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 348 | | break; |
| | 349 | | case DCLAction_Trigger.ToggleEmoteShortcut9: |
| 0 | 350 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[9]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 351 | | emoteJustTriggeredFromShortcut.Set(true); |
| 0 | 352 | | break; |
| | 353 | | case DCLAction_Trigger.ToggleShortcut0: |
| 0 | 354 | | if (emotesVisible.Get()) |
| 0 | 355 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[0]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 356 | | break; |
| | 357 | | case DCLAction_Trigger.ToggleShortcut1: |
| 0 | 358 | | if (emotesVisible.Get()) |
| 0 | 359 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[1]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 360 | | break; |
| | 361 | | case DCLAction_Trigger.ToggleShortcut2: |
| 0 | 362 | | if (emotesVisible.Get()) |
| 0 | 363 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[2]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 364 | | break; |
| | 365 | | case DCLAction_Trigger.ToggleShortcut3: |
| 0 | 366 | | if (emotesVisible.Get()) |
| 0 | 367 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[3]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 368 | | break; |
| | 369 | | case DCLAction_Trigger.ToggleShortcut4: |
| 0 | 370 | | if (emotesVisible.Get()) |
| 0 | 371 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[4]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 372 | | break; |
| | 373 | | case DCLAction_Trigger.ToggleShortcut5: |
| 0 | 374 | | if (emotesVisible.Get()) |
| 0 | 375 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[5]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 376 | | break; |
| | 377 | | case DCLAction_Trigger.ToggleShortcut6: |
| 0 | 378 | | if (emotesVisible.Get()) |
| 0 | 379 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[6]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 380 | | break; |
| | 381 | | case DCLAction_Trigger.ToggleShortcut7: |
| 0 | 382 | | if (emotesVisible.Get()) |
| 0 | 383 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[7]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 384 | | break; |
| | 385 | | case DCLAction_Trigger.ToggleShortcut8: |
| 0 | 386 | | if (emotesVisible.Get()) |
| 0 | 387 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[8]?.id, UserProfile.EmoteSource.Shortcut); |
| 0 | 388 | | break; |
| | 389 | | case DCLAction_Trigger.ToggleShortcut9: |
| 0 | 390 | | if (emotesVisible.Get()) |
| 0 | 391 | | PlayEmote(emotesCustomizationDataStore.equippedEmotes[9]?.id, UserProfile.EmoteSource.Shortcut); |
| | 392 | | break; |
| | 393 | | } |
| 0 | 394 | | } |
| | 395 | |
|
| 0 | 396 | | private void OnViewClosed() { emotesVisible.Set(false); } |
| 2 | 397 | | private void OnAvatarEmoteSet(string id, long timestamp, UserProfile.EmoteSource source) { emotesVisible.Set(fal |
| 6 | 398 | | private void OnCloseWindowPressed(DCLAction_Trigger action) { emotesVisible.Set(false); } |
| | 399 | |
|
| | 400 | | private void OnOpenEmotesCustomizationInputActionTriggered(DCLAction_Hold action) |
| | 401 | | { |
| 0 | 402 | | if (!emotesVisible.Get()) |
| 0 | 403 | | return; |
| | 404 | |
|
| 0 | 405 | | OpenEmotesCustomizationSection(); |
| 0 | 406 | | } |
| | 407 | |
|
| | 408 | | private void OpenEmotesCustomizationSection() |
| | 409 | | { |
| 0 | 410 | | emotesVisible.Set(false); |
| 0 | 411 | | isAvatarEditorVisible.Set(true); |
| 0 | 412 | | emotesCustomizationDataStore.isEmotesCustomizationSelected.Set(true); |
| 0 | 413 | | } |
| | 414 | | } |
| | 415 | | } |