/// <summary>
        /// 创建加载数据表失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的加载数据表失败事件。</returns>
        public static LoadDataTableFailureEventArgs Create(GameFramework.DataTable.LoadDataTableFailureEventArgs e)
        {
            LoadDataTableInfo             loadDataTableInfo             = (LoadDataTableInfo)e.UserData;
            LoadDataTableFailureEventArgs loadDataTableFailureEventArgs = ReferencePool.Acquire <LoadDataTableFailureEventArgs>();

            loadDataTableFailureEventArgs.DataRowType        = loadDataTableInfo.DataRowType;
            loadDataTableFailureEventArgs.DataTableName      = loadDataTableInfo.DataTableName;
            loadDataTableFailureEventArgs.DataTableAssetName = e.DataTableAssetName;
            loadDataTableFailureEventArgs.LoadType           = e.LoadType;
            loadDataTableFailureEventArgs.ErrorMessage       = e.ErrorMessage;
            loadDataTableFailureEventArgs.UserData           = loadDataTableInfo.UserData;
            ReferencePool.Release(loadDataTableInfo);
            return(loadDataTableFailureEventArgs);
        }
        /// <summary>
        /// 填充加载数据表失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>加载数据表失败事件。</returns>
        public LoadDataTableFailureEventArgs Fill(GameFramework.DataTable.LoadDataTableFailureEventArgs e)
        {
            LoadDataTableInfo loadDataTableInfo = (LoadDataTableInfo)e.UserData;

            DataRowType        = loadDataTableInfo.DataRowType;
            DataTableName      = loadDataTableInfo.DataTableName;
            DataTableAssetName = e.DataTableAssetName;
            LoadType           = e.LoadType;
            ErrorMessage       = e.ErrorMessage;
            UserData           = loadDataTableInfo.UserData;

            ReferencePool.Release(loadDataTableInfo);
            return(this);
        }
Пример #3
0
        /// <summary>
        /// 加载数据表。
        /// </summary>
        /// <param name="dataRowType">数据表行的类型。</param>
        /// <param name="dataTableName">数据表名称。</param>
        /// <param name="dataTableNameInType">数据表类型下的名称。</param>
        /// <param name="dataTableAssetName">数据表资源名称。</param>
        /// <param name="loadType">数据表加载方式。</param>
        /// <param name="priority">加载数据表资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadDataTable(Type dataRowType, string dataTableName, string dataTableNameInType, string dataTableAssetName, LoadType loadType, int priority, object userData)
        {
            if (dataRowType == null)
            {
                Log.Error("Data row type is invalid.");
                return;
            }

            if (string.IsNullOrEmpty(dataTableName))
            {
                Log.Error("Data table name is invalid.");
                return;
            }

            m_DataTableManager.LoadDataTable(dataTableAssetName, loadType, priority, LoadDataTableInfo.Create(dataRowType, dataTableName, dataTableNameInType, userData));
        }
        /// <summary>
        /// 加载数据表。
        /// </summary>
        /// <param name="dataRowType">数据表行的类型。</param>
        /// <param name="dataTableName">数据表名称。</param>
        /// <param name="dataTableNameInType">数据表类型下的名称。</param>
        /// <param name="dataTableAssetName">数据表资源名称。</param>
        /// <param name="loadType">数据表加载方式。</param>
        /// <param name="priority">加载数据表资源的优先级。</param>
        /// <param name="userData">用户自定义数据。</param>
        public void LoadDataTable(Type dataRowType, string dataTableName, string dataTableNameInType, string dataTableAssetName, LoadType loadType, int priority, object userData)
        {
            if (dataRowType == null)
            {
                Log.Error("Data row type is invalid.");
                return;
            }

            if (string.IsNullOrEmpty(dataTableName))
            {
                Log.Error("Data table name is invalid.");
                return;
            }

            LoadDataTableInfo loadDataTableInfo = ReferencePool.Acquire <LoadDataTableInfo>();

            loadDataTableInfo.Initialize(dataRowType, dataTableName, dataTableNameInType, userData);
            m_DataTableManager.LoadDataTable(dataTableAssetName, loadType, priority, loadDataTableInfo);
        }
        /// <summary>
        /// 加载数据表。
        /// </summary>
        /// <param name="dataTableAssetName">数据表资源名称。</param>
        /// <param name="dataTableObject">数据表对象。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>是否加载成功。</returns>
        public bool LoadDataTable(string dataTableAssetName, object dataTableObject, object userData)
        {
            LoadDataTableInfo loadDataTableInfo = (LoadDataTableInfo)userData;

            return(LoadDataTable(loadDataTableInfo.DataRowType, loadDataTableInfo.DataTableName, loadDataTableInfo.DataTableNameInType, dataTableAssetName, dataTableObject, loadDataTableInfo.UserData));
        }
Пример #6
0
        /// <summary>
        /// 加载数据表。
        /// </summary>
        /// <param name="dataTableAsset">数据表资源。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>加载是否成功。</returns>
        public bool LoadDataTable(object dataTableAsset, object userData)
        {
            LoadDataTableInfo loadDataTableInfo = userData as LoadDataTableInfo;

            return(LoadDataTable(loadDataTableInfo.DataTableName, loadDataTableInfo.DataTableType, loadDataTableInfo.DataTableNameInType, dataTableAsset, loadDataTableInfo.UserData));
        }