//------------------------------------------------------------ // Game Framework // Copyright © 2013-2021 loyalsoft. All rights reserved. // Homepage: http://www.game7000.com/ // Feedback: http://www.game7000.com/ //------------------------------------------------------------ using GameFramework; using GameFramework.Download; using GameFramework.FileSystem; using GameFramework.ObjectPool; using GameFramework.Resource; using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.SceneManagement; namespace UnityGameFramework.Runtime { /// /// 编辑器资源组件。 /// [DisallowMultipleComponent] public sealed class EditorResourceComponent : MonoBehaviour, IResourceManager { private const int DefaultPriority = 0; private static readonly int AssetsStringLength = "Assets".Length; [SerializeField] private bool m_EnableCachedAssets = true; [SerializeField] private int m_LoadAssetCountPerFrame = 1; [SerializeField] private float m_MinLoadAssetRandomDelaySeconds = 0f; [SerializeField] private float m_MaxLoadAssetRandomDelaySeconds = 0f; private string m_ReadOnlyPath = null; private string m_ReadWritePath = null; private Dictionary m_CachedAssets = null; private GameFrameworkLinkedList m_LoadAssetInfos = null; private GameFrameworkLinkedList m_LoadSceneInfos = null; private GameFrameworkLinkedList m_UnloadSceneInfos = null; /// /// 获取资源只读区路径。 /// public string ReadOnlyPath { get { return m_ReadOnlyPath; } } /// /// 获取资源读写区路径。 /// public string ReadWritePath { get { return m_ReadWritePath; } } /// /// 获取资源模式。 /// public ResourceMode ResourceMode { get { return ResourceMode.Unspecified; } } /// /// 获取当前变体。 /// public string CurrentVariant { get { return null; } } /// /// 获取单机模式版本资源列表序列化器。 /// public PackageVersionListSerializer PackageVersionListSerializer { get { throw new NotSupportedException("ReadWriteVersionListSerializer"); } } /// /// 获取可更新模式版本资源列表序列化器。 /// public UpdatableVersionListSerializer UpdatableVersionListSerializer { get { throw new NotSupportedException("ReadWriteVersionListSerializer"); } } /// /// 获取本地只读区版本资源列表序列化器。 /// public ReadOnlyVersionListSerializer ReadOnlyVersionListSerializer { get { throw new NotSupportedException("ReadWriteVersionListSerializer"); } } /// /// 获取本地读写区版本资源列表序列化器。 /// public ReadWriteVersionListSerializer ReadWriteVersionListSerializer { get { throw new NotSupportedException("ReadWriteVersionListSerializer"); } } /// /// 获取资源包版本资源列表序列化器。 /// public ResourcePackVersionListSerializer ResourcePackVersionListSerializer { get { throw new NotSupportedException("ResourcePackVersionListSerializer"); } } /// /// 获取当前资源适用的游戏版本号。 /// public string ApplicableGameVersion { get { throw new NotSupportedException("ApplicableGameVersion"); } } /// /// 获取当前内部资源版本号。 /// public int InternalResourceVersion { get { throw new NotSupportedException("InternalResourceVersion"); } } /// /// 获取已准备完毕资源数量。 /// public int AssetCount { get { throw new NotSupportedException("AssetCount"); } } /// /// 获取已准备完毕资源数量。 /// public int ResourceCount { get { throw new NotSupportedException("ResourceCount"); } } /// /// 获取资源组个数。 /// public int ResourceGroupCount { get { throw new NotSupportedException("ResourceGroupCount"); } } /// /// 获取或设置资源更新下载地址。 /// public string UpdatePrefixUri { get { throw new NotSupportedException("UpdatePrefixUri"); } set { throw new NotSupportedException("UpdatePrefixUri"); } } /// /// 获取或设置每更新多少字节的资源,重新生成一次版本资源列表。 /// public int GenerateReadWriteVersionListLength { get { throw new NotSupportedException("GenerateReadWriteVersionListLength"); } set { throw new NotSupportedException("GenerateReadWriteVersionListLength"); } } /// /// 获取正在应用的资源包路径。 /// public string ApplyingResourcePackPath { get { throw new NotSupportedException("ApplyingResourcePackPath"); } } /// /// 获取等待应用资源数量。 /// public int ApplyWaitingCount { get { throw new NotSupportedException("ApplyWaitingCount"); } } /// /// 获取或设置资源更新重试次数。 /// public int UpdateRetryCount { get { throw new NotSupportedException("UpdateRetryCount"); } set { throw new NotSupportedException("UpdateRetryCount"); } } /// /// 获取正在更新的资源组。 /// public IResourceGroup UpdatingResourceGroup { get { throw new NotSupportedException("UpdatingResourceGroup"); } } /// /// 获取等待更新资源个数。 /// public int UpdateWaitingCount { get { throw new NotSupportedException("UpdateWaitingCount"); } } /// /// 获取使用时下载的等待更新资源数量。 /// public int UpdateWaitingWhilePlayingCount { get { throw new NotSupportedException("UpdateWaitingWhilePlayingCount"); } } /// /// 获取候选更新资源数量。 /// public int UpdateCandidateCount { get { throw new NotSupportedException("UpdateCandidateCount"); } } /// /// 获取加载资源代理总个数。 /// public int LoadTotalAgentCount { get { throw new NotSupportedException("LoadTotalAgentCount"); } } /// /// 获取可用加载资源代理个数。 /// public int LoadFreeAgentCount { get { throw new NotSupportedException("LoadFreeAgentCount"); } } /// /// 获取工作中加载资源代理个数。 /// public int LoadWorkingAgentCount { get { throw new NotSupportedException("LoadWorkingAgentCount"); } } /// /// 获取等待加载资源任务个数。 /// public int LoadWaitingTaskCount { get { throw new NotSupportedException("LoadWaitingTaskCount"); } } /// /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// public float AssetAutoReleaseInterval { get { throw new NotSupportedException("AssetAutoReleaseInterval"); } set { throw new NotSupportedException("AssetAutoReleaseInterval"); } } /// /// 获取或设置资源对象池的容量。 /// public int AssetCapacity { get { throw new NotSupportedException("AssetCapacity"); } set { throw new NotSupportedException("AssetCapacity"); } } /// /// 获取或设置资源对象池对象过期秒数。 /// public float AssetExpireTime { get { throw new NotSupportedException("AssetExpireTime"); } set { throw new NotSupportedException("AssetExpireTime"); } } /// /// 获取或设置资源对象池的优先级。 /// public int AssetPriority { get { throw new NotSupportedException("AssetPriority"); } set { throw new NotSupportedException("AssetPriority"); } } /// /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// public float ResourceAutoReleaseInterval { get { throw new NotSupportedException("ResourceAutoReleaseInterval"); } set { throw new NotSupportedException("ResourceAutoReleaseInterval"); } } /// /// 获取或设置资源对象池的容量。 /// public int ResourceCapacity { get { throw new NotSupportedException("ResourceCapacity"); } set { throw new NotSupportedException("ResourceCapacity"); } } /// /// 获取或设置资源对象池对象过期秒数。 /// public float ResourceExpireTime { get { throw new NotSupportedException("ResourceExpireTime"); } set { throw new NotSupportedException("ResourceExpireTime"); } } /// /// 获取或设置资源对象池的优先级。 /// public int ResourcePriority { get { throw new NotSupportedException("ResourcePriority"); } set { throw new NotSupportedException("ResourcePriority"); } } /// /// 获取等待编辑器加载的资源数量。 /// public int LoadWaitingAssetCount { get { return m_LoadAssetInfos.Count; } } string IResourceManager.ReadOnlyPath => throw new NotImplementedException(); string IResourceManager.ReadWritePath => throw new NotImplementedException(); ResourceMode IResourceManager.ResourceMode => throw new NotImplementedException(); string IResourceManager.CurrentVariant => throw new NotImplementedException(); PackageVersionListSerializer IResourceManager.PackageVersionListSerializer => throw new NotImplementedException(); UpdatableVersionListSerializer IResourceManager.UpdatableVersionListSerializer => throw new NotImplementedException(); ReadOnlyVersionListSerializer IResourceManager.ReadOnlyVersionListSerializer => throw new NotImplementedException(); ReadWriteVersionListSerializer IResourceManager.ReadWriteVersionListSerializer => throw new NotImplementedException(); ResourcePackVersionListSerializer IResourceManager.ResourcePackVersionListSerializer => throw new NotImplementedException(); string IResourceManager.ApplicableGameVersion => throw new NotImplementedException(); int IResourceManager.InternalResourceVersion => throw new NotImplementedException(); int IResourceManager.AssetCount => throw new NotImplementedException(); int IResourceManager.ResourceCount => throw new NotImplementedException(); int IResourceManager.ResourceGroupCount => throw new NotImplementedException(); string IResourceManager.UpdatePrefixUri { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } int IResourceManager.GenerateReadWriteVersionListLength { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } string IResourceManager.ApplyingResourcePackPath => throw new NotImplementedException(); int IResourceManager.ApplyWaitingCount => throw new NotImplementedException(); int IResourceManager.UpdateRetryCount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } IResourceGroup IResourceManager.UpdatingResourceGroup => throw new NotImplementedException(); int IResourceManager.UpdateWaitingCount => throw new NotImplementedException(); int IResourceManager.UpdateWaitingWhilePlayingCount => throw new NotImplementedException(); int IResourceManager.UpdateCandidateCount => throw new NotImplementedException(); int IResourceManager.LoadTotalAgentCount => throw new NotImplementedException(); int IResourceManager.LoadFreeAgentCount => throw new NotImplementedException(); int IResourceManager.LoadWorkingAgentCount => throw new NotImplementedException(); int IResourceManager.LoadWaitingTaskCount => throw new NotImplementedException(); float IResourceManager.AssetAutoReleaseInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } int IResourceManager.AssetCapacity { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } float IResourceManager.AssetExpireTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } int IResourceManager.AssetPriority { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } float IResourceManager.ResourceAutoReleaseInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } int IResourceManager.ResourceCapacity { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } float IResourceManager.ResourceExpireTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } int IResourceManager.ResourcePriority { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } #pragma warning disable 0067, 0414 /// /// 资源应用成功事件。 /// public event EventHandler ResourceApplySuccess = null; /// /// 资源应用失败事件。 /// public event EventHandler ResourceApplyFailure = null; /// /// 资源更新开始事件。 /// public event EventHandler ResourceUpdateStart = null; /// /// 资源更新改变事件。 /// public event EventHandler ResourceUpdateChanged = null; /// /// 资源更新成功事件。 /// public event EventHandler ResourceUpdateSuccess = null; /// /// 资源更新失败事件。 /// public event EventHandler ResourceUpdateFailure = null; /// /// 资源更新全部完成事件。 /// public event EventHandler ResourceUpdateAllComplete = null; event EventHandler IResourceManager.ResourceApplySuccess { add { // throw new NotImplementedException(); } remove { // throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceApplyFailure { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceUpdateStart { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceUpdateChanged { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceUpdateSuccess { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceUpdateFailure { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } event EventHandler IResourceManager.ResourceUpdateAllComplete { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } #pragma warning restore 0067, 0414 private void Awake() { m_ReadOnlyPath = null; m_ReadWritePath = null; m_CachedAssets = new Dictionary(StringComparer.Ordinal); m_LoadAssetInfos = new GameFrameworkLinkedList(); m_LoadSceneInfos = new GameFrameworkLinkedList(); m_UnloadSceneInfos = new GameFrameworkLinkedList(); BaseComponent baseComponent = GetComponent(); if (baseComponent == null) { Log.Error("Can not find base component."); return; } if (baseComponent.EditorResourceMode) { baseComponent.EditorResourceHelper = this; enabled = true; } else { enabled = false; } } private void Update() { if (m_LoadAssetInfos.Count > 0) { int count = 0; LinkedListNode current = m_LoadAssetInfos.First; while (current != null && count < m_LoadAssetCountPerFrame) { LoadAssetInfo loadAssetInfo = current.Value; float elapseSeconds = (float)(DateTime.UtcNow - loadAssetInfo.StartTime).TotalSeconds; if (elapseSeconds >= loadAssetInfo.DelaySeconds) { UnityEngine.Object asset = GetCachedAsset(loadAssetInfo.AssetName); if (asset == null) { #if UNITY_EDITOR if (loadAssetInfo.AssetType != null) { asset = UnityEditor.AssetDatabase.LoadAssetAtPath(loadAssetInfo.AssetName, loadAssetInfo.AssetType); } else { asset = UnityEditor.AssetDatabase.LoadMainAssetAtPath(loadAssetInfo.AssetName); } if (m_EnableCachedAssets && asset != null) { m_CachedAssets.Add(loadAssetInfo.AssetName, asset); } #endif } if (asset != null) { if (loadAssetInfo.LoadAssetCallbacks.LoadAssetSuccessCallback != null) { loadAssetInfo.LoadAssetCallbacks.LoadAssetSuccessCallback(loadAssetInfo.AssetName, asset, elapseSeconds, loadAssetInfo.UserData); } } else { if (loadAssetInfo.LoadAssetCallbacks.LoadAssetFailureCallback != null) { loadAssetInfo.LoadAssetCallbacks.LoadAssetFailureCallback(loadAssetInfo.AssetName, LoadResourceStatus.AssetError, "Can not load this asset from asset database.", loadAssetInfo.UserData); } } LinkedListNode next = current.Next; m_LoadAssetInfos.Remove(loadAssetInfo); current = next; count++; } else { if (loadAssetInfo.LoadAssetCallbacks.LoadAssetUpdateCallback != null) { loadAssetInfo.LoadAssetCallbacks.LoadAssetUpdateCallback(loadAssetInfo.AssetName, elapseSeconds / loadAssetInfo.DelaySeconds, loadAssetInfo.UserData); } current = current.Next; } } } if (m_LoadSceneInfos.Count > 0) { LinkedListNode current = m_LoadSceneInfos.First; while (current != null) { LoadSceneInfo loadSceneInfo = current.Value; if (loadSceneInfo.AsyncOperation.isDone) { if (loadSceneInfo.AsyncOperation.allowSceneActivation) { if (loadSceneInfo.LoadSceneCallbacks.LoadSceneSuccessCallback != null) { loadSceneInfo.LoadSceneCallbacks.LoadSceneSuccessCallback(loadSceneInfo.SceneAssetName, (float)(DateTime.UtcNow - loadSceneInfo.StartTime).TotalSeconds, loadSceneInfo.UserData); } } else { if (loadSceneInfo.LoadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneInfo.LoadSceneCallbacks.LoadSceneFailureCallback(loadSceneInfo.SceneAssetName, LoadResourceStatus.AssetError, "Can not load this scene from asset database.", loadSceneInfo.UserData); } } LinkedListNode next = current.Next; m_LoadSceneInfos.Remove(loadSceneInfo); current = next; } else { if (loadSceneInfo.LoadSceneCallbacks.LoadSceneUpdateCallback != null) { loadSceneInfo.LoadSceneCallbacks.LoadSceneUpdateCallback(loadSceneInfo.SceneAssetName, loadSceneInfo.AsyncOperation.progress, loadSceneInfo.UserData); } current = current.Next; } } } if (m_UnloadSceneInfos.Count > 0) { LinkedListNode current = m_UnloadSceneInfos.First; while (current != null) { UnloadSceneInfo unloadSceneInfo = current.Value; if (unloadSceneInfo.AsyncOperation.isDone) { if (unloadSceneInfo.AsyncOperation.allowSceneActivation) { if (unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneSuccessCallback != null) { unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneSuccessCallback(unloadSceneInfo.SceneAssetName, unloadSceneInfo.UserData); } } else { if (unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneFailureCallback != null) { unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneFailureCallback(unloadSceneInfo.SceneAssetName, unloadSceneInfo.UserData); } } LinkedListNode next = current.Next; m_UnloadSceneInfos.Remove(unloadSceneInfo); current = next; } else { current = current.Next; } } } } /// /// 设置资源只读区路径。 /// /// 资源只读区路径。 public void SetReadOnlyPath(string readOnlyPath) { if (string.IsNullOrEmpty(readOnlyPath)) { Log.Error("Read-only path is invalid."); return; } m_ReadOnlyPath = readOnlyPath; } /// /// 设置资源读写区路径。 /// /// 资源读写区路径。 public void SetReadWritePath(string readWritePath) { if (string.IsNullOrEmpty(readWritePath)) { Log.Error("Read-write path is invalid."); return; } m_ReadWritePath = readWritePath; } /// /// 设置资源模式。 /// /// 资源模式。 public void SetResourceMode(ResourceMode resourceMode) { throw new NotSupportedException("SetResourceMode"); } /// /// 设置当前变体。 /// /// 当前变体。 public void SetCurrentVariant(string currentVariant) { throw new NotSupportedException("SetCurrentVariant"); } /// /// 设置对象池管理器。 /// /// 对象池管理器。 public void SetObjectPoolManager(IObjectPoolManager objectPoolManager) { throw new NotSupportedException("SetObjectPoolManager"); } /// /// 设置文件系统管理器。 /// /// 文件系统管理器。 public void SetFileSystemManager(IFileSystemManager fileSystemManager) { throw new NotSupportedException("SetFileSystemManager"); } /// /// 设置下载管理器。 /// /// 下载管理器。 public void SetDownloadManager(IDownloadManager downloadManager) { throw new NotSupportedException("SetDownloadManager"); } /// /// 设置解密资源回调函数。 /// /// 要设置的解密资源回调函数。 /// 如果不设置,将使用默认的解密资源回调函数。 public void SetDecryptResourceCallback(DecryptResourceCallback decryptResourceCallback) { throw new NotSupportedException("SetDecryptResourceCallback"); } /// /// 设置资源辅助器。 /// /// 资源辅助器。 public void SetResourceHelper(IResourceHelper resourceHelper) { throw new NotSupportedException("SetResourceHelper"); } /// /// 增加加载资源代理辅助器。 /// /// 要增加的加载资源代理辅助器。 public void AddLoadResourceAgentHelper(ILoadResourceAgentHelper loadResourceAgentHelper) { throw new NotSupportedException("AddLoadResourceAgentHelper"); } /// /// 使用单机模式并初始化资源。 /// /// 使用单机模式并初始化资源完成时的回调函数。 public void InitResources(InitResourcesCompleteCallback initResourcesCompleteCallback) { throw new NotSupportedException("InitResources"); } /// /// 检查版本资源列表。 /// /// 最新的内部资源版本号。 /// 检查版本资源列表结果。 public CheckVersionListResult CheckVersionList(int latestInternalResourceVersion) { throw new NotSupportedException("CheckVersionList"); } /// /// 使用可更新模式并更新版本资源列表。 /// /// 版本资源列表大小。 /// 版本资源列表哈希值。 /// 版本资源列表压缩后大小。 /// 版本资源列表压缩后哈希值。 /// 版本资源列表更新回调函数集。 public void UpdateVersionList(int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode, UpdateVersionListCallbacks updateVersionListCallbacks) { throw new NotSupportedException("UpdateVersionList"); } /// /// 使用可更新模式并检查资源。 /// /// 是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。 /// 使用可更新模式并检查资源完成时的回调函数。 public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback) { throw new NotSupportedException("CheckResources"); } /// /// 使用可更新模式并应用资源包资源。 /// /// 要应用的资源包路径。 /// 使用可更新模式并应用资源包资源完成时的回调函数。 public void ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback) { throw new NotSupportedException("ApplyResources"); } /// /// 使用可更新模式并更新所有资源。 /// /// 使用可更新模式并更新默认资源组完成时的回调函数。 public void UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback) { throw new NotSupportedException("UpdateResources"); } /// /// 使用可更新模式并更新指定资源组的资源。 /// /// 要更新的资源组名称。 /// 使用可更新模式并更新指定资源组完成时的回调函数。 public void UpdateResources(string resourceGroupName, UpdateResourcesCompleteCallback updateResourcesCompleteCallback) { throw new NotSupportedException("UpdateResources"); } /// /// 停止更新资源。 /// public void StopUpdateResources() { throw new NotSupportedException("StopUpdateResources"); } /// /// 校验资源包。 /// /// 要校验的资源包路径。 /// 是否校验资源包成功。 public bool VerifyResourcePack(string resourcePackPath) { throw new NotSupportedException("VerifyResourcePack"); } /// /// 获取所有加载资源任务的信息。 /// /// 所有加载资源任务的信息。 public TaskInfo[] GetAllLoadAssetInfos() { throw new NotSupportedException("GetAllLoadAssetInfos"); } /// /// 获取所有加载资源任务的信息。 /// /// 所有加载资源任务的信息。 public void GetAllLoadAssetInfos(List results) { throw new NotSupportedException("GetAllLoadAssetInfos"); } /// /// 检查资源是否存在。 /// /// 要检查资源的名称。 /// 检查资源是否存在的结果。 public HasAssetResult HasAsset(string assetName) { #if UNITY_EDITOR UnityEngine.Object obj = UnityEditor.AssetDatabase.LoadMainAssetAtPath(assetName); if (obj == null) { return HasAssetResult.NotExist; } HasAssetResult result = obj.GetType() == typeof(UnityEditor.DefaultAsset) ? HasAssetResult.BinaryOnDisk : HasAssetResult.AssetOnDisk; obj = null; UnityEditor.EditorUtility.UnloadUnusedAssetsImmediate(); return result; #else return HasAssetResult.NotExist; #endif } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 加载资源回调函数集。 public void LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks) { LoadAsset(assetName, null, DefaultPriority, loadAssetCallbacks, null); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 要加载资源的类型。 /// 加载资源回调函数集。 public void LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks) { LoadAsset(assetName, assetType, DefaultPriority, loadAssetCallbacks, null); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 加载资源的优先级。 /// 加载资源回调函数集。 public void LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks) { LoadAsset(assetName, null, priority, loadAssetCallbacks, null); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 加载资源回调函数集。 /// 用户自定义数据。 public void LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks, object userData) { LoadAsset(assetName, null, DefaultPriority, loadAssetCallbacks, userData); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 要加载资源的类型。 /// 加载资源的优先级。 /// 加载资源回调函数集。 public void LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks) { LoadAsset(assetName, assetType, priority, loadAssetCallbacks, null); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 要加载资源的类型。 /// 加载资源回调函数集。 /// 用户自定义数据。 public void LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks, object userData) { LoadAsset(assetName, assetType, DefaultPriority, loadAssetCallbacks, userData); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 加载资源的优先级。 /// 加载资源回调函数集。 /// 用户自定义数据。 public void LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData) { LoadAsset(assetName, null, priority, loadAssetCallbacks, userData); } /// /// 异步加载资源。 /// /// 要加载资源的名称。 /// 要加载资源的类型。 /// 加载资源的优先级。 /// 加载资源回调函数集。 /// 用户自定义数据。 public void LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData) { if (loadAssetCallbacks == null) { Log.Error("Load asset callbacks is invalid."); return; } if (string.IsNullOrEmpty(assetName)) { if (loadAssetCallbacks.LoadAssetFailureCallback != null) { loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, "Asset name is invalid.", userData); } return; } if (!assetName.StartsWith("Assets/", StringComparison.Ordinal)) { if (loadAssetCallbacks.LoadAssetFailureCallback != null) { loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, Utility.Text.Format("Asset name '{0}' is invalid.", assetName), userData); } return; } if (!HasFile(assetName)) { if (loadAssetCallbacks.LoadAssetFailureCallback != null) { loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, Utility.Text.Format("Asset '{0}' is not exist.", assetName), userData); } return; } m_LoadAssetInfos.AddLast(new LoadAssetInfo(assetName, assetType, priority, DateTime.UtcNow, m_MinLoadAssetRandomDelaySeconds + (float)Utility.Random.GetRandomDouble() * (m_MaxLoadAssetRandomDelaySeconds - m_MinLoadAssetRandomDelaySeconds), loadAssetCallbacks, userData)); } /// /// 卸载资源。 /// /// 要卸载的资源。 public void UnloadAsset(object asset) { // Do nothing in editor resource mode. } /// /// 异步加载场景。 /// /// 要加载场景资源的名称。 /// 加载场景回调函数集。 public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks) { LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, null); } /// /// 异步加载场景。 /// /// 要加载场景资源的名称。 /// 加载场景资源的优先级。 /// 加载场景回调函数集。 public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks) { LoadScene(sceneAssetName, priority, loadSceneCallbacks, null); } /// /// 异步加载场景。 /// /// 要加载场景资源的名称。 /// 加载场景回调函数集。 /// 用户自定义数据。 public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, userData); } /// /// 异步加载场景。 /// /// 要加载场景资源的名称。 /// 加载场景资源的优先级。 /// 加载场景回调函数集。 /// 用户自定义数据。 public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData) { if (loadSceneCallbacks == null) { Log.Error("Load scene callbacks is invalid."); return; } if (string.IsNullOrEmpty(sceneAssetName)) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, "Scene asset name is invalid.", userData); } return; } if (!sceneAssetName.StartsWith("Assets/", StringComparison.Ordinal) || !sceneAssetName.EndsWith(".unity", StringComparison.Ordinal)) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene asset name '{0}' is invalid.", sceneAssetName), userData); } return; } if (!HasFile(sceneAssetName)) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene '{0}' is not exist.", sceneAssetName), userData); } return; } #if UNITY_5_5_OR_NEWER AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneAssetName, LoadSceneMode.Additive); #else AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(SceneComponent.GetSceneName(sceneAssetName), LoadSceneMode.Additive); #endif if (asyncOperation == null) { return; } m_LoadSceneInfos.AddLast(new LoadSceneInfo(asyncOperation, sceneAssetName, priority, DateTime.UtcNow, loadSceneCallbacks, userData)); } /// /// 异步卸载场景。 /// /// 要卸载场景资源的名称。 /// 卸载场景回调函数集。 public void UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks) { UnloadScene(sceneAssetName, unloadSceneCallbacks, null); } /// /// 异步卸载场景。 /// /// 要卸载场景资源的名称。 /// 卸载场景回调函数集。 /// 用户自定义数据。 public void UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData) { if (string.IsNullOrEmpty(sceneAssetName)) { Log.Error("Scene asset name is invalid."); return; } if (!sceneAssetName.StartsWith("Assets/", StringComparison.Ordinal) || !sceneAssetName.EndsWith(".unity", StringComparison.Ordinal)) { Log.Error("Scene asset name '{0}' is invalid.", sceneAssetName); return; } if (unloadSceneCallbacks == null) { Log.Error("Unload scene callbacks is invalid."); return; } if (!HasFile(sceneAssetName)) { Log.Error("Scene '{0}' is not exist.", sceneAssetName); return; } #if UNITY_5_5_OR_NEWER AsyncOperation asyncOperation = SceneManager.UnloadSceneAsync(sceneAssetName); if (asyncOperation == null) { return; } m_UnloadSceneInfos.AddLast(new UnloadSceneInfo(asyncOperation, sceneAssetName, unloadSceneCallbacks, userData)); #else if (SceneManager.UnloadScene(SceneComponent.GetSceneName(sceneAssetName))) { if (unloadSceneCallbacks.UnloadSceneSuccessCallback != null) { unloadSceneCallbacks.UnloadSceneSuccessCallback(sceneAssetName, userData); } } else { if (unloadSceneCallbacks.UnloadSceneFailureCallback != null) { unloadSceneCallbacks.UnloadSceneFailureCallback(sceneAssetName, userData); } } #endif } /// /// 获取二进制资源的实际路径。 /// /// 要获取实际路径的二进制资源的名称。 /// 二进制资源的实际路径。 /// 此方法仅适用于二进制资源存储在磁盘(而非文件系统)中的情况。若二进制资源存储在文件系统中时,返回值将始终为空。 public string GetBinaryPath(string binaryAssetName) { if (!HasFile(binaryAssetName)) { return null; } return Application.dataPath.Substring(0, Application.dataPath.Length - AssetsStringLength) + binaryAssetName; } /// /// 获取二进制资源的实际路径。 /// /// 要获取实际路径的二进制资源的名称。 /// 二进制资源是否存储在只读区中。 /// 二进制资源是否存储在文件系统中。 /// 二进制资源或存储二进制资源的文件系统,相对于只读区或者读写区的相对路径。 /// 若二进制资源存储在文件系统中,则指示二进制资源在文件系统中的名称,否则此参数返回空。 /// 是否获取二进制资源的实际路径成功。 public bool GetBinaryPath(string binaryAssetName, out bool storageInReadOnly, out bool storageInFileSystem, out string relativePath, out string fileName) { throw new NotSupportedException("GetBinaryPath"); } /// /// 获取二进制资源的长度。 /// /// 要获取长度的二进制资源的名称。 /// 二进制资源的长度。 public int GetBinaryLength(string binaryAssetName) { string binaryPath = GetBinaryPath(binaryAssetName); if (string.IsNullOrEmpty(binaryPath)) { return -1; } return (int)new System.IO.FileInfo(binaryPath).Length; } /// /// 异步加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 加载二进制资源回调函数集。 public void LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks) { LoadBinary(binaryAssetName, loadBinaryCallbacks, null); } /// /// 异步加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 加载二进制资源回调函数集。 /// 用户自定义数据。 public void LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks, object userData) { if (loadBinaryCallbacks == null) { Log.Error("Load binary callbacks is invalid."); return; } if (string.IsNullOrEmpty(binaryAssetName)) { if (loadBinaryCallbacks.LoadBinaryFailureCallback != null) { loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, "Binary asset name is invalid.", userData); } return; } if (!binaryAssetName.StartsWith("Assets/", StringComparison.Ordinal)) { if (loadBinaryCallbacks.LoadBinaryFailureCallback != null) { loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Binary asset name '{0}' is invalid.", binaryAssetName), userData); } return; } string binaryPath = GetBinaryPath(binaryAssetName); if (binaryPath == null) { if (loadBinaryCallbacks.LoadBinaryFailureCallback != null) { loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Binary asset '{0}' is not exist.", binaryAssetName), userData); } return; } try { byte[] binaryBytes = File.ReadAllBytes(binaryPath); loadBinaryCallbacks.LoadBinarySuccessCallback(binaryAssetName, binaryBytes, 0f, userData); } catch (Exception exception) { if (loadBinaryCallbacks.LoadBinaryFailureCallback != null) { loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.AssetError, exception.ToString(), userData); } } } /// /// 从文件系统中加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 存储加载二进制资源的二进制流。 public byte[] LoadBinaryFromFileSystem(string binaryAssetName) { throw new NotSupportedException("LoadBinaryFromFileSystem"); } /// /// 从文件系统中加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 存储加载二进制资源的二进制流。 /// 实际加载了多少字节。 public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer) { throw new NotSupportedException("LoadBinaryFromFileSystem"); } /// /// 从文件系统中加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 存储加载二进制资源的二进制流。 /// 存储加载二进制资源的二进制流的起始位置。 /// 实际加载了多少字节。 public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex) { throw new NotSupportedException("LoadBinaryFromFileSystem"); } /// /// 从文件系统中加载二进制资源。 /// /// 要加载二进制资源的名称。 /// 存储加载二进制资源的二进制流。 /// 存储加载二进制资源的二进制流的起始位置。 /// 存储加载二进制资源的二进制流的长度。 /// 实际加载了多少字节。 public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length) { throw new NotSupportedException("LoadBinaryFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 要加载片段的长度。 /// 存储加载二进制资源片段内容的二进制流。 public byte[] LoadBinarySegmentFromFileSystem(string binaryAssetName, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 要加载片段的偏移。 /// 要加载片段的长度。 /// 存储加载二进制资源片段内容的二进制流。 public byte[] LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 存储加载二进制资源片段内容的二进制流。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 存储加载二进制资源片段内容的二进制流。 /// 要加载片段的长度。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 存储加载二进制资源片段内容的二进制流。 /// 存储加载二进制资源片段内容的二进制流的起始位置。 /// 要加载片段的长度。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 要加载片段的偏移。 /// 存储加载二进制资源片段内容的二进制流。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 要加载片段的偏移。 /// 存储加载二进制资源片段内容的二进制流。 /// 要加载片段的长度。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 从文件系统中加载二进制资源的片段。 /// /// 要加载片段的二进制资源的名称。 /// 要加载片段的偏移。 /// 存储加载二进制资源片段内容的二进制流。 /// 存储加载二进制资源片段内容的二进制流的起始位置。 /// 要加载片段的长度。 /// 实际加载了多少字节。 public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int startIndex, int length) { throw new NotSupportedException("LoadBinarySegmentFromFileSystem"); } /// /// 检查资源组是否存在。 /// /// 要检查资源组的名称。 /// 资源组是否存在。 public bool HasResourceGroup(string resourceGroupName) { throw new NotSupportedException("HasResourceGroup"); } /// /// 获取默认资源组。 /// /// 默认资源组。 public IResourceGroup GetResourceGroup() { throw new NotSupportedException("GetResourceGroup"); } /// /// 获取资源组。 /// /// 要获取的资源组名称。 /// 要获取的资源组。 public IResourceGroup GetResourceGroup(string resourceGroupName) { throw new NotSupportedException("GetResourceGroup"); } /// /// 获取所有资源组。 /// /// 所有资源组。 public IResourceGroup[] GetAllResourceGroups() { throw new NotSupportedException("GetAllResourceGroups"); } /// /// 获取所有资源组。 /// /// 所有资源组。 public void GetAllResourceGroups(List results) { throw new NotSupportedException("GetAllResourceGroups"); } /// /// 获取资源组集合。 /// /// 要获取的资源组名称的集合。 /// 要获取的资源组集合。 public IResourceGroupCollection GetResourceGroupCollection(params string[] resourceGroupNames) { throw new NotSupportedException("GetResourceGroupCollection"); } /// /// 获取资源组集合。 /// /// 要获取的资源组名称的集合。 /// 要获取的资源组集合。 public IResourceGroupCollection GetResourceGroupCollection(List resourceGroupNames) { throw new NotSupportedException("GetResourceGroupCollection"); } private bool HasFile(string assetName) { if (string.IsNullOrEmpty(assetName)) { return false; } if (HasCachedAsset(assetName)) { return true; } string assetFullName = Application.dataPath.Substring(0, Application.dataPath.Length - AssetsStringLength) + assetName; if (string.IsNullOrEmpty(assetFullName)) { return false; } string[] splitedAssetFullName = assetFullName.Split('/'); string currentPath = Path.GetPathRoot(assetFullName); for (int i = 1; i < splitedAssetFullName.Length - 1; i++) { string[] directoryNames = Directory.GetDirectories(currentPath, splitedAssetFullName[i]); if (directoryNames.Length != 1) { return false; } currentPath = directoryNames[0]; } string[] fileNames = Directory.GetFiles(currentPath, splitedAssetFullName[splitedAssetFullName.Length - 1]); if (fileNames.Length != 1) { return false; } string fileFullName = Utility.Path.GetRegularPath(fileNames[0]); if (fileFullName == null) { return false; } if (assetFullName != fileFullName) { if (assetFullName.ToLowerInvariant() == fileFullName.ToLowerInvariant()) { Log.Warning("The real path of the specific asset '{0}' is '{1}'. Check the case of letters in the path.", assetName, "Assets" + fileFullName.Substring(Application.dataPath.Length)); } return false; } return true; } private bool HasCachedAsset(string assetName) { if (!m_EnableCachedAssets) { return false; } if (string.IsNullOrEmpty(assetName)) { return false; } return m_CachedAssets.ContainsKey(assetName); } private UnityEngine.Object GetCachedAsset(string assetName) { if (!m_EnableCachedAssets) { return null; } if (string.IsNullOrEmpty(assetName)) { return null; } UnityEngine.Object asset = null; if (m_CachedAssets.TryGetValue(assetName, out asset)) { return asset; } return null; } void IResourceManager.SetReadOnlyPath(string readOnlyPath) { throw new NotImplementedException(); } void IResourceManager.SetReadWritePath(string readWritePath) { throw new NotImplementedException(); } void IResourceManager.SetResourceMode(ResourceMode resourceMode) { throw new NotImplementedException(); } void IResourceManager.SetCurrentVariant(string currentVariant) { throw new NotImplementedException(); } void IResourceManager.SetObjectPoolManager(IObjectPoolManager objectPoolManager) { throw new NotImplementedException(); } void IResourceManager.SetFileSystemManager(IFileSystemManager fileSystemManager) { throw new NotImplementedException(); } void IResourceManager.SetDownloadManager(IDownloadManager downloadManager) { throw new NotImplementedException(); } void IResourceManager.SetDecryptResourceCallback(DecryptResourceCallback decryptResourceCallback) { throw new NotImplementedException(); } void IResourceManager.SetResourceHelper(IResourceHelper resourceHelper) { throw new NotImplementedException(); } void IResourceManager.AddLoadResourceAgentHelper(ILoadResourceAgentHelper loadResourceAgentHelper) { throw new NotImplementedException(); } void IResourceManager.InitResources(InitResourcesCompleteCallback initResourcesCompleteCallback) { throw new NotImplementedException(); } CheckVersionListResult IResourceManager.CheckVersionList(int latestInternalResourceVersion) { throw new NotImplementedException(); } void IResourceManager.UpdateVersionList(int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode, UpdateVersionListCallbacks updateVersionListCallbacks) { throw new NotImplementedException(); } void IResourceManager.CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback) { throw new NotImplementedException(); } void IResourceManager.ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback) { throw new NotImplementedException(); } void IResourceManager.UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback) { throw new NotImplementedException(); } void IResourceManager.UpdateResources(string resourceGroupName, UpdateResourcesCompleteCallback updateResourcesCompleteCallback) { throw new NotImplementedException(); } void IResourceManager.StopUpdateResources() { throw new NotImplementedException(); } bool IResourceManager.VerifyResourcePack(string resourcePackPath) { throw new NotImplementedException(); } GameFramework.TaskInfo[] IResourceManager.GetAllLoadAssetInfos() { throw new NotImplementedException(); } void IResourceManager.GetAllLoadAssetInfos(List results) { throw new NotImplementedException(); } HasAssetResult IResourceManager.HasAsset(string assetName) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.UnloadAsset(object asset) { throw new NotImplementedException(); } void IResourceManager.LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData) { throw new NotImplementedException(); } void IResourceManager.UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks) { throw new NotImplementedException(); } void IResourceManager.UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData) { throw new NotImplementedException(); } string IResourceManager.GetBinaryPath(string binaryAssetName) { throw new NotImplementedException(); } bool IResourceManager.GetBinaryPath(string binaryAssetName, out bool storageInReadOnly, out bool storageInFileSystem, out string relativePath, out string fileName) { throw new NotImplementedException(); } int IResourceManager.GetBinaryLength(string binaryAssetName) { throw new NotImplementedException(); } void IResourceManager.LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks) { throw new NotImplementedException(); } void IResourceManager.LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks, object userData) { throw new NotImplementedException(); } byte[] IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName) { throw new NotImplementedException(); } int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer) { throw new NotImplementedException(); } int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex) { throw new NotImplementedException(); } int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length) { throw new NotImplementedException(); } byte[] IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int length) { throw new NotImplementedException(); } byte[] IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, int length) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int length) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int length) { throw new NotImplementedException(); } int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int startIndex, int length) { throw new NotImplementedException(); } bool IResourceManager.HasResourceGroup(string resourceGroupName) { throw new NotImplementedException(); } IResourceGroup IResourceManager.GetResourceGroup() { throw new NotImplementedException(); } IResourceGroup IResourceManager.GetResourceGroup(string resourceGroupName) { throw new NotImplementedException(); } IResourceGroup[] IResourceManager.GetAllResourceGroups() { throw new NotImplementedException(); } void IResourceManager.GetAllResourceGroups(List results) { throw new NotImplementedException(); } IResourceGroupCollection IResourceManager.GetResourceGroupCollection(params string[] resourceGroupNames) { throw new NotImplementedException(); } IResourceGroupCollection IResourceManager.GetResourceGroupCollection(List resourceGroupNames) { throw new NotImplementedException(); } [StructLayout(LayoutKind.Auto)] private struct LoadAssetInfo { private readonly string m_AssetName; private readonly Type m_AssetType; private readonly int m_Priority; private readonly DateTime m_StartTime; private readonly float m_DelaySeconds; private readonly LoadAssetCallbacks m_LoadAssetCallbacks; private readonly object m_UserData; public LoadAssetInfo(string assetName, Type assetType, int priority, DateTime startTime, float delaySeconds, LoadAssetCallbacks loadAssetCallbacks, object userData) { m_AssetName = assetName; m_AssetType = assetType; m_Priority = priority; m_StartTime = startTime; m_DelaySeconds = delaySeconds; m_LoadAssetCallbacks = loadAssetCallbacks; m_UserData = userData; } public string AssetName { get { return m_AssetName; } } public Type AssetType { get { return m_AssetType; } } public int Priority { get { return m_Priority; } } public DateTime StartTime { get { return m_StartTime; } } public float DelaySeconds { get { return m_DelaySeconds; } } public LoadAssetCallbacks LoadAssetCallbacks { get { return m_LoadAssetCallbacks; } } public object UserData { get { return m_UserData; } } } [StructLayout(LayoutKind.Auto)] private struct LoadSceneInfo { private readonly AsyncOperation m_AsyncOperation; private readonly string m_SceneAssetName; private readonly int m_Priority; private readonly DateTime m_StartTime; private readonly LoadSceneCallbacks m_LoadSceneCallbacks; private readonly object m_UserData; public LoadSceneInfo(AsyncOperation asyncOperation, string sceneAssetName, int priority, DateTime startTime, LoadSceneCallbacks loadSceneCallbacks, object userData) { m_AsyncOperation = asyncOperation; m_SceneAssetName = sceneAssetName; m_Priority = priority; m_StartTime = startTime; m_LoadSceneCallbacks = loadSceneCallbacks; m_UserData = userData; } public AsyncOperation AsyncOperation { get { return m_AsyncOperation; } } public string SceneAssetName { get { return m_SceneAssetName; } } public int Priority { get { return m_Priority; } } public DateTime StartTime { get { return m_StartTime; } } public LoadSceneCallbacks LoadSceneCallbacks { get { return m_LoadSceneCallbacks; } } public object UserData { get { return m_UserData; } } } [StructLayout(LayoutKind.Auto)] private struct UnloadSceneInfo { private readonly AsyncOperation m_AsyncOperation; private readonly string m_SceneAssetName; private readonly UnloadSceneCallbacks m_UnloadSceneCallbacks; private readonly object m_UserData; public UnloadSceneInfo(AsyncOperation asyncOperation, string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData) { m_AsyncOperation = asyncOperation; m_SceneAssetName = sceneAssetName; m_UnloadSceneCallbacks = unloadSceneCallbacks; m_UserData = userData; } public AsyncOperation AsyncOperation { get { return m_AsyncOperation; } } public string SceneAssetName { get { return m_SceneAssetName; } } public UnloadSceneCallbacks UnloadSceneCallbacks { get { return m_UnloadSceneCallbacks; } } public object UserData { get { return m_UserData; } } } } }