feat(localization): add MPUIKit plugin

This commit is contained in:
Fangh 2024-02-29 21:33:27 +01:00
parent 39bfa4b2e7
commit 9d3dfb8c0f
123 changed files with 8738 additions and 0 deletions

8
Assets/MPUIKit.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f2b1f7fc7f3ee4097bdc8a214a25adb5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3be96de8ad725594daed36f170ebc783
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6dd8df1b756a60749afb0e7b5f235a9a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/MPUIKit/Editor/Images/background.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: fc2679c53c135d6439749bc914f017c7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 28e13a84bec69524f83ef82d190512b7
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/MPUIKit/Editor/Images/flip_h_0.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 2b75b377ce173b342846139114db41c0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_h_1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 909ed2453e96f58469413d872d9514f2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_h_2.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: f5ba0cbf55aa907498bc5d9ff5e444fe
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_h_3.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 30771270a2bd2f4409feadba3a9fc9e9
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_v_0.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 433dc7f6ca55dda4aaed66f61ded97e0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_v_1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 55d0889b3d34fd643bddd75020104564
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_v_2.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 4df45fbb9245e5d41bc81708f0e99416
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/flip_v_3.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 7179a1b48ada8c44b9223fdcbf5b672c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/logo.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: ed7c0349ea442c7468846ed9a15d6767
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5de6378f08e8b374dbe5fa7e4a3e4308
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/MPUIKit/Editor/Images/rotate_left_0.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 2d1f072a775a3ce4091efc83457078c1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_left_1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: b8059e7446805dd40b70642e58f171db
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_left_2.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 0d26fbf225e256240bb774a29d43c174
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_left_3.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 3d59d8c1ca0ebeb4ba5322f57f3a1cbf
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_right_0.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 5b159abd08591a44da0189ddd60f268c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_right_1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 8c982da53e6cb914388752101293948a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_right_2.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 691588d46541ae24fb0e81b16fdee53a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/rotate_right_3.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 68519222aeac862479f7ef5cc8c995cd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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:

