yyl
2026-03-26 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7
Main/System/HeroUI/HeroHeadBaseCell.cs
@@ -134,13 +134,14 @@
    void Awake()
    {
        LoadPrefab();
        LoadPrefab().Forget();
    }
    // 武将小头像,(职业和名称不再此管理,各个界面排版不同)
    public void Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
    public async UniTask Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
    {
        LoadPrefab();   //存在被卸载的可能,重新加载
        await LoadPrefab();   //存在被卸载的可能,重新加载
        if (this == null) return;
        if (onclick != null)
        {
            clickBtn.AddListener(onclick);
@@ -192,7 +193,8 @@
    // 武将小头像 Async版本
    public async UniTask InitAsync(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null)
    {
        LoadPrefab();   //存在被卸载的可能,重新加载
        await LoadPrefab();   //存在被卸载的可能,重新加载
        if (this == null) return;
        if (onclick != null)
        {
            clickBtn.AddListener(onclick);
@@ -265,19 +267,23 @@
        }
        if (cellContainer == null)
        {
            cellContainer = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
            var inst = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell");
            if (this == null)
            {
                if (cellContainer != null)
                {
                    DestroyImmediate(cellContainer);
                    return;
                }
                if (inst != null) DestroyImmediate(inst);
                return;
            }
            if (cellContainer != null)
            {
                DestroyImmediate(inst);
                return;
            }
            cellContainer = inst;
            if (cellContainer != null)
            {
                cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
                cellContainer.transform.SetAsFirstSibling();
            }