Ejemplo n.º 1
0
        public static LoadConfigInfo Create(string configName, object userData)
        {
            LoadConfigInfo loadConfigInfo = ReferencePool.Acquire <LoadConfigInfo>();

            loadConfigInfo.m_ConfigName = configName;
            loadConfigInfo.m_UserData   = userData;
            return(loadConfigInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载全局配置。
        /// </summary>
        /// <param name="configName">全局配置名称。</param>
        /// <param name="configAssetName">全局配置资源名称。</param>
        /// <param name="loadType">全局配置加载方式。</param>
        /// <param name="priority">加载全局配置资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadConfig(string configName, string configAssetName, LoadType loadType, int priority, object userData)
        {
            if (string.IsNullOrEmpty(configName))
            {
                Log.Error("Config name is invalid.");
                return;
            }

            m_ConfigManager.LoadConfig(configAssetName, loadType, priority, LoadConfigInfo.Create(configName, userData));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 填充加载配置更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置更新事件。</returns>
        public LoadConfigUpdateEventArgs Fill(GameFramework.Config.LoadConfigUpdateEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName      = loadConfigInfo.ConfigName;
            ConfigAssetName = e.ConfigAssetName;
            Progress        = e.Progress;
            UserData        = loadConfigInfo.UserData;

            return(this);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 填充加载配置成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置成功事件。</returns>
        public LoadConfigSuccessEventArgs Fill(GameFramework.Config.LoadConfigSuccessEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName      = loadConfigInfo.ConfigName;
            ConfigAssetName = e.ConfigAssetName;
            Duration        = e.Duration;
            UserData        = loadConfigInfo.UserData;

            return(this);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 填充加载配置失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置失败事件。</returns>
        public LoadConfigFailureEventArgs Fill(GameFramework.Config.LoadConfigFailureEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName      = loadConfigInfo.ConfigName;
            ConfigAssetName = e.ConfigAssetName;
            ErrorMessage    = e.ErrorMessage;
            UserData        = loadConfigInfo.UserData;

            return(this);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 创建加载全局配置更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载全局配置更新事件。</returns>
        public static LoadConfigUpdateEventArgs Create(GameFramework.Config.LoadConfigUpdateEventArgs e)
        {
            LoadConfigInfo            loadConfigInfo            = (LoadConfigInfo)e.UserData;
            LoadConfigUpdateEventArgs loadConfigUpdateEventArgs = ReferencePool.Acquire <LoadConfigUpdateEventArgs>();

            loadConfigUpdateEventArgs.ConfigName      = loadConfigInfo.ConfigName;
            loadConfigUpdateEventArgs.ConfigAssetName = e.ConfigAssetName;
            loadConfigUpdateEventArgs.Progress        = e.Progress;
            loadConfigUpdateEventArgs.UserData        = loadConfigInfo.UserData;
            return(loadConfigUpdateEventArgs);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 创建加载全局配置失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载全局配置失败事件。</returns>
        public static LoadConfigFailureEventArgs Create(GameFramework.Config.LoadConfigFailureEventArgs e)
        {
            LoadConfigInfo             loadConfigInfo             = (LoadConfigInfo)e.UserData;
            LoadConfigFailureEventArgs loadConfigFailureEventArgs = ReferencePool.Acquire <LoadConfigFailureEventArgs>();

            loadConfigFailureEventArgs.ConfigName      = loadConfigInfo.ConfigName;
            loadConfigFailureEventArgs.ConfigAssetName = e.ConfigAssetName;
            loadConfigFailureEventArgs.ErrorMessage    = e.ErrorMessage;
            loadConfigFailureEventArgs.UserData        = loadConfigInfo.UserData;
            ReferencePool.Release(loadConfigInfo);
            return(loadConfigFailureEventArgs);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 创建加载全局配置成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载全局配置成功事件。</returns>
        public static LoadConfigSuccessEventArgs Create(GameFramework.Config.LoadConfigSuccessEventArgs e)
        {
            LoadConfigInfo             loadConfigInfo             = (LoadConfigInfo)e.UserData;
            LoadConfigSuccessEventArgs loadConfigSuccessEventArgs = ReferencePool.Acquire <LoadConfigSuccessEventArgs>();

            loadConfigSuccessEventArgs.ConfigName      = loadConfigInfo.ConfigName;
            loadConfigSuccessEventArgs.ConfigAssetName = e.ConfigAssetName;
            loadConfigSuccessEventArgs.Duration        = e.Duration;
            loadConfigSuccessEventArgs.UserData        = loadConfigInfo.UserData;
            ReferencePool.Release(loadConfigInfo);
            return(loadConfigSuccessEventArgs);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 加载配置。
        /// </summary>
        /// <param name="configName">配置名称。</param>
        /// <param name="configAssetName">配置资源名称。</param>
        /// <param name="loadType">配置加载方式。</param>
        /// <param name="priority">加载配置资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadConfig(string configName, string configAssetName, LoadType loadType, int priority, object userData)
        {
            if (string.IsNullOrEmpty(configName))
            {
                Log.Error("Config name is invalid.");
                return;
            }

            LoadConfigInfo loadConfigInfo = ReferencePool.Acquire <LoadConfigInfo>();

            loadConfigInfo.Initialize(configName, userData);
            m_ConfigManager.LoadConfig(configAssetName, loadType, priority, loadConfigInfo);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 创建加载配置时加载依赖资源事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载配置时加载依赖资源事件。</returns>
        public static LoadConfigDependencyAssetEventArgs Create(GameFramework.Config.LoadConfigDependencyAssetEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;
            LoadConfigDependencyAssetEventArgs loadConfigDependencyAssetEventArgs = ReferencePool.Acquire <LoadConfigDependencyAssetEventArgs>();

            loadConfigDependencyAssetEventArgs.ConfigName          = loadConfigInfo.ConfigName;
            loadConfigDependencyAssetEventArgs.ConfigAssetName     = e.ConfigAssetName;
            loadConfigDependencyAssetEventArgs.DependencyAssetName = e.DependencyAssetName;
            loadConfigDependencyAssetEventArgs.LoadedCount         = e.LoadedCount;
            loadConfigDependencyAssetEventArgs.TotalCount          = e.TotalCount;
            loadConfigDependencyAssetEventArgs.UserData            = loadConfigInfo.UserData;
            return(loadConfigDependencyAssetEventArgs);
        }
        /// <summary>
        /// 填充加载配置成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置成功事件。</returns>
        public LoadConfigSuccessEventArgs Fill(GameFramework.Config.LoadConfigSuccessEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName      = loadConfigInfo.ConfigName;
            ConfigAssetName = e.ConfigAssetName;
            LoadType        = e.LoadType;
            Duration        = e.Duration;
            UserData        = loadConfigInfo.UserData;

            ReferencePool.Release(loadConfigInfo);
            return(this);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 填充加载配置失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置失败事件。</returns>
        public LoadConfigFailureEventArgs Fill(GameFramework.Config.LoadConfigFailureEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName      = loadConfigInfo.ConfigName;
            ConfigAssetName = e.ConfigAssetName;
            LoadType        = e.LoadType;
            ErrorMessage    = e.ErrorMessage;
            UserData        = loadConfigInfo.UserData;

            ReferencePool.Release(loadConfigInfo);
            return(this);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 填充加载配置时加载依赖资源事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载配置时加载依赖资源事件。</returns>
        public LoadConfigDependencyAssetEventArgs Fill(GameFramework.Config.LoadConfigDependencyAssetEventArgs e)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)e.UserData;

            ConfigName          = loadConfigInfo.ConfigName;
            ConfigAssetName     = e.ConfigAssetName;
            DependencyAssetName = e.DependencyAssetName;
            LoadedCount         = e.LoadedCount;
            TotalCount          = e.TotalCount;
            UserData            = loadConfigInfo.UserData;

            return(this);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 加载配置。
        /// </summary>
        /// <param name="configAsset">配置资源。</param>
        /// <param name="loadType">配置加载方式。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>是否加载成功。</returns>
        public bool LoadConfig(object configAsset, LoadType loadType, object userData)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)userData;

            return(LoadConfig(loadConfigInfo.ConfigName, configAsset, loadType, loadConfigInfo.UserData));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 加载全局配置。
        /// </summary>
        /// <param name="configAssetName">全局配置资源名称。</param>
        /// <param name="configObject">全局配置对象。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>是否加载成功。</returns>
        public bool LoadConfig(string configAssetName, object configObject, object userData)
        {
            LoadConfigInfo loadConfigInfo = (LoadConfigInfo)userData;

            return(LoadConfig(loadConfigInfo.ConfigName, configAssetName, configObject, loadConfigInfo.UserData));
        }