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