No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DrawIncomingChangesOverview.cs 3.0KB

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