浏览代码

added chevron to AddRandomizerMenu directory label

/main
Steven Leal 4 年前
当前提交
7b8062f9
共有 16 个文件被更改,包括 337 次插入11 次删除
  1. 8
      com.unity.perception/Editor/Randomization/Uss/AddRandomizerMenuStyles.uss
  2. 8
      com.unity.perception/Editor/Randomization/Uxml/Randomizer/AddRandomizerMenu.uxml
  3. 27
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs
  4. 3
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs
  5. 5
      com.unity.perception/Editor/Randomization/Icons/ChevronLeft.png
  6. 144
      com.unity.perception/Editor/Randomization/Icons/ChevronLeft.png.meta
  7. 6
      com.unity.perception/Editor/Randomization/Icons/ChevronRight.png
  8. 144
      com.unity.perception/Editor/Randomization/Icons/ChevronRight.png.meta
  9. 3
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer.meta
  10. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs.meta
  11. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs.meta
  12. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs
  13. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs.meta
  14. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs
  15. 0
      /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs

8
com.unity.perception/Editor/Randomization/Uss/AddRandomizerMenuStyles.uss


.chevron-right {
height: 12px;
width: 12px;
background-image: resource("Packages/com.unity.perception/Editor/Randomization/Icons/FoldoutClosed.png");
background-image: resource("Packages/com.unity.perception/Editor/Randomization/Icons/ChevronRight.png");
}
.chevron-left {
height: 12px;
width: 12px;
background-image: resource("Packages/com.unity.perception/Editor/Randomization/Icons/ChevronLeft.png");
}
.menu-element:hover {

8
com.unity.perception/Editor/Randomization/Uxml/Randomizer/AddRandomizerMenu.uxml


<UXML xmlns="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements">
<UXML xmlns="UnityEngine.UIElements">
<TextElement name="directory-name" text="Randomizers" style="-unity-text-align: middle-center; -unity-font-style: bold; padding: 3px; background-color: #414141; border-bottom-width: 1px; border-top-width: 1px;border-color: #232323;"/>
<VisualElement name="directory-label" style="flex-direction: row; justify-content: space-between; align-items: center; background-color: #414141">
<VisualElement name="directory-chevron" class="chevron-left"/>
<TextElement name="directory-label-text" text="Randomizers" style="-unity-font-style: bold; padding: 3px;"/>
<VisualElement/>
</VisualElement>
<VisualElement name="menu-options"/>
</VisualElement>
</UXML>

27
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs


{
class AddRandomizerMenu : VisualElement
{
const string k_DefaultDirectoryText = "Randomizers";
string m_CurrentPath = string.Empty;
string currentPath
{

get
{
if (m_CurrentPath == string.Empty)
return "Randomizers";
return k_DefaultDirectoryText;
var pathItems = m_CurrentPath.Split('/');
return pathItems[pathItems.Length - 1];
}

DrawDirectoryItems();
else
DrawSearchItems();
}
}
string directoryText
{
set
{
m_DirectoryLabelText.text = value;
m_DirectoryChevron.style.visibility = value == k_DefaultDirectoryText
? new StyleEnum<Visibility>(Visibility.Hidden)
: new StyleEnum<Visibility>(Visibility.Visible);
TextElement m_DirectoryName;
TextElement m_DirectoryLabelText;
VisualElement m_DirectoryChevron;
Dictionary<string, List<MenuItem>> m_MenuItemsMap = new Dictionary<string, List<MenuItem>>();
Dictionary<string, HashSet<string>> m_MenuDirectories = new Dictionary<string, HashSet<string>>();
List<MenuItem> m_MenuItems = new List<MenuItem>();

ExitMenu();
});
m_DirectoryName = this.Q<TextElement>("directory-name");
m_DirectoryName.RegisterCallback<MouseUpEvent>(evt => { AscendDirectory(); });
var directoryLabel = this.Q<VisualElement>("directory-label");
directoryLabel.RegisterCallback<MouseUpEvent>(evt => { AscendDirectory(); });
m_DirectoryLabelText = this.Q<TextElement>("directory-label-text");
m_DirectoryChevron = this.Q<VisualElement>("directory-chevron");
var searchBar = this.Q<TextField>("search-bar");
searchBar.schedule.Execute(() => searchBar.ElementAt(0).Focus());

void DrawDirectoryItems()
{
m_DirectoryName.text = currentPathName;
directoryText = currentPathName;
m_MenuElements.Clear();
if (m_MenuDirectories.ContainsKey(currentPath))

void DrawSearchItems()
{
m_DirectoryName.text = "Randomizers";
directoryText = k_DefaultDirectoryText;
m_MenuElements.Clear();
var upperSearchString = searchString.ToUpper();

3
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs


using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.Experimental.Perception.Randomization.Editor;
using UnityEngine.Experimental.Perception.Randomization.Randomizers;
using UnityEngine.UIElements;
namespace UnityEngine.Experimental.Perception.Randomization.VisualElements

SerializedProperty m_Property;
VisualElement m_PropertiesContainer;
Randomizer randomizer => (Randomizer)StaticData.GetManagedReferenceValue(m_Property);
Randomizers.Randomizer randomizer => (Randomizers.Randomizer)StaticData.GetManagedReferenceValue(m_Property);
public Type randomizerType => randomizer.GetType();

5
com.unity.perception/Editor/Randomization/Icons/ChevronLeft.png

之前 之后
宽度: 32  |  高度: 32  |  大小: 2.0 KiB

144
com.unity.perception/Editor/Randomization/Icons/ChevronLeft.png.meta


fileFormatVersion: 2
guid: 8ccf58823c99c574f9cfb36e2e051078
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

6
com.unity.perception/Editor/Randomization/Icons/ChevronRight.png

之前 之后
宽度: 32  |  高度: 32  |  大小: 2.0 KiB

144
com.unity.perception/Editor/Randomization/Icons/ChevronRight.png.meta


fileFormatVersion: 2
guid: 799cb8d9484d2ea4a9d4ddd15bda85aa
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

3
com.unity.perception/Editor/Randomization/VisualElements/Randomizer.meta


fileFormatVersion: 2
guid: c194e9893fcc4197ab26d01371347d07
timeCreated: 1601054944

/com.unity.perception/Editor/Randomization/VisualElements/RandomizerElement.cs.meta → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs.meta

/com.unity.perception/Editor/Randomization/VisualElements/RandomizerList.cs.meta → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs.meta

/com.unity.perception/Editor/Randomization/VisualElements/AddRandomizerMenu.cs → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs

/com.unity.perception/Editor/Randomization/VisualElements/AddRandomizerMenu.cs.meta → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs.meta

/com.unity.perception/Editor/Randomization/VisualElements/RandomizerElement.cs → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs

/com.unity.perception/Editor/Randomization/VisualElements/RandomizerList.cs → /com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs

正在加载...
取消
保存