2021-04-08 20:09:59 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using ET;
|
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using ET;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class ResourceViewHelper
|
|
|
|
|
{
|
|
|
|
|
public static async ETTask<ValueTuple<Transform, bool>> LoadPrefabBoolAsync(int prefabId)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Sys_Prefab sysPrefab =DataTableHelper.Get<Sys_Prefab>(prefabId);
|
|
|
|
|
(Transform trans, bool isNew) = await GameObjectPool.Instanse.GameObjectSpawn((int)sysPrefab.Id, sysPrefab.PoolId, sysPrefab.AssetPath, sysPrefab.CullDespawned, sysPrefab.CullAbove, sysPrefab.CullDelay, sysPrefab.CullMaxPerPass);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return (trans, isNew);
|
|
|
|
|
}
|
|
|
|
|
public static async ETTask<Transform> LoadPrefabAsync(int prefabId)
|
|
|
|
|
{
|
|
|
|
|
return (await LoadPrefabBoolAsync(prefabId)).Item1;
|
|
|
|
|
}
|
|
|
|
|
public static void DestoryPrefabAsync(GameObject go)
|
|
|
|
|
{
|
|
|
|
|
if (!go) return;
|
|
|
|
|
DestoryPrefabAsync(go.transform);
|
|
|
|
|
}
|
|
|
|
|
public static void DestoryPrefabAsync(Transform go)
|
|
|
|
|
{
|
|
|
|
|
if (!go) return;
|
|
|
|
|
GameObjectPool.Instanse.GameObjectDespawn(go);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|