Browse Source

修改render texture为动态加载

leiyasi 1 year ago
parent
commit
7e1587fe53

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Travel/UI_TravelUI.cs

@@ -13,6 +13,7 @@ namespace UI.Travel
         public GGraph m_bg_eff;
         public GComponent m_comValueBar;
         public GButton m_btnback;
+        public GGraph m_db_loadingEff_holder;
         public GGraph m_travellingDB_eff;
         public GTextField m_txtTime;
         public GGraph m_txt_eff;
@@ -76,6 +77,7 @@ namespace UI.Travel
             m_bg_eff = (GGraph)comp.GetChild("bg_eff");
             m_comValueBar = (GComponent)comp.GetChild("comValueBar");
             m_btnback = (GButton)comp.GetChild("btnback");
+            m_db_loadingEff_holder = (GGraph)comp.GetChild("db_loadingEff_holder");
             m_travellingDB_eff = (GGraph)comp.GetChild("travellingDB_eff");
             m_txtTime = (GTextField)comp.GetChild("txtTime");
             m_txt_eff = (GGraph)comp.GetChild("txt_eff");
@@ -95,6 +97,7 @@ namespace UI.Travel
             m_bg_eff = null;
             m_comValueBar = null;
             m_btnback = null;
+            m_db_loadingEff_holder = null;
             m_travellingDB_eff = null;
             m_txtTime = null;
             m_txt_eff = null;

+ 19 - 6
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -1004,12 +1004,22 @@ namespace GFGGame
             );
         }
 
+        private RenderTexture renderTexure;
         private void CreateHeadImg()
         {
+            // 创建render texture
+            renderTexure = new RenderTexture(550, 760, 24);
+
             // 换装父节点 + 相机
             _dressUpSceneObj = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("StoryDialogSelfImg/StoryDialogDressUpObj"));
+            Camera camera = _dressUpSceneObj.transform.Find("Camera").GetComponent<Camera>();
+            camera.targetTexture = renderTexure;
+
             // 创建RawImg
             _selfHeadImgObj = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("StoryDialogSelfImg/Canvas"));
+            RawImage rawImage = _selfHeadImgObj.transform.Find("mask/RawImage").GetComponent<RawImage>();
+            rawImage.texture = renderTexure;
+
             // 将RawImg放在FGUI上
             GoWrapper goWrapper = new GoWrapper(_selfHeadImgObj);
             _ui.m_dialogHead.m_compDressUp.m_holder.SetNativeObject(goWrapper);
@@ -1022,10 +1032,17 @@ namespace GFGGame
 
         private void DestroyHeadImg()
         {
+            // 清空render Texture
             Camera camera = _dressUpSceneObj.transform.Find("Camera").GetComponent<Camera>();
             camera.targetTexture = null;
-            Transform parent = _dressUpSceneObj.transform.Find("Role");
-            ChangeLayer(parent, 0);
+            RawImage rawImage = _selfHeadImgObj.transform.Find("mask/RawImage").GetComponent<RawImage>();
+            rawImage.texture = null;
+            renderTexure.Release();
+            renderTexure = null;
+
+            // 回收人物
+            _dressUpObj?.Dispose();
+            _dressUpObj = null;
 
             // 回收RawImage
             if (_selfHeadImgObj != null)
@@ -1040,10 +1057,6 @@ namespace GFGGame
                 PrefabManager.Instance.Restore(_dressUpSceneObj);
                 _dressUpSceneObj = null;
             }
-
-            // 回收人物
-            _dressUpObj?.Dispose();
-            _dressUpObj = null;
         }
 
         /// <summary>

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Views/Travel/TravelView.cs

@@ -58,6 +58,9 @@ namespace GFGGame
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("cj_bg_ychm");
 
             _effectUIDic.Add("XQFS_Kuang_All", EffectUIPool.CreateEffectUI(_ui.m_bg_eff, "ui_HaiZhiShi", "XQFS_Kuang_All"));
+            _effectUIDic.Add("XQFS_DouBao01", EffectUIPool.CreateEffectUI(_ui.m_btnGo.m_btnGo_db_eff, "ui_HaiZhiShi", "XQFS_DouBao01"));
+            _effectUIDic.Add("XQFS_DouBao_Loading", EffectUIPool.CreateEffectUI(_ui.m_db_loadingEff_holder, "ui_HaiZhiShi", "XQFS_DouBao_Loading"));
+
             // 省略号特效
             _effectUIDic.Add("XQFS_Text_Loading", EffectUIPool.CreateEffectUI(_ui.m_txt_eff, "ui_HaiZhiShi", "XQFS_Text_Loading"));
             _effectUIDic.Add("XQFS_Button_YouLi", EffectUIPool.CreateEffectUI(_ui.m_btnGo.m_btnGo_eff, "ui_HaiZhiShi", "XQFS_Button_YouLi"));

+ 1 - 1
GameClient/Assets/ResIn/Prefab/StoryDialogSelfImg/Canvas.prefab

@@ -65,7 +65,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_Texture: {fileID: 8400000, guid: d75358a96d5bdc349947ff8414ae83f6, type: 2}
+  m_Texture: {fileID: 0}
   m_UVRect:
     serializedVersion: 2
     x: 0

+ 0 - 38
GameClient/Assets/ResIn/Prefab/StoryDialogSelfImg/SelfRenderTexture.renderTexture

@@ -1,38 +0,0 @@
-%YAML 1.1
-%TAG !u! tag:unity3d.com,2011:
---- !u!84 &8400000
-RenderTexture:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_Name: SelfRenderTexture
-  m_ImageContentsHash:
-    serializedVersion: 2
-    Hash: 00000000000000000000000000000000
-  m_ForcedFallbackFormat: 4
-  m_DownscaleFallback: 0
-  m_IsAlphaChannelOptional: 0
-  serializedVersion: 3
-  m_Width: 550
-  m_Height: 760
-  m_AntiAliasing: 1
-  m_MipCount: -1
-  m_DepthFormat: 2
-  m_ColorFormat: 8
-  m_MipMap: 0
-  m_GenerateMips: 1
-  m_SRGB: 0
-  m_UseDynamicScale: 0
-  m_BindMS: 0
-  m_EnableCompatibleFormat: 1
-  m_TextureSettings:
-    serializedVersion: 2
-    m_FilterMode: 1
-    m_Aniso: 0
-    m_MipBias: 0
-    m_WrapU: 1
-    m_WrapV: 1
-    m_WrapW: 1
-  m_Dimension: 2
-  m_VolumeDepth: 1

+ 0 - 8
GameClient/Assets/ResIn/Prefab/StoryDialogSelfImg/SelfRenderTexture.renderTexture.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d75358a96d5bdc349947ff8414ae83f6
-NativeFormatImporter:
-  externalObjects: {}
-  mainObjectFileID: 8400000
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 1 - 1
GameClient/Assets/ResIn/Prefab/StoryDialogSelfImg/StoryDialogDressUpObj.prefab

@@ -115,7 +115,7 @@ Camera:
     serializedVersion: 2
     m_Bits: 64
   m_RenderingPath: -1
-  m_TargetTexture: {fileID: 8400000, guid: d75358a96d5bdc349947ff8414ae83f6, type: 2}
+  m_TargetTexture: {fileID: 0}
   m_TargetDisplay: 0
   m_TargetEye: 3
   m_HDR: 1

BIN
GameClient/Assets/ResIn/UI/Travel/Travel_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/Travel/Travel_atlas0.png


BIN
GameClient/Assets/ResIn/UI/Travel/Travel_fui.bytes