A game about forced loneliness, made by TACStudios
1using UnityEditor;
2using UnityEngine;
3
4using Codice.Client.Common;
5using PlasticGui;
6using PlasticGui.WorkspaceWindow.Merge;
7using Unity.PlasticSCM.Editor.UI;
8
9namespace Unity.PlasticSCM.Editor.Views.Merge
10{
11 internal static class DrawMergeOverview
12 {
13 internal static void For(
14 int directoryConflictCount,
15 int fileConflictCount,
16 MergeViewTexts.ChangesToApplySummary changesSummary)
17 {
18 DrawItem(
19 Images.GetConflictedIcon(),
20 PlasticLocalization.Name.DirectoryConflictsTitleSingular,
21 PlasticLocalization.Name.DirectoryConflictsTitlePlural,
22 directoryConflictCount,
23 0,
24 false);
25
26 DrawItem(
27 Images.GetConflictedIcon(),
28 PlasticLocalization.Name.FileConflictsTitleSingular,
29 PlasticLocalization.Name.FileConflictsTitlePlural,
30 fileConflictCount,
31 0,
32 false);
33
34 DrawItem(
35 Images.GetOutOfSyncIcon(),
36 PlasticLocalization.Name.MergeChangesMadeInSourceOfMergeOverviewSingular,
37 PlasticLocalization.Name.MergeChangesMadeInSourceOfMergeOverviewPlural,
38 changesSummary.FilesToModify,
39 changesSummary.SizeToModify,
40 true);
41
42 DrawItem(
43 Images.GetAddedLocalIcon(),
44 PlasticLocalization.Name.MergeNewItemsToDownloadOverviewSingular,
45 PlasticLocalization.Name.MergeNewItemsToDownloadOverviewPlural,
46 changesSummary.FilesToAdd,
47 changesSummary.SizeToAdd,
48 true);
49
50 DrawItem(
51 Images.GetDeletedRemoteIcon(),
52 PlasticLocalization.Name.MergeDeletesToApplyOverviewSingular,
53 PlasticLocalization.Name.MergeDeletesToApplyOverviewPlural,
54 changesSummary.FilesToDelete,
55 changesSummary.SizeToDelete,
56 true);
57 }
58
59 static void DrawItem(
60 Texture2D icon,
61 PlasticLocalization.Name singularLabel,
62 PlasticLocalization.Name pluralLabel,
63 int count,
64 long size,
65 bool showSize)
66 {
67 if (count == 0)
68 return;
69
70 EditorGUILayout.BeginHorizontal();
71
72 GUIContent iconContent = new GUIContent(icon);
73 GUILayout.Label(iconContent, GUILayout.Width(20f), GUILayout.Height(20f));
74
75 string label = PlasticLocalization.GetString(count > 1 ? pluralLabel : singularLabel);
76 if (showSize)
77 label = string.Format(label, count, SizeConverter.ConvertToSizeString(size));
78 else
79 label = string.Format(label, count);
80
81 GUIContent content = new GUIContent(label);
82 GUILayout.Label(content, UnityStyles.MergeTab.InfoLabel);
83
84 GUILayout.Space(5);
85
86 EditorGUILayout.EndHorizontal();
87 }
88 }
89}