| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.Emotes |
| | 7 | | { |
| | 8 | | [CreateAssetMenu(menuName = "DCL/Emotes/EmbeddedEmotes", fileName = "EmbeddedEmotes")] |
| | 9 | | public class EmbeddedEmotesSO : ScriptableObject |
| | 10 | | { |
| | 11 | | [SerializeField] private EmbeddedEmote[] emotes; |
| | 12 | | [SerializeField] private ExtendedEmote[] extendedEmotes; |
| | 13 | |
|
| | 14 | | private string[] ids; |
| | 15 | | private List<EmbeddedEmote> items; |
| | 16 | |
|
| | 17 | | public string[] GetAllIds() |
| | 18 | | { |
| 0 | 19 | | return ids ??= emotes.Select(e => e.id).Union(extendedEmotes.Select(e => e.id)).ToArray(); |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public IEnumerable<EmbeddedEmote> GetAllEmotes() |
| | 23 | | { |
| 376 | 24 | | if (items is { Count: > 0 }) return items; |
| | 25 | |
|
| 334 | 26 | | items = new List<EmbeddedEmote>(); |
| 334 | 27 | | items.AddRange(emotes); |
| 334 | 28 | | items.AddRange(extendedEmotes); |
| | 29 | |
|
| 334 | 30 | | return items; |
| | 31 | | } |
| | 32 | |
|
| | 33 | | public EmbeddedEmote[] GetEmbeddedEmotes() => |
| 321 | 34 | | emotes; |
| | 35 | |
|
| | 36 | | public ExtendedEmote[] GetExtendedEmbeddedEmotes() => |
| 321 | 37 | | extendedEmotes; |
| | 38 | |
|
| | 39 | | public void Clear() |
| | 40 | | { |
| 333 | 41 | | emotes = Array.Empty<EmbeddedEmote>(); |
| 333 | 42 | | extendedEmotes = Array.Empty<ExtendedEmote>(); |
| 333 | 43 | | } |
| | 44 | |
|
| | 45 | | public void OverrideEmotes(EmbeddedEmote[] emotes) |
| | 46 | | { |
| 1 | 47 | | this.emotes = emotes; |
| 1 | 48 | | } |
| | 49 | | } |
| | 50 | |
|
| | 51 | | [Serializable] |
| | 52 | | public class EmbeddedEmote : WearableItem |
| | 53 | | { |
| | 54 | | public AnimationClip femaleAnimation; |
| | 55 | | public AnimationClip maleAnimation; |
| | 56 | | public bool dontShowInBackpack; |
| | 57 | |
|
| | 58 | | public override bool ShowInBackpack() => |
| | 59 | | !dontShowInBackpack; |
| | 60 | | } |
| | 61 | |
|
| | 62 | | [Serializable] |
| | 63 | | public class ExtendedEmote : EmbeddedEmote |
| | 64 | | { |
| | 65 | | public GameObject propPrefab; |
| | 66 | | public AudioClip clip; |
| | 67 | | } |
| | 68 | | } |