static void DrawStatusLabels( AssetsOverlays.AssetStatus assetStatus, LockStatusData lockStatusData) { AssetsOverlays.AssetStatus statusesToDraw = DrawAssetOverlay.GetStatusesToDraw(assetStatus); foreach (AssetsOverlays.AssetStatus status in Enum.GetValues(typeof(AssetsOverlays.AssetStatus))) { if (status == AssetsOverlays.AssetStatus.None) { continue; } if (!statusesToDraw.HasFlag(status)) { continue; } string label = string.Format("{0}", DrawAssetOverlay.GetStatusString(status)); Texture icon = DrawAssetOverlay.DrawOverlayIcon.GetOverlayIcon( status); string tooltipText = DrawAssetOverlay.GetTooltipText( status, lockStatusData); GUILayout.Label(new GUIContent( label, icon, tooltipText), GUILayout.Height(18)); } }
internal AssetStatus GetStatus(string fullPath) { LockStatusData lockStatusData = GetLockStatusData(fullPath); if (lockStatusData == null) { return(AssetStatus.None); } return(lockStatusData.Status); }
static void Editor_finishedDefaultHeaderGUI(UnityEditor.Editor obj) { if (!mIsEnabled) { return; } AssetList assetList = mAssetsSelection.GetSelectedAssets(); if (mOperations == null || assetList.Count == 0 || string.IsNullOrEmpty(assetList[0].path)) { return; } string selectionFullPath = Path.GetFullPath(assetList[0].path); AssetsOverlays.AssetStatus assetStatus = (assetList.Count > 1) ? AssetsOverlays.AssetStatus.None : mStatusCache.GetStatusForPath(selectionFullPath); LockStatusData lockStatusData = mStatusCache.GetLockStatusDataForPath( selectionFullPath); SelectedAssetGroupInfo selectedGroupInfo = SelectedAssetGroupInfo. BuildFromAssetList(assetList, mStatusCache); AssetMenuOperations assetOperations = AssetMenuUpdater.GetAvailableMenuOperations(selectedGroupInfo); bool guiEnabledBck = GUI.enabled; GUI.enabled = true; try { DrawBackRectangle(guiEnabledBck); GUILayout.BeginHorizontal(); DrawStatusLabel(assetStatus, lockStatusData); GUILayout.FlexibleSpace(); DrawButtons(assetList, assetOperations); GUILayout.EndHorizontal(); } finally { GUI.enabled = guiEnabledBck; } }
static void DrawStatusLabel( AssetsOverlays.AssetStatus assetStatus, LockStatusData lockStatusData) { Texture overlayIcon = DrawAssetOverlay.DrawOverlayIcon. GetOverlayIcon(assetStatus); if (overlayIcon == null) { return; } string statusText = DrawAssetOverlay. GetStatusString(assetStatus); string tooltipText = DrawAssetOverlay.GetTooltipText( assetStatus, lockStatusData); Rect selectionRect = GUILayoutUtility.GetRect( new GUIContent(statusText + EXTRA_SPACE, overlayIcon), GUIStyle.none); selectionRect.height = UnityConstants.OVERLAY_STATUS_ICON_SIZE; Rect overlayRect = OverlayRect.GetCenteredRect(selectionRect); GUI.DrawTexture( overlayRect, overlayIcon, ScaleMode.ScaleToFit); selectionRect.x += UnityConstants.OVERLAY_STATUS_ICON_SIZE; selectionRect.width -= UnityConstants.OVERLAY_STATUS_ICON_SIZE; GUI.Label( selectionRect, new GUIContent(statusText, tooltipText)); }
internal static Dictionary <string, LockStatusData> ForLocks( string wkPath, Dictionary <WorkspaceTreeNode, LockInfo> lockInfoByNode) { Dictionary <string, LockStatusData> result = BuildPathDictionary.ForPlatform <LockStatusData>(); LockOwnerNameResolver nameResolver = new LockOwnerNameResolver(); foreach (WorkspaceTreeNode node in lockInfoByNode.Keys) { LockStatusData lockStatusData = BuildLockStatusData( node, lockInfoByNode[node], nameResolver); string nodeWkPath = WorkspacePath.GetWorkspacePathFromCmPath( wkPath, WorkspaceNodeOperations.GetCmPath(node), PathHelper.GetDirectorySeparatorChar(wkPath)); result.Add(nodeWkPath, lockStatusData); } return(result); }
static void Editor_finishedDefaultHeaderGUI(UnityEditor.Editor inspector) { if (!sIsEnabled) { return; } if (!FindWorkspace.HasWorkspace(Application.dataPath)) { Disable(); return; } sAssetSelection.SetActiveInspector(inspector); AssetList assetList = ((AssetOperations.IAssetSelection) sAssetSelection).GetSelectedAssets(); if (assetList.Count == 0 || string.IsNullOrEmpty(assetList[0].path)) { return; } string selectionFullPath = Path.GetFullPath(assetList[0].path); AssetsOverlays.AssetStatus assetStatus = (assetList.Count > 1) ? AssetsOverlays.AssetStatus.None : PlasticPlugin.AssetStatusCache.GetStatusForPath(selectionFullPath); LockStatusData lockStatusData = PlasticPlugin.AssetStatusCache.GetLockStatusDataForPath( selectionFullPath); SelectedAssetGroupInfo selectedGroupInfo = SelectedAssetGroupInfo. BuildFromAssetList(assetList, PlasticPlugin.AssetStatusCache); AssetMenuOperations assetOperations = AssetMenuUpdater.GetAvailableMenuOperations(selectedGroupInfo); bool guiEnabledBck = GUI.enabled; GUI.enabled = true; try { DrawBackRectangle(guiEnabledBck); GUILayout.BeginHorizontal(); DrawStatusLabel(assetStatus, lockStatusData); GUILayout.FlexibleSpace(); DrawButtons(assetList, assetOperations); GUILayout.EndHorizontal(); } finally { GUI.enabled = guiEnabledBck; } }