String2MD5Window.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. using System;
  6. using HDJ.Framework.Utils;
  7. public class String2MD5Window : EditorWindow
  8. {
  9. [MenuItem("Window/String转MD5(1003)", priority = 1003)]
  10. private static void OpenWindow()
  11. {
  12. String2MD5Window win = GetWindow<String2MD5Window>();
  13. win.autoRepaintOnSceneChange = true;
  14. win.wantsMouseMove = true;
  15. EditorWindow.FocusWindowIfItsOpen<String2MD5Window>();
  16. win.Init();
  17. }
  18. private void Init()
  19. {
  20. }
  21. string inputText = "";
  22. string resText = "";
  23. private void OnGUI()
  24. {
  25. GUILayout.FlexibleSpace();
  26. GUILayout.Space(5);
  27. GUILayout.BeginHorizontal();
  28. inputText = EditorDrawGUIUtil.DrawBaseValue("输入字符串:", inputText).ToString();
  29. if (GUILayout.Button("转换"))
  30. {
  31. resText= MD5Utils.GetObjectMD5(inputText);
  32. }
  33. GUILayout.EndHorizontal();
  34. EditorDrawGUIUtil.DrawBaseValue("MD5:", resText);
  35. GUILayout.FlexibleSpace();
  36. }
  37. }