A game about forced loneliness, made by TACStudios
1using UnityEditor; 2using UnityEngine; 3using UnityEvent = UnityEngine.Event; 4 5namespace Unity.VisualScripting 6{ 7 public static class BoltGUI 8 { 9 private static UnityEvent e => UnityEvent.current; 10 11 public static float GetVariableFieldHeight(GUIContent label, string value, ActionDirection direction) 12 { 13 return EditorGUIUtility.singleLineHeight; 14 } 15 16 public static string VariableField(Rect position, GUIContent label, string value, ActionDirection direction) 17 { 18 position = EditorGUI.PrefixLabel(position, label); 19 var style = direction != ActionDirection.Any ? BoltStyles.variableFieldWithDirectionIndicator : BoltStyles.variableFieldWithoutDirectionIndicator; 20 value = EditorGUI.TextField(position, GUIContent.none, value, style); 21 22 var iconPosition = new Rect 23 ( 24 position.x + 3, 25 position.y + 2, 26 12, 27 12 28 ); 29 30 GUI.DrawTexture(iconPosition, BoltCore.Icons.variable?[IconSize.Small]); 31 32 if (direction != ActionDirection.Any) 33 { 34 var arrowPosition = new Rect 35 ( 36 iconPosition.xMax + (direction == ActionDirection.Get ? 12 : -2), 37 position.y + 2, 38 12 * (direction == ActionDirection.Get ? -1 : 1), 39 12 40 ); 41 42 if (e.type == EventType.Repaint) 43 { 44 BoltStyles.variableFieldDirectionIndicator.Draw(arrowPosition, false, false, false, false); 45 } 46 } 47 48 return value; 49 } 50 } 51}