BIN
Assets/MPUIKit/Editor/Images/title.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: a2dcf70d1c4d4c4428dfb453aadfc4dc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: c5805dcd91ec2754381bd5945014a5ef
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
{
"name": "MPUIKit.Editor",
"references": [
"GUID:5b70f83da6937434491f26e0fd0cd099"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 64c50969ba90b4463bb322f2967096a1
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: da5bb45cfcea53d46a0e1d8eadb2dec3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,70 @@
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor
{
public class EditorGUILayoutExtended : UnityEditor.Editor
{
private static readonly Type editorGUIType = typeof(EditorGUI);
private static readonly Type RecycledTextEditorType =
Assembly.GetAssembly(editorGUIType).GetType("UnityEditor.EditorGUI+RecycledTextEditor");
private static readonly Type[] argumentTypes =
{
RecycledTextEditorType, typeof(Rect), typeof(Rect), typeof(int), typeof(float), typeof(string),
typeof(GUIStyle), typeof(bool)
};
private static readonly MethodInfo doFloatFieldMethod = editorGUIType.GetMethod("DoFloatField",
BindingFlags.NonPublic | BindingFlags.Static, null, argumentTypes, null);
private static readonly FieldInfo fieldInfo =
editorGUIType.GetField("s_RecycledEditor", BindingFlags.NonPublic | BindingFlags.Static);
private static readonly object recycledEditor = fieldInfo.GetValue(null);
private static readonly GUIStyle style = EditorStyles.numberField;
public static float FloatFieldExtended(Rect _position, float _value, Rect _dragHotZone)
{
int controlId = GUIUtility.GetControlID("EditorTextField".GetHashCode(), FocusType.Keyboard, _position);
object[] parameters = {recycledEditor, _position, _dragHotZone, controlId, _value, "g7", style, true};
return (float) doFloatFieldMethod.Invoke(null, parameters);
}
// public static float FloatField(GUIContent _content, float _value, float _inputBoxWidth, params GUILayoutOption[] _options)
// {
// Rect totalRect = EditorGUILayout.GetControlRect(_options);
// float width;
// if (_inputBoxWidth < 1) width = totalRect.width * Mathf.Clamp(_inputBoxWidth, 0.2f, 0.8f);
// else width = Mathf.Clamp(_inputBoxWidth, totalRect.width * 0.2f, totalRect.width * 0.8f);
// Rect labelRect = new Rect(totalRect.x, totalRect.y, totalRect.width - width - 8, totalRect.height);
// Rect inputRect = new Rect(totalRect.x + totalRect.width - width, totalRect.y, width, totalRect.height);
//
// EditorGUI.LabelField(labelRect, _content);
// return FloatFieldExtended(inputRect, _value, labelRect);
// }
public static float FloatField(GUIContent _content, float _value, float _labelwidth,
params GUILayoutOption[] _options)
{
Rect totalRect = EditorGUILayout.GetControlRect(_options);
// float width;
// if (_labelwidth < 1) width = totalRect.width * Mathf.Clamp(_labelwidth, 0.2f, 0.8f);
// else width = Mathf.Clamp(_labelwidth, totalRect.width * 0.2f, totalRect.width * 0.8f);
Rect labelRect = new Rect(totalRect.x, totalRect.y, _labelwidth, totalRect.height);
Rect inputRect = new Rect(totalRect.x + _labelwidth, totalRect.y, totalRect.width - _labelwidth,
totalRect.height);
// Rect labelRect = new Rect(totalRect.x, totalRect.y, totalRect.width - width - 8, totalRect.height);
// Rect inputRect = new Rect(totalRect.x + totalRect.width - width, totalRect.y, width, totalRect.height);
EditorGUI.LabelField(labelRect, _content);
return FloatFieldExtended(inputRect, _value, labelRect);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6578e090f4183b34f8420ebe855dce58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2954915c9a2e49da8fba55e1a2a62a89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(GradientEffect))]
public class GradeintEffectPropertyDrawer : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
SerializedProperty Enabled = property.FindPropertyRelative("m_Enabled");
bool enabled = Enabled.boolValue;
SerializedProperty gradientType = property.FindPropertyRelative("m_GradientType");
GradientType gradType = (GradientType) gradientType.enumValueIndex;
SerializedProperty gradient = property.FindPropertyRelative("m_Gradient");
SerializedProperty rotation = property.FindPropertyRelative("m_Rotation");
SerializedProperty cornerColors = property.FindPropertyRelative("m_CornerGradientColors");
Rect line = position;
line.height = EditorGUIUtility.singleLineHeight;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = Enabled.hasMultipleDifferentValues;
enabled = EditorGUI.Toggle(line, "Gradient", enabled);
EditorGUI.showMixedValue = false;
if (enabled) {
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.showMixedValue = gradientType.hasMultipleDifferentValues;
gradType = (GradientType) EditorGUI.EnumPopup(line, "Type", gradType);
EditorGUI.showMixedValue = false;
}
}
if (EditorGUI.EndChangeCheck()) {
Enabled.boolValue = enabled;
gradientType.enumValueIndex = (int) gradType;
}
if (enabled) {
if (gradType == GradientType.Corner) {
if (cornerColors.arraySize != 4)
cornerColors.arraySize = 4;
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
float colFieldWidth = line.width / 2f - 5f;
line.width = colFieldWidth;
EditorGUI.PropertyField(line, cornerColors.GetArrayElementAtIndex(0), GUIContent.none);
line.x += colFieldWidth + 10;
EditorGUI.PropertyField(line, cornerColors.GetArrayElementAtIndex(1), GUIContent.none);
line.x -= colFieldWidth + 10;
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(line, cornerColors.GetArrayElementAtIndex(2), GUIContent.none);
line.x += colFieldWidth + 10;
EditorGUI.PropertyField(line, cornerColors.GetArrayElementAtIndex(3), GUIContent.none);
line.x -= colFieldWidth + 10;
line.width = colFieldWidth * 2 + 10;
}
else {
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.showMixedValue = gradient.hasMultipleDifferentValues;
EditorGUI.PropertyField(line, gradient, false);
if (gradType == GradientType.Linear) {
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.showMixedValue = rotation.hasMultipleDifferentValues;
EditorGUI.PropertyField(line, rotation, new GUIContent("Rotation"));
}
EditorGUI.showMixedValue = false;
}
}
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
SerializedProperty enabled = property.FindPropertyRelative("m_Enabled");
if (enabled.boolValue) {
SerializedProperty gradientMode = property.FindPropertyRelative("m_GradientType");
if (gradientMode.enumValueIndex == (int) GradientType.Radial) {
return EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing * 2;
}
return EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing * 3;
}
return EditorGUIUtility.singleLineHeight;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 242b08f96b7b1b549b6a19a05267d72d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,129 @@
using System.IO;
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[InitializeOnLoad]
internal static class MPEditorContents {
private static string _mpuiKitImagesDirectory = string.Empty;
private static GUIContent _flipHorizontalNormal, _flipHorizontalActive;
private static GUIContent _flipVerticalNormal, _flipVerticalActive;
private static GUIContent _rotateLeftNormal, _rotateLeftActive;
private static GUIContent _rotateRightNormal, _rotateRightActive;
private static Texture2D _logo, _background, _title;
public static GUIContent FlipHorizontalNormal {
get {
if (_flipHorizontalNormal != null) return _flipHorizontalNormal;
_flipHorizontalNormal = new GUIContent(LoadImage("flip_h", false));
return _flipHorizontalNormal;
}
}
public static GUIContent FlipHorizontalActive {
get {
if (_flipHorizontalActive != null) return _flipHorizontalActive;
_flipHorizontalActive = new GUIContent(LoadImage("flip_h", true));
return _flipHorizontalActive;
}
}
public static GUIContent FlipVerticalNormal {
get {
if (_flipVerticalNormal != null) return _flipVerticalNormal;
_flipVerticalNormal = new GUIContent(LoadImage("flip_v", false));
return _flipVerticalNormal;
}
}
public static GUIContent FlipVerticalActive {
get {
if (_flipVerticalActive != null) return _flipVerticalActive;
_flipVerticalActive = new GUIContent(LoadImage("flip_v", true));
return _flipVerticalActive;
}
}
public static GUIContent RotateLeftNormal {
get {
if (_rotateLeftNormal != null) return _rotateLeftNormal;
_rotateLeftNormal = new GUIContent(LoadImage("rotate_left", false));
return _rotateLeftNormal;
}
}
public static GUIContent RotateLeftActive {
get {
if (_rotateLeftActive != null) return _rotateLeftActive;
_rotateLeftActive = new GUIContent(LoadImage("rotate_left", true));
return _rotateLeftActive;
}
}
public static GUIContent RotateRightNormal {
get {
if (_rotateRightNormal != null) return _rotateRightNormal;
_rotateRightNormal = new GUIContent(LoadImage("rotate_right", false));
return _rotateRightNormal;
}
}
public static GUIContent RotateRightActive {
get {
if (_rotateRightActive != null) return _rotateRightActive;
_rotateRightActive = new GUIContent(LoadImage("rotate_right", true));
return _rotateRightActive;
}
}
public static Texture Logo {
get {
if (_logo != null) return _logo;
_logo = LoadImage("logo", false, true);
return _logo;
}
}
public static Texture Background {
get {
if (_background != null) return _background;
_background = LoadImage("background", false, true);
return _background;
}
}
public static Texture Title {
get {
if (_title != null) return _title;
_title = LoadImage("title", false, true);
return _title;
}
}
static MPEditorContents() {
FindMpuiKitIconsDirectory();
}
private static void FindMpuiKitIconsDirectory()
{
string rootDir = MPEditorUtility.FindMPUIKitRootDirectory();
_mpuiKitImagesDirectory = string.IsNullOrEmpty(rootDir) ? string.Empty : Path.Combine(rootDir, "Editor", "Images");
}
private static Texture2D LoadImage(string name, bool activeState, bool ignoreState = false) {
int colorLevel = 0;
if (!ignoreState) {
if (activeState) colorLevel = 3;
else colorLevel = EditorGUIUtility.isProSkin ? 2 : 1;
}
if (_mpuiKitImagesDirectory == string.Empty) FindMpuiKitIconsDirectory();
string assetPath = $"{_mpuiKitImagesDirectory}{Path.DirectorySeparatorChar}{name}{(ignoreState ? string.Empty : $"_{colorLevel}")}.png";
return AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D)) as Texture2D;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a6f9388f4adce440beef499dd64fba1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,171 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;
namespace MPUIKIT.Editor {
public static class MPEditorUtility {
[MenuItem("GameObject/UI/MPImage")]
public static void AddMPImageObject() {
GameObject g = new GameObject {name = "MPImage"};
Transform parent = GetParentTransform();
g.transform.SetParent(parent, false);
g.AddComponent<MPImage>();
Selection.activeGameObject = g;
Undo.RegisterCreatedObjectUndo(g, "MPImage Created");
EditorUtility.SetDirty(g);
}
[MenuItem("GameObject/UI/MPImage Basic")]
public static void AddMPImageBasicObject() {
GameObject g = new GameObject {name = "MPImageBasic"};
Transform parent = GetParentTransform();
g.transform.SetParent(parent, false);
g.AddComponent<MPImageBasic>();
Selection.activeGameObject = g;
Undo.RegisterCreatedObjectUndo(g, "MPImage Basic Created");
EditorUtility.SetDirty(g);
}
private static Transform GetParentTransform()
{
Transform parent;
if (Selection.activeGameObject != null &&
Selection.activeGameObject.GetComponentInParent<Canvas>() != null)
{
parent = Selection.activeGameObject.transform;
}
else
{
Canvas c = GetCanvas();
AddAdditionalShaderChannelsToCanvas(c);
parent = c.transform;
}
return parent;
}
private static Canvas GetCanvas()
{
StageHandle handle = StageUtility.GetCurrentStageHandle();
if (!handle.FindComponentOfType<Canvas>())
{
EditorApplication.ExecuteMenuItem("GameObject/UI/Canvas");
}
Canvas c = handle.FindComponentOfType<Canvas>();
return c;
}
[MenuItem("CONTEXT/Image/Replace with MPImage")]
public static void ReplaceWithMPImage(MenuCommand command) {
if(command.context is MPImage) return;
if (command.context is MPImageBasic) {
// Convert MPImageBasic to MPImage
MPImageBasic img = (MPImageBasic) command.context;
GameObject obj = img.gameObject;
Object.DestroyImmediate(img);
obj.AddComponent<MPImage>();
EditorUtility.SetDirty(obj);
}
else {
Image img = (Image) command.context;
GameObject obj = img.gameObject;
Object.DestroyImmediate(img);
obj.AddComponent<MPImage>();
EditorUtility.SetDirty(obj);
}
}
[MenuItem("CONTEXT/Image/Replace with MPImage Basic")]
public static void ReplaceWithMPImageBasic(MenuCommand command) {
if(command.context is MPImageBasic) return;
if (command.context is MPImage) {
// Convert MPImage to MPImageBasic
MPImage img = (MPImage) command.context;
GameObject obj = img.gameObject;
Object.DestroyImmediate(img);
obj.AddComponent<MPImageBasic>();
EditorUtility.SetDirty(obj);
}
else {
Image img = (Image) command.context;
GameObject obj = img.gameObject;
Object.DestroyImmediate(img);
obj.AddComponent<MPImageBasic>();
EditorUtility.SetDirty(obj);
}
}
internal static void AddAdditionalShaderChannelsToCanvas(Canvas c) {
AdditionalCanvasShaderChannels additionalShaderChannels = c.additionalShaderChannels;
additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
c.additionalShaderChannels = additionalShaderChannels;
}
internal static bool HasAdditionalShaderChannels(Canvas c) {
AdditionalCanvasShaderChannels asc = c.additionalShaderChannels;
return (asc & AdditionalCanvasShaderChannels.TexCoord1) != 0 &&
(asc & AdditionalCanvasShaderChannels.TexCoord2) != 0;
}
public static void CornerRadiusModeGUI(Rect rect, ref SerializedProperty property, string[] toolBarHeading,
string label = "Corner Radius") {
bool boolVal = property.boolValue;
Rect labelRect = new Rect(rect.x, rect.y, EditorGUIUtility.labelWidth, rect.height);
Rect toolBarRect = new Rect(rect.x + EditorGUIUtility.labelWidth, rect.y,
rect.width - EditorGUIUtility.labelWidth, rect.height);
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = property.hasMultipleDifferentValues;
EditorGUI.LabelField(labelRect, label);
boolVal = GUI.Toolbar(toolBarRect, boolVal ? 1 : 0, toolBarHeading) == 1;
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
property.boolValue = boolVal;
}
}
private static Sprite _emptySprite;
internal static Sprite EmptySprite {
get {
if (_emptySprite == null) {
_emptySprite = Resources.Load<Sprite>("mpui_default_empty_sprite");
}
return _emptySprite;
}
}
internal static string FindMPUIKitRootDirectory()
{
string guid = AssetDatabase.FindAssets("MPImage t:Shader").FirstOrDefault();
string path = AssetDatabase.GUIDToAssetPath(guid);
if(string.IsNullOrEmpty(path)) return String.Empty;
string[] directories = path.Split(new[] {Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar});
StringBuilder sb = new StringBuilder();
for (int i = 0; i < directories.Length; i++)
{
sb.Append(directories[i]);
sb.Append(Path.DirectorySeparatorChar);
if(directories[i].Equals("MPUIKit", StringComparison.OrdinalIgnoreCase))
break;
}
return sb.ToString();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e892ccdb916743d79dc89600b5d4ce61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,528 @@
using System;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using UnityEditor.UI;
namespace MPUIKIT.Editor {
[CustomEditor(typeof(MPImageBasic))]
public class MPImageBasicEditor : ImageEditor {
private SerializedProperty spSprite;
private SerializedProperty spCircleRadius, spCircleFitToRect;
private SerializedProperty spTriangleCornerRadius, spTriangleUniformCornerRadius;
private SerializedProperty spRectangleCornerRadius, spRectangleUniformCornerRadius;
private SerializedProperty spNStarPolygonSideCount, spNStarPolygonInset, spNStarPolygonCornerRadius;
private SerializedProperty spPreserveAspect;
private SerializedProperty spFillMethod, spFillOrigin, spFillAmount, spFillClockwise;
private SerializedProperty spShape;
private SerializedProperty spStrokeWidth, spOutlineWidth, spOutlineColor, spFalloffDistance;
private SerializedProperty spConstrainRotation, spShapeRotation, spFlipHorizontal, spFlipVertical;
private SerializedProperty spImageType;
protected override void OnEnable() {
base.OnEnable();
spSprite = serializedObject.FindProperty("m_Sprite");
spShape = serializedObject.FindProperty("m_DrawShape");
spStrokeWidth = serializedObject.FindProperty("m_StrokeWidth");
spOutlineWidth = serializedObject.FindProperty("m_OutlineWidth");
spOutlineColor = serializedObject.FindProperty("m_OutlineColor");
spFalloffDistance = serializedObject.FindProperty("m_FalloffDistance");
spImageType = serializedObject.FindProperty("m_ImageType");
spFillMethod = serializedObject.FindProperty("m_FillMethod");
spFillOrigin = serializedObject.FindProperty("m_FillOrigin");
spFillAmount = serializedObject.FindProperty("m_FillAmount");
spFillClockwise = serializedObject.FindProperty("m_FillClockwise");
spConstrainRotation = serializedObject.FindProperty("m_ConstrainRotation");
spShapeRotation = serializedObject.FindProperty("m_ShapeRotation");
spFlipHorizontal = serializedObject.FindProperty("m_FlipHorizontal");
spFlipVertical = serializedObject.FindProperty("m_FlipVertical");
spCircleRadius = serializedObject.FindProperty("m_CircleRadius");
spCircleFitToRect = serializedObject.FindProperty("m_CircleFitToRect");
spTriangleCornerRadius = serializedObject.FindProperty("m_TriangleCornerRadius");
spTriangleUniformCornerRadius = serializedObject.FindProperty("m_TriangleUniformCornerRadius");
spRectangleCornerRadius = serializedObject.FindProperty("m_RectangleCornerRadius");
spRectangleUniformCornerRadius = serializedObject.FindProperty("m_TriangleUniformCornerRadius");
spNStarPolygonSideCount = serializedObject.FindProperty("m_NStarPolygonSideCount");
spNStarPolygonInset = serializedObject.FindProperty("m_NStarPolygonInset");
spNStarPolygonCornerRadius = serializedObject.FindProperty("m_NStarPolygonCornerRadius");
spPreserveAspect = serializedObject.FindProperty("m_PreserveAspect");
}
public override void OnInspectorGUI() {
serializedObject.Update();
RaycastControlsGUI();
EditorGUILayout.PropertyField(m_Color);
EditorGUILayout.Space();
Rect shapePopupRect = EditorGUILayout.GetControlRect();
DrawShapeBasic selectedIndex = (DrawShapeBasic) spShape.enumValueIndex;
if (selectedIndex == (DrawShapeBasic) DrawShape.Pentagon || selectedIndex == (DrawShapeBasic) DrawShape.Hexagon)
{
selectedIndex = (DrawShapeBasic) DrawShape.None;
spShape.enumValueIndex = (int) selectedIndex;
}
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spShape.hasMultipleDifferentValues;
selectedIndex = (DrawShapeBasic) EditorGUI.EnumPopup(shapePopupRect, "Draw Shape", selectedIndex);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
spShape.enumValueIndex = (int) selectedIndex;
}
if (spShape.enumValueIndex != (int) DrawShape.None && !spShape.hasMultipleDifferentValues) {
EditorGUILayout.BeginVertical("Box");
if (!spShape.hasMultipleDifferentValues) {
switch ((DrawShape) spShape.enumValueIndex) {
case DrawShape.Circle:
CircleGUI();
break;
case DrawShape.Rectangle:
RectangleGUI();
break;
case DrawShape.Triangle:
TriangleGUI();
break;
case DrawShape.NStarPolygon:
NStarPolygonGUI();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
EditorGUILayout.Space();
if (spShape.enumValueIndex != (int) DrawShape.None) {
AdditionalShapeDataGUI();
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.Space();
ImageTypeGUI();
SpriteGUI();
if (!spSprite.hasMultipleDifferentValues && spSprite.objectReferenceValue != null) {
EditorGUILayout.PropertyField(spPreserveAspect);
}
SetShowNativeSize(spSprite.objectReferenceValue != null, true);
NativeSizeButtonGUI();
EditorGUILayout.Space();
serializedObject.ApplyModifiedProperties();
}
private void NStarPolygonGUI() {
spNStarPolygonSideCount.intValue =
EditorGUILayout.IntSlider("Side Count", spNStarPolygonSideCount.intValue, 3, 10);
spNStarPolygonInset.floatValue =
EditorGUILayout.Slider("Inset", spNStarPolygonInset.floatValue, 2f,
spNStarPolygonSideCount.intValue - 0.1f);
spNStarPolygonCornerRadius.floatValue =
EditorGUILayout.FloatField("Corner Radius", spNStarPolygonCornerRadius.floatValue);
}
private void CircleGUI() {
EditorGUI.BeginDisabledGroup(spCircleFitToRect.boolValue);
EditorGUILayout.PropertyField(spCircleRadius, new GUIContent("Radius"));
EditorGUI.EndDisabledGroup();
Rect rect = EditorGUILayout.GetControlRect();
MPEditorUtility.CornerRadiusModeGUI(rect, ref spCircleFitToRect, new[] {"Free", "Fit"}, String.Empty);
}
private void RectangleGUI() {
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
MPEditorUtility.CornerRadiusModeGUI(rect, ref spRectangleUniformCornerRadius, new[] {"Free", "Uniform"});
Vector4 vectorValue = spRectangleCornerRadius.vector4Value;
float floatVal = vectorValue.x;
float[] zw = new[] {vectorValue.w, vectorValue.z};
float[] xy = new[] {vectorValue.x, vectorValue.y};
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spRectangleCornerRadius.hasMultipleDifferentValues;
if (spRectangleUniformCornerRadius.boolValue) {
floatVal = EditorGUILayout.FloatField("Uniform Radius", floatVal);
}
else {
rect = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight * 2);
Rect RadiusVectorRect = new Rect(rect.x, rect.y,
rect.width, EditorGUIUtility.singleLineHeight);
EditorGUI.MultiFloatField(RadiusVectorRect, new[] {
new GUIContent("W"), new GUIContent("Z")
}, zw);
RadiusVectorRect.y +=
EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.MultiFloatField(RadiusVectorRect, new[] {
new GUIContent("X "), new GUIContent("Y")
}, xy);
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spRectangleCornerRadius.vector4Value = spRectangleUniformCornerRadius.boolValue
? new Vector4(floatVal, floatVal, floatVal, floatVal)
: new Vector4(xy[0], xy[1], zw[1], zw[0]);
}
}
private void TriangleGUI() {
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
MPEditorUtility.CornerRadiusModeGUI(rect, ref spTriangleUniformCornerRadius, new[] {"Free", "Uniform"});
Vector3 vectorValue = spTriangleCornerRadius.vector3Value;
float floatVal = vectorValue.x;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spTriangleCornerRadius.hasMultipleDifferentValues;
if (spTriangleUniformCornerRadius.boolValue) {
floatVal = EditorGUILayout.FloatField("Uniform Radius", floatVal);
}
else {
vectorValue = EditorGUILayout.Vector3Field("", vectorValue);
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spTriangleCornerRadius.vector3Value = spTriangleUniformCornerRadius.boolValue
? new Vector3(floatVal, floatVal, floatVal)
: vectorValue;
}
}
private void AdditionalShapeDataGUI() {
EditorGUILayout.Space();
float strokeWidth = spStrokeWidth.floatValue;
float outlineWidth = spOutlineWidth.floatValue;
float falloff = spFalloffDistance.floatValue;
Color outlineColor = spOutlineColor.colorValue;
Rect r = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing);
Rect line = r;
line.height = EditorGUIUtility.singleLineHeight;
float x = (line.width - 10f) / 2;
float fieldWidth = x / 2 - 10f;
float labelWidth = x - fieldWidth;
line.width = labelWidth;
EditorGUI.LabelField(line, "Stroke");
Rect dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spStrokeWidth.hasMultipleDifferentValues;
strokeWidth =
EditorGUILayoutExtended.FloatFieldExtended(line, spStrokeWidth.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spStrokeWidth.floatValue = strokeWidth;
}
line.x += fieldWidth + 10;
line.width = labelWidth;
EditorGUI.LabelField(line, "Falloff");
dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spFalloffDistance.hasMultipleDifferentValues;
falloff =
EditorGUILayoutExtended.FloatFieldExtended(line, spFalloffDistance.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spFalloffDistance.floatValue = falloff;
}
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
line.x = r.x;
line.width = labelWidth;
EditorGUI.LabelField(line, "Outline Width");
dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spOutlineWidth.hasMultipleDifferentValues;
outlineWidth =
EditorGUILayoutExtended.FloatFieldExtended(line, spOutlineWidth.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spOutlineWidth.floatValue = outlineWidth;
}
line.x += fieldWidth + 10;
line.width = labelWidth;
EditorGUI.LabelField(line, "Outline Color");
dragZone = line;
line.width = fieldWidth;
line.x += labelWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spOutlineColor.hasMultipleDifferentValues;
outlineColor = EditorGUI.ColorField(line, spOutlineColor.colorValue);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spOutlineColor.colorValue = outlineColor;
}
EditorGUILayout.Space();
RotationGUI();
}
private void RotationGUI() {
Rect r = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight + 24 + EditorGUIUtility.standardVerticalSpacing);
Rect line = r;
line.height = EditorGUIUtility.singleLineHeight;
float x = (line.width - 10f) / 2;
float fieldWidth = x / 2 - 10f;
float labelWidth = x - fieldWidth;
line.width = labelWidth;
EditorGUI.LabelField(line, "Rotation");
line.x += labelWidth;
line.width = r.width - labelWidth - 78;
string[] options = spConstrainRotation.hasMultipleDifferentValues
? new[] {"---", "---"}
: new[] {"Free", "Constrained"};
bool boolVal = spConstrainRotation.boolValue;
EditorGUI.BeginChangeCheck();
{
boolVal = GUI.Toolbar(line, boolVal ? 1 : 0, options) == 1;
}
if (EditorGUI.EndChangeCheck()) {
spConstrainRotation.boolValue = boolVal;
GUI.FocusControl(null);
}
line.x += line.width + 14;
line.width = 64;
EditorGUI.LabelField(line, "Flip");
line.y += EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight;
line.x = r.x + 10;
line.height = EditorGUIUtility.singleLineHeight;
line.width = labelWidth - 10;
EditorGUI.BeginDisabledGroup(spConstrainRotation.boolValue);
{
Rect dragZone = line;
EditorGUI.LabelField(line, "Angle");
line.x = r.x + labelWidth;
line.width = r.width - labelWidth - 148;
float rotationValue = spShapeRotation.floatValue;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spShapeRotation.hasMultipleDifferentValues;
rotationValue =
EditorGUILayoutExtended.FloatFieldExtended(line, spShapeRotation.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spShapeRotation.floatValue = rotationValue;
}
}
EditorGUI.EndDisabledGroup();
EditorGUI.BeginDisabledGroup(!spConstrainRotation.boolValue);
{
line.x += line.width + 4;
line.width = 30;
line.height = 24;
if (GUI.Button(line, MPEditorContents.RotateLeftNormal)) {
float rotation = spShapeRotation.floatValue;
float remainder = rotation % 90;
if (Mathf.Abs(remainder) <= 0) {
rotation += 90;
}
else {
rotation = rotation - remainder + 90;
}
if (Math.Abs(rotation) >= 360) rotation = 0;
spShapeRotation.floatValue = rotation;
}
line.x += 34;
if (GUI.Button(line, MPEditorContents.RotateRightNormal)) {
float rotation = spShapeRotation.floatValue;
float remainder = rotation % 90;
if (Mathf.Abs(remainder) <= 0) {
rotation -= 90;
}
else {
rotation -= remainder;
}
if (Math.Abs(rotation) >= 360) rotation = 0;
spShapeRotation.floatValue = rotation;
}
}
EditorGUI.EndDisabledGroup();
line.x += 46;
bool flipH = spFlipHorizontal.boolValue;
bool flipV = spFlipVertical.boolValue;
EditorGUI.BeginChangeCheck();
{
EditorGUI.BeginDisabledGroup(spFlipHorizontal.hasMultipleDifferentValues ||
spFlipVertical.hasMultipleDifferentValues);
flipH = GUI.Toggle(line, spFlipHorizontal.boolValue,
spFlipHorizontal.boolValue
? MPEditorContents.FlipHorizontalActive
: MPEditorContents.FlipHorizontalNormal, "button");
line.x += 34;
flipV = GUI.Toggle(line, spFlipVertical.boolValue,
spFlipVertical.boolValue
? MPEditorContents.FlipVerticalActive
: MPEditorContents.FlipVerticalNormal, "button");
EditorGUI.EndDisabledGroup();
}
if (EditorGUI.EndChangeCheck()) {
spFlipHorizontal.boolValue = flipH;
spFlipVertical.boolValue = flipV;
}
}
private new void SpriteGUI() {
Sprite spriteRef = spSprite.objectReferenceValue as Sprite;
Sprite sprite = MPEditorUtility.EmptySprite.Equals(spriteRef) ? null : spriteRef;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spSprite.hasMultipleDifferentValues;
sprite = EditorGUILayout.ObjectField("Sprite", sprite, typeof(Sprite), false, GUILayout.Height(EditorGUIUtility.singleLineHeight)) as Sprite;
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
Sprite newSprite = sprite == null? MPEditorUtility.EmptySprite : sprite;
if (newSprite != null) {
Image.Type oldType = (Image.Type) spImageType.enumValueIndex;
if (newSprite.border.SqrMagnitude() > 0) {
spImageType.enumValueIndex = (int) Image.Type.Sliced;
}
else if (oldType == Image.Type.Sliced) {
spImageType.enumValueIndex = (int) Image.Type.Simple;
}
}
spSprite.objectReferenceValue = newSprite;
(serializedObject.targetObject as Image)?.DisableSpriteOptimizations();
}
EditorGUI.EndDisabledGroup();
}
private void ImageTypeGUI() {
int selectedIndex = spImageType.enumValueIndex == (int) Image.Type.Simple ? 0 : 1;
Rect imageTypeRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginChangeCheck();
{
EditorGUI.LabelField(
new Rect(imageTypeRect.x, imageTypeRect.y, EditorGUIUtility.labelWidth, imageTypeRect.height),
"Type");
imageTypeRect.x += EditorGUIUtility.labelWidth + 2;
imageTypeRect.width -= EditorGUIUtility.labelWidth + 2;
selectedIndex = EditorGUI.Popup(imageTypeRect, selectedIndex, new[] {"Simple", "Filled"});
}
if (EditorGUI.EndChangeCheck()) {
spImageType.enumValueIndex = (int) (selectedIndex == 0 ? Image.Type.Simple : Image.Type.Filled);
}
if (!spImageType.hasMultipleDifferentValues && spImageType.enumValueIndex == (int) Image.Type.Filled) {
++EditorGUI.indentLevel;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(spFillMethod);
if (EditorGUI.EndChangeCheck()) {
spFillOrigin.intValue = 0;
}
switch ((Image.FillMethod) spFillMethod.enumValueIndex) {
case Image.FillMethod.Horizontal:
spFillOrigin.intValue = (int) (Image.OriginHorizontal) EditorGUILayout.EnumPopup("Fill Origin",
(Image.OriginHorizontal) spFillOrigin.intValue);
break;
case Image.FillMethod.Vertical:
spFillOrigin.intValue = (int) (Image.OriginVertical) EditorGUILayout.EnumPopup("Fill Origin",
(Image.OriginVertical) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial90:
spFillOrigin.intValue =
(int) (Image.Origin90) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin90) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial180:
spFillOrigin.intValue =
(int) (Image.Origin180) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin180) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial360:
spFillOrigin.intValue =
(int) (Image.Origin360) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin360) spFillOrigin.intValue);
break;
}
EditorGUILayout.PropertyField(spFillAmount);
if ((Image.FillMethod) spFillMethod.enumValueIndex > Image.FillMethod.Vertical) {
EditorGUILayout.PropertyField(spFillClockwise, new GUIContent("Clockwise"));
}
--EditorGUI.indentLevel;
}
}
private enum DrawShapeBasic
{
None = 0,
Circle = 1,
Triangle = 2,
Rectangle = 3,
NStarPolygon = 6
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f33e7dc5ed3a5604f86b7d66c008e468
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,506 @@
using System;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;
namespace MPUIKIT.Editor {
[CustomEditor(typeof(MPImage), true)]
[CanEditMultipleObjects]
public class MPImageEditor : ImageEditor {
private SerializedProperty spSprite;
private SerializedProperty spCircle, spTriangle, spRectangle, spPentagon, spHexagon, spNStarPolygon;
private SerializedProperty spPreserveAspect;
private SerializedProperty spFillMethod, spFillOrigin, spFillAmount, spFillClockwise;
private SerializedProperty spShape;
private SerializedProperty spStrokeWidth, spOutlineWidth, spOutlineColor, spFalloffDistance;
private SerializedProperty spConstrainRotation, spShapeRotation, spFlipHorizontal, spFlipVertical;
private SerializedProperty spMaterialSettings, spMaterial, spImageType;
private SerializedProperty spGradient;
private bool gsInitialized, shaderChannelsNeedUpdate;
protected override void OnEnable() {
foreach (Object obj in serializedObject.targetObjects) {
((MPImage) obj).UpdateSerializedValuesFromSharedMaterial();
}
base.OnEnable();
spSprite = serializedObject.FindProperty("m_Sprite");
spShape = serializedObject.FindProperty("m_DrawShape");
spStrokeWidth = serializedObject.FindProperty("m_StrokeWidth");
spOutlineWidth = serializedObject.FindProperty("m_OutlineWidth");
spOutlineColor = serializedObject.FindProperty("m_OutlineColor");
spFalloffDistance = serializedObject.FindProperty("m_FalloffDistance");
spMaterialSettings = serializedObject.FindProperty("m_MaterialMode");
spMaterial = serializedObject.FindProperty("m_Material");
spImageType = serializedObject.FindProperty("m_ImageType");
spFillMethod = serializedObject.FindProperty("m_FillMethod");
spFillOrigin = serializedObject.FindProperty("m_FillOrigin");
spFillAmount = serializedObject.FindProperty("m_FillAmount");
spFillClockwise = serializedObject.FindProperty("m_FillClockwise");
spConstrainRotation = serializedObject.FindProperty("m_ConstrainRotation");
spShapeRotation = serializedObject.FindProperty("m_ShapeRotation");
spFlipHorizontal = serializedObject.FindProperty("m_FlipHorizontal");
spFlipVertical = serializedObject.FindProperty("m_FlipVertical");
spCircle = serializedObject.FindProperty("m_Circle");
spRectangle = serializedObject.FindProperty("m_Rectangle");
spTriangle = serializedObject.FindProperty("m_Triangle");
spPentagon = serializedObject.FindProperty("m_Pentagon");
spHexagon = serializedObject.FindProperty("m_Hexagon");
spNStarPolygon = serializedObject.FindProperty("m_NStarPolygon");
spPreserveAspect = serializedObject.FindProperty("m_PreserveAspect");
spGradient = serializedObject.FindProperty("m_GradientEffect");
}
public override void OnInspectorGUI() {
serializedObject.Update();
FixShaderChannelGUI();
RaycastControlsGUI();
EditorGUILayout.PropertyField(m_Color);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(spShape);
if (spShape.enumValueIndex != (int) DrawShape.None) {
EditorGUILayout.BeginVertical("Box");
if (!spShape.hasMultipleDifferentValues) {
switch ((DrawShape) spShape.enumValueIndex) {
case DrawShape.Circle:
EditorGUILayout.PropertyField(spCircle);
break;
case DrawShape.Rectangle:
EditorGUILayout.PropertyField(spRectangle);
break;
case DrawShape.Pentagon:
EditorGUILayout.PropertyField(spPentagon);
break;
case DrawShape.Triangle:
EditorGUILayout.PropertyField(spTriangle);
break;
case DrawShape.Hexagon:
EditorGUILayout.PropertyField(spHexagon);
break;
case DrawShape.NStarPolygon:
EditorGUILayout.PropertyField(spNStarPolygon);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
EditorGUILayout.Space();
if (spShape.enumValueIndex != (int) DrawShape.None) {
AdditionalShapeDataGUI();
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.Space();
ImageTypeGUI();
SpriteGUI();
if (!spSprite.hasMultipleDifferentValues && spSprite.objectReferenceValue != null) {
EditorGUILayout.PropertyField(spPreserveAspect);
}
SetShowNativeSize(spSprite.objectReferenceValue != null, true);
NativeSizeButtonGUI();
EditorGUILayout.Space();
SharedMaterialGUI();
EditorGUILayout.Space();
EditorGUILayout.BeginVertical("Box");
{
EditorGUILayout.PropertyField(spGradient);
}
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
serializedObject.Update();
Repaint();
}
private void AdditionalShapeDataGUI() {
EditorGUILayout.Space();
float strokeWidth = spStrokeWidth.floatValue;
float outlineWidth = spOutlineWidth.floatValue;
float falloff = spFalloffDistance.floatValue;
Color outlineColor = spOutlineColor.colorValue;
Rect r = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing);
Rect line = r;
line.height = EditorGUIUtility.singleLineHeight;
float x = (line.width - 10f) / 2;
float fieldWidth = x / 2 - 10f;
float labelWidth = x - fieldWidth;
line.width = labelWidth;
EditorGUI.LabelField(line, "Stroke");
Rect dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spStrokeWidth.hasMultipleDifferentValues;
strokeWidth =
EditorGUILayoutExtended.FloatFieldExtended(line, spStrokeWidth.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
spStrokeWidth.floatValue = strokeWidth;
}
line.x += fieldWidth + 10;
line.width = labelWidth;
EditorGUI.LabelField(line, "Falloff");
dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spFalloffDistance.hasMultipleDifferentValues;
falloff =
EditorGUILayoutExtended.FloatFieldExtended(line, spFalloffDistance.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
spFalloffDistance.floatValue = falloff;
}
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
line.x = r.x;
line.width = labelWidth;
EditorGUI.LabelField(line, "Outline Width");
dragZone = line;
line.x += labelWidth;
line.width = fieldWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spOutlineWidth.hasMultipleDifferentValues;
outlineWidth =
EditorGUILayoutExtended.FloatFieldExtended(line, spOutlineWidth.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
spOutlineWidth.floatValue = outlineWidth;
}
line.x += fieldWidth + 10;
line.width = labelWidth;
EditorGUI.LabelField(line, "Outline Color");
dragZone = line;
line.width = fieldWidth;
line.x += labelWidth;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spOutlineColor.hasMultipleDifferentValues;
outlineColor = EditorGUI.ColorField(line, spOutlineColor.colorValue);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
spOutlineColor.colorValue = outlineColor;
}
EditorGUILayout.Space();
RotationGUI();
}
private void RotationGUI() {
Rect r =EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight + 24 + EditorGUIUtility.standardVerticalSpacing);
Rect line = r;
line.height = EditorGUIUtility.singleLineHeight;
float x = (line.width - 10f) / 2;
float fieldWidth = x / 2 - 10f;
float labelWidth = x - fieldWidth;
line.width = labelWidth;
EditorGUI.LabelField(line, "Rotation");
line.x += labelWidth;
line.width = r.width - labelWidth - 78;
string[] options = spConstrainRotation.hasMultipleDifferentValues? new []{ "---", "---" } : new []{"Free", "Constrained"};
bool boolVal = spConstrainRotation.boolValue;
EditorGUI.BeginChangeCheck();
{
boolVal = GUI.Toolbar(line, boolVal ? 1 : 0, options) == 1;
}
if (EditorGUI.EndChangeCheck()) {
spConstrainRotation.boolValue = boolVal;
GUI.FocusControl(null);
}
line.x += line.width + 14;
line.width = 64;
EditorGUI.LabelField(line, "Flip");
line.y += EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight;
line.x = r.x + 10;
line.height = EditorGUIUtility.singleLineHeight;
line.width = labelWidth - 10;
EditorGUI.BeginDisabledGroup(spConstrainRotation.boolValue);
{
Rect dragZone = line;
EditorGUI.LabelField(line, "Angle");
line.x = r.x + labelWidth;
line.width = r.width - labelWidth - 148;
float rotationValue = spShapeRotation.floatValue;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spShapeRotation.hasMultipleDifferentValues;
rotationValue = EditorGUILayoutExtended.FloatFieldExtended(line, spShapeRotation.floatValue, dragZone);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spShapeRotation.floatValue = rotationValue;
}
}
EditorGUI.EndDisabledGroup();
EditorGUI.BeginDisabledGroup(!spConstrainRotation.boolValue);
{
line.x += line.width + 4;
line.width = 30;
line.height = 24;
if (GUI.Button(line, MPEditorContents.RotateLeftNormal)) {
float rotation = spShapeRotation.floatValue;
float remainder = rotation % 90;
if (Mathf.Abs(remainder) <= 0) {
rotation += 90;
}
else {
rotation = rotation - remainder + 90;
}
if (Math.Abs(rotation) >= 360) rotation = 0;
spShapeRotation.floatValue = rotation;
}
line.x += 34;
if (GUI.Button(line, MPEditorContents.RotateRightNormal)) {
float rotation = spShapeRotation.floatValue;
float remainder = rotation % 90;
if (Mathf.Abs(remainder) <= 0) {
rotation -= 90;
}
else {
rotation -= remainder;
}
if (Math.Abs(rotation) >= 360) rotation = 0;
spShapeRotation.floatValue = rotation;
}
}
EditorGUI.EndDisabledGroup();
line.x += 46;
bool flipH = spFlipHorizontal.boolValue;
bool flipV = spFlipVertical.boolValue;
EditorGUI.BeginChangeCheck();
{
EditorGUI.BeginDisabledGroup(spFlipHorizontal.hasMultipleDifferentValues || spFlipVertical.hasMultipleDifferentValues);
flipH = GUI.Toggle(line, spFlipHorizontal.boolValue, spFlipHorizontal.boolValue ? MPEditorContents.FlipHorizontalActive:MPEditorContents.FlipHorizontalNormal, "button");
line.x += 34;
flipV = GUI.Toggle(line, spFlipVertical.boolValue, spFlipVertical.boolValue?MPEditorContents.FlipVerticalActive:MPEditorContents.FlipVerticalNormal, "button");
EditorGUI.EndDisabledGroup();
}
if (EditorGUI.EndChangeCheck()) {
spFlipHorizontal.boolValue = flipH;
spFlipVertical.boolValue = flipV;
}
}
private void FixShaderChannelGUI() {
if (!shaderChannelsNeedUpdate) return;
EditorGUILayout.HelpBox(
"Parent Canvas needs to have these additional shader channels : Texcoord1, Texcoord2",
MessageType.Error);
EditorGUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Fix", GUILayout.Width(100))) {
Canvas canvas = (target as MPImage)?.GetComponentInParent<Canvas>();
if (canvas != null) {
MPEditorUtility.AddAdditionalShaderChannelsToCanvas(canvas);
shaderChannelsNeedUpdate = false;
}
}
}
EditorGUILayout.EndHorizontal();
}
private new void SpriteGUI() {
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(spSprite, new GUIContent("Sprite"));
if (EditorGUI.EndChangeCheck()) {
Sprite newSprite = spSprite.objectReferenceValue as Sprite;
if (newSprite) {
Image.Type oldType = (Image.Type) spImageType.enumValueIndex;
if (newSprite.border.SqrMagnitude() > 0) {
spImageType.enumValueIndex = (int) Image.Type.Sliced;
}
else if (oldType == Image.Type.Sliced) {
spImageType.enumValueIndex = (int) Image.Type.Simple;
}
}
(serializedObject.targetObject as Image)?.DisableSpriteOptimizations();
}
}
private void ImageTypeGUI() {
int selectedIndex = spImageType.enumValueIndex == (int) Image.Type.Simple ? 0 : 1;
Rect imageTypeRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginChangeCheck();
{
EditorGUI.LabelField(
new Rect(imageTypeRect.x, imageTypeRect.y, EditorGUIUtility.labelWidth, imageTypeRect.height),
"Type");
imageTypeRect.x += EditorGUIUtility.labelWidth + 2;
imageTypeRect.width -= EditorGUIUtility.labelWidth + 2;
selectedIndex = EditorGUI.Popup(imageTypeRect, selectedIndex, new[] {"Simple", "Filled"});
}
if (EditorGUI.EndChangeCheck()) {
spImageType.enumValueIndex = (int) (selectedIndex == 0 ? Image.Type.Simple : Image.Type.Filled);
}
if (!spImageType.hasMultipleDifferentValues && spImageType.enumValueIndex == (int) Image.Type.Filled) {
++EditorGUI.indentLevel;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(spFillMethod);
if (EditorGUI.EndChangeCheck()) {
spFillOrigin.intValue = 0;
}
switch ((Image.FillMethod) spFillMethod.enumValueIndex) {
case Image.FillMethod.Horizontal:
spFillOrigin.intValue = (int) (Image.OriginHorizontal) EditorGUILayout.EnumPopup("Fill Origin",
(Image.OriginHorizontal) spFillOrigin.intValue);
break;
case Image.FillMethod.Vertical:
spFillOrigin.intValue = (int) (Image.OriginVertical) EditorGUILayout.EnumPopup("Fill Origin",
(Image.OriginVertical) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial90:
spFillOrigin.intValue =
(int) (Image.Origin90) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin90) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial180:
spFillOrigin.intValue =
(int) (Image.Origin180) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin180) spFillOrigin.intValue);
break;
case Image.FillMethod.Radial360:
spFillOrigin.intValue =
(int) (Image.Origin360) EditorGUILayout.EnumPopup("Fill Origin",
(Image.Origin360) spFillOrigin.intValue);
break;
}
EditorGUILayout.PropertyField(spFillAmount);
if ((Image.FillMethod) spFillMethod.enumValueIndex > Image.FillMethod.Vertical) {
EditorGUILayout.PropertyField(spFillClockwise, new GUIContent("Clockwise"));
}
--EditorGUI.indentLevel;
}
}
private void SharedMaterialGUI() {
Rect rect = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
int matSett = spMaterialSettings.enumValueIndex;
Rect labelRect = rect;
labelRect.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelRect, "Material Mode");
rect.x += labelRect.width;
rect.width -= labelRect.width;
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = spMaterialSettings.hasMultipleDifferentValues;
string[] options = new[] {"Dynamic", "Shared"};
if (EditorGUI.showMixedValue) options = new[] {"---", "---"};
matSett = GUI.Toolbar(rect, matSett, options);
if (EditorGUI.EndChangeCheck()) {
spMaterialSettings.enumValueIndex = matSett;
foreach (Object obj in targets) {
((MPImage) obj).MaterialMode = (MaterialMode) matSett;
EditorUtility.SetDirty(obj);
}
}
EditorGUI.showMixedValue = false;
EditorGUI.BeginDisabledGroup(spMaterialSettings.enumValueIndex == (int) MaterialMode.Dynamic);
{
rect = EditorGUILayout.GetControlRect(true,
EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
Object matObj = spMaterial.objectReferenceValue;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = spMaterialSettings.hasMultipleDifferentValues;
matObj = (Material) EditorGUI.ObjectField(
new Rect(rect.x, rect.y, rect.width - 60, EditorGUIUtility.singleLineHeight),
matObj, typeof(Material), false);
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
spMaterial.objectReferenceValue = matObj;
foreach (Object obj in targets) {
((MPImage) obj).material = (Material) matObj;
EditorUtility.SetDirty(obj);
}
}
EditorGUI.BeginDisabledGroup(spMaterial.objectReferenceValue != null);
{
if (GUI.Button(new Rect(rect.x + rect.width - 55, rect.y, 55, EditorGUIUtility.singleLineHeight),
"Create")) {
Material mat = ((MPImage) target).CreateMaterialAssetFromComponentSettings();
spMaterial.objectReferenceValue = mat;
foreach (Object obj in targets) {
((MPImage) obj).material = mat;
EditorUtility.SetDirty(obj);
}
}
}
EditorGUI.EndDisabledGroup();
}
EditorGUI.EndDisabledGroup();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7639e6809ad59f4bb65a8948d16b305
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor
{
public class MPImageShaderGUI : ShaderGUI
{
private bool _showValues;
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
{
EditorGUILayout.HelpBox(
"Nothing to modify here. Select an MPImage component in the hierarchy and modify the values in the inspector.",
MessageType.Info);
if (GUILayout.Button(_showValues ? "Hide Debug Values" : "Show Debug Values", EditorStyles.miniLabel)) _showValues = !_showValues;
if (_showValues)
{
EditorGUI.BeginDisabledGroup(true);
base.OnGUI(materialEditor, properties);
EditorGUI.EndDisabledGroup();
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3baee42b106f43cd8eb1edfa21a94ae5
timeCreated: 1590741710

View File

@ -0,0 +1,134 @@
using System.IO;
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor
{
public class MPUIKitUtilityWindow : EditorWindow
{
private static SerializedObject _graphicsSettingsObj;
private static bool _setup;
private static bool _alreadyShownOnStartup;
private bool _initialized;
private string _version = "Version: 1.2.0";
private static bool _setupIsRequired;
private static UnityEditor.Editor _settingsEditor;
[MenuItem("Window/MPUIKit/Utility Panel")]
public static void ShowWindow()
{
EditorWindow window = GetWindow<MPUIKitUtilityWindow>(true, "MPUIKit Utility Panel", true);
window.minSize = new Vector2(400, 400);
window.maxSize = new Vector2(400, 400);
}
private void OnGUI()
{
TopBannerGUI();
WelcomeGUI();
UtilButtonsGUI();
BottomBarGUI();
}
private static void TopBannerGUI()
{
Rect headingRect = new Rect(0, 0, EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight * 5);
Rect backgroundTexCoords = new Rect(0, 0, headingRect.width / headingRect.height, 1);
Texture background = MPEditorContents.Background;
background.wrapMode = TextureWrapMode.Repeat;
GUI.DrawTextureWithTexCoords(headingRect, background, backgroundTexCoords);
float height = headingRect.height;
float width = headingRect.width - height - 30;
Rect titleRect = new Rect(headingRect.width - width - 5, 20, width, height - 30);
GUI.DrawTexture(titleRect, MPEditorContents.Title, ScaleMode.ScaleToFit);
Rect textureRect = headingRect;
textureRect.x = 0;
textureRect.width = textureRect.height - 7;
textureRect.height -= 7;
GUI.DrawTexture(textureRect, MPEditorContents.Logo, ScaleMode.ScaleToFit);
GUILayout.Space(headingRect.height + 20);
}
private static void WelcomeGUI()
{
var style = new GUIStyle(GUI.skin.label) {alignment = TextAnchor.MiddleCenter};
EditorGUILayout.LabelField("Thank you for using", style, GUILayout.ExpandWidth(true));
EditorGUILayout.LabelField("Modern Procedural UI Kit", style, GUILayout.ExpandWidth(true));
GUILayout.Space(20);
}
private static void UtilButtonsGUI()
{
GUILayout.Space(6);
Rect buttonRect = EditorGUILayout.GetControlRect(false, 40 * 3 + 4);
buttonRect.width = (buttonRect.width / 2) - 1;
buttonRect.height = 40;
if (GUI.Button(buttonRect, "Documentation"))
{
Application.OpenURL("https://scrollbie.com/documentations/mpuikit-docs/");
}
buttonRect.x += buttonRect.width + 2;
if (GUI.Button(buttonRect, "Website"))
{
Application.OpenURL("https://scrollbie.com/mpuikit/");
}
buttonRect.y += 42;
buttonRect.x -= buttonRect.width + 2;
if (GUI.Button(buttonRect, "Email"))
{
Application.OpenURL("mailto:support@scrollbie.com");
}
buttonRect.x += buttonRect.width + 2;
if (GUI.Button(buttonRect, "Forum"))
{
Application.OpenURL(
"https://forum.unity.com/threads/an-advanced-procedural-ui-generation-tool-create-modify-animate-spriteless-ui-even-at-runtime.846772");
}
buttonRect.y += 42;
buttonRect.x -= buttonRect.width + 2;
if (GUI.Button(buttonRect, "Changelog"))
{
Application.OpenURL("https://scrollbie.com/mpuikit/changelog.html");
}
buttonRect.x += buttonRect.width + 2;
if (GUI.Button(buttonRect, "Other Assets"))
{
Application.OpenURL("https://assetstore.unity.com/publishers/29536");
}
if (GUILayout.Button("★ Rate/Review MPUIKit", GUILayout.ExpandWidth(true), GUILayout.Height(40)))
{
Application.OpenURL("https://assetstore.unity.com/packages/slug/163041");
}
}
private void BottomBarGUI()
{
EditorGUILayout.BeginVertical();
{
GUILayout.FlexibleSpace();
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("© Copyright 2020 Scrollbie Studio", EditorStyles.miniLabel);
GUIStyle style = new GUIStyle(EditorStyles.miniLabel);
style.alignment = TextAnchor.MiddleRight;
GUILayout.FlexibleSpace();
EditorGUILayout.LabelField(_version, style, GUILayout.Width(120));
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cd4e467557d59f48822fd363721ec89
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6137a2ba9e274726810f9f0b17addea6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,51 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(Circle))]
public class CirclePropertyDrawer : PropertyDrawer{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
Rect radiusRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
Rect toolBarRect = new Rect(position.x + EditorGUIUtility.labelWidth,
position.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing,
position.width - EditorGUIUtility.labelWidth, EditorGUIUtility.singleLineHeight);
SerializedProperty spFitCircleRadius = property.FindPropertyRelative("m_FitRadius");
bool FitCirlce = spFitCircleRadius.boolValue;
EditorGUI.BeginDisabledGroup(FitCirlce);
{
EditorGUI.PropertyField(radiusRect, property.FindPropertyRelative("m_Radius"),
new GUIContent("Radius"));
}
EditorGUI.EndDisabledGroup();
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = spFitCircleRadius.hasMultipleDifferentValues;
{
EditorGUILayout.BeginHorizontal();
{
GUILayout.Space(EditorGUIUtility.labelWidth);
FitCirlce = GUI.Toolbar(toolBarRect, FitCirlce ? 1 : 0, new[] {"Free", "Fit"}) == 1;
}
EditorGUILayout.EndHorizontal();
}
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck()) {
spFitCircleRadius.boolValue = FitCirlce;
}
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
return EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing * 2;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b2a76e1f0ab8461190ccc8f5beaa70e9
timeCreated: 1586464240

View File

@ -0,0 +1,106 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(Hexagon))]
public class HexagonPropertyDrawer : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
SerializedProperty rectRadius = property.FindPropertyRelative("m_CornerRadius");
SerializedProperty uniformRect = property.FindPropertyRelative("m_UniformCornerRadius");
SerializedProperty triSizes = property.FindPropertyRelative("m_TipSize");
SerializedProperty uniformTriS = property.FindPropertyRelative("m_UniformTipSize");
SerializedProperty triRadius = property.FindPropertyRelative("m_TipRadius");
SerializedProperty uniformTriR = property.FindPropertyRelative("m_UniformTipRadius");
Vector4 radiusVectorValue = rectRadius.vector4Value;
float radiusFloatValue = radiusVectorValue.x;
bool rectBoolVal = uniformRect.boolValue;
float[] zw = new[] {radiusVectorValue.w, radiusVectorValue.z};
float[] xy = new[] {radiusVectorValue.x, radiusVectorValue.y};
Vector2 triSizesVectorValue = triSizes.vector2Value;
float triSizesFloatValue = triSizesVectorValue.x;
Vector2 triRadiusVectorValue = triRadius.vector2Value;
float triRadiusFloatValue = triRadiusVectorValue.x;
Rect line = position;
line.height = EditorGUIUtility.singleLineHeight;
string[] toolbarLabel = new[] {"Free", "Uniform"};
MPEditorUtility.CornerRadiusModeGUI(line, ref uniformRect, toolbarLabel);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = rectRadius.hasMultipleDifferentValues;
if (rectBoolVal) {
radiusFloatValue = EditorGUI.FloatField(line, "Uniform Radius", radiusFloatValue);
}
else {
EditorGUI.MultiFloatField(line, new []{new GUIContent("W"), new GUIContent("Z")}, zw);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.MultiFloatField(line, new []{new GUIContent("X"), new GUIContent("Y")}, xy);
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
rectRadius.vector4Value = rectBoolVal
? new Vector4(radiusFloatValue, radiusFloatValue, radiusFloatValue, radiusFloatValue)
: new Vector4(xy[0], xy[1], zw[1], zw[0]);
}
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
MPEditorUtility.CornerRadiusModeGUI(line, ref uniformTriS, toolbarLabel, "Tip Size");
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = triSizes.hasMultipleDifferentValues;
if (uniformTriS.boolValue) {
triSizesFloatValue = EditorGUI.FloatField(line, "Uniform Size", triSizesFloatValue);
}
else {
triSizesVectorValue = EditorGUI.Vector2Field(line, string.Empty, triSizesVectorValue);
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
triSizes.vector2Value = uniformTriS.boolValue
? new Vector2(triSizesFloatValue, triSizesFloatValue)
: triSizesVectorValue;
}
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
MPEditorUtility.CornerRadiusModeGUI(line, ref uniformTriR, toolbarLabel, "Tip Radius");
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = triRadius.hasMultipleDifferentValues;
if (uniformTriR.boolValue) {
triRadiusFloatValue = EditorGUI.FloatField(line, "Uniform Radius", triRadiusFloatValue);
}
else {
triRadiusVectorValue = EditorGUI.Vector2Field(line, string.Empty, triRadiusVectorValue);
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
triRadius.vector2Value = uniformTriR.boolValue
? new Vector2(triRadiusFloatValue, triRadiusFloatValue)
: triRadiusVectorValue;
}
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
if (property.FindPropertyRelative("m_UniformCornerRadius").boolValue) {
return EditorGUIUtility.singleLineHeight * 6 + EditorGUIUtility.standardVerticalSpacing * 5;
}
return EditorGUIUtility.singleLineHeight * 7 + EditorGUIUtility.standardVerticalSpacing * 6;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e3e33a21b8af4566a49e820424dc26e2
timeCreated: 1586503332

View File

@ -0,0 +1,33 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(NStarPolygon))]
public class NStarPolygonPropertyDrawer : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
SerializedProperty sideCount = property.FindPropertyRelative("m_SideCount");
SerializedProperty inset = property.FindPropertyRelative("m_Inset");
SerializedProperty cornerRadius = property.FindPropertyRelative("m_CornerRadius");
SerializedProperty offset = property.FindPropertyRelative("m_Offset");
Rect line = position;
line.height = EditorGUIUtility.singleLineHeight;
EditorGUI.Slider(line, sideCount, 3f, 10f);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.Slider(line, inset, 2f, sideCount.floatValue - 0.01f);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(line, cornerRadius);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(line, offset);
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
return EditorGUIUtility.singleLineHeight * 4.5f + EditorGUIUtility.standardVerticalSpacing * 4;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0e141ee519724007b787256b6fdb8782
timeCreated: 1586505239

View File

@ -0,0 +1,63 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(Pentagon))]
public class PentagonPropertyDrawer : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
SerializedProperty RectRadius = property.FindPropertyRelative("m_CornerRadius");
SerializedProperty uniform = property.FindPropertyRelative("m_UniformCornerRadius");
SerializedProperty triSize = property.FindPropertyRelative("m_TipSize");
SerializedProperty triRadius = property.FindPropertyRelative("m_TipRadius");
Vector4 radiusVectorValue = RectRadius.vector4Value;
float radiusFloatValue = radiusVectorValue.x;
bool boolVal = uniform.boolValue;
float[] zw = new[] {radiusVectorValue.w, radiusVectorValue.z};
float[] xy = new[] {radiusVectorValue.x, radiusVectorValue.y};
Rect line = position;
line.height = EditorGUIUtility.singleLineHeight;
MPEditorUtility.CornerRadiusModeGUI(line, ref uniform, new []{"Free", "Uniform"});
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = RectRadius.hasMultipleDifferentValues;
if (boolVal) {
radiusFloatValue = EditorGUI.FloatField(line," Uniform Radius", radiusFloatValue);
}
else {
line.x += 10;
line.width -= 10;
EditorGUI.MultiFloatField(line, new []{new GUIContent("W"), new GUIContent("Z"), }, zw);
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.MultiFloatField(line, new []{new GUIContent("X "), new GUIContent("Y"), }, xy);
line.x -= 10;
line.width += 10;
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
RectRadius.vector4Value = boolVal ? new Vector4(radiusFloatValue, radiusFloatValue, radiusFloatValue, radiusFloatValue) : new Vector4(xy[0], xy[1], zw[1], zw[0]);
}
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(line, triSize, new GUIContent("Tip size"));
line.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(line, triRadius, new GUIContent("Tip Radius"));
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
if (property.FindPropertyRelative("m_UniformCornerRadius").boolValue) {
return EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing * 3;
}
return EditorGUIUtility.singleLineHeight * 5 + EditorGUIUtility.standardVerticalSpacing * 4;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b3117b92bdcb4b69a32f19a16ef9e482
timeCreated: 1586501835

