|
@@ -1,5 +1,6 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Threading.Tasks;
|
|
|
using UnityEngine;
|
|
|
using YooAsset;
|
|
|
|
|
@@ -48,10 +49,10 @@ namespace GFGGame
|
|
|
AddItemGameObjectToList(bodyParent, false);
|
|
|
}
|
|
|
|
|
|
- public void AddSceneItem(GameObject parentGameObj, ItemCfg itemCfg, int layer, bool setLayer, bool isOnlyEff = false)
|
|
|
+ public async Task AddSceneItem(GameObject parentGameObj, ItemCfg itemCfg, int layer, bool setLayer, bool isOnlyEff = false)
|
|
|
{
|
|
|
|
|
|
- AddItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
|
|
|
+ await AddItemToScene(sceneObject, parentGameObj, itemCfg.id, layer);
|
|
|
|
|
|
string layerName = string.Format("resLayer{0}", layer);
|
|
|
string value = typeof(ItemCfg).GetField(layerName).GetValue(itemCfg).ToString();
|
|
@@ -60,7 +61,7 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
//拍照场景添加单个道具
|
|
|
- public async void AddItemToScene(GameObject sceneObj, GameObject parentGameObj, int itemId, int resLayer)
|
|
|
+ public async Task AddItemToScene(GameObject sceneObj, GameObject parentGameObj, int itemId, int resLayer)
|
|
|
{
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
|
|
|
parentGameObj.transform.SetParent(sceneObj.transform.Find("Scene"), false);
|
|
@@ -73,9 +74,9 @@ namespace GFGGame
|
|
|
|
|
|
string resPath = ResPathUtil.GetDressUpAnimationPath(res);
|
|
|
var handler = DressUpUtil.AddItemAsync(itemId, sceneObj, false, true, parentGameObj, resLayer);
|
|
|
- if(handler != null)
|
|
|
+ if (handler != null)
|
|
|
{
|
|
|
- foreach(var t in handler)
|
|
|
+ foreach (var t in handler)
|
|
|
{
|
|
|
await t.Task;
|
|
|
}
|
|
@@ -91,18 +92,20 @@ namespace GFGGame
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- GameObject gameObject = parentGameObj.transform.GetChild(0).gameObject;
|
|
|
- SetBoxCollider2DToGameObject(gameObject);
|
|
|
+ if (parentGameObj.transform.childCount > 0)
|
|
|
+ {
|
|
|
+ GameObject gameObject = parentGameObj.transform.GetChild(0).gameObject;
|
|
|
+ SetBoxCollider2DToGameObject(gameObject);
|
|
|
+ }
|
|
|
}
|
|
|
- PhotographUtil.Instance.SetGameObjectCenter(parentGameObj);
|
|
|
+
|
|
|
+ await PhotographUtil.Instance.SetGameObjectCenter(parentGameObj);
|
|
|
}
|
|
|
|
|
|
//拍照角色
|
|
|
private void UpdatePhotographBody(GameObject sceneObj, GameObject parentObj)
|
|
|
{
|
|
|
-
|
|
|
- PhotographDataManager.Instance.dressUpObj.setSceneObj(sceneObj, false, false, parentObj, false,
|
|
|
- () => { });
|
|
|
+ PhotographDataManager.Instance.dressUpObj.setSceneObj(sceneObj, false, false, parentObj, false);
|
|
|
PhotographDataManager.Instance.dressUpObj.PutOnDressUpData(MyDressUpHelper.dressUpObj.DressUpDataClone());
|
|
|
SetRoleBoxCollider(parentObj);
|
|
|
}
|
|
@@ -117,6 +120,7 @@ namespace GFGGame
|
|
|
SetBoxCollider2DToGameObject(transform.gameObject);
|
|
|
}
|
|
|
}
|
|
|
+ //await Task.Delay(16);
|
|
|
PhotographUtil.Instance.SetGameObjectCenter(parentObj);
|
|
|
}
|
|
|
|