// 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); }
private bool HasSoftlocks(string assetGUID) { if (!Collab.instance.IsCollabEnabledForCurrentProject()) { return(false); } bool hasSoftLocks; bool isValid = (SoftLockData.TryHasSoftLocks(assetGUID, out hasSoftLocks) && hasSoftLocks); return(isValid); }
private bool HasSoftlocks(string assetGUID) { bool result; if (!Collab.instance.IsCollabEnabledForCurrentProject()) { result = false; } else { bool flag2; bool flag = SoftLockData.TryHasSoftLocks(assetGUID, out flag2) && flag2; result = flag; } return(result); }
private bool HasSoftlocks(string assetGUID) { bool result; if (!CollabAccess.Instance.IsServiceEnabled()) { result = false; } else { bool flag2; bool flag = SoftLockData.TryHasSoftLocks(assetGUID, out flag2) && flag2; result = flag; } return(result); }
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); }
// 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); } }
// Returns true when the 'editor' supports Softlock UI and the // user has Collaborate permissions. private bool HasSoftlockSupport(Editor editor) { if (!Collab.instance.IsCollabEnabledForCurrentProject() || editor == null || editor.targets.Length > 1) { return(false); } if (editor.target == null || !SoftLockData.AllowsSoftLocks(editor.target)) { return(false); } // Support Scene and Game object Inspector headers, not others like MaterialEditor. bool hasSupport = true; Type editorType = editor.GetType(); if (editorType != typeof(GameObjectInspector) && editorType != typeof(GenericInspector)) { hasSupport = false; } return(hasSupport); }
private bool HasSoftlockSupport(Editor editor) { bool result; if (!Collab.instance.IsCollabEnabledForCurrentProject() || editor == null || editor.targets.Length > 1) { result = false; } else if (editor.target == null || !SoftLockData.AllowsSoftLocks(editor.target)) { result = false; } else { bool flag = true; Type type = editor.GetType(); if (type != typeof(GameObjectInspector) && type != typeof(GenericInspector)) { flag = false; } result = flag; } return(result); }