Esempio n. 1
0
        internal void OnUpdateProgress()
        {
            var progress = mGuiClient.Progress;

            progress.ProgressHeader = FixNotificationPath(
                mWkPath, mNotifier.GetNotificationMessage());

            UpdateOperationStatus status = mNotifier.GetUpdateStatus();

            string totalSize   = SizeConverter.ConvertToSizeString(status.TotalSize);
            string updatedSize = SizeConverter.ConvertToSizeString(status.UpdatedSize);

            progress.TotalProgressMessage = PlasticLocalization.GetString(
                status.IsCalculating ?
                PlasticLocalization.Name.UpdateProgressCalculating :
                PlasticLocalization.Name.UpdateProgress,
                updatedSize, totalSize, status.UpdatedFiles, status.TotalFiles);

            progress.TotalProgressPercent = CalculateProgress(status.UpdatedSize, status.TotalSize);
        }
Esempio n. 2
0
        static void DrawChangesOverviewItem(
            Texture 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();
        }
        static void IncomingChangeTreeViewItemCellGUI(
            string wkPath,
            Rect rect,
            float rowHeight,
            UnityIncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView treeView,
            ChangeTreeViewItem item,
            IncomingChangesTreeColumn column,
            bool isSelected,
            bool isFocused,
            bool isCurrentConflict,
            bool isSolvedConflict)
        {
            MergeChangeInfo incomingChange = item.ChangeInfo;

            string label = incomingChange.GetColumnText(
                IncomingChangesTreeHeaderState.GetColumnName(column));

            if (column == IncomingChangesTreeColumn.Path)
            {
                if (incomingChangesTree.HasMeta(item.ChangeInfo))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                Texture icon = GetIcon(wkPath, incomingChange);

                Texture overlayIcon =
                    GetChangesOverlayIcon.ForPlasticIncomingChange(
                        incomingChange, isSolvedConflict);

                DrawTreeViewItem.ForItemCell(
                    rect,
                    rowHeight,
                    item.depth,
                    icon,
                    overlayIcon,
                    label,
                    isSelected,
                    isFocused,
                    isCurrentConflict,
                    false);

                return;
            }

            if (column == IncomingChangesTreeColumn.Size)
            {
                // If there is a meta file, add the meta file to the file size so that it is consistent
                // with the Incoming Changes overview
                if (incomingChangesTree.HasMeta(item.ChangeInfo))
                {
                    MergeChangeInfo metaFileInfo = incomingChangesTree.GetMetaChange(incomingChange);
                    long            metaFileSize = metaFileInfo.GetSize();
                    long            fileSize     = incomingChange.GetSize();

                    label = SizeConverter.ConvertToSizeString(fileSize + metaFileSize);
                }

                DrawTreeViewItem.ForSecondaryLabelRightAligned(
                    rect, label, isSelected, isFocused, isCurrentConflict);
                return;
            }

            DrawTreeViewItem.ForSecondaryLabel(
                rect, label, isSelected, isFocused, isCurrentConflict);
        }