From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1

---
 Main/System/HeroUI/HeroShowBaseCell.cs |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Main/System/HeroUI/HeroShowBaseCell.cs b/Main/System/HeroUI/HeroShowBaseCell.cs
index 84b1c13..a11e383 100644
--- a/Main/System/HeroUI/HeroShowBaseCell.cs
+++ b/Main/System/HeroUI/HeroShowBaseCell.cs
@@ -141,6 +141,7 @@
     public async void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false)
     {
         await LoadPrefab();   //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+        if (this == null) return;
         var heroConfig = HeroConfig.Get(heroID);
         qualityBG.SetSprite("herodz" + heroConfig.Quality);
         // int skinID = 0;
@@ -221,19 +222,23 @@
         }
         if (cellContainer == null)
         {
-            cellContainer = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
+            var inst = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow");
 
             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();
             }

--
Gitblit v1.8.0