public static void LoadDataTable(this DataTableComponent dataTableComponent, string dataTableName, string dataTableAssetName, object userData) { if (string.IsNullOrEmpty(dataTableName)) { Log.Warning("Data table name is invalid."); return; } string[] splitedNames = dataTableName.Split('_'); if (splitedNames.Length > 2) { Log.Warning("Data table name is invalid."); return; } string dataRowClassName = DataRowClassPrefixName + splitedNames[0]; Type dataRowType = Type.GetType(dataRowClassName); if (dataRowType == null) { Log.Warning("Can not get data row type with class name '{0}'.", dataRowClassName); return; } string name = splitedNames.Length > 1 ? splitedNames[1] : null; DataTableBase dataTable = dataTableComponent.CreateDataTable(dataRowType, name); dataTable.ReadData(dataTableAssetName, Constant.AssetPriority.DataTableAsset, userData); }
protected override bool LoadDataTable(Type dataRowType, string dataTableName, string dataTableNameInType, object dataTableAsset, object userData) { TextAsset textAsset = dataTableAsset as TextAsset; if (textAsset == null) { Log.Warning("Data table asset '{0}' is invalid.", dataTableName); return(false); } if (dataRowType == null) { Log.Warning("Data row type is invalid."); return(false); } m_DataTableComponent.CreateDataTable(dataRowType, dataTableNameInType, textAsset.text); return(true); }