View File

@ -0,0 +1,60 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(Rectangle))]
public class RectanglePropertyDrawer : PropertyDrawer{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
Rect LabelRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
Rect RadiusVectorRect = new Rect(position.x,
position.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing,
position.width, EditorGUIUtility.singleLineHeight);
SerializedProperty uniform = property.FindPropertyRelative("m_UniformCornerRadius");
SerializedProperty radius = property.FindPropertyRelative("m_CornerRadius");
MPEditorUtility.CornerRadiusModeGUI(LabelRect, ref uniform, new []{"Free", "Uniform"});
float floatVal = radius.vector4Value.x;
Vector4 vectorValue = radius.vector4Value;
float[] zw = new[] {vectorValue.w, vectorValue.z};
float[] xy = new[] {vectorValue.x, vectorValue.y};
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = radius.hasMultipleDifferentValues;
if (uniform.boolValue) {
floatVal = EditorGUI.FloatField(RadiusVectorRect, "Uniform Radius", floatVal);
}
else {
EditorGUI.MultiFloatField(RadiusVectorRect, new [] {
new GUIContent("W"), new GUIContent("Z")}, zw );
RadiusVectorRect.y +=
EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.MultiFloatField(RadiusVectorRect, new [] {
new GUIContent("X "), new GUIContent("Y")}, xy );
}
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck()) {
radius.vector4Value = uniform.boolValue
? new Vector4(floatVal, floatVal, floatVal, floatVal)
: new Vector4(xy[0], xy[1], zw[1], zw[0]);
}
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
if (property.FindPropertyRelative("m_UniformCornerRadius").boolValue) {
return EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
}
return EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing * 2;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d7068ffa19a9492ea7028dbaa23890b3
timeCreated: 1586499570

