void OnGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.BeginScrollView(new Vector2(1000, 1000)); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("open table", GUILayout.Width(120), GUILayout.Height(30))) { InitTable(); } GUILayout.Space(10); if (GUILayout.Button("save table", GUILayout.Width(120), GUILayout.Height(30))) { Save(); } GUILayout.Space(10); if (GUILayout.Button("export cs", GUILayout.Width(120), GUILayout.Height(30))) { TableExportCs.ExportCs(_targetPath); } GUILayout.Space(10); if (GUILayout.Button("generate byte", GUILayout.Width(120), GUILayout.Height(30))) { TableExportByte.ExportByte(_targetPath); } EditorGUILayout.EndHorizontal(); var count = _colDict.Count; for (var i = 0; i < count; i++) { GUILayout.Space(6); GUILayout.Label("==================================="); GUILayout.Space(6); EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(10)); GUILayout.Label(_colDict[i].Key, GUILayout.Width(150)); int index = EditorGUILayout.Popup((int)_colDict[i].Value, _tableTypeOptions, GUILayout.Width(150)); if ((int)_colDict[i].Value != index) { _colDict[i] = new KeyValuePair <string, TableFiledType>(_colDict[i].Key, (TableFiledType)index); _infoDict[2][i] = _colDict[i].Key + ":" + _colDict[i].Value.ToString(); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }
public static void ExportSelectCsharp() { string path = string.Empty; try { path = EditorUtility.OpenFilePanel("选择配置表", TableConfig.TablePath, "csv"); } catch (Exception e) { LogHelper.PrintWarning(e.ToString()); } if (string.IsNullOrEmpty(path)) { return; } TableExportCs.ExportCs(path); }