NLDClient-yudde/ProjectNLD/Assets/Editor/Tools/AutoConfig/ConfigTools.cs

89 lines
2.5 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
//////////////////////////////////////////////////////////////////////////
//
// 文件Assets/Editor/Tools/ConfigTools.cs
// 作者Xoen Xie
// 时间2023/07/25
// 描述Config tools
// 说明:
//
//////////////////////////////////////////////////////////////////////////
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Xml;
using System.Text;
using System.Diagnostics;
using System;
using AutoConfig;
using Cysharp.Threading.Tasks;
public static class ConfigTools
{
2024-12-26 16:09:14 +08:00
public static string CONFIG_DIR = Application.dataPath + "/../../../NLDMisc/config/Datas";
2023-08-22 19:08:45 +08:00
#if UNITY_EDITOR_OSX
//static string PYTHON_NAME = "python3";
static string CMD_NAME = "sh";
static string CMD_PARAM = "mac_client_export.sh " + Application.dataPath;
#elif UNITY_EDITOR_WIN
//static string PYTHON_NAME = "python";
static string CMD_NAME = "cmd.exe";
static string CMD_PARAM = "gen_code_json.bat";
#endif
public static void ConfigExportClient()
{
EditorUtility.DisplayProgressBar("配置工具", "正在导出配置到【Client】", 0);
try
{
2023-10-23 16:54:35 +08:00
// VersionControlSystem.Checkout(Application.dataPath + "/Code/Scripts/Gameplay/DataTable");
// VersionControlSystem.Checkout(Application.dataPath + "/Config/Data");
2023-08-22 19:08:45 +08:00
#if UNITY_EDITOR_WIN
var dirInfo = new DirectoryInfo(CONFIG_DIR);
EditorUtil.StartProcess(dirInfo.FullName + CMD_PARAM, Application.dataPath, CONFIG_DIR);
#else
EditorUtil.StartProcess(CMD_NAME, CMD_PARAM, CONFIG_DIR);
#endif
AssetDatabase.Refresh();
}
catch (Exception e)
{
UnityEngine.Debug.LogError("出现异常message=" + e.Message + "\n,trace=" + e.StackTrace);
}
EditorUtility.ClearProgressBar();
UnityEngine.Debug.Log("导出完成");
}
public static void ConfigExportServer()
{
EditorUtility.DisplayProgressBar("配置工具", "正在导出配置到【Server】", 0);
try
{
EditorUtil.StartProcess(CMD_NAME, "mac_server_export.sh", CONFIG_DIR);
}
catch (Exception e)
{
UnityEngine.Debug.LogError("出现异常message=" + e.Message + "\n,trace=" + e.StackTrace);
}
EditorUtility.ClearProgressBar();
UnityEngine.Debug.Log("导出完成");
}
2025-02-27 13:31:47 +08:00
[MenuItem("Tools/*配置工具/数据导出工具 _F7", false, (int)NLDMenuID.ConfigExport)]
2024-12-25 15:24:02 +08:00
public static void ConfigExport()
2023-08-22 19:08:45 +08:00
{
ConfigWindow.ShowWindow();
}
2024-12-25 15:24:02 +08:00
2023-08-22 19:08:45 +08:00
}