View File

@ -0,0 +1,43 @@
using UnityEditor;
using UnityEngine;
namespace MPUIKIT.Editor {
[CustomPropertyDrawer(typeof(Triangle))]
public class TrianglePropertyDrawer : PropertyDrawer{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
{
Rect LabelRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
Rect RadiusVectorRect = new Rect(position.x,
position.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing,
position.width, EditorGUIUtility.singleLineHeight);
SerializedProperty uniform = property.FindPropertyRelative("m_UniformCornerRadius");
SerializedProperty radius = property.FindPropertyRelative("m_CornerRadius");
MPEditorUtility.CornerRadiusModeGUI(LabelRect, ref uniform, new []{"Free", "Uniform"});
float floatVal = radius.vector3Value.x;
Vector3 vectorValue = radius.vector3Value;
EditorGUI.BeginChangeCheck();
{
if (uniform.boolValue) {
floatVal = EditorGUI.FloatField(RadiusVectorRect, "Uniform Radius", floatVal);
}
else {
vectorValue = EditorGUI.Vector3Field(RadiusVectorRect, string.Empty, vectorValue);
}
}
if (EditorGUI.EndChangeCheck()) {
radius.vector3Value = uniform.boolValue ? new Vector3(floatVal, floatVal, floatVal) : vectorValue;
}
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
return EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing * 2;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ef3050eb698744e890c498947ee39173
timeCreated: 1586497240

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71a347ea230e702488b787c090488261
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
{
"name": "MPUIKit"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5b70f83da6937434491f26e0fd0cd099
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d7143df56a13a7343a4b063f89644fef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ad8edb96550859f46802907d97aaaff8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,79 @@
#ifndef SDF_2D
#define SDF_2D
float circle(float2 _samplePosition, float _radius){
return length(_samplePosition) - _radius;
}
float rectanlge(float2 _samplePosition, float _width, float _height){
float2 d = abs(_samplePosition) - float2(_width, _height) / 2.0;
float sdf = min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
return sdf;
}
//Credit: https://www.shadertoy.com/view/XdXcRB | MIT License
float ndot(float2 a, float2 b ) { return a.x*b.x - a.y*b.y; }
float sdRhombus(float2 p, float2 b) {
float2 q = abs(p);
float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);
float d = length( q - 0.5*b*float2(1.0-h,1.0+h) );
return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );
}
//EndCredit
//Credit: https://www.shadertoy.com/view/MldcD7 | MIT License
float sdTriangleIsosceles(float2 p, float2 q )
{
p.x = abs(p.x);
float2 a = p - q*clamp( dot(p,q)/dot(q,q), 0.0, 1.0 );
float2 b = p - q*float2( clamp( p.x/q.x, 0.0, 1.0 ), 1.0 );
float s = -sign( q.y );
float2 d = min( float2( dot(a,a), s*(p.x*q.y-p.y*q.x) ), float2( dot(b,b), s*(p.y-q.y) ));
return -sqrt(d.x)*sign(d.y);
}
//EndCredit
//Credit: https://www.shadertoy.com/view/3tSGDy | MIT License
float sdNStarPolygon(in float2 p, in float r, in float n, in float m) // m=[2,n]
{
float an = 3.141593/float(n);
float en = 3.141593/m;
float2 acs = float2(cos(an),sin(an));
float2 ecs = float2(cos(en),sin(en));
float bn = abs(atan2(p.x, p.y)) % (2.0*an) - an;
p = length(p)*float2(cos(bn),abs(sin(bn)));
p -= r*acs;
p += ecs*clamp( -dot(p,ecs), 0.0, r*acs.y/ecs.y);
return length(p)*sign(p.x);
}
//EndCredit
float sampleSdf(float _sdf, float _offset){
float sdf = saturate(-_sdf * _offset);
return sdf;
}
float sampleSdfStrip(float _sdf, float _stripWidth, float _offset){
float l = (_stripWidth+1.0/_offset)/2.0;
return saturate((l-distance(-_sdf,l))*_offset);
}
float sdfUnion(float _a, float _b){
return max(_a, _b);
}
float sdfIntersection(float _a, float _b){
return min(_a, _b);
}
float sdfDifference(float _a, float _b)
{
return max(_a, -_b);
}
float map(float val, float low1, float high1, float low2, float high2){
return low2 + (val - low1) * (high2 - low2) / (high1 - low1);
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ffbce863d4e97d04db0d9865e9f72902
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,686 @@
Shader "MPUI/Procedural Image"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" { }
_Color ("Tint", Color) = (1, 1, 1, 1)
_TextureSize ("Texture Size", Vector) = (1, 1, 1, 1)
_DrawShape ("Draw Shape", int) = 2
_StrokeWidth ("Stroke Width", float) = 0
_FalloffDistance ("Falloff Distance", float) = 0.5
_PixelWorldScale ("Pixel world scale", Range(0.01, 5)) = 1
_ShapeRotation ("shape Rotation", float) = 0
_ConstrainRotation("Constrained Rotation", int) = 0
_FlipHorizontal ("Flip Horizontal", int) = 0
_FlipVertical ("Flip Vertical", int) = 0
_RectangleCornerRadius ("Rectangle Corner Radius", Vector) = (0, 0, 0, 0)
_CircleRadius ("Circle Radius", float) = 0
_CircleFitRadius ("Fit Circle Radius", float) = 0
_PentagonCornerRadius ("Pentagon Corner Radius", Vector) = (0, 0, 0, 0)
_PentagonTipRadius ("Pentagon Triangle Radius", float) = 0
_PentagonTipSize ("Pentagon Triangle Size", float) = 0
_TriangleCornerRadius ("Triangle Radius", Vector) = (0, 0, 0, 0)
_HexagonTipSize ("Hexagon Tip Size", Vector) = (0, 0, 0, 0)
_HexagonTipRadius ("Hexagon Tip Radius", Vector) = (0, 0, 0, 0)
_HexagonCornerRadius ("Hexagon Corner Radius", Vector) = (0, 0, 0, 0)
_NStarPolygonSideCount ("NStar Polygon Side Count", float) = 3
_NStarPolygonInset ("Nstar Polygon Inset", float) = 2
_NStarPolygonCornerRadius ("Nstar Polygon Corner Radius", float) = 0
_NStarPolygonOffset ("Nstar Polygon Offset", Vector) = (0, 0, 0, 0)
_EnableGradient ("Enable GradientEffect", int) = 0
_GradientType ("GradientEffect Type", int) = 0
_GradientInterpolationType ("GradientEffect Interpolation Type", int) = 0
_GradientRotation ("_GradientRotation", float) = 0
_GradientColor0 ("GradientColor0", Vector) = (0, 0, 0, 0)
_GradientColor1 ("GradientColor1", Vector) = (1, 1, 1, 1)
_GradientColor2 ("GradientColor2", Vector) = (0, 0, 0, 0)
_GradientColor3 ("GradientColor3", Vector) = (0, 0, 0, 0)
_GradientColor4 ("GradientColor4", Vector) = (0, 0, 0, 0)
_GradientColor5 ("GradientColor5", Vector) = (0, 0, 0, 0)
_GradientColor6 ("GradientColor6", Vector) = (0, 0, 0, 0)
_GradientColor7 ("GradientColor7", Vector) = (0, 0, 0, 0)
_GradientColorLength ("GradientColorLength", int) = 0
_GradientAlpha0 ("GradientAlpha0", Vector) = (1, 0, 0, 0)
_GradientAlpha1 ("GradientAlpha1", Vector) = (1, 1, 0, 0)
_GradientAlpha2 ("GradientAlpha2", Vector) = (0, 0, 0, 0)
_GradientAlpha3 ("GradientAlpha3", Vector) = (0, 0, 0, 0)
_GradientAlpha4 ("GradientAlpha4", Vector) = (0, 0, 0, 0)
_GradientAlpha5 ("GradientAlpha5", Vector) = (0, 0, 0, 0)
_GradientAlpha6 ("GradientAlpha6", Vector) = (0, 0, 0, 0)
_GradientAlpha7 ("GradientAlpha7", Vector) = (0, 0, 0, 0)
_GradientAlphaLength ("GradientAlphaLength", int) = 0
_CornerGradientColor0 ("CornerGradientColor0", Color) = (1, 0, 0, 1)
_CornerGradientColor1 ("CornerGradientColor1", Color) = (0, 1, 0, 1)
_CornerGradientColor2 ("CornerGradientColor2", Color) = (0, 0, 1, 1)
_CornerGradientColor3 ("CornerGradientColor3", Color) = (0, 0, 0, 1)
_OutlineWidth ("Outline Width", float) = 0
_OutlineColor ("Outline Color", Color) = (0, 0, 0, 1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
/* //SOFTMASK_HANDLE_START
[PerRendererData] _SoftMask ("Mask", 2D) = "white" {}
*/ //SOFTMASK_HANDLE_END
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" "CanUseSpriteAtlas" = "True" }
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "2D_SDF.cginc"
/* //SOFTMASK_HANDLE_START
#include "Assets/SoftMask/Shaders/SoftMask.cginc" //SOFTMASK_INCLUDE_HANDLE
*/ //SOFTMASK_HANDLE_END
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
#pragma multi_compile_local _ CIRCLE TRIANGLE RECTANGLE PENTAGON HEXAGON NSTAR_POLYGON
#pragma multi_compile_local _ STROKE OUTLINED OUTLINED_STROKE
#pragma multi_compile_local _ GRADIENT_LINEAR GRADIENT_RADIAL GRADIENT_CORNER
/* //SOFTMASK_HANDLE_START
#pragma multi_compile _ SOFTMASK_SIMPLE
*/ //SOFTMASK_HANDLE_END
struct appdata_t
{
float4 vertex: POSITION;
float4 color: COLOR;
float2 texcoord: TEXCOORD0;
float2 uv1: TEXCOORD1;
float2 size: TEXCOORD2;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex: SV_POSITION;
fixed4 color: COLOR;
float2 texcoord: TEXCOORD0;
float4 shapeData: TEXCOORD1;
float2 effectsUv: TEXCOORD2;
float4 worldPosition : TEXCOORD3;
/* //SOFTMASK_HANDLE_START
SOFTMASK_COORDS(4)
*/ //SOFTMASK_HANDLE_END
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex; float4 _MainTex_ST;
fixed4 _Color;
fixed4 _TextureSize;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
half _PixelWorldScale;
half _StrokeWidth;
half _OutlineWidth;
half4 _OutlineColor;
half _FalloffDistance;
half _ShapeRotation;
half _ConstrainRotation;
half _FlipHorizontal;
half _FlipVertical;
#if RECTANGLE
float4 _RectangleCornerRadius;
#endif
#if CIRCLE
float _CircleRadius;
float _CircleFitRadius;
#endif
#if PENTAGON
float4 _PentagonCornerRadius;
float _PentagonTipRadius;
float _PentagonTipSize;
#endif
#if TRIANGLE
float3 _TriangleCornerRadius;
#endif
#if HEXAGON
half2 _HexagonTipSize;
half2 _HexagonTipRadius;
half4 _HexagonCornerRadius;
#endif
#if NSTAR_POLYGON
float _NStarPolygonSideCount;
float _NStarPolygonCornerRadius;
float _NStarPolygonInset;
float2 _NStarPolygonOffset;
#endif
#if GRADIENT_LINEAR || GRADIENT_RADIAL
half4 colors[8];
half4 alphas[8];
half _GradientInterpolationType;
half _GradientColorLength;
half _GradientAlphaLength;
half _GradientRotation;
half4 _GradientColor0;
half4 _GradientColor1;
half4 _GradientColor2;
half4 _GradientColor3;
half4 _GradientColor4;
half4 _GradientColor5;
half4 _GradientColor6;
half4 _GradientColor7;
half4 _GradientAlpha0;
half4 _GradientAlpha1;
half4 _GradientAlpha2;
half4 _GradientAlpha3;
half4 _GradientAlpha4;
half4 _GradientAlpha5;
half4 _GradientAlpha6;
half4 _GradientAlpha7;
#endif
#if GRADIENT_CORNER
half4 _CornerGradientColor0;
half4 _CornerGradientColor1;
half4 _CornerGradientColor2;
half4 _CornerGradientColor3;
#endif
#if GRADIENT_LINEAR || GRADIENT_RADIAL
float4 SampleGradient(float Time)
{
float3 color = colors[0].rgb;
[unroll]
for (int c = 1; c < 8; c ++)
{
float colorPos = saturate((Time - colors[c - 1].w) / (colors[c].w - colors[c - 1].w)) * step(c, _GradientColorLength - 1);
color = lerp(color, colors[c].rgb, lerp(colorPos, step(0.01, colorPos), _GradientInterpolationType));
}
float alpha = alphas[0].x;
[unroll]
for (int a = 1; a < 8; a ++)
{
float alphaPos = saturate((Time - alphas[a - 1].y) / (alphas[a].y - alphas[a - 1].y)) * step(a, _GradientAlphaLength - 1);
alpha = lerp(alpha, alphas[a].x, lerp(alphaPos, step(0.01, alphaPos), _GradientInterpolationType));
}
return float4(color, alpha);
}
#endif
#if RECTANGLE
half rectangleScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float4 radius = _RectangleCornerRadius;
half4 c = half4(_texcoord, _size - _texcoord);
half rect = min(min(min(c.x, c.y), c.z), c.w);
bool4 cornerRects;
cornerRects.x = _texcoord.x < radius.x && _texcoord.y < radius.x;
cornerRects.y = _texcoord.x > _size.x - radius.y && _texcoord.y < radius.y;
cornerRects.z = _texcoord.x > _size.x - radius.z && _texcoord.y > _size.y - radius.z;
cornerRects.w = _texcoord.x < radius.w && _texcoord.y > _size.y - radius.w;
half cornerMask = any(cornerRects);
half4 cornerCircles;
cornerCircles.x = radius.x - length(_texcoord - radius.xx);
cornerCircles.y = radius.y - length(_texcoord - half2(_size.x - radius.y, radius.y));
cornerCircles.z = radius.z - length(_texcoord - (half2(_size.x, _size.y) - radius.zz));
cornerCircles.w = radius.w - length(_texcoord - half2(radius.w, _size.y - radius.w));
cornerCircles = min(max(cornerCircles, 0) * cornerRects, rect);
half corners = max(max(max(cornerCircles.x, cornerCircles.y), cornerCircles.z), cornerCircles.w);
corners = max(corners, 0.0) * cornerMask;
return rect*(cornerMask-1) - corners;
/*
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float4 radius = _RectangleCornerRadius;
half rect = rectanlge(_texcoord - half2(_size.x / 2.0, _size.y / 2.0), _size.x, _size.y);
half cornerCircle = circle(_texcoord - radius.xx, radius.x);
rect = _texcoord.x < radius.x && _texcoord.y < radius.x ? cornerCircle: rect;
cornerCircle = circle(_texcoord - half2(_size.x - radius.y, radius.y), radius.y);
rect = _texcoord.x > _size.x - radius.y && _texcoord.y < radius.y ? cornerCircle: rect;
cornerCircle = circle(_texcoord - (half2(_size.x, _size.y) - radius.zz), radius.z);
rect = _texcoord.x > _size.x - radius.z && _texcoord.y > _size.y - radius.z ? cornerCircle: rect;
cornerCircle = circle(_texcoord - half2(radius.w, _size.y - radius.w), radius.w);
rect = _texcoord.x < radius.w && _texcoord.y > _size.y - radius.w ? cornerCircle: rect;
return rect;
*/
}
#endif
#if CIRCLE
float circleScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float width = _size.x;
float height = _size.y;
float radius = lerp(_CircleRadius, min(width, height) / 2.0, _CircleFitRadius);
half sdf = circle(_texcoord - float2(width / 2.0, height / 2.0), radius);
return sdf;
}
#endif
#if TRIANGLE
half triangleScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float width = _size.x;//_additionalData.z;
float height = _size.y;//_additionalData.w;
half sdf = sdTriangleIsosceles(_texcoord - half2(width / 2.0, height), half2(width / 2.0, -height));
//return sdf;
_TriangleCornerRadius = max(_TriangleCornerRadius, half3(0.001, 0.001, 0.001));
// Left Corner
half halfWidth = width / 2.0;
half m = height / halfWidth;
half d = sqrt(1.0 + m * m);
half c = 0.0;
half k = -_TriangleCornerRadius.x * d + c;
half x = (_TriangleCornerRadius.x - k) / m;
half2 circlePivot = half2(x, _TriangleCornerRadius.x);
half cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.x);
//sdf = sdfDifference(sdf, cornerCircle);
//return sdf;
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m);
half y = m * x + c;
half fy = map(_texcoord.x, x, circlePivot.x, y, circlePivot.y);
sdf = _texcoord.y < fy && _texcoord.x < circlePivot.x ? cornerCircle: sdf;
//return sdf;
// Right Corner
m = -m; c = 2.0 * height;
k = -_TriangleCornerRadius.y * d + c;
x = (_TriangleCornerRadius.y - k) / m;
circlePivot = half2(x, _TriangleCornerRadius.y);
cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.y);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, y);
sdf = _texcoord.x > circlePivot.x && _texcoord.y < fy ? cornerCircle: sdf;
//Top Corner
k = -_TriangleCornerRadius.z * sqrt(1.0 + m * m) + c;
y = m * (width / 2.0) + k;
circlePivot = half2(halfWidth, y);
cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.z);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, width - x, x, -1.0, 1.0);
fy = lerp(circlePivot.y, y, abs(fy));
sdf = _texcoord.y > fy ? cornerCircle: sdf;
return sdf;
}
#endif
#if PENTAGON
half pentagonScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float width = _size.x;
float height = _size.y;
// solid pentagon
half baseRect = rectanlge(_texcoord - half2(width / 2.0, height / 2.0), width, height);
half scale = height / _PentagonTipSize;
half rhombus = sdRhombus(_texcoord - float2(width / 2, _PentagonTipSize * scale), float2(width / 2, _PentagonTipSize) * scale);
half sdfPentagon = sdfDifference(baseRect, sdfDifference(baseRect, rhombus));
// Bottom rounded corner
_PentagonTipRadius = max(_PentagonTipRadius, 0.001);
float halfWidth = width / 2;
float m = -_PentagonTipSize / halfWidth;
float d = sqrt(1 + m * m);
float c = _PentagonTipSize;
float k = _PentagonTipRadius * d + _PentagonTipSize;
half2 circlePivot = half2(halfWidth, m * halfWidth + k);
half cornerCircle = circle(_texcoord - circlePivot, _PentagonTipRadius);
half x = (circlePivot.y + circlePivot.x / m - c) / (m + 1 / m);
half y = m * x + c;
half fy = map(_texcoord.x, x, width - x, -1, 1);
fy = lerp(_PentagonTipRadius, y, abs(fy));
sdfPentagon = _texcoord.y < fy ? cornerCircle: sdfPentagon;
// Mid Left rounded corner
k = _PentagonCornerRadius.w * d + _PentagonTipSize;
circlePivot = half2(_PentagonCornerRadius.w, m * _PentagonCornerRadius.w + k);
cornerCircle = circle(_texcoord - circlePivot, _PentagonCornerRadius.w);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1 / m); y = m * x + c;
fy = map(_texcoord.x, x, circlePivot.x, y, circlePivot.y);
sdfPentagon = _texcoord.y > fy && _texcoord.y < circlePivot.y ? cornerCircle: sdfPentagon;
// Mid Right rounded corner
m = -m; k = _PentagonCornerRadius.z * d - _PentagonTipSize;
circlePivot = half2(width - _PentagonCornerRadius.z, m * (width - _PentagonCornerRadius.z) + k);
cornerCircle = circle(_texcoord - circlePivot, _PentagonCornerRadius.z);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, y);
sdfPentagon = _texcoord.y > fy && _texcoord.y < circlePivot.y ? cornerCircle: sdfPentagon;
// Top rounded corners
cornerCircle = circle(_texcoord - half2(_PentagonCornerRadius.x, height - _PentagonCornerRadius.x), _PentagonCornerRadius.x);
bool mask = _texcoord.x < _PentagonCornerRadius.x && _texcoord.y > height - _PentagonCornerRadius.x;
sdfPentagon = mask ? cornerCircle: sdfPentagon;
cornerCircle = circle(_texcoord - half2(width - _PentagonCornerRadius.y, height - _PentagonCornerRadius.y), _PentagonCornerRadius.y);
mask = _texcoord.x > width - _PentagonCornerRadius.y && _texcoord.y > height - _PentagonCornerRadius.y;
sdfPentagon = mask ? cornerCircle: sdfPentagon;
return sdfPentagon;
}
#endif
#if HEXAGON
half hexagonScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float2 _size = float2(_additionalData.z, _additionalData.w);
float width = _size.x;//_additionalData.z;
float height = _size.y;//_additionalData.w;
half baseRect = rectanlge(_texcoord - half2(width / 2.0, height / 2.0), width, height);
half scale = width / _HexagonTipSize.x;
half rhombus1 = sdRhombus(_texcoord - float2(_HexagonTipSize.x * scale, height / 2.0), float2(_HexagonTipSize.x, height / 2.0) * scale);
scale = width / _HexagonTipSize.y;
half rhombus2 = sdRhombus(_texcoord - float2(width - _HexagonTipSize.y * scale, height / 2.0), float2(_HexagonTipSize.y, height / 2.0) * scale);
half sdfHexagon = sdfDifference(sdfDifference(baseRect, -rhombus1), -rhombus2);
//Left Rounded Corners
float halfHeight = height / 2.0;
float m = -halfHeight / _HexagonTipSize.x;
float c = halfHeight;
float d = sqrt(1.0 + m * m);
float k = _HexagonTipRadius.x * d + c;
//middle
half2 circlePivot = half2((halfHeight - k) / m, halfHeight);
half cornerCircle = circle(_texcoord - circlePivot, _HexagonTipRadius.x);
half x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m);
half y = m * x + c;
half fy = map(_texcoord.x, x, circlePivot.x, y, circlePivot.y);
sdfHexagon = _texcoord.y > fy && _texcoord.y < height - fy ? cornerCircle: sdfHexagon;
//return sdfHexagon;
//bottom
k = _HexagonCornerRadius.x * d + c;
circlePivot = half2((_HexagonCornerRadius.x - k) / m, _HexagonCornerRadius.x);
cornerCircle = circle(_texcoord - circlePivot, _HexagonCornerRadius.x);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, x, circlePivot.x, y, circlePivot.y);
sdfHexagon = _texcoord.y < fy && _texcoord.x < circlePivot.x ? cornerCircle: sdfHexagon;
//return sdfHexagon;
//top
k = _HexagonCornerRadius.w * d + c;
circlePivot = half2((_HexagonCornerRadius.w - k) / m, height - _HexagonCornerRadius.w);
cornerCircle = circle(_texcoord - circlePivot, _HexagonCornerRadius.w);
x = (_HexagonCornerRadius.w + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, x, circlePivot.x, height - y, circlePivot.y);
sdfHexagon = _texcoord.y > fy && _texcoord.x < circlePivot.x ? cornerCircle: sdfHexagon;
//return sdfHexagon;
//Right Rounded Corners
m = halfHeight / _HexagonTipSize.y;
d = sqrt(1.0 + m * m);
c = halfHeight - m * width;
k = _HexagonTipRadius.y * d + c;
//middle
circlePivot = half2((halfHeight - k) / m, halfHeight);
cornerCircle = circle(_texcoord - circlePivot, _HexagonTipRadius.y);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, y);
sdfHexagon = _texcoord.y > fy && _texcoord.y < height - fy ? cornerCircle: sdfHexagon;
//return sdfHexagon;
//bottom
k = _HexagonCornerRadius.y * d + c;
circlePivot = half2((_HexagonCornerRadius.y - k) / m, _HexagonCornerRadius.y);
cornerCircle = circle(_texcoord - circlePivot, _HexagonCornerRadius.y);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, y);
sdfHexagon = _texcoord.y < fy && _texcoord.x > circlePivot.x ? cornerCircle: sdfHexagon;
//return sdfHexagon;
//top
k = _HexagonCornerRadius.z * d + c;
circlePivot = half2((_HexagonCornerRadius.z - k) / m, height - _HexagonCornerRadius.z);
cornerCircle = circle(_texcoord - circlePivot, _HexagonCornerRadius.z);
x = (_HexagonCornerRadius.z + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, height - y);
sdfHexagon = _texcoord.y > fy && _texcoord.x > circlePivot.x ? cornerCircle: sdfHexagon;
return sdfHexagon;
}
#endif
#if NSTAR_POLYGON
half nStarPolygonScene(float4 _additionalData)
{
float2 _texcoord = _additionalData.xy;
float width = _additionalData.z;
float height = _additionalData.w;
float size = height / 2 - _NStarPolygonCornerRadius;
half str = sdNStarPolygon(_texcoord - half2(width / 2, height / 2) - _NStarPolygonOffset, size, _NStarPolygonSideCount, _NStarPolygonInset) - _NStarPolygonCornerRadius;
return str;
}
#endif
float2 rotateUV(float2 uv, float rotation, float2 mid)
{
return float2(
cos(rotation) * (uv.x - mid.x) + sin(rotation) * (uv.y - mid.y) + mid.x,
cos(rotation) * (uv.y - mid.y) - sin(rotation) * (uv.x - mid.x) + mid.y
);
}
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = UnityObjectToClipPos(v.vertex);
OUT.texcoord = v.texcoord;
OUT.effectsUv = v.uv1;
float2 size = float2(v.size.x + _FalloffDistance, v.size.y + _FalloffDistance);
float shapeRotation = radians(_ShapeRotation);
size = _ConstrainRotation > 0.0 && frac(abs(shapeRotation) / 3.14159) > 0.1? float2(size.y, size.x) : size;
float2 shapeUv = _ConstrainRotation > 0 ? v.uv1 : v.uv1 * size;
shapeUv = rotateUV(shapeUv, shapeRotation, _ConstrainRotation > 0? float2(0.5, 0.5) : size * 0.5);
shapeUv*= _ConstrainRotation > 0.0? size : 1.0;
shapeUv.x = lerp(shapeUv.x, abs(size.x - shapeUv.x), _FlipHorizontal);
shapeUv.y = lerp(shapeUv.y, abs(size.y - shapeUv.y), _FlipVertical);
OUT.shapeData = float4(shapeUv.x, shapeUv.y, size.x, size.y);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0) * float2(-1.0, 1.0);
#endif
OUT.color = v.color * _Color;
/* //SOFTMASK_HANDLE_START
SOFTMASK_CALCULATE_COORDS(OUT, v.vertex);
*/ //SOFTMASK_HANDLE_END
return OUT;
}
fixed4 frag(v2f IN): SV_Target
{
half4 color = IN.color;
half2 texcoord = IN.texcoord;
color = (tex2D(_MainTex, texcoord) + _TextureSampleAdd) * color;
#if GRADIENT_LINEAR || GRADIENT_RADIAL
colors[0] = _GradientColor0;
colors[1] = _GradientColor1;
colors[2] = _GradientColor2;
colors[3] = _GradientColor3;
colors[4] = _GradientColor4;
colors[5] = _GradientColor5;
colors[6] = _GradientColor6;
colors[7] = _GradientColor7;
alphas[0] = _GradientAlpha0;
alphas[1] = _GradientAlpha1;
alphas[2] = _GradientAlpha2;
alphas[3] = _GradientAlpha3;
alphas[4] = _GradientAlpha4;
alphas[5] = _GradientAlpha5;
alphas[6] = _GradientAlpha6;
alphas[7] = _GradientAlpha7;
#endif
#if GRADIENT_LINEAR
half gradientRotation = radians(_GradientRotation);
half t = cos(gradientRotation) * (IN.effectsUv.x - 0.5) +
sin(gradientRotation) * (IN.effectsUv.y - 0.5) + 0.5;
half4 grad = SampleGradient(t);
color *= grad;
#endif
#if GRADIENT_RADIAL
half fac = saturate(length(IN.effectsUv - float2(.5, .5)) * 2);
half4 grad = SampleGradient(clamp(fac, 0, 1));
color *= grad;
#endif
#if GRADIENT_CORNER
half4 topCol = lerp(_CornerGradientColor2, _CornerGradientColor3, IN.effectsUv.x);
half4 bottomCol = lerp(_CornerGradientColor0, _CornerGradientColor1, IN.effectsUv.x);
half4 finalCol = lerp(topCol, bottomCol, IN.effectsUv.y);
color *= finalCol;
#endif
#if RECTANGLE || CIRCLE || PENTAGON || TRIANGLE || HEXAGON || NSTAR_POLYGON
float sdfData = 0;
float pixelScale = clamp(1.0/_FalloffDistance, 1.0/2048.0, 2048.0);
#if RECTANGLE
sdfData = rectangleScene(IN.shapeData);
#elif CIRCLE
sdfData = circleScene(IN.shapeData);
#elif PENTAGON
sdfData = pentagonScene(IN.shapeData);
#elif TRIANGLE
sdfData = triangleScene(IN.shapeData);
#elif HEXAGON
sdfData = hexagonScene(IN.shapeData);
#elif NSTAR_POLYGON
sdfData = nStarPolygonScene(IN.shapeData);
#endif
#if !OUTLINED && !STROKE && !OUTLINED_STROKE
float sdf = sampleSdf(sdfData, pixelScale);
color.a *= sdf;
#endif
#if STROKE
float sdf = sampleSdfStrip(sdfData, _StrokeWidth + _OutlineWidth, pixelScale);
color.a *= sdf;
#endif
#if OUTLINED
float alpha = sampleSdf(sdfData, pixelScale);
float lerpFac = sampleSdf(sdfData + _OutlineWidth, pixelScale);
color = half4(lerp(_OutlineColor.rgb, color.rgb, lerpFac), lerp(_OutlineColor.a * color.a, color.a, lerpFac));
color.a *= alpha;
#endif
#if OUTLINED_STROKE
float alpha = sampleSdfStrip(sdfData, _OutlineWidth + _StrokeWidth, pixelScale);
float lerpFac = sampleSdfStrip(sdfData + _OutlineWidth, _StrokeWidth + _FalloffDistance, pixelScale);
lerpFac = clamp(lerpFac, 0, 1);
color = half4(lerp(_OutlineColor.rgb, color.rgb, lerpFac), lerp(_OutlineColor.a * color.a, color.a, lerpFac));
color.a *= alpha;
#endif
#endif
/* //SOFTMASK_HANDLE_START
color.a *= SOFTMASK_GET_MASK(IN);
*/ //SOFTMASK_HANDLE_END
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return fixed4(color);
}
ENDCG
}
}
CustomEditor "MPUIKIT.Editor.MPImageShaderGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0162a17359546d3479ae73858a9226ab
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,410 @@
Shader "MPUI/Basic Procedural Image"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" { }
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
/* //SOFTMASK_HANDLE_START
[PerRendererData] _SoftMask ("Mask", 2D) = "white" {}
*/ //SOFTMASK_HANDLE_END
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" "CanUseSpriteAtlas" = "True" }
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "2D_SDF.cginc"
/* //SOFTMASK_HANDLE_START
#include "Assets/SoftMask/Shaders/SoftMask.cginc" //SOFTMASK_INCLUDE_HANDLE
*/ //SOFTMASK_HANDLE_END
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
#pragma multi_compile_local _ CIRCLE TRIANGLE RECTANGLE NSTAR_POLYGON
#pragma multi_compile_local _ STROKE OUTLINED OUTLINED_STROKE
/* //SOFTMASK_HANDLE_START
#pragma multi_compile _ SOFTMASK_SIMPLE
*/ //SOFTMASK_HANDLE_END
struct appdata_t
{
float4 vertex: POSITION;
float4 color: COLOR;
float2 uv0: TEXCOORD0;
float2 uv1: TEXCOORD1;
float2 uv2: TEXCOORD2;
float2 uv3: TEXCOORD3;
float3 normal: NORMAL;
float4 tangent: TANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex: SV_POSITION;
fixed4 color: COLOR;
float2 uv0: TEXCOORD0;
float4 sizeData: TEXCOORD1;
float4 strokeOutlineCornerData: TEXCOORD2;
fixed4 outlineColor: COLOR1;
float4 shapeData: TEXCOORD3;
float4 worldPosition: TEXCOORD4;
/* //SOFTMASK_HANDLE_START
SOFTMASK_COORDS(5)
*/ //SOFTMASK_HANDLE_END
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
fixed4 _Color;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
float4 _MainTex_ST;
#if RECTANGLE
half rectangleScene(float4 _sizeData, float4 _shapeData, float _cornerStyle)
{
float2 _texcoord = _sizeData.xy;
float2 _size = float2(_sizeData.z, _sizeData.w);
float4 radius = _shapeData;
half4 c = half4(_texcoord, _size - _texcoord);
half rect = min(min(min(c.x, c.y), c.z), c.w);
bool4 cornerRects;
cornerRects.x = _texcoord.x < radius.x && _texcoord.y < radius.x;
cornerRects.y = _texcoord.x > _size.x - radius.y && _texcoord.y < radius.y;
cornerRects.z = _texcoord.x > _size.x - radius.z && _texcoord.y > _size.y - radius.z;
cornerRects.w = _texcoord.x < radius.w && _texcoord.y > _size.y - radius.w;
half cornerMask = any(cornerRects);
half4 cornerCircles;
cornerCircles.x = radius.x - length(_texcoord - radius.xx);//circle(_texcoord - radius.xx, radius.x);
cornerCircles.y = radius.y - length(_texcoord - half2(_size.x - radius.y, radius.y));//circle(_texcoord - half2(_size.x - radius.y, radius.y), radius.y);
cornerCircles.z = radius.z - length(_texcoord - (half2(_size.x, _size.y) - radius.zz));//circle(_texcoord - (half2(_size.x, _size.y) - radius.zz), radius.z);
cornerCircles.w = radius.w - length(_texcoord - half2(radius.w, _size.y - radius.w)); //circle(_texcoord - half2(radius.w, _size.y - radius.w), radius.w);
cornerCircles = min(max(cornerCircles, 0) * cornerRects, rect);
//cornerCircles = max(cornerCircles, 0) * cornerRects;
half corners = max(max(max(cornerCircles.x, cornerCircles.y), cornerCircles.z), cornerCircles.w);
corners = max(corners, 0.0) * cornerMask;
//return rect;
return rect*(cornerMask-1) - corners;
/*
half rect = rectanlge(_texcoord - half2(_size.x / 2.0, _size.y / 2.0), _size.x, _size.y);
half cornerCircle = circle(_texcoord - radius.xx, radius.x);
rect = _texcoord.x < radius.x && _texcoord.y < radius.x ? cornerCircle: rect;
cornerCircle = circle(_texcoord - half2(_size.x - radius.y, radius.y), radius.y);
rect = _texcoord.x > _size.x - radius.y && _texcoord.y < radius.y ? cornerCircle: rect;
cornerCircle = circle(_texcoord - (half2(_size.x, _size.y) - radius.zz), radius.z);
rect = _texcoord.x > _size.x - radius.z && _texcoord.y > _size.y - radius.z ? cornerCircle: rect;
cornerCircle = circle(_texcoord - half2(radius.w, _size.y - radius.w), radius.w);
rect = _texcoord.x < radius.w && _texcoord.y > _size.y - radius.w ? cornerCircle: rect;
*/
//max(max(max(cornerCircles.x, cornerCircles.y), cornerCircles.z), cornerCircles.w);
}
#endif
#if CIRCLE
float circleScene(float4 _sizeData, float4 _shapeData)
{
float2 _texcoord = _sizeData.xy;
float2 _size = _sizeData.zw;
float width = _size.x;
float height = _size.y;
float radius = lerp(_shapeData.x, min(width, height) / 2.0, _shapeData.y);
float sdf = circle(_texcoord - float2(width / 2.0, height / 2.0), radius);
return sdf;
}
#endif
#if TRIANGLE
half triangleScene(float4 _sizeData, float4 _shapeData)
{
float2 _texcoord = _sizeData.xy;
float2 _size = _sizeData.zw;
float width = _size.x;//_additionalData.z;
float height = _size.y;//_additionalData.w;
half sdf = sdTriangleIsosceles(_texcoord - half2(width / 2.0, height), half2(width / 2.0, -height));
//return sdf;
float3 _TriangleCornerRadius = max(_shapeData.xyz, float3(0.001, 0.001, 0.001));
// Left Corner
half halfWidth = width / 2.0;
half m = height / halfWidth;
half d = sqrt(1.0 + m * m);
half c = 0.0;
half k = -_TriangleCornerRadius.x * d + c;
half x = (_TriangleCornerRadius.x - k) / m;
half2 circlePivot = half2(x, _TriangleCornerRadius.x);
half cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.x);
//sdf = sdfDifference(sdf, cornerCircle);
//return sdf;
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m);
half y = m * x + c;
half fy = map(_texcoord.x, x, circlePivot.x, y, circlePivot.y);
sdf = _texcoord.y < fy && _texcoord.x < circlePivot.x ? cornerCircle: sdf;
//return sdf;
// Right Corner
m = -m; c = 2.0 * height;
k = -_TriangleCornerRadius.y * d + c;
x = (_TriangleCornerRadius.y - k) / m;
circlePivot = half2(x, _TriangleCornerRadius.y);
cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.y);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, circlePivot.x, x, circlePivot.y, y);
sdf = _texcoord.x > circlePivot.x && _texcoord.y < fy ? cornerCircle: sdf;
//Top Corner
k = -_TriangleCornerRadius.z * sqrt(1.0 + m * m) + c;
y = m * (width / 2.0) + k;
circlePivot = half2(halfWidth, y);
cornerCircle = circle(_texcoord - circlePivot, _TriangleCornerRadius.z);
x = (circlePivot.y + circlePivot.x / m - c) / (m + 1.0 / m); y = m * x + c;
fy = map(_texcoord.x, width - x, x, -1.0, 1.0);
fy = lerp(circlePivot.y, y, abs(fy));
sdf = _texcoord.y > fy ? cornerCircle: sdf;
return sdf;
}
#endif
#if NSTAR_POLYGON
half nStarPolygonScene(float4 _sizeData, float4 _shapeData)
{
float2 _texcoord = _sizeData.xy;
float width = _sizeData.z;
float height = _sizeData.w;
float size = height / 2 - _shapeData.y;
half str = sdNStarPolygon(_texcoord - half2(width / 2, height / 2), size, _shapeData.x, _shapeData.z) - _shapeData.y;
return str;
}
#endif
float2 rotateUV(float2 uv, float rotation, float2 mid)
{
return float2(
cos(rotation) * (uv.x - mid.x) + sin(rotation) * (uv.y - mid.y) + mid.x,
cos(rotation) * (uv.y - mid.y) - sin(rotation) * (uv.x - mid.x) + mid.y
);
}
float4 decode_0_1_16(float2 input){
float m = 65535.0;
float e = 256.0 / 255.0;
float n = 1.0 / m;
float4 c = float4(input.x, input.x, input.y, input.y);
c.yw *= m;
c = frac(c);
c -= float4(c.y, 0.0, c.w, 0.0) * n;
return clamp(c * e, 0.0, 1.0);
}
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.vertex = UnityObjectToClipPos(v.vertex);
OUT.worldPosition = v.vertex;
OUT.color = v.color * _Color;
OUT.uv0 = v.uv0;
float2 size = v.uv1;
half strokeWidth = v.normal.y;
half falloff = v.normal.z;
float rotationData = v.uv3.x;
half cornerStyle = v.uv3.y;
half outlineWidth = v.normal.x;
half4 outlineColor = v.tangent;
float4 shapeData;
#if CIRCLE
shapeData.xy = v.uv2.xy;
#else
shapeData = decode_0_1_16(v.uv2) * min(size.x, size.y);
#endif
OUT.strokeOutlineCornerData = float4(strokeWidth, falloff, outlineWidth, cornerStyle);
OUT.outlineColor = outlineColor;
OUT.shapeData = shapeData;
// Rotation Values
half sign = rotationData > 0.0 ? 1 : -1;
float f = abs(rotationData);
float shapeRotation = frac(f) * 360.0 * sign;
// r.xyz -> constrainRotation, flipHorizontal, flipVertical
f = floor(f);
float p = f / 100.0;
float z = round(p);
p = frac(p) * 10.0;
float y = round(p);
p = frac(p) * 10.0;
float x = round(p);
half constrainRotation = x;
half flipHorizontal = y;
half flipVertical = z;
shapeRotation = radians(shapeRotation);
size = constrainRotation > 0.0 && frac(abs(shapeRotation) / 3.14159) > 0.1? float2(size.y, size.x) : size;
float2 shapeUv = constrainRotation > 0 ? v.uv0 : v.uv0 * size;
shapeUv = rotateUV(shapeUv, shapeRotation, constrainRotation > 0? float2(0.5, 0.5) : size * 0.5);
shapeUv*= constrainRotation > 0.0? size : 1.0;
shapeUv.x = lerp(shapeUv.x, abs(size.x - shapeUv.x), flipHorizontal);
shapeUv.y = lerp(shapeUv.y, abs(size.y - shapeUv.y), flipVertical);
OUT.sizeData = float4(shapeUv.x, shapeUv.y, size.x, size.y);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0) * float2(-1.0, 1.0);
#endif
/* //SOFTMASK_HANDLE_START
SOFTMASK_CALCULATE_COORDS(OUT, v.vertex);
*/ //SOFTMASK_HANDLE_END
return OUT;
}
fixed4 frag(v2f IN): SV_Target
{
half4 color = IN.color;
half2 texcoord = IN.uv0;
color = (tex2D(_MainTex, texcoord) + _TextureSampleAdd) * color;
float4 sizeData = IN.sizeData;
float strokeWidth = IN.strokeOutlineCornerData.x;
float falloff = IN.strokeOutlineCornerData.y;
float outlineWidth = IN.strokeOutlineCornerData.z;
half4 outlineColor = IN.outlineColor;
float cornerStyle = IN.strokeOutlineCornerData.w;
float4 shapeData = IN.shapeData;
half pixelScale = clamp(1.0/falloff, 1.0/2048.0, 2048.0);
float sdfData = 0;
#if RECTANGLE
sdfData = rectangleScene(sizeData, shapeData, cornerStyle);
#endif
#if CIRCLE
sdfData = circleScene(sizeData, shapeData);
#endif
#if TRIANGLE
sdfData = triangleScene(sizeData, shapeData);
#endif
#if NSTAR_POLYGON
sdfData = nStarPolygonScene(sizeData, shapeData);
#endif
#if !OUTLINED && !STROKE && !OUTLINED_STROKE
half shape = sampleSdf(sdfData, pixelScale);
color.a *= shape;
//color.a = sdfData;
#endif
#if STROKE
half shape = sampleSdfStrip(sdfData, strokeWidth, pixelScale);
color.a *= shape;
#endif
#if OUTLINED
float alpha = sampleSdf(sdfData, pixelScale);
float lerpFac = sampleSdf(sdfData + outlineWidth, pixelScale);
color = half4(lerp(outlineColor.rgb, color.rgb, lerpFac), lerp(outlineColor.a * color.a, color.a, lerpFac));
color.a *= alpha;
#endif
#if OUTLINED_STROKE
float alpha = sampleSdfStrip(sdfData, outlineWidth + strokeWidth, pixelScale);
float lerpFac = sampleSdfStrip(sdfData + outlineWidth, strokeWidth + falloff, pixelScale);
lerpFac = clamp(lerpFac, 0, 1);
color = half4(lerp(outlineColor.rgb, color.rgb, lerpFac), lerp(outlineColor.a * color.a, color.a, lerpFac));
color.a *= alpha;
#endif
/* //SOFTMASK_HANDLE_START
color.a *= SOFTMASK_GET_MASK(IN);
*/ //SOFTMASK_HANDLE_END
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return fixed4(color);
}
ENDCG
}
}
CustomEditor "MPUIKIT.Editor.MPImageShaderGUI"
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5309a3f903204db8982ae4b1954c6db2
timeCreated: 1606546667

