UxmlDefine.cs 998 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #if UNITY_2020_3_OR_NEWER
  2. using System;
  3. using UnityEditor;
  4. using UnityEngine;
  5. using UnityEditor.UIElements;
  6. using UnityEngine.UIElements;
  7. namespace YooAsset.Editor
  8. {
  9. /// <summary>
  10. /// 分屏控件
  11. /// </summary>
  12. public class SplitView : TwoPaneSplitView
  13. {
  14. public new class UxmlFactory : UxmlFactory<SplitView, TwoPaneSplitView.UxmlTraits>
  15. {
  16. }
  17. /// <summary>
  18. /// 窗口分屏适配
  19. /// </summary>
  20. public static void Adjuster(VisualElement root)
  21. {
  22. var topGroup = root.Q<VisualElement>("TopGroup");
  23. var bottomGroup = root.Q<VisualElement>("BottomGroup");
  24. topGroup.style.minHeight = 100f;
  25. bottomGroup.style.minHeight = 100f;
  26. root.Remove(topGroup);
  27. root.Remove(bottomGroup);
  28. var spliteView = new SplitView();
  29. spliteView.fixedPaneInitialDimension = 300;
  30. spliteView.orientation = TwoPaneSplitViewOrientation.Vertical;
  31. spliteView.contentContainer.Add(topGroup);
  32. spliteView.contentContainer.Add(bottomGroup);
  33. root.Add(spliteView);
  34. }
  35. }
  36. }
  37. #endif