Exemple #1
0
        /// <summary>
        /// 加载数据表
        /// </summary>
        /// <param name="dataTableComponent">数据表组件</param>
        /// <param name="dataTableName">数据表名字</param>
        /// <param name="userData">用户自定义数据</param>
        public static void LoadDataTable(this DataTableComponent dataTableComponent, string dataTableName, object userData = null)
        {
            if (string.IsNullOrEmpty(dataTableName))
            {
                Log.Warning("Data table name is invalid.");
                return;
            }

            string[] splitNames = dataTableName.Split('_');
            if (splitNames.Length > 2)
            {
                Log.Warning("Data table name is invalid.");
                return;
            }

            string dataRowClassName = DataRowClassPrefixName + splitNames[0];

            Type dataRowType = Type.GetType(dataRowClassName);

            if (dataRowType == null)
            {
                Log.Warning("Can not get data row type with class name '{0}'.", dataRowClassName);
                return;
            }

            string dataTableNameInType = splitNames.Length > 1 ? splitNames[1] : null;

            dataTableComponent.LoadDataTable(dataRowType, dataTableName, dataTableNameInType, AssetUtility.GetDataTableAsset(dataTableName), userData);
        }
 public LuaFileInfo(string luaName)
 {
     LuaName   = luaName;
     AssetName = AssetUtility.GetLuaAsset(luaName);
 }