/// <summary> /// Create the specified type, ignores and joinType. /// </summary> /// <param name="type">Type.</param> /// <param name="ignores">Ignores.</param> /// <param name="joinType">Join type.</param> public void Create (JsonImportType type, string[] ignores = null, TResultDelegate<Type> joinType = null) { book = FileStream (); if (book == null) { return; } if (book.NumberOfSheets <= 0) { Debug.LogWarning ("No sheet."); return; } index = 0; listExcel = new List<ExcelData> (); if (type == JsonImportType.NORMAL) { EditorUtil.StartCoroutine (CreateExcelData (delegate() { if (listExcel.Count <= 0) { Debug.LogWarning ("No data on the sheet."); ClearProgressBar (); return; } if (ignores != null) { listExcel.RemoveAll (x => ignores.Contains (x.sheetName)); } index = 0; EditorUtil.StartCoroutine (CreateNormalJson ()); })); } else { this.joinType = joinType; EditorUtil.StartCoroutine (CreateExcelData (delegate() { if (listExcel.Count <= 0) { Debug.LogWarning ("No data on the sheet."); ClearProgressBar (); return; } listType = new List<Type> (); Type[] types = Reflection.GetExecutingAssembly (); for (int i = 0; i < types.Length; i++) { ExcelAttribute excel = types [i].GetAttributeValue<ExcelAttribute> (); if (excel == null || excel.CreateFileName == "") { continue; } listType.Add (types [i]); } if (listType.Count <= 0) { Debug.LogWarning ("No class is set to Excel Attribute."); ClearProgressBar (); return; } index = 0; EditorUtil.StartCoroutine (CreateAttributeJson ()); })); } }
/// <summary> /// Create the specified type, ignores and joinType. /// </summary> /// <param name="type">Type.</param> /// <param name="ignores">Ignores.</param> /// <param name="joinType">Join type.</param> public void Create(JsonImportType type, string[] ignores = null, TResultDelegate <Type> joinType = null) { book = FileStream(); if (book == null) { return; } if (book.NumberOfSheets <= 0) { Debug.LogWarning("No sheet."); return; } index = 0; listExcel = new List <ExcelData> (); if (type == JsonImportType.NORMAL) { EditorUtil.StartCoroutine(CreateExcelData(delegate() { if (listExcel.Count <= 0) { Debug.LogWarning("No data on the sheet."); ClearProgressBar(); return; } if (ignores != null) { listExcel.RemoveAll(x => ignores.Contains(x.sheetName)); } index = 0; EditorUtil.StartCoroutine(CreateNormalJson()); })); } else { this.joinType = joinType; EditorUtil.StartCoroutine(CreateExcelData(delegate() { if (listExcel.Count <= 0) { Debug.LogWarning("No data on the sheet."); ClearProgressBar(); return; } listType = new List <Type> (); Type[] types = Reflection.GetExecutingAssembly(); for (int i = 0; i < types.Length; i++) { ExcelAttribute excel = types [i].GetAttributeValue <ExcelAttribute> (); if (excel == null || excel.CreateFileName == "") { continue; } listType.Add(types [i]); } if (listType.Count <= 0) { Debug.LogWarning("No class is set to Excel Attribute."); ClearProgressBar(); return; } index = 0; EditorUtil.StartCoroutine(CreateAttributeJson()); })); } }