A game about forced loneliness, made by TACStudios
1using System;
2using UnityEngine;
3
4namespace UnityEditor.U2D.Animation
5{
6 internal class UnselectTool<T>
7 {
8 private Unselector<T> m_Unselector = new Unselector<T>();
9 public ICacheUndo cacheUndo { get; set; }
10 public ISelection<T> selection
11 {
12 get { return m_Unselector.selection; }
13 set { m_Unselector.selection = value; }
14 }
15 public Action onUnselect = () => {};
16
17 public void OnGUI()
18 {
19 Debug.Assert(cacheUndo != null);
20 Debug.Assert(selection != null);
21
22 var e = Event.current;
23
24 if (selection.Count > 0 && e.type == EventType.MouseDown && e.button == 1 && !e.alt)
25 {
26 cacheUndo.BeginUndoOperation(TextContent.clearSelection);
27 m_Unselector.Select();
28 e.Use();
29 onUnselect.Invoke();
30 }
31 }
32 }
33}