浏览代码

修改剧情中,主角对象dressUpObj创建和销毁位置

leiyasi 1 年之前
父节点
当前提交
472fec247d
共有 1 个文件被更改,包括 12 次插入9 次删除
  1. 12 9
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

+ 12 - 9
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -63,9 +63,6 @@ namespace GFGGame
                 _animObject = null;
             }
 
-            _dressUpObj?.Dispose();
-            _dressUpObj = null;
-
             _wordTextField = null;
             _arrow = null;
             _isShowLetters = false;
@@ -108,11 +105,6 @@ namespace GFGGame
 
             _ui.m_btnSpeedUp.onClick.Add(OnClickBtnSpeedUp);
             _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
-
-            if (_dressUpObj == null)
-            {
-                _dressUpObj = new DressUpObj();
-            }
         }
 
         protected override void OnShown()
@@ -128,7 +120,11 @@ namespace GFGGame
             if (_sceneObject == null)
             {
                 _sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("SceneStoryDialog"));
+            }
 
+            if (_dressUpObj == null)
+            {
+                _dressUpObj = new DressUpObj();
             }
 
             CreateHeadImg();
@@ -1026,7 +1022,10 @@ namespace GFGGame
 
         private void DestroyHeadImg()
         {
-            _dressUpSceneObj.transform.Find("Camera").GetComponent<Camera>().targetTexture = null;
+            Camera camera = _dressUpSceneObj.transform.Find("Camera").GetComponent<Camera>();
+            camera.targetTexture = null;
+            Transform parent = _dressUpSceneObj.transform.Find("Role");
+            ChangeLayer(parent, 0);
 
             // 回收RawImage
             if (_selfHeadImgObj != null)
@@ -1041,6 +1040,10 @@ namespace GFGGame
                 PrefabManager.Instance.Restore(_dressUpSceneObj);
                 _dressUpSceneObj = null;
             }
+
+            // 回收人物
+            _dressUpObj?.Dispose();
+            _dressUpObj = null;
         }
 
         /// <summary>