A game about forced loneliness, made by TACStudios
1using System;
2
3using Codice.Client.Common;
4
5using Unity.PlasticSCM.Editor.UI.Avatar;
6
7using UnityEngine;
8
9namespace Unity.PlasticSCM.Editor.UI
10{
11 internal static class DrawUserIcon
12 {
13 internal static void ForPendingChangesTab(
14 ResolvedUser currentUser,
15 Action avatarLoadedAction)
16 {
17 Rect rect = BuildUserIconAreaRect(35f);
18
19 if (currentUser == null)
20 {
21 GUI.DrawTexture(rect, Images.GetEmptyGravatar());
22 return;
23 }
24
25 GUI.Label(rect, new GUIContent(
26 GetAvatar.ForEmail(currentUser.Name, avatarLoadedAction),
27 currentUser.Name));
28 }
29
30 static Rect BuildUserIconAreaRect(float sizeOfImage)
31 {
32 GUIStyle commentTextAreaStyle = UnityStyles.PendingChangesTab.CommentTextArea;
33
34 Rect result = GUILayoutUtility.GetRect(sizeOfImage, sizeOfImage); // Needs to be a square
35 result.x = commentTextAreaStyle.margin.left;
36
37 return result;
38 }
39 }
40}