|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
{
|
|
|
|
public class AutoResLoaderComponentAwakeSystem: AwakeSystem<AutoResLoaderComponent>
|
|
|
|
{
|
|
|
|
public override void Awake(AutoResLoaderComponent self)
|
|
|
|
{
|
|
|
|
self.Awake();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class AutoResLoaderComponentDestroySystem: DestroySystem<AutoResLoaderComponent>
|
|
|
|
{
|
|
|
|
public override void Destroy(AutoResLoaderComponent self)
|
|
|
|
{
|
|
|
|
self.Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class AutoResLoaderComponentSystem
|
|
|
|
{
|
|
|
|
public static void Awake(this AutoResLoaderComponent self)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static async ETTask<GameObject> InstantiateAsync(this AutoResLoaderComponent self, string location, Transform parent_transform = null,
|
|
|
|
bool stay_world_space = false)
|
|
|
|
{
|
|
|
|
var go = await YooAssetComponent.Instance.InstantiateAsyncAuto(self.GetHashCode(), location, parent_transform, stay_world_space);
|
|
|
|
return go;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static GameObject InstantiateSync(this AutoResLoaderComponent self, string location, Transform parent_transform = null,
|
|
|
|
bool stay_world_space = false)
|
|
|
|
{
|
|
|
|
var go = YooAssetComponent.Instance.InstantiateSyncAuto(self.GetHashCode(), location, parent_transform, stay_world_space);
|
|
|
|
return go;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static async ETTask<T> LoadAssetAsync<T>(this AutoResLoaderComponent self, string location) where T : UnityEngine.Object
|
|
|
|
{
|
|
|
|
var obj = await YooAssetComponent.Instance.LoadAssetAsyncAuto<T>(self.GetHashCode(), location);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static T LoadAssetSync<T>(this AutoResLoaderComponent self, string location) where T : UnityEngine.Object
|
|
|
|
{
|
|
|
|
var obj = YooAssetComponent.Instance.LoadAssetSyncAuto<T>(self.GetHashCode(), location);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Destroy(this AutoResLoaderComponent self)
|
|
|
|
{
|
|
|
|
YooAssetComponent.Instance.ReleaseAuto(self.GetHashCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|