예제 #1
0
        internal static void For(
            Rect rect,
            string topText,
            string bottomText,
            string buttonText,
            Images.Name iconName,
            Action buttonClickedAction)
        {
            GUIContent topContent = new GUIContent(topText);
            Vector2    topSize    = GetContentSize(topContent);

            GUIContent bottomContent = new GUIContent(bottomText);
            Vector2    bottomSize    = GetContentSize(bottomContent);

            GUI.BeginGroup(rect);

            DrawLabel(
                topContent,
                topSize,
                (rect.width - topSize.x) / 2,
                (rect.height - topSize.y) / 2);

            DrawLabelWithIconAndButton(
                bottomContent,
                bottomSize,
                (rect.width - bottomSize.x) / 2,
                (rect.height + bottomSize.y) / 2,
                iconName,
                buttonText,
                buttonClickedAction);

            GUI.EndGroup();
        }
예제 #2
0
        internal void Notify(string message, MessageType type, Images.Name imageName)
        {
            NotifyMessage notifyMessage = new NotifyMessage(message, type, imageName);

            notifications.Enqueue(notifyMessage);
            Task.Delay(AUTO_HIDE_DELAY).ContinueWith(t => notifications.Dequeue());
        }
예제 #3
0
        static void DrawIncomingChangesNotification(
            WorkspaceInfo wkInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher,
            IncomingChangesNotification notification,
            bool isGluonMode)
        {
            Images.Name iconName =
                notification.Status == PlasticNotification.Status.Conflicts ?
                Images.Name.IconConflicted :
                Images.Name.IconOutOfSync;

            DrawIcon(iconName);

            DrawNotificationLabel(notification.InfoText);

            if (DrawButton(notification.ActionText, notification.TooltipText))
            {
                if (notification.HasUpdateAction)
                {
                    workspaceWindow.UpdateWorkspace();
                    return;
                }

                ShowIncomingChangesForMode(
                    wkInfo,
                    mergeViewLauncher,
                    gluonViewSwitcher,
                    isGluonMode);
            }
        }
예제 #4
0
        static void DoLoginOrSignUpStep(
            bool isStep2Completed,
            ProgressControlsForViews.Data progressData)
        {
            Images.Name stepImage = (isStep2Completed) ?
                                    Images.Name.StepOk :
                                    Images.Name.Step2;

            string stepText = GetConfigurationStepText(
                progressData,
                isStep2Completed);

            GUIStyle style = new GUIStyle(EditorStyles.label);

            style.richText = true;

            GUILayout.BeginHorizontal();

            DoStepLabel(
                stepText,
                stepImage,
                style);

            GUILayout.EndHorizontal();
        }
예제 #5
0
        static void DoDownloadAndInstallStep(
            bool isStep1Completed,
            ProgressControlsForViews.Data progressData)
        {
            Images.Name stepImage = (isStep1Completed) ?
                                    Images.Name.StepOk :
                                    Images.Name.Step1;

            string stepText = GetDownloadStepText(
                progressData,
                isStep1Completed);

            GUIStyle style = new GUIStyle(EditorStyles.label);

            style.richText = true;

            GUILayout.BeginHorizontal();

            DoStepLabel(
                stepText,
                stepImage,
                style);

            GUILayout.EndHorizontal();
        }
예제 #6
0
        internal static void SetControlImage(
            this VisualElement element,
            string name,
            Images.Name imageName)
        {
            Image imageElem = element.Query <Image>(name).First();

            imageElem.image = Images.GetImage(imageName);
        }
예제 #7
0
        internal void Show(Images.Name helpImage, HelpData helpData)
        {
            ClearData();

            UpdateData(helpImage, helpData);

            Visible = true;

            mWindow.Repaint();
        }
예제 #8
0
 internal static Texture GetIcon(Status status)
 {
     Images.Name iconName = Images.Name.IconPlasticView;
     if (status == Status.IncomingChanges)
     {
         iconName = Images.Name.IconPlasticNotifyIncoming;
     }
     else if (status == Status.Conflicts)
     {
         iconName = Images.Name.IconPlasticNotifyConflict;
     }
     return(Images.GetImage(iconName));
 }
예제 #9
0
        static void DoStepLabel(
            string text,
            Images.Name imageName,
            GUIStyle style)
        {
            GUILayout.Space(STEPS_LEFT_MARGIN);

            GUIContent stepLabelContent = new GUIContent(
                string.Format(" {0}", text),
                Images.GetImage(imageName));

            GUILayout.Label(
                stepLabelContent,
                style,
                GUILayout.Height(STEP_LABEL_HEIGHT));
        }
