private void DrawExcelAnalyse() { if (excelState >= ExcelState.Analysing) { if (excelState == ExcelState.Analysing) { excelColumnCheckLog = ExcelManager.CheckExcel(excelPath); excelState = ExcelState.ExcelChecked; } EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); if (excelColumnCheckLog != "") { EditorGUILayout.LabelField(" ERROR: " + excelColumnCheckLog); } else if (excelState == ExcelState.ExcelChecked) { excelExampleHeaderSplit = ExcelManager.CSVSplit(ExcelManager.ReadOneLine(excelPath)); excelExampleColumnSplit = ExcelManager.CSVSplit(ExcelManager.ReadOneLine(excelPath, excelIgnoreHeaderLine)); excelState = ExcelState.HasReadFirstColumn; } if (excelState >= ExcelState.HasReadFirstColumn) { GUILayout.Label("Please define the header - Example column"); GUILayout.Space(5); //Header popups generieren int len = excelExampleColumnSplit.Length; if (excelState == ExcelState.HasReadFirstColumn) { headerPopupSelectedIndex.Clear(); for (int i = 0; i < len; i++) { if (i == 0) { headerPopupSelectedIndex.Add(1); } else if (i == 1) { headerPopupSelectedIndex.Add(2); } else { headerPopupSelectedIndex.Add(0); } } headerPopupList.Clear(); headerPopupList.Add("None"); headerPopupList.Add("Category"); headerPopupList.Add("Tag"); foreach (string language in Enum.GetNames(typeof(Languages))) { headerPopupList.Add(language); } //Header Tags vorbelegen, wenn category, tag oder eine vergebene Sprache gefunden wird for (int i = 0; i < excelExampleHeaderSplit.Length; i++) { if (excelExampleHeaderSplit[i].Equals("Category", StringComparison.CurrentCultureIgnoreCase) || excelExampleHeaderSplit[i].Equals("Categories", StringComparison.CurrentCultureIgnoreCase)) { headerPopupSelectedIndex[i] = 1; } if (excelExampleHeaderSplit[i].Equals("Tag", StringComparison.CurrentCultureIgnoreCase) || excelExampleHeaderSplit[i].Equals("Tags", StringComparison.CurrentCultureIgnoreCase)) { headerPopupSelectedIndex[i] = 2; } if (Enum.IsDefined(typeof(Languages), excelExampleHeaderSplit[i])) { headerPopupSelectedIndex[i] = (int)Enum.Parse(typeof(Languages), excelExampleHeaderSplit[i]) + 3; } } excelState = ExcelState.HasFilledHeaderList; } //Draw Header wenn gewünscht if (excelIgnoreHeaderLine) { GUILayout.BeginHorizontal(); for (int i = 0; i < len; i++) { GUILayout.Space(10); if (headerPopupSelectedIndex[i] == 0) { GUI.enabled = false; } EditorGUILayout.LabelField(excelExampleHeaderSplit[i], GUILayout.Width(position.width / len - 14)); GUI.enabled = true; } GUILayout.EndHorizontal(); } //Draw Popups für jede Spalte GUILayout.BeginHorizontal(); for (int i = 0; i < len; i++) { headerPopupSelectedIndex[i] = EditorGUILayout.Popup(headerPopupSelectedIndex[i], headerPopupList.ToArray(), GUILayout.Width(position.width / len - 4)); } GUILayout.EndHorizontal(); //Draw Example Zeile GUILayout.BeginHorizontal(); for (int i = 0; i < len; i++) { GUILayout.Space(10); if (headerPopupSelectedIndex[i] == 0) { GUI.enabled = false; } EditorGUILayout.LabelField(excelExampleColumnSplit[i], GUILayout.Width(position.width / len - 14)); GUI.enabled = true; } GUILayout.EndHorizontal(); if (CheckExcelHeaderTags()) { if (excelState != ExcelState.IsTagged) { excelState = ExcelState.IsTagged; } } else { excelState = ExcelState.HasFilledHeaderList; } } } }