LubanTools.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using UnityEditor;
  5. using UnityEngine;
  6. namespace YIUI.Luban.Editor
  7. {
  8. public partial class LubanTools
  9. {
  10. public static Action CloseWindow;
  11. public static Action CloseWindowRefresh;
  12. private void OnGUI()
  13. {
  14. if (!GenPackageExists())
  15. {
  16. if (GUILayout.Button("创建 LubanGen包", GUILayout.Height(50)))
  17. {
  18. InitGen();
  19. }
  20. }
  21. else
  22. {
  23. OnGUITools();
  24. }
  25. }
  26. private void OnGUITools()
  27. {
  28. if (GUILayout.Button("Luban 官方文档"))
  29. {
  30. Application.OpenURL("https://luban.doc.code-philosophy.com/docs/intro");
  31. }
  32. if (GUILayout.Button("Luban YIUI文档"))
  33. {
  34. Application.OpenURL("https://lib9kmxvq7k.feishu.cn/wiki/W1ylwC9xDip1YQk4eijcxgO9nh0");
  35. }
  36. GUILayout.Space(10);
  37. if (GUILayout.Button("导出", GUILayout.ExpandWidth(true), GUILayout.Height(50)))
  38. {
  39. LubanGen();
  40. }
  41. if (GUILayout.Button("仅生成Conf", GUILayout.ExpandWidth(true), GUILayout.Height(30)))
  42. {
  43. var result = CreateLubanConf();
  44. UnityTipsHelper.Show($"Luban生成Conf {(result ? "成功" : "失败")}");
  45. }
  46. GUILayout.Space(10);
  47. EditorGUILayout.LabelField("选择目标ET包文件夹 创建配置模版");
  48. if (GUILayout.Button("创建模版", GUILayout.Height(50)))
  49. {
  50. var folderPath = EditorUtility.OpenFolderPanel("选择 ET包", "", "");
  51. if (!string.IsNullOrEmpty(folderPath))
  52. {
  53. CreateToPackage(folderPath);
  54. }
  55. }
  56. GUILayout.Space(20);
  57. if (DemoPackageExists())
  58. {
  59. if (GUILayout.Button("删除 LubanDemo包", GUILayout.Height(50)))
  60. {
  61. DeleteLubanDemoPackage();
  62. }
  63. }
  64. else
  65. {
  66. if (GUILayout.Button("创建 LubanDemo包", GUILayout.Height(50)))
  67. {
  68. CreateLubanDemoPackage();
  69. }
  70. }
  71. if (GUILayout.Button("替换 ET.Excel To Luban", GUILayout.Height(30)))
  72. {
  73. if (ReplaceAll(true))
  74. {
  75. CloseWindowRefresh?.Invoke();
  76. }
  77. }
  78. if (GUILayout.Button("同步覆盖 LoaderInvoker", GUILayout.Height(30)))
  79. {
  80. SyncInvoke();
  81. }
  82. }
  83. }
  84. }