-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockGUI.cs
52 lines (43 loc) · 1.68 KB
/
DockGUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace DockGUI
{
public static class DockGUI
{
public const float REARRANGE_TAB_DISTANCE = 10.0f;
public const float WORLD_WINDOW_OFFSET_X = -3.0f;
public const float WORLD_WINDOW_OFFSET_Y = -22.0f;
public const float DOCK_LAYOUT_RATIO = 0.3f;
public static Vector2 WorldWindowOffset()
{
return new Vector2(WORLD_WINDOW_OFFSET_X, WORLD_WINDOW_OFFSET_Y);
}
public static VisualElement CreateVisualElement(params string[] styleClasses)
{
return CreateVisualElement(DockGUIStyles.DefaultStyle, styleClasses);
}
public static VisualElement CreateVisualElement(StyleSheet styleSheet, params string[] styleClasses)
{
VisualElement result = new VisualElement();
result.styleSheets.Add(styleSheet);
foreach (var styleClass in styleClasses)
{
result.AddToClassList(styleClass);
}
return result;
}
public static VisualElement CreateVisualElement(VisualElement parent, StyleSheet styleSheet, params string[] styleClasses)
{
VisualElement element = CreateVisualElement(styleSheet, styleClasses);
parent.Add(element);
return element;
}
public static VisualElement CreateVisualElement(VisualElement parent,
params string[] styleClasses)
{
return CreateVisualElement(parent, DockGUIStyles.DefaultStyle);
}
}
}