/// <summary> /// 初始化资源管理器的新实例。 /// </summary> public ResourceManager() { m_AssetInfos = null; m_ResourceInfos = null; m_ReadWriteResourceInfos = new SortedDictionary <ResourceName, ReadWriteResourceInfo>(new ResourceNameComparer()); m_CachedBytesForEncryptedString = new byte[byte.MaxValue]; m_ResourceIniter = null; m_VersionListProcessor = null; m_ResourceChecker = null; m_ResourceUpdater = null; m_ResourceLoader = new ResourceLoader(this); m_ResourceHelper = null; m_ReadOnlyPath = null; m_ReadWritePath = null; m_ResourceMode = ResourceMode.Unspecified; m_RefuseSetCurrentVariant = false; m_CurrentVariant = null; m_UpdatePrefixUri = null; m_ApplicableGameVersion = null; m_InternalResourceVersion = 0; m_UpdateFileCache = null; m_DecompressCache = null; m_DecryptResourceCallback = null; m_InitResourcesCompleteCallback = null; m_UpdateVersionListCallbacks = null; m_CheckResourcesCompleteCallback = null; m_UpdateResourcesCompleteCallback = null; m_ResourceUpdateStartEventHandler = null; m_ResourceUpdateChangedEventHandler = null; m_ResourceUpdateSuccessEventHandler = null; m_ResourceUpdateFailureEventHandler = null; }
/// <summary> /// 初始化资源管理器的新实例。 /// </summary> public ResourceManager() { ResourceNameComparer resourceNameComparer = new ResourceNameComparer(); m_AssetInfos = new Dictionary <string, AssetInfo>(); m_AssetDependencyInfos = new Dictionary <string, AssetDependencyInfo>(); m_ResourceInfos = new Dictionary <ResourceName, ResourceInfo>(resourceNameComparer); m_ResourceGroups = new Dictionary <string, ResourceGroup>(); m_ReadWriteResourceInfos = new SortedDictionary <ResourceName, ReadWriteResourceInfo>(resourceNameComparer); m_ResourceIniter = null; m_ResourceLoader = new ResourceLoader(this); m_ResourceHelper = null; m_ReadOnlyPath = null; m_ReadWritePath = null; m_ResourceMode = ResourceMode.Unspecified; m_RefuseSetCurrentVariant = false; m_CurrentVariant = null; m_UpdatePrefixUri = null; m_ApplicableGameVersion = null; m_InternalResourceVersion = 0; m_DecryptResourceCallback = null; m_ResourceInitCompleteEventHandler = null; }
/// <summary> /// 初始化资源管理器的新实例。 /// </summary> public ResourceManager() { m_AssetInfos = new Dictionary <string, AssetInfo>(); m_AssetDependencyInfos = new Dictionary <string, AssetDependencyInfo>(); m_ResourceInfos = new Dictionary <ResourceName, ResourceInfo>(); m_ResourceGroups = new Dictionary <string, ResourceGroup>(); m_ReadWriteResourceInfos = new SortedDictionary <ResourceName, ReadWriteResourceInfo>(); m_ResourceIniter = null; m_VersionListProcessor = null; m_ResourceChecker = null; m_ResourceUpdater = null; m_ResourceLoader = new ResourceLoader(this); m_ResourceHelper = null; m_ReadOnlyPath = null; m_ReadWritePath = null; m_ResourceMode = ResourceMode.Unspecified; m_RefuseSetCurrentVariant = false; m_CurrentVariant = null; m_UpdatePrefixUri = null; m_ApplicableGameVersion = null; m_InternalResourceVersion = 0; m_DecryptResourceCallback = null; m_ResourceInitCompleteEventHandler = null; m_VersionListUpdateSuccessEventHandler = null; m_VersionListUpdateFailureEventHandler = null; m_ResourceCheckCompleteEventHandler = null; m_ResourceUpdateStartEventHandler = null; m_ResourceUpdateChangedEventHandler = null; m_ResourceUpdateSuccessEventHandler = null; m_ResourceUpdateFailureEventHandler = null; m_ResourceUpdateAllCompleteEventHandler = null; }
public void SetResourceMode(ResourceMode mode) { if (m_ResourceMode == m_ResourceMode.Unspecified) { m_ResourceMode = m_ResourceMode; if (m_ResourceMode == ResourceMode.Package) { m_ResourceIniter = new ResourceIniter(this); m_ResourceIniter.ResourceInitComplete += OnInitResourceInitComplete; } else if (m_ResourceMode == ResourceMode.Updatable) { m_VersionListProcessor = new VersionListProcessor(this); m_VersionListProcessor.VersionListUpdateSuccess += OnVersionListProcessorUpdateSuccess; m_ResourceChecker = new ResourceChecker(this); m_ResourceChecker.ResourceNeedUpdate += OnCheckerResourceNeedUpdate; m_ResourceChecker.ResourceCheckComplete += OnCheckResourceCheckComplete; m_ResourceUpdater = new ResourceUpdater(this); m_ResourceUpdater.ResourceUpdateStart += OnUpdateResourceUpdateStart; m_ResourceUpdater.ResourceUpdateSuccess += OnUpdateResourceUpdateSuccess; } } }
internal override void Shutdown() { if (m_ResourceIniter != null) { m_ResourceIniter.Shutdown(); m_ResourceIniter = null; } m_VersionListProcessor.VersionListUpdateSuccess -= OnVersionListProcessorUpdateSuccess; m_VersionListProcessor.Shutdown(); m_VersionListProcessor = null; m_ResourceChecker.ResourceNeedUpdate -= OnCheckerResourceNeedUpdate; m_resourceChecker.Shutdown(); m_ResourceChecker = null; m_ResourceUpdater.ResourceUpdateStart -= OnUpdateResourceUpdateStart; m_ResourceUpdater.ResourceUpdateAllComplete -= OnUpdateResourceUpdateAllComplete; m_ResourceUpdater.Shutdown(); m_ResourceUpdater = null; m_ResourceLoader.Shutdown(); m_ResourceLoader = null; m_AssetInfos.Clear(); m_AssetDependencyInfos.Clear(); m_ResourceInfos.Clear(); m_ReadWriteResourceInfos.Clear(); }
/// <summary> /// 使用单机模式并初始化资源。 /// </summary> public void InitResources() { m_ResourceIniter = new ResourceIniter(this); m_ResourceIniter.ResourceInitComplete += OnIniterResourceInitComplete; m_RefuseSetCurrentVariant = true; m_ResourceIniter.InitResources(m_CurrentVariant); }
private void OnIniterResourceInitComplete() { m_ResourceIniter.ResouceInitComplete -= OnIniterResourceInitComplete; m_ResourceIniter.Shutdown(); m_ResourceIniter = null; m_ResourceInitCompleteEventHandler(this, new ResourceInitCompleteEventArgs() ; }
private void OnIniterResourceInitComplete() { m_ResourceIniter.ResourceInitComplete -= OnIniterResourceInitComplete; m_ResourceIniter.Shutdown(); m_ResourceIniter = null; m_InitResourcesCompleteCallback(); m_InitResourcesCompleteCallback = null; }
/// <summary> /// 关闭并清理资源管理器。 /// </summary> internal override void Shutdown() { if (m_ResourceIniter != null) { m_ResourceIniter.Shutdown(); m_ResourceIniter = null; } if (m_ResourceLoader != null) { m_ResourceLoader.Shutdown(); m_ResourceLoader = null; } m_AssetInfos.Clear(); m_AssetDependencyInfos.Clear(); m_ResourceInfos.Clear(); m_ReadWriteResourceInfos.Clear(); }
/// <summary> /// 设置资源模式。 /// </summary> /// <param name="resourceMode">资源模式。</param> public void SetResourceMode(ResourceMode resourceMode) { if (resourceMode == ResourceMode.Unspecified) { throw new AshException("Resource mode is invalid."); } if (m_ResourceMode == ResourceMode.Unspecified) { m_ResourceMode = resourceMode; if (m_ResourceMode == ResourceMode.Package) { m_ResourceIniter = new ResourceIniter(this); m_ResourceIniter.ResourceInitComplete += OnIniterResourceInitComplete; } else if (m_ResourceMode == ResourceMode.Updatable) { m_VersionListProcessor = new VersionListProcessor(this); m_VersionListProcessor.VersionListUpdateSuccess += OnVersionListProcessorUpdateSuccess; m_VersionListProcessor.VersionListUpdateFailure += OnVersionListProcessorUpdateFailure; m_ResourceChecker = new ResourceChecker(this); m_ResourceChecker.ResourceNeedUpdate += OnCheckerResourceNeedUpdate; m_ResourceChecker.ResourceCheckComplete += OnCheckerResourceCheckComplete; m_ResourceUpdater = new ResourceUpdater(this); m_ResourceUpdater.ResourceUpdateStart += OnUpdaterResourceUpdateStart; m_ResourceUpdater.ResourceUpdateChanged += OnUpdaterResourceUpdateChanged; m_ResourceUpdater.ResourceUpdateSuccess += OnUpdaterResourceUpdateSuccess; m_ResourceUpdater.ResourceUpdateFailure += OnUpdaterResourceUpdateFailure; m_ResourceUpdater.ResourceUpdateAllComplete += OnUpdaterResourceUpdateAllComplete; } } else if (m_ResourceMode != resourceMode) { throw new AshException("You can not change resource mode at this time."); } }
/// <summary> /// 设置资源模式。 /// </summary> /// <param name="resourceMode">资源模式。</param> public void SetResourceMode(ResourceMode resourceMode) { if (resourceMode == ResourceMode.Unspecified) { throw new GameFrameworkException("Resource mode is invalid."); } if (m_ResourceMode == ResourceMode.Unspecified) { m_ResourceMode = resourceMode; if (m_ResourceMode == ResourceMode.Package) { m_ResourceIniter = new ResourceIniter(this); m_ResourceIniter.ResourceInitComplete += OnIniterResourceInitComplete; } } else if (m_ResourceMode != resourceMode) { throw new GameFrameworkException("You can not change resource mode at this time."); } }
public ResourceManager() { ResourceNameComparer resourceNameComparer = new ResourceNameComparer(); m_AssetInfos = new Dictionary<string, AssetInfo>(); m_AssetDependencyInfos = new Dictionary<string, AssetDependencyInfo>(); m_ResourceInfos = new Dictionary<ResourceName, ResourceInfo>(resourceNameComparer; m_ResourceGroup = new Dictionary<string, ResourceGroup>(); m_ResourceIniter = null; m_VersionListProcesor = null; m_ResourceChecker = null; m_ResourceUpdater null; m_ResourceLoader = new ResourceLoader(this); m_ResourceHelper = null; m_ReadOnlyPath = null; m_CurrentVariant = null; m_ApplicableGameVersion = null; m_ResourceInitCompleteEventHandler = null; m_ResourceUpdateSuccessEventHandler = null; }
/// <summary> /// 关闭并清理资源管理器。 /// </summary> internal override void Shutdown() { if (m_ResourceIniter != null) { m_ResourceIniter.Shutdown(); m_ResourceIniter = null; } if (m_VersionListProcessor != null) { m_VersionListProcessor.VersionListUpdateSuccess -= OnVersionListProcessorUpdateSuccess; m_VersionListProcessor.VersionListUpdateFailure -= OnVersionListProcessorUpdateFailure; m_VersionListProcessor.Shutdown(); m_VersionListProcessor = null; } if (m_ResourceChecker != null) { m_ResourceChecker.ResourceNeedUpdate -= OnCheckerResourceNeedUpdate; m_ResourceChecker.ResourceCheckComplete -= OnCheckerResourceCheckComplete; m_ResourceChecker.Shutdown(); m_ResourceChecker = null; } if (m_ResourceUpdater != null) { m_ResourceUpdater.ResourceUpdateStart -= OnUpdaterResourceUpdateStart; m_ResourceUpdater.ResourceUpdateChanged -= OnUpdaterResourceUpdateChanged; m_ResourceUpdater.ResourceUpdateSuccess -= OnUpdaterResourceUpdateSuccess; m_ResourceUpdater.ResourceUpdateFailure -= OnUpdaterResourceUpdateFailure; m_ResourceUpdater.ResourceUpdateAllComplete -= OnUpdaterResourceUpdateAllComplete; m_ResourceUpdater.Shutdown(); m_ResourceUpdater = null; m_UpdateFileCache = null; if (m_DecompressCache != null) { m_DecompressCache.Dispose(); m_DecompressCache = null; } } if (m_ResourceLoader != null) { m_ResourceLoader.Shutdown(); m_ResourceLoader = null; } if (m_AssetInfos != null) { m_AssetInfos.Clear(); m_AssetInfos = null; } if (m_ResourceInfos != null) { m_ResourceInfos.Clear(); m_ResourceInfos = null; } m_ReadWriteResourceInfos.Clear(); }