HDY 4 месяцев назад
Родитель
Сommit
08e3d0c1bf

+ 7 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs

@@ -71,6 +71,13 @@ namespace GFGGame
         /// <param name="showBg">是否显示背景</param>
         public void ResetSceneObj(int scale = 100, bool needSetMask = false, bool showSceneType = true, GameObject roleObj = null, bool showBg = true)
         {
+            // 先销毁旧的场景对象
+            if (sceneObject != null)
+            {
+                GameObject.Destroy(sceneObject);
+                sceneObject = null;
+            }
+
             //这里每次都要实例化新的,复用会有bug
             sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath(this.prefabName));
             sceneObject.transform.localScale = new Vector3(scale, scale, scale);

+ 8 - 8
GameClient/Assets/Game/HotUpdate/Views/FieldGuide/SuitShowView.cs

@@ -15,6 +15,7 @@ namespace GFGGame
         private DressUpObjUI _dressUpObjUI;
         private bool _actionIsPic;
         private List<int> _suitIds;
+        private bool touchClick = true;
 
         public override void Dispose()
         {
@@ -25,12 +26,6 @@ namespace GFGGame
                 _dressUpObjUI = null;
             }
 
-            if (_dressUpObjUI != null)
-            {
-                _dressUpObjUI.Dispose();
-                _dressUpObjUI = null;
-            }
-
             if (_ui != null)
             {
                 _ui.Dispose();
@@ -50,7 +45,7 @@ namespace GFGGame
             //isReturnView = true;
             this.clickBlankToClose = false;
 
-            _dressUpObjUI = new DressUpObjUI("SceneDressUp");
+            //_dressUpObjUI = new DressUpObjUI("SceneDressUp");
 
             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
@@ -127,6 +122,7 @@ namespace GFGGame
 
         private void OnTimerUpDate(object param = null)
         {
+            touchClick = true;
             _dressUpObjUI.UpdateWrapper(_ui.m_holder);
         }
 
@@ -145,7 +141,7 @@ namespace GFGGame
 
             _dressUpObjUI.ResetSceneObj(100, false, true, null, false);
             _dressUpObjUI.dressUpObj.PutOnSuitCfg(_suitId, isPic, new int[] { ConstDressUpItemType.BEI_JING }, true, false);
-            Timers.inst.Add(0.1f, 1, OnTimerUpDate);
+            Timers.inst.Add(0.2f, 1, OnTimerUpDate);
             UpdateSuitBoxStatus();
 
             // 使用异步方式重置场景对象
@@ -188,6 +184,8 @@ namespace GFGGame
 
         private void OnClickBtnLeft()
         {
+            if (!touchClick) return;
+            touchClick = false;
             int index = _suitIds.IndexOf(_suitId);
             int targetIndex = index - 1;
             if (targetIndex >= 0)
@@ -202,6 +200,8 @@ namespace GFGGame
 
         private void OnClickBtnRight()
         {
+            if (!touchClick) return;
+            touchClick = false;
             int index = _suitIds.IndexOf(_suitId);
             int targetIndex = index + 1;
             if (targetIndex < _suitIds.Count)