A game about forced loneliness, made by TACStudios
1using UnityEngine; 2using UnityEditor; 3 4namespace UnityEditor.U2D.Common.Path.GUIFramework 5{ 6 /// <summary> 7 /// Represents transform data for a slider. 8 /// </summary> 9 /// <remarks> 10 /// Unity uses this data to position and orient the slider in the custom editor. 11 /// </remarks> 12 internal struct SliderData 13 { 14 /// <summary> 15 /// The slider's position. 16 /// </summary> 17 public Vector3 position; 18 /// <summary> 19 /// The slider's forward vector. 20 /// </summary> 21 public Vector3 forward; 22 /// <summary> 23 /// The slider's up vector. 24 /// </summary> 25 public Vector3 up; 26 /// <summary> 27 /// The slider's right vector. 28 /// </summary> 29 public Vector3 right; 30 31 /// <summary> 32 /// zero definition for SliderData 33 /// </summary> 34 public static readonly SliderData zero = new SliderData() { position = Vector3.zero, forward = Vector3.forward, up = Vector3.up, right = Vector3.right }; 35 } 36 37 /// <summary> 38 /// Interface for GUIStates 39 /// </summary> 40 internal interface IGUIState 41 { 42 /// <summary> 43 /// The mouse position. 44 /// </summary> 45 Vector2 mousePosition { get; } 46 /// <summary> 47 /// The mouse button pressed. 48 /// </summary> 49 int mouseButton { get; } 50 /// <summary> 51 /// The number of mouse clicks. 52 /// </summary> 53 int clickCount { get; set; } 54 /// <summary> 55 /// Indicates whether the shift key is pressed. 56 /// </summary> 57 bool isShiftDown { get; } 58 /// <summary> 59 /// Indicates whether the alt key is pressed. 60 /// </summary> 61 bool isAltDown { get; } 62 /// <summary> 63 /// Indicates whether the action key is pressed. 64 /// </summary> 65 bool isActionKeyDown { get; } 66 /// <summary> 67 /// The KeyCode of the currently pressed key. 68 /// </summary> 69 KeyCode keyCode { get; } 70 /// <summary> 71 /// The type of the event. 72 /// </summary> 73 EventType eventType { get; } 74 /// <summary> 75 /// The name of the event's command. 76 /// </summary> 77 string commandName { get; } 78 /// <summary> 79 /// The closest control to the event. 80 /// </summary> 81 int nearestControl { get; set; } 82 /// <summary> 83 /// Hot Control 84 /// </summary> 85 int hotControl { get; set; } 86 /// <summary> 87 /// Indicates whether the GUI has changed. 88 /// </summary> 89 bool changed { get; set; } 90 /// <summary> 91 92 /// <summary> 93 /// Gets the ID of a nested control by a hint and focus type. 94 /// </summary> 95 /// <param name="hint">The hint this function uses to identify the control ID.</param> 96 /// <param name="focusType">The focus Type</param> 97 /// <returns>Returns the ID of the control that matches the hint and focus type.</returns> 98 int GetControlID(int hint, FocusType focusType); 99 /// <summary> 100 /// Adds a control to the GUIState. 101 /// </summary> 102 /// <param name="controlID">The ID of the control to add.</param> 103 /// <param name="distance">The distance from the camera to the control.</param> 104 void AddControl(int controlID, float distance); 105 /// <summary> 106 /// Checks whether a slider value has changed. 107 /// </summary> 108 /// <param name="id">The ID of the slider to check.</param> 109 /// <param name="sliderData">The slider's data.</param> 110 /// <param name="newPosition">The new position of the slider.</param> 111 /// <returns>Returns `true` if the slider has changed. Otherwise, returns `false`.</returns> 112 bool Slider(int id, SliderData sliderData, out Vector3 newPosition); 113 /// <summary> 114 /// Uses the event. 115 /// </summary> 116 void UseEvent(); 117 /// <summary> 118 /// Repaints the GUI. 119 /// </summary> 120 void Repaint(); 121 /// <summary> 122 /// Checks if the current camera is valid. 123 /// </summary> 124 /// <returns>Returns `true` if the current camera is not null. Otherwise, returns `false`.</returns> 125 bool HasCurrentCamera(); 126 /// <summary> 127 /// Gets the size of the handle. 128 /// </summary> 129 /// <param name="position">The position of the handle.</param> 130 /// <returns>Returns the size of the handle.</returns> 131 float GetHandleSize(Vector3 position); 132 /// <summary> 133 /// Measures the GUI-space distance between two points of a segment. 134 /// </summary> 135 /// <param name="p1">The first point.</param> 136 /// <param name="p2">The second point.</param> 137 /// <returns>Returns the GUI-space distance between p1 and p2.</returns> 138 float DistanceToSegment(Vector3 p1, Vector3 p2); 139 /// <summary> 140 /// Measures the distance to a circle. 141 /// </summary> 142 /// <param name="center">The center of the circle</param> 143 /// <param name="radius">The radius of the circle</param> 144 /// <returns>Returns the distance to a circle with the specified center and radius.</returns> 145 float DistanceToCircle(Vector3 center, float radius); 146 /// <summary> 147 /// Transforms a GUI-space position into world space. 148 /// </summary> 149 /// <param name="guiPosition">The GUI Position.</param> 150 /// <param name="planeNormal">The plane normal.</param> 151 /// <param name="planePos">The plane position.</param> 152 /// <returns>Returns the world-space position of `guiPosition`.</returns> 153 Vector3 GUIToWorld(Vector2 guiPosition, Vector3 planeNormal, Vector3 planePos); 154 } 155}