Binary file not shown.

View File

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: 6b96d6950a9c30743a2e826ee8684ac4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2578ed92ef82c514e8bbd96fb1c68462
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d777f9201a672da4289932e37ec6ac34
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7fa9108346022b448941984d96434457
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,264 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace MPUIKIT {
/// <summary>
/// Gradient overlay of the image.
/// </summary>
[Serializable]
public struct GradientEffect : IMPUIComponent {
[SerializeField] private bool m_Enabled;
[SerializeField] private GradientType m_GradientType;
[SerializeField] private Gradient m_Gradient;
[SerializeField] private Color[] m_CornerGradientColors;
[SerializeField] private float m_Rotation;
/// <summary>
/// Enable/Disable Gradient overlay
/// </summary>
public bool Enabled {
get => m_Enabled;
set {
m_Enabled = value;
if (ShouldModifySharedMat) {
SharedMat.SetInt(SpEnableGradient, m_Enabled?1:0);
}
OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
/// <summary>
/// Type of the Gradient. There are three types: Linear, Radial, Corner
/// </summary>
public GradientType GradientType {
get => m_GradientType;
set {
m_GradientType = value;
if (ShouldModifySharedMat) {
SharedMat.SetInt(SpGradientType, (int)m_GradientType);
}
OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
/// <summary>
/// Rotation of the gradient. Only applies for Linear Gradient.
/// </summary>
public float Rotation {
get => m_Rotation;
set {
m_Rotation = value;
if (ShouldModifySharedMat) {
SharedMat.SetFloat(SpGradientRotation, m_Rotation);
}
OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
/// <summary>
/// Gradient that will be overlaid onto the image.
/// </summary>
public Gradient Gradient {
get => m_Gradient;
set {
m_Gradient = value;
if (ShouldModifySharedMat) {
List<Color> Colors = new List<Color>(8);
List<Color> Alphas = new List<Color>(8);
for (int i = 0; i < 8; i++) {
if (i < m_Gradient.colorKeys.Length) {
Color col = m_Gradient.colorKeys[i].color;
Vector4 data = new Vector4(col.r, col.g, col.b,
m_Gradient.colorKeys[i].time);
Colors.Add(data);
SharedMat.SetColor("_GradientColor"+i, data);
}
else {
SharedMat.SetColor("_GradientColor"+i, Vector4.zero);
}
if (i < m_Gradient.alphaKeys.Length) {
Vector4 data = new Vector4(m_Gradient.alphaKeys[i].alpha, m_Gradient.alphaKeys[i].time);
Alphas.Add(data);
SharedMat.SetColor("_GradientAlpha"+i, data);
}
else {
SharedMat.SetColor("_GradientAlpha"+i, Vector4.zero);
}
}
SharedMat.SetInt(SpGradientColorsLength, m_Gradient.colorKeys.Length);
SharedMat.SetInt(SpGradientAlphasLength, m_Gradient.alphaKeys.Length);
for (int i = Colors.Count; i < 8; i++)
{
Colors.Add(Vector4.zero);
}
for (int i = Alphas.Count; i < 8; i++)
{
Alphas.Add(Vector4.zero);
}
SharedMat.SetColorArray(SpGradientColors, Colors);
SharedMat.GetColorArray(SpGradientAlphas, Alphas);
SharedMat.SetInt(SpGradientInterpolationType, (int) m_Gradient.mode);
}
OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
/// <summary>
/// 4 Colors for Corner Gradient overlay.
/// <para>[0] => top-left, [1] => top-right</para>
/// <para>[2] => bottom-left, [3] => bottom-right</para>
/// </summary>
public Color[] CornerGradientColors {
get => m_CornerGradientColors;
set {
if (m_CornerGradientColors.Length != 4) {
m_CornerGradientColors = new Color[4];
}
for (int i = 0; i < value.Length && i < 4; i++) {
m_CornerGradientColors[i] = value[i];
}
if (ShouldModifySharedMat) {
for (int i = 0; i < m_CornerGradientColors.Length; i++) {
SharedMat.SetColor("_CornerGradientColor"+i, m_CornerGradientColors[i]);
}
}
OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
private static readonly int SpGradientType = Shader.PropertyToID("_GradientType");
private static readonly int SpGradientColors = Shader.PropertyToID("colors");
private static readonly int SpGradientAlphas = Shader.PropertyToID("alphas");
private static readonly int SpGradientColorsLength = Shader.PropertyToID("_GradientColorLength");
private static readonly int SpGradientAlphasLength = Shader.PropertyToID("_GradientAlphaLength");
private static readonly int SpGradientInterpolationType = Shader.PropertyToID("_GradientInterpolationType");
private static readonly int SpEnableGradient = Shader.PropertyToID("_EnableGradient");
private static readonly int SpGradientRotation = Shader.PropertyToID("_GradientRotation");
public Material SharedMat { get; set; }
public bool ShouldModifySharedMat { get; set; }
public RectTransform RectTransform { get; set; }
public void Init(Material SharedMat, Material renderMat, RectTransform rectTransform) {
this.SharedMat = SharedMat;
this.ShouldModifySharedMat = SharedMat == renderMat;
this.RectTransform = rectTransform;
if (m_CornerGradientColors == null || m_CornerGradientColors.Length != 4) {
m_CornerGradientColors = new Color[4];
}
}
public event EventHandler OnComponentSettingsChanged;
public void OnValidate() {
Enabled = m_Enabled;
GradientType = m_GradientType;
Gradient = m_Gradient;
CornerGradientColors = m_CornerGradientColors;
Rotation = m_Rotation;
}
public void InitValuesFromMaterial(ref Material material) {
m_Enabled = material.GetInt(SpEnableGradient) == 1;
m_GradientType = (GradientType) material.GetInt(SpGradientType);
m_Rotation = material.GetFloat(SpGradientRotation);
int colorLength = material.GetInt(SpGradientColorsLength);
int alphaLength = material.GetInt(SpGradientAlphasLength);
Gradient gradient = new Gradient();
GradientColorKey[] colorKeys = new GradientColorKey[colorLength];
GradientAlphaKey[] alphaKeys = new GradientAlphaKey[alphaLength];
for (int i = 0; i < colorLength; i++) {
Color colorValue = material.GetColor("_GradientColor" + i);
colorKeys[i].color = new Color(colorValue.r, colorValue.g, colorValue.b);
colorKeys[i].time = colorValue.a;
}
gradient.colorKeys = colorKeys;
for (int i = 0; i < alphaLength; i++) {
Color alphaValue = material.GetColor("_GradientAlpha" + i);
alphaKeys[i].alpha = alphaValue.r;
alphaKeys[i].time = alphaValue.g;
}
gradient.alphaKeys = alphaKeys;
gradient.mode = (GradientMode) material.GetInt(SpGradientInterpolationType);
m_Gradient = gradient;
m_CornerGradientColors = new Color[4];
for (int i = 0; i < CornerGradientColors.Length; i++) {
CornerGradientColors[i] = material.GetColor("_CornerGradientColor" + i);
}
}
public void ModifyMaterial(ref Material material, params object[] otherProperties) {
material.DisableKeyword("GRADIENT_LINEAR");
material.DisableKeyword("GRADIENT_RADIAL");
material.DisableKeyword("GRADIENT_CORNER");
if (!m_Enabled) return;
material.SetInt(SpEnableGradient, m_Enabled?1:0);
material.SetInt(SpGradientType, (int)m_GradientType);
switch (m_GradientType) {
case GradientType.Linear:
material.EnableKeyword("GRADIENT_LINEAR");
break;
case GradientType.Radial:
material.EnableKeyword("GRADIENT_RADIAL");
break;
case GradientType.Corner:
material.EnableKeyword("GRADIENT_CORNER");
break;
default:
throw new ArgumentOutOfRangeException();
}
if (m_GradientType == GradientType.Corner) {
for (int i = 0; i < m_CornerGradientColors.Length; i++) {
material.SetColor("_CornerGradientColor"+i, m_CornerGradientColors[i]);
}
}
else {
Color[] colors = new Color[8];
Color[] alphas = new Color[8];
for (int i = 0; i < m_Gradient.colorKeys.Length; i++) {
Color col = m_Gradient.colorKeys[i].color;
colors[i] = new Color(col.r, col.g, col.b, m_Gradient.colorKeys[i].time);
}
for (int i = 0; i < m_Gradient.alphaKeys.Length; i++) {
alphas[i] = new Color(m_Gradient.alphaKeys[i].alpha, m_Gradient.alphaKeys[i].time, 0, 0);
}
material.SetFloat(SpGradientColorsLength, m_Gradient.colorKeys.Length);
material.SetFloat(SpGradientAlphasLength, m_Gradient.alphaKeys.Length);
material.SetFloat(SpGradientInterpolationType, (int)m_Gradient.mode);
material.SetFloat(SpGradientRotation, m_Rotation);
for (int i = 0; i < colors.Length; i++) {
material.SetColor("_GradientColor"+i, colors[i]);
}
for (int i = 0; i < alphas.Length; i++) {
material.SetColor("_GradientAlpha"+i, alphas[i]);
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dc339dba02e2a204bb8fbf6bf949b948
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
namespace MPUIKIT
{
public enum DrawShape {
None = 0,
Circle,
Triangle,
Rectangle,
Pentagon,
Hexagon,
NStarPolygon
}
public enum GradientType {
Linear,
Corner,
Radial
}
public enum MaterialMode {
Dynamic,
Shared
}
public enum CornerStyleType {
Sharp, Rounded, Cropped, BoxCut, CircleCut
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 546177621794a974cbee7e2628280bfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
using System;
using UnityEngine;
namespace MPUIKIT {
public interface IMPUIComponent{
Material SharedMat { get; set; }
bool ShouldModifySharedMat { get; set; }
RectTransform RectTransform { get; set; }
void Init(Material sharedMat, Material renderMat, RectTransform rectTransform);
event EventHandler OnComponentSettingsChanged;
void OnValidate();
void InitValuesFromMaterial(ref Material material);
void ModifyMaterial(ref Material material, params object[] otherProperties);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b4b38c0ec8d16245b60f2f0f2320058
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,688 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI.MPUIKIT;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace MPUIKIT {
[AddComponentMenu("UI/MPUI/MPImage")]
public class MPImage : Image {
#region Constants
public const string MpShaderName = "MPUI/Procedural Image";
#endregion
#region SerializedFields
[SerializeField] private DrawShape m_DrawShape = DrawShape.None;
[SerializeField] private Type m_ImageType = Type.Simple;
[SerializeField] private MaterialMode m_MaterialMode;
[SerializeField] private float m_StrokeWidth;
[SerializeField] private float m_OutlineWidth;
[SerializeField] private Color m_OutlineColor = Color.black;
[SerializeField] private float m_FalloffDistance = 0.5f;
[SerializeField] private bool m_ConstrainRotation = true;
[SerializeField] private float m_ShapeRotation;
[SerializeField] private bool m_FlipHorizontal;
[SerializeField] private bool m_FlipVertical;
[SerializeField] private Triangle m_Triangle = new Triangle();
[SerializeField] private Rectangle m_Rectangle = new Rectangle();
[SerializeField] private Circle m_Circle = new Circle();
[SerializeField] private Pentagon m_Pentagon = new Pentagon();
[SerializeField] private Hexagon m_Hexagon = new Hexagon();
[SerializeField] private NStarPolygon m_NStarPolygon = new NStarPolygon();
[SerializeField] private GradientEffect m_GradientEffect = new GradientEffect();
#endregion
#region Public Properties
#region Draw Settings
/// <summary>
/// Type of the shape to be drawn. ie: Rectangle, Circle
/// </summary>
public DrawShape DrawShape {
get => m_DrawShape;
set {
m_DrawShape = value;
if (material == m_Material) {
m_Material.SetInt(SpDrawShape, (int) m_DrawShape);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Width of the stroke for the drawn shape. 0 is no stroke.
/// </summary>
public float StrokeWidth {
get => m_StrokeWidth;
set {
m_StrokeWidth = value;
m_StrokeWidth = m_StrokeWidth < 0 ? 0 : m_StrokeWidth;
if (material == m_Material) {
m_Material.SetFloat(SpStrokeWidth, m_StrokeWidth);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Width of the outline for the drawn shape. 0 is no outline.
/// </summary>
public float OutlineWidth {
get => m_OutlineWidth;
set {
m_OutlineWidth = value;
m_OutlineWidth = m_OutlineWidth < 0 ? 0 : m_OutlineWidth;
if (m_Material == material) {
m_Material.SetFloat(SpOutlineWidth, m_OutlineWidth);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Color of the Outline. Has no effect is teh value of the OutlineWidth is 0
/// </summary>
public Color OutlineColor {
get => m_OutlineColor;
set {
m_OutlineColor = value;
if (m_Material == material) {
m_Material.SetColor(SpOutlineColor, m_OutlineColor);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Edge falloff distance of the shape
/// </summary>
public float FalloffDistance {
get { return m_FalloffDistance; }
set {
m_FalloffDistance = Mathf.Max(value, 0f);
if (material == m_Material) {
m_Material.SetFloat(SpFalloffDistance, m_FalloffDistance);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Constrains rotation to 0, 90, 270 degrees angle if set to true. But the width and height of the shape
/// is replaced as necessary to avoid clipping.
/// If set to false, any shapes can be rotated in any arbitrary angle but will often result in
/// clipping of the shape.
/// </summary>
public bool ConstrainRotation {
get { return m_ConstrainRotation; }
set {
m_ConstrainRotation = value;
if (m_Material == material) {
m_Material.SetInt(SpConstrainedRotation, value?1:0);
}
if (value) {
m_ShapeRotation = ConstrainRotationValue(m_ShapeRotation);
}
base.SetVerticesDirty();
base.SetMaterialDirty();
}
}
private float ConstrainRotationValue(float val) {
float finalRotation = val - val % 90;
if (Mathf.Abs(finalRotation) >= 360) finalRotation = 0;
return finalRotation;
}
/// <summary>
/// Rotation of the shape.
/// </summary>
public float ShapeRotation {
get { return m_ShapeRotation; }
set {
m_ShapeRotation = m_ConstrainRotation ? ConstrainRotationValue(value) : value;
if (m_Material == material) {
m_Material.SetFloat(SpShapeRotation, m_ShapeRotation);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Flips the shape horizontally.
/// </summary>
public bool FlipHorizontal {
get { return m_FlipHorizontal; }
set {
m_FlipHorizontal = value;
if (m_Material == material) {
m_Material.SetInt(SpFlipHorizontal, m_FlipHorizontal ? 1 : 0);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Flips the shape vertically
/// </summary>
public bool FlipVertical {
get { return m_FlipVertical; }
set {
m_FlipVertical = value;
if (m_Material == material) {
m_Material.SetInt(SpFlipVertical, m_FlipVertical ? 1 : 0);
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Defines what material type of use to render the shape. Dynamic or Shared.
/// Default is Dynamic and will issue one draw call per image object. If set to shared, assigned
/// material in the material slot will be used to render the image. It will fallback to dynamic
/// if no material in the material slot is assigned
/// </summary>
public MaterialMode MaterialMode {
get { return m_MaterialMode; }
set {
if (m_MaterialMode == value) return;
m_MaterialMode = value;
InitializeComponents();
if (material == m_Material) {
InitValuesFromSharedMaterial();
#if UNITY_EDITOR
_parseAgainOnValidate = true;
#endif
}
base.SetMaterialDirty();
}
}
/// <summary>
/// Shared material to use to render the shape. the material must use the "MPUI/Procedural Sprite" shader
/// </summary>
public override Material material {
get {
if (m_Material && m_MaterialMode == MaterialMode.Shared) {
return m_Material;
}
return DynamicMaterial;
}
set {
m_Material = value;
if (m_Material && m_MaterialMode == MaterialMode.Shared && m_Material.shader.name == MpShaderName) {
InitValuesFromSharedMaterial();
#if UNITY_EDITOR
_parseAgainOnValidate = true;
#endif
}
InitializeComponents();
base.SetMaterialDirty();
}
}
// ReSharper disable once InconsistentNaming
/// <summary>
/// Type of the image. Only two types are supported. Simple and Filled.
/// Default and fallback value is Simple.
/// </summary>
public new Type type {
get => m_ImageType;
set {
if (m_ImageType == value) return;
switch (value) {
case Type.Simple:
case Type.Filled:
m_ImageType = value;
break;
case Type.Tiled:
case Type.Sliced:
break;
default:
throw new ArgumentOutOfRangeException(value.ToString(), value, null);
}
base.type = m_ImageType;
}
}
#endregion
public Triangle Triangle {
get => m_Triangle;
set {
m_Triangle = value;
SetMaterialDirty();
}
}
public Rectangle Rectangle {
get => m_Rectangle;
set {
m_Rectangle = value;
SetMaterialDirty();
}
}
public Circle Circle{
get => m_Circle;
set {
m_Circle = value;
SetMaterialDirty();
}
}
public Pentagon Pentagon {
get => m_Pentagon;
set {
m_Pentagon = value;
SetMaterialDirty();
}
}
public Hexagon Hexagon {
get => m_Hexagon;
set {
m_Hexagon = value;
SetMaterialDirty();
}
}
public NStarPolygon NStarPolygon {
get => m_NStarPolygon;
set {
m_NStarPolygon = value;
SetMaterialDirty();
}
}
public GradientEffect GradientEffect {
get => m_GradientEffect;
set {
m_GradientEffect = value;
SetMaterialDirty();
}
}
#endregion
#region Private Variables
private Material _dynamicMaterial;
private Material DynamicMaterial {
get {
if (_dynamicMaterial == null) {
_dynamicMaterial = new Material(Shader.Find(MpShaderName));
_dynamicMaterial.name += " [Dynamic]";
}
return _dynamicMaterial;
}
}
#if UNITY_EDITOR
private bool _parseAgainOnValidate;
#endif
private Sprite ActiveSprite {
get {
Sprite overrideSprite1 = overrideSprite;
return overrideSprite1 != null ? overrideSprite1 : sprite;
}
}
#endregion
#region Material PropertyIds
private static readonly int SpPixelWorldScale = Shader.PropertyToID("_PixelWorldScale");
private static readonly int SpDrawShape = Shader.PropertyToID("_DrawShape");
private static readonly int SpStrokeWidth = Shader.PropertyToID("_StrokeWidth");
private static readonly int SpOutlineWidth = Shader.PropertyToID("_OutlineWidth");
private static readonly int SpOutlineColor = Shader.PropertyToID("_OutlineColor");
private static readonly int SpFalloffDistance = Shader.PropertyToID("_FalloffDistance");
private static readonly int SpShapeRotation = Shader.PropertyToID("_ShapeRotation");
private static readonly int SpConstrainedRotation = Shader.PropertyToID("_ConstrainRotation");
private static readonly int SpFlipHorizontal = Shader.PropertyToID("_FlipHorizontal");
private static readonly int SpFlipVertical = Shader.PropertyToID("_FlipVertical");
#endregion
#if UNITY_EDITOR
public void UpdateSerializedValuesFromSharedMaterial() {
if (m_Material && MaterialMode == MaterialMode.Shared) {
InitValuesFromSharedMaterial();
base.SetMaterialDirty();
}
}
protected override void OnValidate() {
InitializeComponents();
if (_parseAgainOnValidate) {
InitValuesFromSharedMaterial();
_parseAgainOnValidate = false;
}
DrawShape = m_DrawShape;
StrokeWidth = m_StrokeWidth;
OutlineWidth = m_OutlineWidth;
OutlineColor = m_OutlineColor;
FalloffDistance = m_FalloffDistance;
ConstrainRotation = m_ConstrainRotation;
ShapeRotation = m_ShapeRotation;
FlipHorizontal = m_FlipHorizontal;
FlipVertical = m_FlipVertical;
m_Triangle.OnValidate();
m_Circle.OnValidate();
m_Rectangle.OnValidate();
m_Pentagon.OnValidate();
m_Hexagon.OnValidate();
m_NStarPolygon.OnValidate();
m_GradientEffect.OnValidate();
base.OnValidate();
base.SetMaterialDirty();
}
#endif
private void InitializeComponents() {
m_Circle.Init(m_Material, material, rectTransform);
m_Triangle.Init(m_Material, material, rectTransform);
m_Rectangle.Init(m_Material, material, rectTransform);
m_Pentagon.Init(m_Material, material, rectTransform);
m_Hexagon.Init(m_Material, material, rectTransform);
m_NStarPolygon.Init(m_Material, material, rectTransform);
m_GradientEffect.Init(m_Material, material, rectTransform);
}
void FixAdditionalShaderChannelsInCanvas()
{
Canvas c = canvas;
if(canvas == null) return;
AdditionalCanvasShaderChannels additionalShaderChannels = c.additionalShaderChannels;
additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
c.additionalShaderChannels = additionalShaderChannels;
}
#if UNITY_EDITOR
protected override void Reset() {
InitializeComponents();
base.Reset();
}
#else
void Reset() {
InitializeComponents();
}
#endif
protected override void Awake()
{
base.Awake();
Init();
}
public void Init()
{
InitializeComponents();
FixAdditionalShaderChannelsInCanvas();
if (m_Material && MaterialMode == MaterialMode.Shared) {
InitValuesFromSharedMaterial();
}
ListenToComponentChanges(true);
base.SetAllDirty();
}
protected override void OnDestroy() {
ListenToComponentChanges(false);
base.OnDestroy();
}
protected void ListenToComponentChanges(bool toggle) {
if (toggle) {
m_Circle.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_Triangle.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_Rectangle.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_Pentagon.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_Hexagon.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_NStarPolygon.OnComponentSettingsChanged += OnComponentSettingsChanged;
m_GradientEffect.OnComponentSettingsChanged += OnComponentSettingsChanged;
}
else {
m_Circle.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_Triangle.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_Rectangle.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_Pentagon.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_Hexagon.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_NStarPolygon.OnComponentSettingsChanged -= OnComponentSettingsChanged;
m_GradientEffect.OnComponentSettingsChanged += OnComponentSettingsChanged;
}
}
protected override void OnTransformParentChanged()
{
base.OnTransformParentChanged();
FixAdditionalShaderChannelsInCanvas();
}
private void OnComponentSettingsChanged(object sender, EventArgs e) {
base.SetMaterialDirty();
}
protected override void OnRectTransformDimensionsChange() {
base.OnRectTransformDimensionsChange();
m_Circle.UpdateCircleRadius(rectTransform);
base.SetMaterialDirty();
}
protected override void OnPopulateMesh(VertexHelper vh) {
switch (type) {
case Type.Simple:
case Type.Sliced:
case Type.Tiled:
MPImageHelper.GenerateSimpleSprite(vh, preserveAspect, canvas, rectTransform, ActiveSprite,
color, m_FalloffDistance);
break;
case Type.Filled:
MPImageHelper.GenerateFilledSprite(vh, preserveAspect, canvas, rectTransform, ActiveSprite,
color, fillMethod, fillAmount, fillOrigin, fillClockwise, m_FalloffDistance);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
public override Material GetModifiedMaterial(Material baseMaterial) {
Material mat = base.GetModifiedMaterial(baseMaterial);
if (m_Material && MaterialMode == MaterialMode.Shared) {
InitValuesFromSharedMaterial();
}
DisableAllMaterialKeywords(mat);
RectTransform rt = rectTransform;
if (DrawShape != DrawShape.None) {
mat.SetFloat(SpOutlineWidth, m_OutlineWidth);
mat.SetFloat(SpStrokeWidth, m_StrokeWidth);
mat.SetColor(SpOutlineColor, OutlineColor);
mat.SetFloat(SpFalloffDistance, FalloffDistance);
float pixelSize = 1/Mathf.Max(0, FalloffDistance);
mat.SetFloat(SpPixelWorldScale, Mathf.Clamp(pixelSize, 0f, 999999f));
if (m_StrokeWidth > 0 && m_OutlineWidth > 0) {
mat.EnableKeyword("OUTLINED_STROKE");
}
else {
if (m_StrokeWidth > 0) {
mat.EnableKeyword("STROKE");
}
else if (m_OutlineWidth > 0) {
mat.EnableKeyword("OUTLINED");
}
else {
mat.DisableKeyword("OUTLINED_STROKE");
mat.DisableKeyword("STROKE");
mat.DisableKeyword("OUTLINED");
}
}
}
m_Triangle.ModifyMaterial(ref mat);
m_Circle.ModifyMaterial(ref mat, m_FalloffDistance);
m_Rectangle.ModifyMaterial(ref mat);
m_Pentagon.ModifyMaterial(ref mat);
m_Hexagon.ModifyMaterial(ref mat);
m_NStarPolygon.ModifyMaterial(ref mat);
m_GradientEffect.ModifyMaterial(ref mat);
switch (DrawShape) {
case DrawShape.None:
mat.DisableKeyword("CIRCLE");
mat.DisableKeyword("TRIANGLE");
mat.DisableKeyword("RECTANGLE");
mat.DisableKeyword("PENTAGON");
mat.DisableKeyword("HEXAGON");
mat.DisableKeyword("NSTAR_POLYGON");
break;
case DrawShape.Circle:
mat.EnableKeyword("CIRCLE");
break;
case DrawShape.Triangle:
mat.EnableKeyword("TRIANGLE");
break;
case DrawShape.Rectangle:
mat.EnableKeyword("RECTANGLE");
break;
case DrawShape.Pentagon:
mat.EnableKeyword("PENTAGON");
break;
case DrawShape.NStarPolygon:
mat.EnableKeyword("NSTAR_POLYGON");
break;
case DrawShape.Hexagon:
mat.EnableKeyword("HEXAGON");
break;
default:
throw new ArgumentOutOfRangeException();
}
mat.SetInt(SpDrawShape, (int) DrawShape);
mat.SetInt(SpFlipHorizontal, m_FlipHorizontal ? 1 : 0);
mat.SetInt(SpFlipVertical, m_FlipVertical ? 1 : 0);
mat.SetFloat(SpShapeRotation, m_ShapeRotation);
mat.SetInt(SpConstrainedRotation, m_ConstrainRotation?1:0);
return mat;
}
private void DisableAllMaterialKeywords(Material mat) {
mat.DisableKeyword("PROCEDURAL");
mat.DisableKeyword("HYBRID");
mat.DisableKeyword("CIRCLE");
mat.DisableKeyword("TRIANGLE");
mat.DisableKeyword("RECTANGLE");
mat.DisableKeyword("PENTAGON");
mat.DisableKeyword("HEXAGON");
mat.DisableKeyword("NSTAR_POLYGON");
mat.DisableKeyword("STROKE");
mat.DisableKeyword("OUTLINED");
mat.DisableKeyword("OUTLINED_STROKE");
mat.DisableKeyword("ROUNDED_CORNERS");
mat.DisableKeyword("GRADIENT_LINEAR");
mat.DisableKeyword("GRADIENT_CORNER");
mat.DisableKeyword("GRADIENT_RADIAL");
}
public void InitValuesFromSharedMaterial() {
if (m_Material == null) return;
Material mat = m_Material;
//Debug.Log("Parsing shared mat");
//Basic Settings
m_DrawShape = (DrawShape) mat.GetInt(SpDrawShape);
m_StrokeWidth = mat.GetFloat(SpStrokeWidth);
m_FalloffDistance = mat.GetFloat(SpFalloffDistance);
m_OutlineWidth = mat.GetFloat(SpOutlineWidth);
m_OutlineColor = mat.GetColor(SpOutlineColor);
m_FlipHorizontal = mat.GetInt(SpFlipHorizontal) == 1;
m_FlipVertical = mat.GetInt(SpFlipVertical) == 1;
m_ConstrainRotation = mat.GetInt(SpConstrainedRotation) == 1;
m_ShapeRotation = mat.GetFloat(SpShapeRotation);
//Debug.Log($"Parsed Falloff Distance: {m_FalloffDistance}");
m_Triangle.InitValuesFromMaterial(ref mat);
m_Circle.InitValuesFromMaterial(ref mat);
m_Rectangle.InitValuesFromMaterial(ref mat);
m_Pentagon.InitValuesFromMaterial(ref mat);
m_Hexagon.InitValuesFromMaterial(ref mat);
m_NStarPolygon.InitValuesFromMaterial(ref mat);
//GradientEffect
m_GradientEffect.InitValuesFromMaterial(ref mat);
}
#if UNITY_EDITOR
public Material CreateMaterialAssetFromComponentSettings() {
Material matAsset = new Material(Shader.Find(MpShaderName));
matAsset = GetModifiedMaterial(matAsset);
string path = EditorUtility.SaveFilePanelInProject("Create Material for MPImage",
"MPMaterial", "mat", "Choose location");
AssetDatabase.CreateAsset(matAsset, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
return matAsset;
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 141109fb25f0083469e71ce8cb3e75c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,421 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace MPUIKIT {
[AddComponentMenu("UI/MPUI/MPImageBasic")]
public class MPImageBasic : Image {
#region SerializedFields
[SerializeField] private DrawShape m_DrawShape = DrawShape.None;
[SerializeField] private Type m_ImageType = Type.Simple; // Mapping in Vertex Stream
[SerializeField] private float m_StrokeWidth; // MapTo -> UV2.x
[SerializeField] private float m_FalloffDistance = 0.5f; // MapTo -> UV2.y
[SerializeField] private float m_OutlineWidth; // MapTo -> Normal.x
[SerializeField] private Color m_OutlineColor = Color.black; // MapTo -> Tangent.x, Tangent.y, Tangent.z, Tangent.w
[SerializeField] private float m_ShapeRotation; // MapTo -> UV3.x Compressed
[SerializeField] private bool m_ConstrainRotation = true; // MapTo -> UV3.x Compressed
[SerializeField] private bool m_FlipHorizontal; // MapTo -> UV3.x Compressed
[SerializeField] private bool m_FlipVertical; // MapTo -> UV3.x Compressed
[SerializeField] private CornerStyleType m_CornerStyle; // MapTo -> UV3.y
[SerializeField] private Vector4 m_RectangleCornerRadius; // MapTo -> Normal.y, Normal.z compressed
[SerializeField] private Vector3 m_TriangleCornerRadius; // MapTo -> Normal.y, Normal.z compressed
#pragma warning disable
// ReSharper disable once NotAccessedField.Local
[SerializeField] private bool m_TriangleUniformCornerRadius = true;
// ReSharper disable once NotAccessedField.Local
[SerializeField] private bool m_RectangleUniformCornerRadius = true;
#pragma warning restore
[SerializeField] private float m_CircleRadius; // MapTo -> Normal.y
[SerializeField] private bool m_CircleFitToRect = true; // MapTo -> Normal.z
[SerializeField] private int m_NStarPolygonSideCount = 3; // MapTo -> Normal.y compressed
[SerializeField] private float m_NStarPolygonInset = 2f; // MapTo -> Normal.y compressed
[SerializeField] private float m_NStarPolygonCornerRadius; // MapTo -> Normal.z
#endregion
#region Public Accessors
public DrawShape Shape { get => m_DrawShape;
set {
m_DrawShape = value;
m_Material = null;
base.SetMaterialDirty();
base.SetVerticesDirty();
}
}
public float StrokeWidth {
get => m_StrokeWidth;
set {
Vector2 size = GetPixelAdjustedRect().size;
m_StrokeWidth = Mathf.Clamp(value, 0, Mathf.Min(size.x, size.y) * 0.5f);
base.SetVerticesDirty();
}
}
public float FallOffDistance {
get => m_FalloffDistance;
set {
m_FalloffDistance = Mathf.Max(0, value);
base.SetVerticesDirty();
}
}
public float OutlineWidth {
get => m_OutlineWidth;
set {
m_OutlineWidth = Mathf.Max(0,value);
base.SetVerticesDirty();
}
}
public Color OutlineColor {
get => m_OutlineColor;
set {
m_OutlineColor = value;
base.SetVerticesDirty();
}
}
public float ShapeRotation {
get => m_ShapeRotation;
set {
m_ShapeRotation = value % 360;
ConstrainRotationValue();
base.SetVerticesDirty();
}
}
public bool ConstrainRotation {
get => m_ConstrainRotation;
set {
m_ConstrainRotation = value;
ConstrainRotationValue();
base.SetVerticesDirty();
}
}
public bool FlipHorizontal {
get => m_FlipHorizontal;
set {
m_FlipHorizontal = value;
base.SetVerticesDirty();
}
}
public bool FlipVertical {
get => m_FlipVertical;
set {
m_FlipVertical = value;
base.SetVerticesDirty();
}
}
/// <summary>
/// Type of the image. Only two types are supported. Simple and Filled.
/// Default and fallback value is Simple.
/// </summary>
public new Type type {
get => m_ImageType;
set {
if (m_ImageType != value) {
switch (value) {
case Type.Simple:
case Type.Filled:
if (sprite) m_ImageType = value;
break;
case Type.Tiled:
case Type.Sliced:
break;
default:
throw new ArgumentOutOfRangeException(value.ToString(), value, null);
}
}
if(base.type != m_ImageType) base.type = m_ImageType;
base.SetAllDirty();
}
}
public CornerStyleType CornerStyle {
get => m_CornerStyle;
set {
m_CornerStyle = value;
base.SetVerticesDirty();
}
}
public Vector3 TriangleCornerRadius {
get => m_TriangleCornerRadius;
set {
Vector2 size = GetPixelAdjustedRect().size;
float zMax = size.x * 0.5f;
m_TriangleCornerRadius.z = Mathf.Clamp(value.z, 0, zMax);
float hMax = Mathf.Min(size.x, size.y) * 0.3f;
m_TriangleCornerRadius.x = Mathf.Clamp(value.x, 0, hMax);
m_TriangleCornerRadius.y = Mathf.Clamp(value.y, 0, hMax);
base.SetVerticesDirty();
}
}
public Vector4 RectangleCornerRadius {
get => m_RectangleCornerRadius;
set
{
m_RectangleCornerRadius = value;
base.SetVerticesDirty();
}
}
public float CircleRadius {
get => m_CircleRadius;
set {
m_CircleRadius = Mathf.Clamp(value, 0, GetMinSize());
base.SetVerticesDirty();
}
}
public bool CircleFitToRect {
get => m_CircleFitToRect;
set {
m_CircleFitToRect = value;
base.SetVerticesDirty();
}
}
public float NStarPolygonCornerRadius {
get => m_NStarPolygonCornerRadius;
set {
float halfHeight = GetPixelAdjustedRect().height * 0.5f;
m_NStarPolygonCornerRadius = Mathf.Clamp(value, m_NStarPolygonSideCount == 2? 0.1f : 0f, halfHeight);
base.SetVerticesDirty();
}
}
public float NStarPolygonInset {
get => m_NStarPolygonInset;
set {
m_NStarPolygonInset = Mathf.Clamp(value, 2f, m_NStarPolygonSideCount);
base.SetVerticesDirty();
}
}
public int NStarPolygonSideCount {
get => m_NStarPolygonSideCount;
set {
m_NStarPolygonSideCount = Mathf.Clamp(value, 2, 10);
base.SetVerticesDirty();
}
}
#endregion
public override Material material {
get
{
switch (m_DrawShape)
{
case DrawShape.None:
return Canvas.GetDefaultCanvasMaterial();
case DrawShape.Circle:
case DrawShape.Triangle:
case DrawShape.Rectangle:
return MPMaterials.GetMaterial((int)m_DrawShape - 1, m_StrokeWidth > 0f, m_OutlineWidth > 0f);
case DrawShape.Pentagon:
case DrawShape.Hexagon:
case DrawShape.NStarPolygon:
return MPMaterials.GetMaterial(3, m_StrokeWidth > 0f, m_OutlineWidth > 0f);
default:
throw new ArgumentOutOfRangeException();
}
}
set => Debug.LogWarning("Setting Material of MPImageBasic has no effect.");
}
public override float preferredWidth => sprite == MPImageUtility.EmptySprite ? 0 : base.preferredWidth;
public override float preferredHeight => sprite == MPImageUtility.EmptySprite ? 0 : base.preferredHeight;
protected override void OnEnable() {
base.OnEnable();
MPImageUtility.FixAdditionalShaderChannelsInCanvas(canvas);
if (sprite == null) sprite = MPImageUtility.EmptySprite;
}
#if UNITY_EDITOR
protected override void OnValidate() {
base.OnValidate();
Shape = m_DrawShape;
if (sprite == null) sprite = MPImageUtility.EmptySprite;
type = m_ImageType;
StrokeWidth = m_StrokeWidth;
FallOffDistance = m_FalloffDistance;
OutlineWidth = m_OutlineWidth;
OutlineColor = m_OutlineColor;
ShapeRotation = m_ShapeRotation;
ConstrainRotation = m_ConstrainRotation;
FlipHorizontal = m_FlipHorizontal;
FlipVertical = m_FlipVertical;
CornerStyle = m_CornerStyle;
}
#endif
private float GetMinSizeHalf() {
return GetMinSize() * 0.5f;
}
private float GetMinSize() {
Vector2 size = GetPixelAdjustedRect().size;
return Mathf.Min(size.x, size.y);
}
private void ConstrainRotationValue() {
if (!m_ConstrainRotation) return;
float finalRotation = m_ShapeRotation - (m_ShapeRotation % 90);
if (Mathf.Abs(finalRotation) >= 360) finalRotation = 0;
m_ShapeRotation = finalRotation;
}
protected override void OnTransformParentChanged() {
base.OnTransformParentChanged();
MPImageUtility.FixAdditionalShaderChannelsInCanvas(canvas);
base.SetVerticesDirty();
}
private MPVertexStream CreateVertexStream() {
MPVertexStream stream = new MPVertexStream();
RectTransform rectT = rectTransform;
stream.RectTransform = rectT;
Rect r = GetPixelAdjustedRect();
stream.Uv1 = new Vector2(r.width + m_FalloffDistance, r.height + m_FalloffDistance);
float packedRotData =
PackRotationData(m_ShapeRotation, m_ConstrainRotation, m_FlipHorizontal, m_FlipVertical);
stream.Uv3 = new Vector2(packedRotData, (float)m_CornerStyle);
stream.Tangent = QualitySettings.activeColorSpace == ColorSpace.Linear? m_OutlineColor.linear : m_OutlineColor;
Vector3 normal = new Vector3();
normal.x = m_OutlineWidth;
normal.y = m_StrokeWidth;
normal.z = m_FalloffDistance;
Vector4 data;
Vector2 shapeProps;
switch (m_DrawShape) {
case DrawShape.Circle:
shapeProps = new Vector2(m_CircleRadius, m_CircleFitToRect ? 1 : 0);
break;
case DrawShape.Triangle:
data = m_TriangleCornerRadius;
data = data / Mathf.Min(r.width, r.height);
shapeProps = MPImageUtility.Encode_0_1_16(data);
break;
case DrawShape.Rectangle:
data = FixRadius(m_RectangleCornerRadius);
data = data / Mathf.Min(r.width, r.height);
shapeProps = MPImageUtility.Encode_0_1_16(data);
break;
case DrawShape.NStarPolygon:
data = new Vector4(m_NStarPolygonSideCount, m_NStarPolygonCornerRadius, m_NStarPolygonInset);
data = data / Mathf.Min(r.width, r.height);
shapeProps = MPImageUtility.Encode_0_1_16(data);
break;
default:
shapeProps = Vector2.zero;
break;
}
stream.Uv2 = shapeProps;
stream.Normal = normal;
return stream;
}
private float PackRotationData(float rotation, bool constrainRotation, bool flipH, bool flipV) {
int c = constrainRotation ? 1 : 0;
c += flipH ? 10 : 0;
c += flipV ? 100 : 0;
float cr = rotation % 360f;
float sign = cr >= 0 ? 1 : -1;
cr = Mathf.Abs(cr) / 360f;
cr = (cr + c) * sign;
return cr;
}
void UnPackRotation(float f) {
float r = 0, x = 0, y = 0, z = 0;
float sign = f >= 0.0f ? 1 : -1;
f = Mathf.Abs(f);
r = fract(f) * 360f * sign;
f = Mathf.Floor(f);
float p = f / 100f;
z = Mathf.Floor(p);
p = fract(p) * 10f;
y = Mathf.Floor(p);
p = fract(p) * 10f;
x = Mathf.Round(p);
// Debug.Log($"Rotation: {r}, X: {x}, Y: {y}, Z: {z}");
float fract(float val) {
val = Mathf.Abs(val);
float ret = val - Mathf.Floor(val);
return ret;
}
}
protected override void OnRectTransformDimensionsChange()
{
base.OnRectTransformDimensionsChange();
base.SetVerticesDirty();
}
private Vector4 FixRadius(Vector4 radius)
{
Rect rect = rectTransform.rect;
radius = Vector4.Max(radius, Vector4.zero);
radius = Vector4.Min(radius, Vector4.one * Mathf.Min(rect.width, rect.height));
float scaleFactor =
Mathf.Min (
Mathf.Min (
Mathf.Min (
Mathf.Min (
rect.width / (radius.x + radius.y),
rect.width / (radius.z + radius.w)),
rect.height / (radius.x + radius.w)),
rect.height / (radius.z + radius.y)),
1f);
return radius * scaleFactor;
}
protected override void OnPopulateMesh(VertexHelper toFill) {
base.OnPopulateMesh(toFill);
MPVertexStream stream = CreateVertexStream();
UIVertex uiVert = new UIVertex();
for (int i = 0; i < toFill.currentVertCount; i++) {
toFill.PopulateUIVertex(ref uiVert, i);
//uiVert.position += ((Vector3)uiVert.uv0 - new Vector3(0.5f, 0.5f)) * m_FalloffDistance;
uiVert.uv1 = stream.Uv1;
uiVert.uv2 = stream.Uv2;
uiVert.uv3 = stream.Uv3;
uiVert.normal = stream.Normal;
uiVert.tangent = stream.Tangent;
toFill.SetUIVertex(uiVert, i);
}
}
#if UNITY_EDITOR
protected override void Reset() {
base.Reset();
if (sprite == null) sprite = MPImageUtility.EmptySprite;
}
#else
void Reset() {
if (sprite == null) sprite = MPImageUtility.EmptySprite;
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fceb93b9d8bf04943b1dd4939eaf6284
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 39276b906c650414984bc6e7d49b4e97
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More