Added samples for burst and entities
This commit is contained in:
parent
2a354e7da5
commit
c1e7044561
|
|
@ -1,7 +1,6 @@
|
|||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
|
|
|
|||
8
Samples~/SamplesToolbarBurst/Icons.meta
Normal file
8
Samples~/SamplesToolbarBurst/Icons.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e31d016aae6230944a6f391781dec340
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -0,0 +1,117 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 60fb1efbdd5470143ad7d05f4789d734
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
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: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,117 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 11a0ecf430044e34da03a9f55d260972
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
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: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,117 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 919dde4918f9c2040ae36996a59f7fda
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
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: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -0,0 +1,117 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aa74587cda5d7cd4881de734449f86c6
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
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: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Module.NavigationTool.Editor.Burst",
|
||||
"rootNamespace": "Module.NavigationTool.Editor.Burst",
|
||||
"references": [
|
||||
"GUID:8339b3ce77cb32f489776d81010ad36c"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c2c8e14dde10d149b8c2675bddde058
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Samples~/SamplesToolbarBurst/Settings.meta
Normal file
8
Samples~/SamplesToolbarBurst/Settings.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9515ea51d438d864bb613126b10ff5fe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using Module.NavigationTool.Editor.Toolbar;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Burst.Toolbar
|
||||
{
|
||||
internal sealed class ToolbarBurstSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Burst";
|
||||
|
||||
private const string PREF_PREFS_ENABLED = "ToolbarSettings.IsBurstsEnabled";
|
||||
|
||||
public static bool IsEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_PREFS_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_PREFS_ENABLED, value);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
IsEnabled = EditorGUILayout.Toggle("Enable Burst", IsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1b064274e467ceb4c876833f7fef3ec2
|
||||
98
Samples~/SamplesToolbarBurst/ToolBurst.cs
Normal file
98
Samples~/SamplesToolbarBurst/ToolBurst.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using JetBrains.Annotations;
|
||||
using Module.NavigationTool.Editor.Toolbar;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Profiling;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Burst.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolBurst : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarBurstSettings.IsEnabled;
|
||||
public override bool Enabled => true;
|
||||
public override EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
public override int Priority => (int)EToolbarPriority.Low;
|
||||
|
||||
protected override void Draw(Rect rect)
|
||||
{
|
||||
Styles.Initialize();
|
||||
|
||||
if (GUI.Button(rect, IsBurstEnabled() ? Styles.ICON_ENABLED : Styles.ICON_DISABLED, styles.button))
|
||||
EditorApplication.ExecuteMenuItem("Jobs/Burst/Enable Compilation");
|
||||
|
||||
GUI.Label(rect, Styles.LABEL, styles.labelCenter);
|
||||
}
|
||||
|
||||
public override float CalculateWidth()
|
||||
{
|
||||
return 24.0f;
|
||||
}
|
||||
|
||||
private bool IsBurstEnabled()
|
||||
{
|
||||
const string typeFullname = "Unity.Burst.Editor.BurstEditorOptions, Unity.Burst";
|
||||
const string propertyName = "EnableBurstCompilation";
|
||||
|
||||
var type = Type.GetType(typeFullname, false, true);
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
Debug.LogWarningFormat("Failed to find type with name: {0}", typeFullname);
|
||||
return false;
|
||||
}
|
||||
|
||||
PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
if (property == null)
|
||||
{
|
||||
Debug.LogWarningFormat("Failed to find property with name: {0} on type: {1}", propertyName, typeFullname);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)property.GetValue(null);
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static readonly GUIContent LABEL = new GUIContent(string.Empty, "Enable/disable burst compiler");
|
||||
|
||||
public static GUIContent ICON_ENABLED;
|
||||
public static GUIContent ICON_DISABLED;
|
||||
|
||||
private static bool IS_INITIALIZED;
|
||||
private const string EditorIconFileNameLight = "tex_icon_burst_light";
|
||||
private const string EditorIconFileNameDark = "tex_icon_burst_dark";
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (IS_INITIALIZED)
|
||||
return;
|
||||
|
||||
ICON_ENABLED = new GUIContent(LoadIcon("_enabled"));
|
||||
ICON_DISABLED = new GUIContent(LoadIcon("_disabled"));
|
||||
IS_INITIALIZED = true;
|
||||
}
|
||||
|
||||
private static Texture2D LoadIcon(string postfix)
|
||||
{
|
||||
string iconPrefix = EditorGUIUtility.isProSkin ? EditorIconFileNameDark : EditorIconFileNameLight;
|
||||
string filename = $"{iconPrefix}{postfix}";
|
||||
string[] guids = AssetDatabase.FindAssets("t:texture " + filename);
|
||||
|
||||
for (int i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
|
||||
if (tex != null)
|
||||
return tex;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Samples~/SamplesToolbarBurst/ToolBurst.cs.meta
Normal file
2
Samples~/SamplesToolbarBurst/ToolBurst.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 12286d5e95c428b4894a8d88b86b8080
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Module.NavigationTool.Editor.Entities",
|
||||
"rootNamespace": "Module.NavigationTool.Editor.Entities",
|
||||
"references": [
|
||||
"GUID:8339b3ce77cb32f489776d81010ad36c"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7f005006296b7aa41b589cd21e890d5c
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Samples~/SamplesToolbarEntities/Settings.meta
Normal file
8
Samples~/SamplesToolbarEntities/Settings.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b746b07b87c4e4340aed5ad6a7bc3b64
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using Module.NavigationTool.Editor.Toolbar;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Entities.Toolbar
|
||||
{
|
||||
internal sealed class ToolbarEntitiesSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Entities";
|
||||
|
||||
private const string PREF_PREFS_ENABLED = "ToolbarSettings.IsEntitiesEnabled";
|
||||
|
||||
public static bool IsEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_PREFS_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_PREFS_ENABLED, value);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
IsEnabled = EditorGUILayout.Toggle("Enable Entities", IsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1077d6399eff29247a55c20578a2df1c
|
||||
125
Samples~/SamplesToolbarEntities/ToolEntities.cs
Normal file
125
Samples~/SamplesToolbarEntities/ToolEntities.cs
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Module.NavigationTool.Editor.Toolbar;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Entities.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolEntities : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarEntitiesSettings.IsEnabled;
|
||||
public override bool Enabled => true;
|
||||
public override EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
public override int Priority => (int)EToolbarPriority.Low;
|
||||
|
||||
protected override void Draw(Rect rect)
|
||||
{
|
||||
Styles.Initialize();
|
||||
|
||||
Rect rect0 = new Rect(rect.x, rect.y, 24f, rect.height);
|
||||
Rect rect1 = new Rect(rect0.xMax, rect.y, 24f, rect.height);
|
||||
Rect rect2 = new Rect(rect1.xMax, rect.y, 24f, rect.height);
|
||||
Rect rect3 = new Rect(rect2.xMax, rect.y, 24f, rect.height);
|
||||
Rect rect4 = new Rect(rect3.xMax, rect.y, 24f, rect.height);
|
||||
|
||||
if (GUI.Button(rect0, Styles.ICON_HIERARCHY, styles.button))
|
||||
ToggleWindow("HierarchyWindow");
|
||||
if (GUI.Button(rect1, Styles.ICON_COMPONENTS, styles.button))
|
||||
ToggleWindow("ComponentsWindow");
|
||||
if (GUI.Button(rect2, Styles.ICON_SYSTEMS, styles.button))
|
||||
ToggleWindow("SystemScheduleWindow");
|
||||
if (GUI.Button(rect3, Styles.ICON_ARCHETYPES, styles.button))
|
||||
ToggleWindow("ArchetypesWindow");
|
||||
if (GUI.Button(rect4, Styles.ICON_JOURNALING, styles.button))
|
||||
ToggleWindow("EntitiesJournalingWindow");
|
||||
|
||||
GUI.Label(rect0, Styles.LABEL_HIERARCHY, styles.labelCenter);
|
||||
GUI.Label(rect1, Styles.LABEL_COMPONENTS, styles.labelCenter);
|
||||
GUI.Label(rect2, Styles.LABEL_SYSTEMS, styles.labelCenter);
|
||||
GUI.Label(rect3, Styles.LABEL_ARCHETYPES, styles.labelCenter);
|
||||
GUI.Label(rect4, Styles.LABEL_JOURNALING, styles.labelCenter);
|
||||
}
|
||||
|
||||
public override float CalculateWidth()
|
||||
{
|
||||
return 120.0f;
|
||||
}
|
||||
|
||||
private void ToggleWindow(string typeName)
|
||||
{
|
||||
string fullname = "Unity.Entities.Editor." + typeName + ", Unity.Entities.Editor";
|
||||
Type type = Type.GetType(fullname, false, true);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
Object[] all = Resources.FindObjectsOfTypeAll(type);
|
||||
|
||||
if (all.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < all.Length; i++)
|
||||
{
|
||||
if (all[i] is EditorWindow window)
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorWindow.GetWindow(type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarningFormat("Failed to find type with name: {0}", fullname);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static readonly GUIContent LABEL_HIERARCHY = new GUIContent(string.Empty, "Show/Hide entities hierarchy window");
|
||||
public static readonly GUIContent LABEL_COMPONENTS = new GUIContent(string.Empty, "Show/Hide entities components window");
|
||||
public static readonly GUIContent LABEL_SYSTEMS = new GUIContent(string.Empty, "Show/Hide entities systems window");
|
||||
public static readonly GUIContent LABEL_ARCHETYPES = new GUIContent(string.Empty, "Show/Hide entities archetypes window");
|
||||
public static readonly GUIContent LABEL_JOURNALING = new GUIContent(string.Empty, "Show/Hide entities journaling window");
|
||||
|
||||
public static GUIContent ICON_HIERARCHY;
|
||||
public static GUIContent ICON_COMPONENTS;
|
||||
public static GUIContent ICON_SYSTEMS;
|
||||
public static GUIContent ICON_ARCHETYPES;
|
||||
public static GUIContent ICON_JOURNALING;
|
||||
|
||||
private static bool IS_INITIALIZED;
|
||||
|
||||
private const string EditorDefaultResourcesPath = "Packages/com.unity.entities/Editor Default Resources/";
|
||||
private const string EditorIconsLightDirectory = EditorDefaultResourcesPath + "icons/light";
|
||||
private const string EditorIconsDarkDirectory = EditorDefaultResourcesPath + "icons/dark";
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (IS_INITIALIZED)
|
||||
return;
|
||||
|
||||
ICON_HIERARCHY = new GUIContent(LoadIcon("EntityGroup/EntityGroup"));
|
||||
ICON_COMPONENTS = new GUIContent(LoadIcon("Component/Component"));
|
||||
ICON_SYSTEMS = new GUIContent(LoadIcon("System/System"));
|
||||
ICON_ARCHETYPES = new GUIContent(LoadIcon("Archetype/Archetype"));
|
||||
ICON_JOURNALING = new GUIContent(LoadIcon("Journaling/Journaling"));
|
||||
|
||||
IS_INITIALIZED = true;
|
||||
}
|
||||
|
||||
private static Texture2D LoadIcon(string name)
|
||||
{
|
||||
string iconsDirectory = EditorIconsLightDirectory;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
iconsDirectory = EditorIconsDarkDirectory;
|
||||
|
||||
Object obj = AssetDatabase.LoadAssetAtPath(iconsDirectory + "/" + name + ".png", typeof(Texture2D));
|
||||
return obj != null ? (Texture2D)obj : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Samples~/SamplesToolbarEntities/ToolEntities.cs.meta
Normal file
2
Samples~/SamplesToolbarEntities/ToolEntities.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 460de731a77f02347b6ae7d35050a5f1
|
||||
15
package.json
15
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.module.navigationtool",
|
||||
"version": "1.9.5",
|
||||
"version": "1.10.0",
|
||||
"displayName": "Module.NavigationTool",
|
||||
"description": "Support for navigation tools, like favorites, history and toolbars",
|
||||
"unity": "2019.2",
|
||||
|
|
@ -19,5 +19,16 @@
|
|||
"email": "anders@ejlersen.info",
|
||||
"url": "https://www.ejlersen.info"
|
||||
},
|
||||
"_fingerprint": "06420f1ad404ea844ae5d2f3a0a3f841703632f5"
|
||||
"samples": [
|
||||
{
|
||||
"displayName": "Entities Toolbar Sample",
|
||||
"description": "Displays a list of five buttons for show/hiding hierarchy, components, systems, archetypes and journaling window",
|
||||
"path": "Samples~/SamplesToolbarEntities"
|
||||
},
|
||||
{
|
||||
"displayName": "Burst Toolbar Sample",
|
||||
"description": "Displays a enable/disable burst compiler button",
|
||||
"path": "Samples~/SamplesToolbarBurst"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue