using asap.core; using cfg; using UnityEngine; using UnityEngine.UI; public class ClubHead : MonoBehaviour { public Image bg_head; public Image icon_head; #if UNITY_EDITOR private void Reset() { Awake(); } #endif private void Awake() { bg_head = transform.Find("bg_head").GetComponent(); icon_head = transform.Find("icon_head").GetComponent(); } public void SetData(string avatars) { if (string.IsNullOrEmpty(avatars) || !avatars.Contains('#')) { int id = GContext.container.Resolve().TbGlobalConfig.ClubInitAvatar; int frameId = GContext.container.Resolve().TbGlobalConfig.ClubInitFrame; avatars = $"{GContext.container.Resolve().TbClubAvatar[id].Avatar}#{GContext.container.Resolve().TbClubFrame[frameId].Frame}"; } string[] icon_frame = avatars.Split('#'); string avatar = icon_frame[0]; string frame = icon_frame[1]; GContext.container.Resolve().SetImageSprite(icon_head, avatar); GContext.container.Resolve().SetImageSprite(bg_head, frame); //GetSpriteEvent getSpriteEvent = new GetSpriteEvent(avatar); //icon_head.sprite = getSpriteEvent.sprite; } public void SetIcon(string avatar) { GContext.container.Resolve().SetImageSprite(icon_head, avatar); } public void SetFrame(string frame) { GContext.container.Resolve().SetImageSprite(bg_head, frame); } }