A game about forced loneliness, made by TACStudios
1using UnityEngine; 2 3namespace Unity.PlasticSCM.Editor.UI 4{ 5 internal class OverlayRect 6 { 7 internal static Rect GetOverlayRect( 8 Rect selectionRect, 9 float iconOffset) 10 { 11 if (selectionRect.width > selectionRect.height) 12 return GetOverlayRectForSmallestSize( 13 selectionRect); 14 15 return GetOverlayRectForOtherSizes(selectionRect, iconOffset); 16 } 17 18 internal static Rect GetCenteredRect( 19 Rect selectionRect) 20 { 21 return new Rect( 22 selectionRect.x + 3f, 23 selectionRect.y + 1f, 24 UnityConstants.OVERLAY_STATUS_ICON_SIZE, 25 UnityConstants.OVERLAY_STATUS_ICON_SIZE); 26 } 27 28 static Rect GetOverlayRectForSmallestSize( 29 Rect selectionRect) 30 { 31 return new Rect( 32 selectionRect.x + 5f, 33 selectionRect.y + 4f, 34 UnityConstants.OVERLAY_STATUS_ICON_SIZE, 35 UnityConstants.OVERLAY_STATUS_ICON_SIZE); 36 } 37 38 static Rect GetOverlayRectForOtherSizes( 39 Rect selectionRect, 40 float iconOffset) 41 { 42 float widthRatio = selectionRect.width / 43 UNITY_STANDARD_ICON_SIZE; 44 float heightRatio = selectionRect.height / 45 UNITY_STANDARD_ICON_SIZE; 46 47 return new Rect( 48 selectionRect.x + (iconOffset * widthRatio) - 1f, 49 selectionRect.y + (iconOffset * heightRatio) - 13f, 50 UnityConstants.OVERLAY_STATUS_ICON_SIZE * widthRatio, 51 UnityConstants.OVERLAY_STATUS_ICON_SIZE * heightRatio); 52 } 53 54 const int UNITY_STANDARD_ICON_SIZE = 32; 55 } 56}