using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Security; using BITFALL.Cosmetic; using BITKit; using BITKit.Entities; using BITKit.Steamwork; using UnityEngine; using YooAsset; using Object = UnityEngine.Object; namespace BITFALL.Entities.Cosmetic { [CustomType(typeof(ICosmeticService))] public class EntityCosmeticService : EntityBehavior,ICosmeticService { [SerializeReference, SubclassSelector] private ISteamService steamService; public ICosmetic[] Cosmetics { get; private set; } public event Action OnCosmeticsChanged; public override async void OnStart() { base.OnStart();var items =await steamService.GetInventoryItemDefsAsync(destroyCancellationToken); List cosmetics=new List(); foreach (var x in items.Select(x=>YooAssets.LoadAssetAsync(x.AddressablePath) )) { x.WaitForAsyncComplete(); cosmetics.Add(x.AssetObject as ICosmetic); } Cosmetics = cosmetics.ToArray(); OnCosmeticsChanged?.Invoke(); } } }