A game about forced loneliness, made by TACStudios
at master 861 B view raw
1using UnityEditor; 2using UnityEngine; 3 4using PlasticGui; 5 6namespace Unity.PlasticSCM.Editor.UI 7{ 8 internal static class DrawCopyableLabel 9 { 10 internal static void For(string label, GUIStyle style) 11 { 12 Rect rect = GUILayoutUtility.GetRect( 13 new GUIContent(label), style); 14 15 GUI.Label(rect, label, style); 16 17 if (Event.current.type != EventType.ContextClick) 18 return; 19 20 if (!rect.Contains(Event.current.mousePosition)) 21 return; 22 23 GenericMenu menu = new GenericMenu(); 24 menu.AddItem( 25 new GUIContent(PlasticLocalization.Name.Copy.GetString()), 26 false, 27 () => EditorGUIUtility.systemCopyBuffer = label); 28 menu.ShowAsContext(); 29 30 Event.current.Use(); 31 } 32 } 33}