using UnityEditor; using System.IO; using UnityEngine; using BF; namespace BFEditor { public static class OtherToolsMenu { [MenuItem("其他工具/账号/创建新号", false, 1)] static public void ClearAccount() { BFLog.Log("创建新号 success!"); LocalData.SetInt("ACCOUNT", Random.Range(100000, 999999)); } [MenuItem("其他工具/账号/切换账号", false, 2)] static public void SelectAccont() { var window = (SelectAccontWindow)EditorWindow.GetWindowWithRect(typeof(SelectAccontWindow), new Rect(Screen.width / 2, Screen.height / 2, 520, 750)); window.Show(); } [MenuItem("其他工具/账号/清除数据", false, 3)] static public void ClearGameData() { PlayerPrefs.DeleteAll(); BFLog.Log("清除数据成功 success!"); } [MenuItem("其他工具/一键导表", false, 3)] public static void ExportExcel() { var designExcelPath = ExportExcelTools.GetDesignExcelPath(); if (string.IsNullOrEmpty(designExcelPath) || !Directory.Exists(designExcelPath)) { OpenClientExcelWindow(); return; } var luaPath = Path.Combine(Application.dataPath, "Developer/lua/main.lua").Replace("\\", "/"); var isDev = File.Exists(luaPath); EditorUtility.DisplayProgressBar("提示", "导表中", 1.0f); bool succ = ExportExcelTools.FastExportExcelToLua(isDev, designExcelPath); EditorUtility.ClearProgressBar(); if (succ) { EditorUtility.DisplayDialog("成功", "导出成功!", "ok"); } else { EditorUtility.DisplayDialog("失败", "导出失败!", "ok"); } } [MenuItem("其他工具/打开导表窗口", false, 4)] public static void OpenClientExcelWindow() { var window = (ExportExcelWindow)EditorWindow.GetWindowWithRect(typeof(ExportExcelWindow), new Rect(Screen.width / 2, Screen.height / 2, 500, 120), true); window.Show(); } [MenuItem("其他工具/生成pb配置", false, 5)] static private void SetProtoGitPath() { SetProtoPathWindow.Init(); } [MenuItem("其他工具/打开设置窗口", false, 6)] static void OpenGameSettingMenu() { GameSettingWindow.ShowWindow(); } [MenuItem("其他工具/批量大写转小写", false, 7)] public static void OpenToggleCaseWindow() { var window = (ToggleCaseWindow)EditorWindow.GetWindowWithRect(typeof(ToggleCaseWindow), new Rect(Screen.width / 2, Screen.height / 2, 500, 120), true); window.Show(); } [MenuItem("其他工具/截图", false, 8)] public static void CaptureScreenshot() { var desktopDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); var path = System.IO.Path.Combine(desktopDir, "dz_screenshot_"); int index = 0; while(true) { var screenshotPath = path + index.ToString() + ".png"; if (!File.Exists(screenshotPath)) { UnityEngine.ScreenCapture.CaptureScreenshot(screenshotPath, 1); break; } index++; } } [MenuItem("其他工具/棋盘编辑器", false, 9)] public static void CreateBoardEditorWindow() { var window = (BoardEditorWindow)EditorWindow.GetWindowWithRect(typeof(BoardEditorWindow), new Rect(Screen.width / 2, Screen.height / 2, 1200, 1000), true); window.Show(); } } }