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