瀏覽代碼

换装显示回调

guodong 1 年之前
父節點
當前提交
e79b642ba0

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Assets/DressUpResPreloadManager.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GFGGame
+{
+    public class DressUpResPreloadManager
+    {
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Assets/DressUpResPreloadManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9d58ae968eaeef24abd1f96f321c4afe
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 4
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjUI.cs

@@ -1,4 +1,5 @@
 using FairyGUI;
+using System;
 using UnityEngine;
 
 namespace GFGGame
@@ -11,10 +12,12 @@ namespace GFGGame
         public DressUpObj dressUpObj;
         string prefabName;
 
+        private Action onShowAction;
 
-        public DressUpObjUI(string prefabName = "SceneDressUp")
+        public DressUpObjUI(string prefabName = "SceneDressUp", Action onShowAction = null)
         {
             this.prefabName = prefabName;
+            this.onShowAction = onShowAction;
             dressUpObj = new DressUpObj();
             wrapper = new GoWrapper();
         }
@@ -24,7 +27,7 @@ namespace GFGGame
             //这里每次都要实例化新的,复用会有bug
             sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath(this.prefabName));
             sceneObject.transform.localScale = new Vector3(scale, scale, scale);
-            dressUpObj.setSceneObj(sceneObject, needSetMask, showSceneType, roleObj, showBg, OnUpdate);
+            dressUpObj.setSceneObj(sceneObject, needSetMask, showSceneType, roleObj, showBg, OnShow);
         }
 
         public void UpdateWrapper(GGraph holder)
@@ -35,6 +38,7 @@ namespace GFGGame
         
         public void Dispose()
         {
+            onShowAction = null;
             if (sceneObject != null)
             {
                 PrefabManager.Instance.Restore(sceneObject);
@@ -58,9 +62,10 @@ namespace GFGGame
             }
         }
 
-        private void OnUpdate()
+        private void OnShow()
         {
-            if(sceneObject == null)
+            onShowAction?.Invoke();
+            if (sceneObject == null)
             {
                 return;
             }