c1_unity/Assets/Editor/BFGameplayTools/TutorialTools/TutorialExcelPathWindow.cs
2023-04-03 11:04:31 +08:00

76 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using XLua;
using Debug = UnityEngine.Debug;
namespace BFEditor
{
public class TutorialExcelPathWindow : EditorWindow
{
private string designExcelPath = "";
private bool designSuccFlag = false;
private bool skillSpecialSuccFlag = false;
private bool isDev = false;
public TutorialExcelPathWindow()
{
this.titleContent = new GUIContent("引导文件");
}
void Awake()
{
var luaPath = Path.Combine(Application.dataPath, "Developer/lua/main.lua").Replace("\\", "/");
isDev = File.Exists(luaPath);
}
private void OnEnable()
{
designExcelPath = ExportExcelTools.GetDesignExcelPath();
}
private void OnGUI()
{
#region Excel路径
GUILayout.Space(18);
GUILayout.BeginHorizontal();
GUILayout.Label("选择excel路径");
GUILayout.TextField(designExcelPath, GUILayout.Width(300));
if (GUILayout.Button("选择", GUILayout.Width(80)))
{
string openPath = EditorUtility.OpenFolderPanel("select excel path", designExcelPath, "");
if (openPath.CompareTo("") != 0){
designExcelPath = openPath;
}
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
#endregion
#region lua
GUILayout.BeginHorizontal();
GUILayout.Space(150);
if (GUILayout.Button("打开引导编辑器", GUILayout.Width(200), GUILayout.Height(40)))
{
OnClickOpen();
}
GUILayout.EndHorizontal();
GUILayout.Space(30);
#endregion
}
private void OnClickOpen()
{
if (string.IsNullOrEmpty(designExcelPath) || !Directory.Exists(designExcelPath))
{
EditorUtility.DisplayDialog("错误", "excel路径不存在请先设置正确路径", "ok");
return;
}
ExportExcelTools.SetDesignExcelPath(designExcelPath);
TutorialConfigWindow window = (TutorialConfigWindow)EditorWindow.GetWindow<TutorialConfigWindow>("新手引导配置窗口");
window.Show();
}
}
}