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/OtherPlayerDetail/OtherNpcHeroCell.cs |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
index a2f86dc..342e71c 100644
--- a/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
+++ b/Main/System/OtherPlayerDetail/OtherNpcHeroCell.cs
@@ -128,6 +128,7 @@
     public async UniTask 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);
 
         heroModel.Create(skinID, 1.2f);
@@ -197,19 +198,23 @@
         }
         if (cellContainer == null)
         {
-            cellContainer = await UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
+            var inst = await UIUtility.CreateWidget("OtherNpcHeroCell", "Container_HeroShow");
 
             if (this == null)
             {
-                if (null != cellContainer)
-                {
-                    DestroyImmediate(cellContainer);
-                }
+                if (null != inst) 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