public static void ImportGameLevels() { string path = EditorUtility.OpenFilePanel("Import Game Levels", "", "xls"); if (string.IsNullOrEmpty(path)) { return; } using (Stream reader = File.OpenRead(path)) { IDictionary <string, PropertyInfo> customPossibleProperties = ExportData.GetCustomPossibleProperties( TypeHelper.GetAllTypes(AllTypeCategory.Game) .Where(type => typeof(GameLevelInfo).IsAssignableFrom(type)) .ToArray()); Dictionary <string, Type> parameters = new Dictionary <string, Type>(); parameters["Id"] = typeof(string); //parameters["Scene"] = typeof(string); //parameters["DisplayName"] = typeof(string); parameters["Name"] = typeof(string); foreach (KeyValuePair <string, PropertyInfo> pair in customPossibleProperties) { parameters[pair.Key] = pair.Value.PropertyType; } HSSFWorkbook workbook = new HSSFWorkbook(reader); ExportData exportData = ExportData.DeserializeFromSheet(parameters, workbook.GetSheetAt(0)); foreach (ExportRow exportRow in exportData.ExportRows) { if (!exportRow.ContainsParameter("Id")) { continue; } string id = (string)exportRow.GetValue("Id").Value; if (!InfoResolver.Resolve <FortInfo>().GameLevel.GameLevelInfos.ContainsKey(id)) { continue; } GameLevelInfo gameLevelInfo = InfoResolver.Resolve <FortInfo>().GameLevel.GameLevelInfos[id]; if (exportRow.ContainsParameter("Scene")) { /* gameLevelInfo.Scene = new FortScene(); * gameLevelInfo.Scene.SceneName = (string)exportRow.GetValue("Scene").Value;*/ } /* if (exportRow.ContainsParameter("DisplayName")) * { * gameLevelInfo.DisplayName = (string)exportRow.GetValue("DisplayName").Value; * }*/ if (exportRow.ContainsParameter("Name")) { gameLevelInfo.Name = (string)exportRow.GetValue("Name").Value; } exportRow.FillCustomExportParameter(gameLevelInfo); } } InfoResolver.Resolve <FortInfo>().Save(); }