using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using YooAsset; using UnityObject = UnityEngine.Object; namespace ET { [ComponentOf(typeof(Scene))] public class YooAssetComponent: Entity, IAwake { public static YooAssetComponent Instance { get; set; } public Dictionary> AutoLoaderGameObjects = new Dictionary>(); public Dictionary> AutoLoaderUnityObjects = new Dictionary>(); } // ConfigLoader中要调用,暂时放在这里 public static partial class YooAssetComponentSystem { public static async ETTask InstantiateAsync(this YooAssetComponent self, string location, Transform parent_transform = null, bool stay_world_space = false) { return await YooAssetWrapper.InstantiateAsync(location, parent_transform, stay_world_space); } public static GameObject InstantiateSync(this YooAssetComponent self, string location, Transform parent_transform = null, bool stay_world_space = false) { return YooAssetWrapper.InstantiateSync(location, parent_transform, stay_world_space); } public static void ReleaseInstance(this YooAssetComponent self, GameObject go) { YooAssetWrapper.ReleaseInstance(go); } public static async ETTask LoadAssetAsync(this YooAssetComponent self, string location) where T : UnityEngine.Object { return await YooAssetWrapper.LoadAssetAsync(location); } public static T LoadAssetSync(this YooAssetComponent self, string location) where T : UnityEngine.Object { return YooAssetWrapper.LoadAssetSync(location); } public static async ETTask LoadSceneAsync(this YooAssetComponent self, string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true) { await YooAssetWrapper.LoadSceneAsync(location, sceneMode, activateOnLoad); } public static void Release(this YooAssetComponent self, UnityEngine.Object obj) { YooAssetWrapper.Release(obj); } public static Dictionary GetAssetsByTagSync(this YooAssetComponent self, string tag) { return YooAssetWrapper.GetAssetsByTagSync(tag); } public static void ReleaseByTag(this YooAssetComponent self, string tag) { YooAssetWrapper.ReleaseByTag(tag); } } }