Esempio n. 1
0
        // Draws in the Hierarchy header, left of the context menu.
        public void DrawSceneUI(Rect availableRect, string scenePath)
        {
            string assetGUID = AssetDatabase.AssetPathToGUID(scenePath);

            if (!HasSoftlocks(assetGUID))
            {
                return;
            }

            int lockCount;

            SoftLockData.TryGetSoftlockCount(assetGUID, out lockCount);

            GUIContent content = GetGUIContent();

            content.image   = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.Scene);
            content.text    = GetDisplayCount(lockCount);
            content.tooltip = Instance.GetTooltip(assetGUID);

            Vector2   contentSize  = GetStyle().CalcSize(content);
            Rect      drawRect     = new Rect(availableRect.position, contentSize);
            const int kRightMargin = 4;

            drawRect.x = (availableRect.width - drawRect.width) - kRightMargin;
            EditorGUI.LabelField(drawRect, content);
        }
Esempio n. 2
0
        private bool DrawInProjectBrowserListMode(Rect iconRect, string assetGUID)
        {
            Texture icon    = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.ProjectBrowser);
            bool    didDraw = false;

            if (icon != null)
            {
                DrawIconWithTooltips(iconRect, icon, assetGUID);
                didDraw = true;
            }
            return(didDraw);
        }
 private void DrawProjectBrowserGridUI(Rect iconRect, string assetGUID, bool isListMode)
 {
     if (!isListMode && this.HasSoftlocks(assetGUID))
     {
         Rect    iconRect2      = Rect.zero;
         Texture iconForSection = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.ProjectBrowser);
         if (iconForSection != null)
         {
             iconRect2 = Overlay.GetRectForBottomRight(iconRect, 0.35);
             this.DrawIconWithTooltips(iconRect2, iconForSection, assetGUID);
         }
     }
 }
Esempio n. 4
0
        // Assigned callback to ObjectListArea.OnPostAssetDrawDelegate.
        // Draws either overtop of the project browser asset (when in grid view).
        private void DrawProjectBrowserGridUI(Rect iconRect, string assetGUID, bool isListMode)
        {
            if (isListMode || !HasSoftlocks(assetGUID))
            {
                return;
            }

            Rect    drawRect = Rect.zero;
            Texture icon     = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.ProjectBrowser);

            if (icon != null)
            {
                drawRect = Overlay.GetRectForBottomRight(iconRect, Overlay.k_OverlaySizeOnLargeIcon);
                DrawIconWithTooltips(drawRect, icon, assetGUID);
            }
        }
        private string GetTooltip(string assetGUID)
        {
            string text;

            if (!this.m_Cache.TryGetTooltipForGUID(assetGUID, out text))
            {
                List <string> locksNamesOnAsset = SoftLockUIData.GetLocksNamesOnAsset(assetGUID);
                string        text2             = (!SoftLockData.IsPrefab(assetGUID)) ? "Unpublished changes by:" : "Unpublished Prefab changes by:";
                text = text2;
                foreach (string current in locksNamesOnAsset)
                {
                    text = text + " \n •  " + current + " ";
                }
                this.m_Cache.StoreTooltipForGUID(assetGUID, text);
            }
            return(text);
        }
 private void DrawInspectorUI(Editor editor, Rect drawRect)
 {
     if (this.HasSoftlockSupport(editor))
     {
         this.m_Cache.StoreEditor(editor);
         string assetGUID = null;
         AssetAccess.TryGetAssetGUIDFromObject(editor.target, out assetGUID);
         if (this.HasSoftlocks(assetGUID))
         {
             Texture iconForSection = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.ProjectBrowser);
             if (iconForSection != null)
             {
                 this.DrawIconWithTooltips(drawRect, iconForSection, assetGUID);
             }
         }
     }
 }
Esempio n. 7
0
        // Returns a string formatted as a vertical list of names with a heading.
        private string GetTooltip(string assetGUID)
        {
            string formattedText;

            if (!m_Cache.TryGetTooltipForGUID(assetGUID, out formattedText))
            {
                List <string> softLockNames     = SoftLockUIData.GetLocksNamesOnAsset(assetGUID);
                string        tooltipHeaderText = (SoftLockData.IsPrefab(assetGUID) ? k_TooltipPrefabHeader : k_TooltipHeader);
                formattedText = tooltipHeaderText;

                foreach (string name in softLockNames)
                {
                    formattedText += k_TooltipNamePrefix + name + " ";
                }
                m_Cache.StoreTooltipForGUID(assetGUID, formattedText);
            }
            return(formattedText);
        }
        public void DrawSceneUI(Rect availableRect, string scenePath)
        {
            string text = AssetDatabase.AssetPathToGUID(scenePath);

            if (this.HasSoftlocks(text))
            {
                int count;
                SoftLockData.TryGetSoftlockCount(text, out count);
                GUIContent gUIContent = this.GetGUIContent();
                gUIContent.image   = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.Scene);
                gUIContent.text    = SoftlockViewController.GetDisplayCount(count);
                gUIContent.tooltip = SoftlockViewController.Instance.GetTooltip(text);
                Vector2 size     = this.GetStyle().CalcSize(gUIContent);
                Rect    position = new Rect(availableRect.position, size);
                position.x = availableRect.width - position.width - 4f;
                EditorGUI.LabelField(position, gUIContent);
            }
        }
Esempio n. 9
0
        private bool DrawProjectBrowserListUI(Rect drawRect, string assetGUID, bool isListMode)
        {
            bool result;

            if (!this.HasSoftlocks(assetGUID))
            {
                result = false;
            }
            else
            {
                Texture iconForSection = SoftLockUIData.GetIconForSection(SoftLockUIData.SectionEnum.ProjectBrowser);
                bool    flag           = false;
                if (iconForSection != null)
                {
                    Rect iconRect = drawRect;
                    iconRect.width = drawRect.height;
                    iconRect.x     = (float)Math.Round((double)(drawRect.center.x - iconRect.width / 2f));
                    this.DrawIconWithTooltips(iconRect, iconForSection, assetGUID);
                    flag = true;
                }
                result = flag;
            }
            return(result);
        }