直接来,1个脚本

using System.Collections;

using System.Collections.Generic;

using System.Diagnostics;

using UnityEditor;

using Debug = UnityEngine.Debug;

public class Excel2LuaEditor : EditorWindow

{

[MenuItem("工具/生成Lua Card")]

static void GenLuaCard()

{

Debug.Log("生成卡牌 Lua");

ProcessCommand(@"D:\UnitySSDProject\GameTRPG\GameTRPG\工具\Excel2Lua\Excel2Lua\Lua生成器\cardexe\bin\Excel2Lua.exe", null);

}

[MenuItem("工具/生成Lua Buff")]

static void GenLuaBuff()

{

Debug.Log("生成Buff Lua");

ProcessCommand(@"D:\UnitySSDProject\GameTRPG\GameTRPG\工具\Excel2Lua\Excel2Lua\Lua生成器\buffexe\bin\Excel2Lua.exe", null);

}

private static void ProcessCommand(string command, string argument){

ProcessStartInfo start = new ProcessStartInfo(command);

start.Arguments = argument;

start.CreateNoWindow = false;

start.ErrorDialog = true;

start.UseShellExecute = true;

if(start.UseShellExecute){

start.RedirectStandardOutput = false;

start.RedirectStandardError = false;

start.RedirectStandardInput = false;

} else{

start.RedirectStandardOutput = true;

start.RedirectStandardError = true;

start.RedirectStandardInput = true;

start.StandardOutputEncoding = System.Text.UTF8Encoding.UTF8;

start.StandardErrorEncoding = System.Text.UTF8Encoding.UTF8;

}

Process p = Process.Start(start);

if(!start.UseShellExecute){

Debug.Log(p.StandardOutput);

Debug.Log(p.StandardError);

}

p.WaitForExit();

p.Close();

}

}

 

打开文件夹

[MenuItem("工具/打开Excel文件夹")]

static void OpenFolder()

{

string path = @"D:\UnitySSDProject\GameTRPG\GameTRPG\Assets\StreamingAssets\Excel\COC7th";

System.Diagnostics.Process.Start("explorer.exe", path);

}

 

 

参考资料:

https://www.jianshu.com/p/3f4120a7c7f6

好文阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。