예제 #10
0
        static void DrawIcon(Images.Name iconName)
        {
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            var icon = Images.GetImage(iconName);

            GUILayout.Label(
                icon,
                UnityStyles.StatusBar.Icon,
                GUILayout.Height(UnityConstants.STATUS_BAR_ICON_SIZE),
                GUILayout.Width(UnityConstants.STATUS_BAR_ICON_SIZE));

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
예제 #11
0
        void UpdateData(Images.Name helpImage, HelpData helpData)
        {
            mHelpImage = helpImage;
            mHelpData  = helpData;

            string formattedHelpText;

            BuildFormattedHelp.ForData(
                mHelpData.CleanText,
                mHelpData.FormattedBlocks.ToArray(),
                mHelpData.Links.ToArray(),
                out formattedHelpText,
                out mFormattedLinks);

            mHelpGUIContent = new GUIContent(formattedHelpText);
        }
예제 #12
0
        internal static void For(
            Rect rect,
            string text,
            Images.Name iconName)
        {
            GUIContent content     = new GUIContent(text);
            Vector2    contentSize = GetContentSize(content);

            GUI.BeginGroup(rect);

            DrawLabelWithIcon(
                content,
                contentSize,
                (rect.width - contentSize.x) / 2,
                rect.height / 2,
                iconName);

            GUI.EndGroup();
        }
예제 #13
0
        static void DrawLabelWithIconAndButton(
            GUIContent content,
            Vector2 contentSize,
            float offsetX,
            float offsetY,
            Images.Name iconName,
            string buttonText,
            Action buttonClickedAction)
        {
            int iconSize = UnityConstants.TREEVIEW_STATUS_ICON_SIZE;
            int padding  = UnityConstants.TREEVIEW_STATUS_CONTENT_PADDING;

            GUIContent button     = new GUIContent(buttonText);
            Vector2    buttonSize = EditorStyles.miniButton.CalcSize(button);

            float iconOffsetX    = offsetX - iconSize + padding - buttonSize.x / 2;
            float contentOffsetX = offsetX + iconSize - padding - buttonSize.x / 2;
            float buttonOffsetX  = contentOffsetX + contentSize.x + 2 * padding;

            GUI.DrawTexture(
                new Rect(iconOffsetX, offsetY + padding, iconSize, iconSize),
                Images.GetImage(iconName),
                ScaleMode.ScaleToFit);

            GUI.Label(
                new Rect(contentOffsetX, offsetY, contentSize.x, contentSize.y),
                content,
                UnityStyles.Tree.StatusLabel
                );

            if (GUI.Button(
                    new Rect(buttonOffsetX, offsetY + padding, buttonSize.x, buttonSize.y),
                    button,
                    EditorStyles.miniButton))
            {
                if (buttonClickedAction != null)
                {
                    buttonClickedAction();
                }
            }
        }
        static void DrawItem(
            Images.Name iconName,
            PlasticLocalization.Name singularLabel,
            PlasticLocalization.Name pluralLabel,
            int count,
            long size,
            bool showSize)
        {
            if (count == 0)
            {
                return;
            }

            EditorGUILayout.BeginHorizontal();

            GUIContent iconContent = new GUIContent(Images.GetImage(iconName));

            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();
        }
예제 #15
0
        static void DrawLabelWithIcon(
            GUIContent content,
            Vector2 contentSize,
            float offsetX,
            float offsetY,
            Images.Name iconName)
        {
            int iconSize = UnityConstants.TREEVIEW_STATUS_ICON_SIZE;
            int padding  = UnityConstants.TREEVIEW_STATUS_CONTENT_PADDING;

            float iconOffsetX    = offsetX - iconSize + padding;
            float contentOffsetX = offsetX + iconSize - padding;

            GUI.DrawTexture(
                new Rect(iconOffsetX, offsetY + padding, iconSize, iconSize),
                Images.GetImage(iconName),
                ScaleMode.ScaleToFit);

            GUI.Label(
                new Rect(contentOffsetX, offsetY, contentSize.x, contentSize.y),
                content,
                UnityStyles.Tree.StatusLabel
                );
        }
예제 #16
0
 internal void Notify(string message, MessageType type, Images.Name imageName)
 {
     mNotification = new Notification(message, type, imageName);
     mCooldownNotificationClearAction.Ping();
 }
예제 #17
0
 internal Notification(string message, MessageType messageType, Images.Name imageName)
 {
     Message     = message;
     MessageType = messageType;
     ImageName   = imageName;
 }
예제 #18
0
 internal Notification(string message, MessageType messageType, Images.Name imageName) : this()
 {
     this.Message     = message;
     this.MessageType = messageType;
     this.ImageName   = imageName;
 }