.vs
Assets
Library
APIUpdater
Artifacts
Bee
BuildPlayerData
PackageCache
com.unity.collab-proxy@2.5.2
.Resources
Documentation~
Editor
PlasticSCM
AssetMenu
AssetOverlays
Assets
AssetsUtils
CollabMigration
Configuration
Developer
Gluon
Help
Hub
Inspector
SceneView
Tool
Toolbar
UI
Avatar
Progress
StatusBar
Tree
UIElements
Avatar.meta
BoolSetting.cs
BoolSetting.cs.meta
CloseWindowIfOpened.cs
CloseWindowIfOpened.cs.meta
CooldownWindowDelayer.cs
CooldownWindowDelayer.cs.meta
DockEditorWindow.cs
DockEditorWindow.cs.meta
DrawActionButton.cs
DrawActionButton.cs.meta
DrawActionButtonWithMenu.cs
DrawActionButtonWithMenu.cs.meta
DrawActionHelpBox.cs
DrawActionHelpBox.cs.meta
DrawActionToolbar.cs
DrawActionToolbar.cs.meta
DrawSearchField.cs
DrawSearchField.cs.meta
DrawSplitter.cs
DrawSplitter.cs.meta
DrawTextBlockWithEndLink.cs
DrawTextBlockWithEndLink.cs.meta
DrawUserIcon.cs
DrawUserIcon.cs.meta
DropDownTextField.cs
DropDownTextField.cs.meta
EditorDispatcher.cs
EditorDispatcher.cs.meta
EditorProgressBar.cs
EditorProgressBar.cs.meta
EditorProgressControls.cs
EditorProgressControls.cs.meta
EditorVersion.cs
EditorVersion.cs.meta
EditorWindowFocus.cs
EditorWindowFocus.cs.meta
EnumPopupSetting.cs
EnumPopupSetting.cs.meta
FindEditorWindow.cs
FindEditorWindow.cs.meta
GUIActionRunner.cs
GUIActionRunner.cs.meta
GetPlasticShortcut.cs
GetPlasticShortcut.cs.meta
GuiEnabled.cs
GuiEnabled.cs.meta
HandleMenuItem.cs
HandleMenuItem.cs.meta
Images.cs
Images.cs.meta
MeasureMaxWidth.cs
MeasureMaxWidth.cs.meta
OverlayRect.cs
OverlayRect.cs.meta
PlasticDialog.cs
PlasticDialog.cs.meta
PlasticSplitterGUILayout.cs
PlasticSplitterGUILayout.cs.meta
Progress.meta
ResponseType.cs
ResponseType.cs.meta
RunModal.cs
RunModal.cs.meta
ScreenResolution.cs
ScreenResolution.cs.meta
ShowWindow.cs
ShowWindow.cs.meta
SortOrderComparer.cs
SortOrderComparer.cs.meta
StatusBar.meta
TabButton.cs
TabButton.cs.meta
Tree.meta
UIElements.meta
UnityConstants.cs
UnityConstants.cs.meta
UnityEvents.cs
UnityEvents.cs.meta
UnityMenuItem.cs
UnityMenuItem.cs.meta
UnityPlasticGuiMessage.cs
UnityPlasticGuiMessage.cs.meta
UnityPlasticTimer.cs
UnityPlasticTimer.cs.meta
UnityStyles.cs
UnityStyles.cs.meta
UnityThreadWaiter.cs
UnityThreadWaiter.cs.meta
Views
WebApi
ApplicationDataPath.cs
ApplicationDataPath.cs.meta
AssemblyInfo.cs
AssemblyInfo.cs.meta
AssetMenu.meta
AssetOverlays.meta
Assets.meta
AssetsUtils.meta
AutoRefresh.cs
AutoRefresh.cs.meta
BuildGetEventExtraInfoFunction.cs
BuildGetEventExtraInfoFunction.cs.meta
CheckWorkspaceTreeNodeStatus.cs
CheckWorkspaceTreeNodeStatus.cs.meta
CollabMigration.meta
CollabPlugin.cs
CollabPlugin.cs.meta
Configuration.meta
Developer.meta
DrawGuiModeSwitcher.cs
DrawGuiModeSwitcher.cs.meta
EnumExtensions.cs
EnumExtensions.cs.meta
FindWorkspace.cs
FindWorkspace.cs.meta
GetRelativePath.cs
GetRelativePath.cs.meta
Gluon.meta
Help.meta
Hub.meta
Inspector.meta
MetaPath.cs
MetaPath.cs.meta
NewIncomingChanges.cs
NewIncomingChanges.cs.meta
OrganizationsInformation.cs
OrganizationsInformation.cs.meta
ParentWindow.cs
ParentWindow.cs.meta
PlasticApp.cs
PlasticApp.cs.meta
PlasticConnectionMonitor.cs
PlasticConnectionMonitor.cs.meta
PlasticMenuItem.cs
PlasticMenuItem.cs.meta
PlasticNotification.cs
PlasticNotification.cs.meta
PlasticPlugin.cs
PlasticPlugin.cs.meta
PlasticPluginIsEnabledPreference.cs
PlasticPluginIsEnabledPreference.cs.meta
PlasticProjectSettingsProvider.cs
PlasticProjectSettingsProvider.cs.meta
PlasticShutdown.cs
PlasticShutdown.cs.meta
PlasticWindow.cs
PlasticWindow.cs.meta
ProjectWindow.cs
ProjectWindow.cs.meta
QueryVisualElementsExtensions.cs
QueryVisualElementsExtensions.cs.meta
SceneView.meta
SwitchModeConfirmationDialog.cs
SwitchModeConfirmationDialog.cs.meta
Tool.meta
Toolbar.meta
UI.meta
UVCPackageVersion.cs
UVCPackageVersion.cs.meta
Unity.PlasticSCM.Editor.asmdef
Unity.PlasticSCM.Editor.asmdef.meta
UnityConfigurationChecker.cs
UnityConfigurationChecker.cs.meta
VCSPlugin.cs
VCSPlugin.cs.meta
ViewSwitcher.cs
ViewSwitcher.cs.meta
Views.meta
VisualElementExtensions.cs
VisualElementExtensions.cs.meta
WebApi.meta
WorkspaceWindow.cs
WorkspaceWindow.cs.meta
PlasticSCM.meta
Lib
.signature
CHANGELOG.md
CHANGELOG.md.meta
Editor.meta
LICENSE.md
LICENSE.md.meta
Lib.meta
README.md
README.md.meta
Third Party Notices.md
Third Party Notices.md.meta
ValidationConfig.json
ValidationConfig.json.meta
package.json
package.json.meta
com.unity.editorcoroutines@1.0.0
com.unity.ext.nunit@1.0.6
com.unity.feature.development@1.0.1
com.unity.ide.rider@3.0.31
com.unity.ide.visualstudio@2.0.22
com.unity.ide.vscode@1.2.5
com.unity.modules.ai@1.0.0
com.unity.modules.androidjni@1.0.0
com.unity.modules.animation@1.0.0
com.unity.modules.assetbundle@1.0.0
com.unity.modules.audio@1.0.0
com.unity.modules.cloth@1.0.0
com.unity.modules.director@1.0.0
com.unity.modules.imageconversion@1.0.0
com.unity.modules.imgui@1.0.0
com.unity.modules.jsonserialize@1.0.0
com.unity.modules.particlesystem@1.0.0
com.unity.modules.physics2d@1.0.0
com.unity.modules.physics@1.0.0
com.unity.modules.screencapture@1.0.0
com.unity.modules.subsystems@1.0.0
com.unity.modules.terrain@1.0.0
com.unity.modules.terrainphysics@1.0.0
com.unity.modules.tilemap@1.0.0
com.unity.modules.ui@1.0.0
com.unity.modules.uielements@1.0.0
com.unity.modules.umbra@1.0.0
com.unity.modules.unityanalytics@1.0.0
com.unity.modules.unitywebrequest@1.0.0
com.unity.modules.unitywebrequestassetbundle@1.0.0
com.unity.modules.unitywebrequestaudio@1.0.0
com.unity.modules.unitywebrequesttexture@1.0.0
com.unity.modules.unitywebrequestwww@1.0.0
com.unity.modules.vehicles@1.0.0
com.unity.modules.video@1.0.0
com.unity.modules.vr@1.0.0
com.unity.modules.wind@1.0.0
com.unity.modules.xr@1.0.0
com.unity.performance.profile-analyzer@1.2.2
com.unity.settings-manager@2.0.1
com.unity.test-framework@1.1.33
com.unity.testtools.codecoverage@1.2.6
com.unity.textmeshpro@3.0.6
com.unity.timeline@1.7.6
com.unity.ugui@1.0.0
com.unity.visualscripting@1.9.4
PackageManager
PlayModeViewStates
PlayerDataCache
ScriptAssemblies
Search
ShaderCache
SplashScreenCache
StateCache
UIElements
AnnotationManager
ArtifactDB
ArtifactDB-lock
BuildPlayer.prefs
BuildSettings.asset
EditorOnlyScriptingSettings.json
EditorOnlyVirtualTextureState.json
EditorSnapSettings.asset
EditorUserBuildSettings.asset
InspectorExpandedItems.asset
LastBuild.buildreport
LastSceneManagerSetup.txt
LibraryFormatVersion.txt
MonoManager.asset
SceneVisibilityState.asset
ScriptMapper
ShaderCache.db
SourceAssetDB
SourceAssetDB-lock
SpriteAtlasDatabase.asset
Style.catalog
expandedItems
ilpp.pid
Logs
Packages
ProjectSettings
UserSettings
obj
.vsconfig
Assembly-CSharp.Player.csproj
Assembly-CSharp.csproj
TM1.sln
Unity.CollabProxy.Editor.csproj
Unity.EditorCoroutines.Editor.csproj
Unity.Performance.Profile-Analyzer.Editor.csproj
Unity.PlasticSCM.Editor.csproj
Unity.Rider.Editor.csproj
Unity.Settings.Editor.csproj
Unity.TestTools.CodeCoverage.Editor.OpenCover.Model.csproj
Unity.TestTools.CodeCoverage.Editor.OpenCover.Mono.Reflection.csproj
Unity.TestTools.CodeCoverage.Editor.csproj
Unity.TextMeshPro.Editor.csproj
Unity.TextMeshPro.Player.csproj
Unity.TextMeshPro.csproj
Unity.Timeline.Editor.csproj
Unity.Timeline.Player.csproj
Unity.Timeline.csproj
Unity.VSCode.Editor.csproj
Unity.VisualScripting.Core.Editor.csproj
Unity.VisualScripting.Core.Player.csproj
Unity.VisualScripting.Core.csproj
Unity.VisualScripting.Flow.Editor.csproj
Unity.VisualScripting.Flow.Player.csproj
Unity.VisualScripting.Flow.csproj
Unity.VisualScripting.SettingsProvider.Editor.csproj
Unity.VisualScripting.Shared.Editor.csproj
Unity.VisualScripting.State.Editor.csproj
Unity.VisualScripting.State.Player.csproj
Unity.VisualScripting.State.csproj
Unity.VisualStudio.Editor.csproj
UnityEditor.TestRunner.csproj
UnityEditor.UI.csproj
UnityEngine.TestRunner.Player.csproj
UnityEngine.TestRunner.csproj
UnityEngine.UI.Player.csproj
UnityEngine.UI.csproj
795 lines
30 KiB
C#
795 lines
30 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
using UnityEditor;
|
|||
|
using UnityEditor.IMGUI.Controls;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Unity.PlasticSCM.Editor.UI
|
|||
|
{
|
|||
|
// Assumption: Members are called from an OnGUI method ( otherwise style composition will fail)
|
|||
|
internal static class UnityStyles
|
|||
|
{
|
|||
|
internal static void Initialize(
|
|||
|
Action repaintPlasticWindow)
|
|||
|
{
|
|||
|
mRepaintPlasticWindow = repaintPlasticWindow;
|
|||
|
|
|||
|
mLazyBackgroundStyles.Add(WarningMessage);
|
|||
|
mLazyBackgroundStyles.Add(SplitterIndicator);
|
|||
|
mLazyBackgroundStyles.Add(PlasticWindow.ActiveTabUnderline);
|
|||
|
mLazyBackgroundStyles.Add(Notification.GreenNotification);
|
|||
|
mLazyBackgroundStyles.Add(Notification.RedNotification);
|
|||
|
mLazyBackgroundStyles.Add(CancelButton);
|
|||
|
mLazyBackgroundStyles.Add(Inspector.HeaderBackgroundStyle);
|
|||
|
mLazyBackgroundStyles.Add(Inspector.DisabledHeaderBackgroundStyle);
|
|||
|
}
|
|||
|
|
|||
|
internal static class Colors
|
|||
|
{
|
|||
|
internal static Color Transparent = new Color(255f / 255, 255f / 255, 255f / 255, 0f / 255);
|
|||
|
internal static Color GreenBackground = new Color(34f / 255, 161f / 255, 63f / 255);
|
|||
|
internal static Color GreenText = new Color(0f / 255, 100f / 255, 0f / 255);
|
|||
|
internal static Color Red = new Color(194f / 255, 51f / 255, 62f / 255);
|
|||
|
internal static Color Warning = new Color(255f / 255, 255f / 255, 176f / 255);
|
|||
|
internal static Color Splitter = new Color(100f / 255, 100f / 255, 100f / 255);
|
|||
|
internal static Color BarBorder = EditorGUIUtility.isProSkin ?
|
|||
|
(Color)new Color32(35, 35, 35, 255) :
|
|||
|
(Color)new Color32(153, 153, 153, 255);
|
|||
|
|
|||
|
internal static Color InspectorHeaderBackground = Transparent;
|
|||
|
|
|||
|
internal static Color InspectorHeaderBackgroundDisabled = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(58f / 255, 58f / 255, 58f / 255) :
|
|||
|
new Color(199f / 255, 199f / 255, 199f / 255);
|
|||
|
|
|||
|
internal static Color TabUnderline = new Color(58f / 255, 121f / 255, 187f / 255);
|
|||
|
internal static Color Link = new Color(0f, 120f / 255, 218f / 255);
|
|||
|
internal static Color SecondaryLabel = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(196f / 255, 196f / 255, 196f / 255) :
|
|||
|
new Color(105f / 255, 105f / 255, 105f / 255);
|
|||
|
internal static Color BackgroundBar = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(35f / 255, 35f / 255, 35f / 255) :
|
|||
|
new Color(160f / 255, 160f / 255, 160f / 255);
|
|||
|
|
|||
|
internal static Color TreeViewBackground = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(48f / 255, 48f / 255, 48f / 255) :
|
|||
|
new Color(194f / 255, 194f / 255, 194f / 255);
|
|||
|
|
|||
|
internal static Color CommentsBackground = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(60f / 255, 60f / 255, 60f / 255) :
|
|||
|
new Color(160f / 255, 160f / 255, 160f / 255);
|
|||
|
|
|||
|
internal static Color ColumnsBackground = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(56f / 255, 56f / 255, 56f / 255) :
|
|||
|
new Color(221f / 255, 221f / 255, 221f / 255);
|
|||
|
|
|||
|
internal static Color ToggleOffText = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(131f / 255, 131f / 255, 131f / 255) :
|
|||
|
new Color(151f / 255, 151f / 255, 151f / 255);
|
|||
|
|
|||
|
internal static Color ToggleHoverText = EditorGUIUtility.isProSkin ?
|
|||
|
new Color(129f / 255, 180f / 255, 255f / 255) :
|
|||
|
new Color(7f / 255, 68f / 255, 146f / 255);
|
|||
|
}
|
|||
|
|
|||
|
internal static class HexColors
|
|||
|
{
|
|||
|
internal const string LINK_COLOR = "#0078DA";
|
|||
|
}
|
|||
|
|
|||
|
internal static class Dialog
|
|||
|
{
|
|||
|
internal static readonly LazyStyle MessageTitle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.boldLabel);
|
|||
|
style.contentOffset = new Vector2(0, -5);
|
|||
|
style.wordWrap = true;
|
|||
|
style.fontSize = MODAL_FONT_SIZE + 1;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle MessageText = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.wordWrap = true;
|
|||
|
style.fontSize = MODAL_FONT_SIZE;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Toggle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.boldLabel);
|
|||
|
style.fontSize = MODAL_FONT_SIZE;
|
|||
|
style.clipping = TextClipping.Overflow;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle RadioToggle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var radioToggleStyle = new GUIStyle(EditorStyles.radioButton);
|
|||
|
radioToggleStyle.fontSize = MODAL_FONT_SIZE;
|
|||
|
radioToggleStyle.clipping = TextClipping.Overflow;
|
|||
|
radioToggleStyle.font = EditorStyles.largeLabel.font;
|
|||
|
return radioToggleStyle;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Foldout = new LazyStyle(() =>
|
|||
|
{
|
|||
|
GUIStyle paragraphStyle = Paragraph;
|
|||
|
var foldoutStyle = new GUIStyle(EditorStyles.foldout);
|
|||
|
foldoutStyle.fontSize = MODAL_FONT_SIZE;
|
|||
|
foldoutStyle.font = paragraphStyle.font;
|
|||
|
return foldoutStyle;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle EntryLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.textField);
|
|||
|
style.wordWrap = true;
|
|||
|
style.fontSize = MODAL_FONT_SIZE;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle AcceptButtonText = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(GetEditorSkin().GetStyle("WhiteLabel"));
|
|||
|
style.alignment = TextAnchor.MiddleCenter;
|
|||
|
style.fontSize = MODAL_FONT_SIZE + 1;
|
|||
|
style.normal.background = null;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle NormalButton = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(GetEditorSkin().button);
|
|||
|
style.alignment = TextAnchor.MiddleCenter;
|
|||
|
style.fontSize = MODAL_FONT_SIZE;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class Tree
|
|||
|
{
|
|||
|
internal static readonly LazyStyle IconStyle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.largeLabel);
|
|||
|
style.alignment = TextAnchor.MiddleLeft;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Label = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(TreeView.DefaultStyles.label);
|
|||
|
style.fontSize = UnityConstants.LABEL_FONT_SIZE;
|
|||
|
style.alignment = TextAnchor.MiddleLeft;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle SecondaryLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(TreeView.DefaultStyles.label);
|
|||
|
style.fontSize = UnityConstants.LABEL_FONT_SIZE;
|
|||
|
style.alignment = TextAnchor.MiddleLeft;
|
|||
|
|
|||
|
style.active = new GUIStyleState() { textColor = Colors.SecondaryLabel };
|
|||
|
style.focused = new GUIStyleState() { textColor = Colors.SecondaryLabel };
|
|||
|
style.hover = new GUIStyleState() { textColor = Colors.SecondaryLabel };
|
|||
|
style.normal = new GUIStyleState() { textColor = Colors.SecondaryLabel };
|
|||
|
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle InfoLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(MultiColumnHeader.DefaultStyles.columnHeader);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle SecondaryBoldLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(SecondaryLabel);
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle RedLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(Label);
|
|||
|
style.active = new GUIStyleState() { textColor = Colors.Red };
|
|||
|
style.focused = new GUIStyleState() { textColor = Colors.Red };
|
|||
|
style.hover = new GUIStyleState() { textColor = Colors.Red };
|
|||
|
style.normal = new GUIStyleState() { textColor = Colors.Red };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle GreenLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(Label);
|
|||
|
style.active = new GUIStyleState() { textColor = Colors.GreenText };
|
|||
|
style.focused = new GUIStyleState() { textColor = Colors.GreenText };
|
|||
|
style.hover = new GUIStyleState() { textColor = Colors.GreenText };
|
|||
|
style.normal = new GUIStyleState() { textColor = Colors.GreenText };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle BoldLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(TreeView.DefaultStyles.boldLabel);
|
|||
|
style.fontSize = UnityConstants.LABEL_FONT_SIZE;
|
|||
|
style.alignment = TextAnchor.MiddleLeft;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle LabelRightAligned = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(TreeView.DefaultStyles.label);
|
|||
|
style.fontSize = UnityConstants.LABEL_FONT_SIZE;
|
|||
|
style.alignment = TextAnchor.MiddleRight;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle SecondaryLabelRightAligned = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(SecondaryLabel);
|
|||
|
style.alignment = TextAnchor.MiddleRight;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle SecondaryLabelBoldRightAligned = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(SecondaryLabelRightAligned);
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle StatusLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.alignment = TextAnchor.MiddleCenter;
|
|||
|
style.fontSize = 14;
|
|||
|
style.padding = new RectOffset(
|
|||
|
0, 0,
|
|||
|
UnityConstants.TREEVIEW_STATUS_CONTENT_PADDING, UnityConstants.TREEVIEW_STATUS_CONTENT_PADDING);
|
|||
|
style.stretchWidth = false;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Columns = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.normal.background = Images.GetColumnsBackgroundTexture();
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public static class Inspector
|
|||
|
{
|
|||
|
public static readonly LazyStyle HeaderBackgroundStyle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
return CreateUnderlineStyle(
|
|||
|
Colors.InspectorHeaderBackground,
|
|||
|
UnityConstants.INSPECTOR_ACTIONS_HEADER_BACK_RECTANGLE_HEIGHT);
|
|||
|
});
|
|||
|
|
|||
|
public static readonly LazyStyle DisabledHeaderBackgroundStyle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
return CreateUnderlineStyle(
|
|||
|
Colors.InspectorHeaderBackgroundDisabled,
|
|||
|
UnityConstants.INSPECTOR_ACTIONS_HEADER_BACK_RECTANGLE_HEIGHT);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class ProjectSettings
|
|||
|
{
|
|||
|
internal static readonly LazyStyle ToggleOn = new LazyStyle(() =>
|
|||
|
{
|
|||
|
GUIStyle result = new GUIStyle(Toggle);
|
|||
|
result.hover.textColor = Colors.ToggleHoverText;
|
|||
|
return result;
|
|||
|
});
|
|||
|
|
|||
|
static readonly LazyStyle Toggle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
GUIStyle result = new GUIStyle(EditorStyles.miniButton);
|
|||
|
result.fixedHeight = 22;
|
|||
|
result.fixedWidth = 85;
|
|||
|
result.fontSize = 12;
|
|||
|
return result;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class PlasticWindow
|
|||
|
{
|
|||
|
internal static readonly LazyStyle TabButton = new LazyStyle(() =>
|
|||
|
{
|
|||
|
GUIStyle result = new GUIStyle(EditorStyles.label);
|
|||
|
result.padding = EditorStyles.toolbarButton.padding;
|
|||
|
result.margin = EditorStyles.toolbarButton.margin;
|
|||
|
result.contentOffset = EditorStyles.toolbarButton.contentOffset;
|
|||
|
result.alignment = EditorStyles.toolbarButton.alignment;
|
|||
|
result.fixedHeight = EditorStyles.toolbarButton.fixedHeight;
|
|||
|
return result;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle ActiveTabUnderline = new LazyStyle(() =>
|
|||
|
{
|
|||
|
return CreateUnderlineStyle(
|
|||
|
Colors.TabUnderline,
|
|||
|
UnityConstants.ACTIVE_TAB_UNDERLINE_HEIGHT);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class StatusBar
|
|||
|
{
|
|||
|
internal static readonly LazyStyle Icon = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.padding.left = 0;
|
|||
|
style.padding.right = 0;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Label = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle LinkLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.linkLabel);
|
|||
|
style.padding = EditorStyles.label.padding;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle NotificationLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Button = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.miniButtonLeft);
|
|||
|
style.fixedWidth = 60;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle NotificationPanel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.helpBox);
|
|||
|
style.fixedHeight = 24;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle NotificationPanelCloseButton = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fixedHeight = 16;
|
|||
|
style.fixedWidth = 16;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class DiffPanel
|
|||
|
{
|
|||
|
internal static readonly LazyStyle HeaderLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
style.contentOffset = new Vector2(0, 1.5f);
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class PendingChangesTab
|
|||
|
{
|
|||
|
internal static readonly LazyStyle CommentPlaceHolder = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.normal = new GUIStyleState() { textColor = Color.gray };
|
|||
|
style.padding = new RectOffset(7, 0, 4, 0);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle CommentTextArea = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.textArea);
|
|||
|
style.margin = new RectOffset(7, 4, 0, 0);
|
|||
|
style.padding = new RectOffset(0, 0, 4, 0);
|
|||
|
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle CommentWarningIcon = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle HeaderLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
style.contentOffset = new Vector2(0, 1.5f);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Comment = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.normal.background = Images.GetCommentBackgroundTexture();
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly GUIStyle DefaultMultiColumHeader = MultiColumnHeader.DefaultStyles.background;
|
|||
|
}
|
|||
|
|
|||
|
internal static class IncomingChangesTab
|
|||
|
{
|
|||
|
internal static readonly LazyStyle PendingConflictsLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 11;
|
|||
|
style.padding.top = 2;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle RedPendingConflictsOfTotalLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(PendingConflictsLabel);
|
|||
|
style.normal = new GUIStyleState() { textColor = Colors.Red };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle GreenPendingConflictsOfTotalLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(PendingConflictsLabel);
|
|||
|
style.normal = new GUIStyleState() { textColor = Colors.GreenText };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle ChangesToApplySummaryLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 11;
|
|||
|
style.padding.top = 2;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal readonly static LazyStyle HeaderWarningLabel
|
|||
|
= new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 11;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class ChangesetsTab
|
|||
|
{
|
|||
|
internal static readonly LazyStyle HeaderLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
style.contentOffset = new Vector2(0, 1.5f);
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class HistoryTab
|
|||
|
{
|
|||
|
internal static readonly LazyStyle HeaderLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
style.contentOffset = new Vector2(0, 1.5f);
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class DirectoryConflictResolution
|
|||
|
{
|
|||
|
internal readonly static LazyStyle WarningLabel
|
|||
|
= new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.alignment = TextAnchor.MiddleLeft;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class Notification
|
|||
|
{
|
|||
|
internal static readonly LazyStyle Label = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.normal = new GUIStyleState() { textColor = Color.white };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle GreenNotification = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.wordWrap = true;
|
|||
|
style.margin = new RectOffset();
|
|||
|
style.padding = new RectOffset(4, 4, 2, 2);
|
|||
|
style.stretchWidth = true;
|
|||
|
style.stretchHeight = true;
|
|||
|
style.alignment = TextAnchor.UpperLeft;
|
|||
|
|
|||
|
var bg = new Texture2D(1, 1);
|
|||
|
bg.SetPixel(0, 0, Colors.GreenBackground);
|
|||
|
bg.Apply();
|
|||
|
style.normal.background = bg;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle RedNotification = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.wordWrap = true;
|
|||
|
style.margin = new RectOffset();
|
|||
|
style.padding = new RectOffset(4, 4, 2, 2);
|
|||
|
style.stretchWidth = true;
|
|||
|
style.stretchHeight = true;
|
|||
|
style.alignment = TextAnchor.UpperLeft;
|
|||
|
|
|||
|
var bg = new Texture2D(1, 1);
|
|||
|
bg.SetPixel(0, 0, Colors.Red);
|
|||
|
bg.Apply();
|
|||
|
style.normal.background = bg;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static class DirectoryConflicts
|
|||
|
{
|
|||
|
internal readonly static LazyStyle TitleLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.largeLabel);
|
|||
|
RectOffset margin = new RectOffset(
|
|||
|
style.margin.left,
|
|||
|
style.margin.right,
|
|||
|
style.margin.top - 1,
|
|||
|
style.margin.bottom);
|
|||
|
style.margin = margin;
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal readonly static LazyStyle BoldLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontStyle = FontStyle.Bold;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal readonly static LazyStyle FileNameTextField = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.textField);
|
|||
|
RectOffset margin = new RectOffset(
|
|||
|
style.margin.left,
|
|||
|
style.margin.right,
|
|||
|
style.margin.top + 2,
|
|||
|
style.margin.bottom);
|
|||
|
style.margin = margin;
|
|||
|
return style;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
internal static readonly LazyStyle ActionToolbar = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.toolbar);
|
|||
|
style.fixedHeight = 40f;
|
|||
|
style.padding = new RectOffset(5, 5, 5, 5);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle SplitterIndicator = new LazyStyle(() =>
|
|||
|
{
|
|||
|
return CreateUnderlineStyle(
|
|||
|
Colors.Splitter,
|
|||
|
UnityConstants.SPLITTER_INDICATOR_HEIGHT);
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle HelpBoxLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
style.wordWrap = true;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle ProgressLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.label);
|
|||
|
style.fontSize = 10;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle TextFieldWithWrapping = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(GetEditorSkin().textArea);
|
|||
|
style.normal = new GUIStyleState() {
|
|||
|
textColor = GetEditorSkin().textArea.normal.textColor,
|
|||
|
background = Images.GetTreeviewBackgroundTexture()
|
|||
|
};
|
|||
|
|
|||
|
style.wordWrap = true;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Search = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle();
|
|||
|
style.normal = new GUIStyleState() { textColor = Color.gray };
|
|||
|
style.padding = new RectOffset(18, 0, 0, 0);
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle WarningMessage = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(GetEditorSkin().box);
|
|||
|
style.wordWrap = true;
|
|||
|
style.margin = new RectOffset();
|
|||
|
style.padding = new RectOffset(8, 8, 6, 6);
|
|||
|
style.stretchWidth = true;
|
|||
|
style.alignment = TextAnchor.UpperLeft;
|
|||
|
|
|||
|
var bg = new Texture2D(1, 1);
|
|||
|
bg.SetPixel(0, 0, Colors.Warning);
|
|||
|
bg.Apply();
|
|||
|
style.normal.background = bg;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle CancelButton = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var normalIcon = Images.GetImage(Images.Name.IconCloseButton);
|
|||
|
var pressedIcon = Images.GetImage(Images.Name.IconPressedCloseButton);
|
|||
|
|
|||
|
var style = new GUIStyle();
|
|||
|
style.normal = new GUIStyleState() { background = normalIcon };
|
|||
|
style.onActive = new GUIStyleState() { background = pressedIcon };
|
|||
|
style.active = new GUIStyleState() { background = pressedIcon };
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle MiniToggle = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.boldLabel);
|
|||
|
style.fontSize = MODAL_FONT_SIZE - 1;
|
|||
|
style.clipping = TextClipping.Overflow;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle Paragraph = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(EditorStyles.largeLabel);
|
|||
|
style.wordWrap = true;
|
|||
|
style.richText = true;
|
|||
|
style.fontSize = MODAL_FONT_SIZE;
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
internal static readonly LazyStyle LinkLabel = new LazyStyle(() =>
|
|||
|
{
|
|||
|
var style = new GUIStyle(GUI.skin.label);
|
|||
|
style.normal.textColor = new Color(0.129f, 0.588f, 0.953f);
|
|||
|
style.hover.textColor = new Color(0.239f, 0.627f, 0.949f);
|
|||
|
style.active.textColor = new Color(0.239f, 0.627f, 0.949f);
|
|||
|
|
|||
|
return style;
|
|||
|
});
|
|||
|
|
|||
|
static GUISkin GetEditorSkin()
|
|||
|
{
|
|||
|
GUISkin editorSkin = null;
|
|||
|
if (EditorGUIUtility.isProSkin)
|
|||
|
editorSkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
|
|||
|
else
|
|||
|
editorSkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
|
|||
|
|
|||
|
return editorSkin;
|
|||
|
}
|
|||
|
|
|||
|
static GUIStyle CreateUnderlineStyle(Color color, int height)
|
|||
|
{
|
|||
|
GUIStyle style = new GUIStyle();
|
|||
|
|
|||
|
Texture2D pixel = new Texture2D(1, height);
|
|||
|
|
|||
|
for (int i = 0; i < height; i++)
|
|||
|
pixel.SetPixel(0, i, color);
|
|||
|
|
|||
|
pixel.wrapMode = TextureWrapMode.Repeat;
|
|||
|
pixel.Apply();
|
|||
|
|
|||
|
style.normal.background = pixel;
|
|||
|
style.fixedHeight = height;
|
|||
|
|
|||
|
return style;
|
|||
|
}
|
|||
|
|
|||
|
static void EnsureBackgroundStyles(LazyStyle lazy)
|
|||
|
{
|
|||
|
// The editor cleans the GUIStyleState.background property
|
|||
|
// when entering the edit mode (exiting the play mode)
|
|||
|
// and also in other situations (e.g when you use Zoom app)
|
|||
|
// Because of this, we have to reset them in order to
|
|||
|
// re-instantiate them the next time they're used
|
|||
|
|
|||
|
if (!mLazyBackgroundStyles.Contains(lazy))
|
|||
|
return;
|
|||
|
|
|||
|
bool needsRepaint = false;
|
|||
|
|
|||
|
foreach (LazyStyle style in mLazyBackgroundStyles)
|
|||
|
{
|
|||
|
if (!style.IsInitialized)
|
|||
|
continue;
|
|||
|
|
|||
|
if (style.Value.normal.background != null)
|
|||
|
continue;
|
|||
|
|
|||
|
style.Reset();
|
|||
|
|
|||
|
needsRepaint = true;
|
|||
|
}
|
|||
|
|
|||
|
if (!needsRepaint)
|
|||
|
return;
|
|||
|
|
|||
|
if (mRepaintPlasticWindow != null)
|
|||
|
mRepaintPlasticWindow();
|
|||
|
}
|
|||
|
|
|||
|
static List<LazyStyle> mLazyBackgroundStyles = new List<LazyStyle>();
|
|||
|
|
|||
|
internal class LazyStyle
|
|||
|
{
|
|||
|
internal bool IsInitialized { get; private set; }
|
|||
|
|
|||
|
internal LazyStyle(Func<GUIStyle> builder)
|
|||
|
{
|
|||
|
mBuilder = builder;
|
|||
|
IsInitialized = false;
|
|||
|
}
|
|||
|
internal GUIStyle Value { get; private set; }
|
|||
|
|
|||
|
internal void Reset()
|
|||
|
{
|
|||
|
IsInitialized = false;
|
|||
|
}
|
|||
|
|
|||
|
public static implicit operator GUIStyle(LazyStyle lazy)
|
|||
|
{
|
|||
|
if (lazy.IsInitialized)
|
|||
|
{
|
|||
|
EnsureBackgroundStyles(lazy);
|
|||
|
return lazy.Value;
|
|||
|
}
|
|||
|
|
|||
|
lazy.Value = lazy.mBuilder();
|
|||
|
lazy.IsInitialized = true;
|
|||
|
return lazy.Value;
|
|||
|
}
|
|||
|
|
|||
|
readonly Func<GUIStyle> mBuilder;
|
|||
|
}
|
|||
|
|
|||
|
static Action mRepaintPlasticWindow;
|
|||
|
|
|||
|
const int MODAL_FONT_SIZE = 13;
|
|||
|
}
|
|||
|
}
|