Example #1
0
        /// <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;
        }
Example #2
0
        /// <summary>
        /// 使用可更新模式并检查资源。
        /// </summary>
        /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成的回调函数。</param>
        public void CheckResources(CheckResourcesCompleteCallback checkResourcesCompleteCallback)
        {
            if (checkResourcesCompleteCallback == null)
            {
                throw new GameFrameworkException("Check resources complete callback is invalid.");
            }

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable)
            {
                throw new GameFrameworkException("You can not use CheckResources without updatable resource mode.");
            }

            if (m_ResourceChecker == null)
            {
                throw new GameFrameworkException("You can not use CheckResources at this time.");
            }

            m_RefuseSetCurrentVariant        = true;
            m_CheckResourcesCompleteCallback = checkResourcesCompleteCallback;
            m_ResourceChecker.CheckResources(m_CurrentVariant);
        }
Example #3
0
        private void OnCheckerResourceCheckComplete(int removedCount, int updateCount, long updateTotalLength, long updateTotalZipLength)
        {
            m_VersionListProcessor.VersionListUpdateSuccess -= OnVersionListProcessorUpdateSuccess;
            m_VersionListProcessor.VersionListUpdateFailure -= OnVersionListProcessorUpdateFailure;
            m_VersionListProcessor.Shutdown();
            m_VersionListProcessor       = null;
            m_UpdateVersionListCallbacks = null;

            m_ResourceChecker.ResourceNeedUpdate    -= OnCheckerResourceNeedUpdate;
            m_ResourceChecker.ResourceCheckComplete -= OnCheckerResourceCheckComplete;
            m_ResourceChecker.Shutdown();
            m_ResourceChecker = null;

            m_ResourceUpdater.CheckResourceComplete(removedCount > 0);

            if (updateCount <= 0)
            {
                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;
                }
            }

            m_CheckResourcesCompleteCallback(updateCount > 0, removedCount, updateCount, updateTotalLength, updateTotalZipLength);
            m_CheckResourcesCompleteCallback = null;
        }
Example #4
0
        /// <summary>
        /// 使用可更新模式并检查资源
        /// </summary>
        /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成的回调函数</param>
        public void CheckResources(CheckResourcesCompleteCallback checkResourcesCompleteCallback)
        {
            if (checkResourcesCompleteCallback == null)
            {
                throw new Exception("Check resources complete callback is invalid.");
            }

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new Exception("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable)
            {
                throw new Exception("You can not use CheckResources without updatable resource mode.");
            }

            if (m_ResourceChecker == null)
            {
                throw new Exception("You can not use CheckResources at this time.");
            }

            CheckResourcesCompleteCallback = checkResourcesCompleteCallback;
            m_ResourceChecker.CheckResources();
        }
 /// <summary>
 /// 使用可更新模式并检查资源。
 /// </summary>
 /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成时的回调函数。</param>
 public void CheckResources(CheckResourcesCompleteCallback checkResourcesCompleteCallback)
 {
     m_ResourceManager.CheckResources(checkResourcesCompleteCallback);
 }
Example #6
0
 /// <summary>
 /// 使用可更新模式并检查资源。
 /// </summary>
 /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成的回调函数。</param>
 public void CheckResources(CheckResourcesCompleteCallback checkResourcesCompleteCallback)
 {
     throw new NotSupportedException("CheckResources");
 }
 /// <summary>
 /// 使用可更新模式并检查资源。
 /// </summary>
 /// <param name="ignoreOtherVariant">是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。</param>
 /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成时的回调函数。</param>
 public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)
 {
     m_ResourceManager.CheckResources(ignoreOtherVariant, checkResourcesCompleteCallback);
 }
Example #8
0
 public void CheckResources(CheckResourcesCompleteCallback checkResourcesCompleteCallback)
 {
     //throw new NotImplementedException();
 }