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