using System; using FairyGUI; using UnityEngine; using BingoBrain.Asset; using BingoBrain; using UnityEngine.Events; using System.Collections.Generic; public class EyesHarmony { private static Dictionary nTexturesDic = new(); public static void GetPicture(string path, string name, UnityAction action) { if (!nTexturesDic.TryGetValue(path + name, out NTexture spr)) { try { BetKit.Instance.LoadSprite(path, name, sprite => { if (sprite != null) { spr = new NTexture(sprite); action?.Invoke(spr); nTexturesDic.TryAdd(path + name, spr); } }); } catch (Exception e) { Debug.LogError(e); } } else { action?.Invoke(spr); } } public static void SetAvatarToLoader(int avatarId, GLoader _GLoader, bool IsNeedDefAvatar = true) { Sprite sprite = null; BetKit.Instance.LoadSprite("Atlas.Avatar", avatarId.ToString(), (spr) => { sprite = spr; var spr1 = new NTexture(sprite); _GLoader.texture = spr1; // nTexturesDic.Add(avatarId.ToString(), spr1); }); } public static void GetItem(int itemId, UnityAction action) { var itemIconPath = "Atlas.Item"; string name = itemId.ToString(); if (GameHelper.IsGiftSwitch()) { if (name == "102") name = "106"; } // else // { // // if (itemId is 102 or 106) // // { // // name += "_normal"; // // } // } GetPicture(itemIconPath, name, action); } }