コード例 #1
0
    void OnGUI()
    {
        CheckData();

        //
        EditorGUILayout.BeginHorizontal("HelpBox");

        EditorGUILayout.LabelField("ConfigPath:", GUILayout.Width(120));
        EditorGUILayout.LabelField(configPath);


        if (GUILayout.Button("NPOI", GUILayout.Width(BUTTON_WIDTH)))
        {
            DirectoryInfo dir = new DirectoryInfo(configPath);
            if (!dir.Exists)
            {
                EditorUtility.DisplayDialog("error", "find not directory", "ok");
                return;
            }

            FileInfo[] fileInfos = dir.GetFiles();
            foreach (FileInfo fileInfo in fileInfos)
            {
                if (!ExcelTool.ExcelToLuaTableNPOT(fileInfo.FullName, savePath + ""))
                {
                    continue;
                }
            }
        }

        if (GUILayout.Button("Kiang", GUILayout.Width(BUTTON_WIDTH)))
        {
            DirectoryInfo dir = new DirectoryInfo(configPath);
            if (!dir.Exists)
            {
                EditorUtility.DisplayDialog("error", "find not directory", "ok");
                return;
            }

            FileInfo[] fileInfos = dir.GetFiles();
            foreach (FileInfo fileInfo in fileInfos)
            {
                if (!ExcelTool.ExcelToLuaTableNPOTKiang(fileInfo.FullName, savePath + ""))
                {
                    continue;
                }
            }
        }

        if (GUILayout.Button("Select", GUILayout.Width(BUTTON_WIDTH)))
        {
            string path = EditorUtility.SaveFolderPanel("SelectConfigPath", configPath, string.Empty);
            if (!path.Equals(string.Empty))
            {
                configPath = configBuilderData.ConfigPath = path;
                SaveConfigData();
            }
        }
        if (GUILayout.Button("Open", GUILayout.Width(BUTTON_WIDTH)))
        {
            System.Diagnostics.Process.Start("explorer.exe", configPath.Replace("/", "\\"));
        }
        //if (GUILayout.Button("EPPlus", GUILayout.Width(BUTTON_WIDTH)))
        //{
        //    DirectoryInfo dir = new DirectoryInfo(configPath);
        //    if (!dir.Exists)
        //    {
        //        EditorUtility.DisplayDialog("error", "find not directory", "ok");
        //        return;
        //    }

        //    FileInfo[] fileInfos = dir.GetFiles();
        //    foreach (FileInfo fileInfo in fileInfos)
        //    {
        //        if (!ExcelTool.ExcelToLuaTableEPPlus(fileInfo.FullName, savePath+ "/EPPlus"))
        //        {
        //            continue;
        //        }
        //    }
        //}

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal("HelpBox");
        EditorGUILayout.LabelField("SavePath:", GUILayout.Width(120));
        EditorGUILayout.LabelField(savePath);
        if (GUILayout.Button("Select", GUILayout.Width(BUTTON_WIDTH)))
        {
            string path = EditorUtility.SaveFolderPanel("SelectSavePath", savePath, string.Empty);
            if (!path.Equals(string.Empty))
            {
                savePath = configBuilderData.SavePath = path;
                SaveConfigData();
            }
        }
        if (GUILayout.Button("Open", GUILayout.Width(BUTTON_WIDTH)))
        {
            System.Diagnostics.Process.Start("explorer.exe", savePath.Replace("/", "\\"));
        }
        EditorGUILayout.EndHorizontal();
    }