diff --git a/Assets/MPUIKit.meta b/Assets/MPUIKit.meta new file mode 100644 index 0000000..df1611e --- /dev/null +++ b/Assets/MPUIKit.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2b1f7fc7f3ee4097bdc8a214a25adb5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor.meta b/Assets/MPUIKit/Editor.meta new file mode 100644 index 0000000..f8ae436 --- /dev/null +++ b/Assets/MPUIKit/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3be96de8ad725594daed36f170ebc783 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Images.meta b/Assets/MPUIKit/Editor/Images.meta new file mode 100644 index 0000000..9cc3100 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6dd8df1b756a60749afb0e7b5f235a9a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Images/background.png b/Assets/MPUIKit/Editor/Images/background.png new file mode 100644 index 0000000..036fd2e --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/background.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63e1fe7d9e32f5ce12132c131c970c3f358229bf306b732bfa2550c0a2272414 +size 47779 diff --git a/Assets/MPUIKit/Editor/Images/background.png.meta b/Assets/MPUIKit/Editor/Images/background.png.meta new file mode 100644 index 0000000..0f53cf1 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/background.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_h_0.png b/Assets/MPUIKit/Editor/Images/flip_h_0.png new file mode 100644 index 0000000..bfd69ba --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad858fa246391204e9112573dc67ce66b4fa1c301a115d36809a153e2617e5de +size 1280 diff --git a/Assets/MPUIKit/Editor/Images/flip_h_0.png.meta b/Assets/MPUIKit/Editor/Images/flip_h_0.png.meta new file mode 100644 index 0000000..5312eef --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_0.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_h_1.png b/Assets/MPUIKit/Editor/Images/flip_h_1.png new file mode 100644 index 0000000..afb6cac --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:622ddbc33cd0903ceb47048ef591d227e97ae1c3c2316ccdfb28d02f61b82b1d +size 1338 diff --git a/Assets/MPUIKit/Editor/Images/flip_h_1.png.meta b/Assets/MPUIKit/Editor/Images/flip_h_1.png.meta new file mode 100644 index 0000000..ae47486 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_1.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_h_2.png b/Assets/MPUIKit/Editor/Images/flip_h_2.png new file mode 100644 index 0000000..c15f51e --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdaad2ceeba0d7a16f5f27d7217290f57040da6bf68522004f0d155e7b0c55f3 +size 1495 diff --git a/Assets/MPUIKit/Editor/Images/flip_h_2.png.meta b/Assets/MPUIKit/Editor/Images/flip_h_2.png.meta new file mode 100644 index 0000000..e47ad61 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_2.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_h_3.png b/Assets/MPUIKit/Editor/Images/flip_h_3.png new file mode 100644 index 0000000..5fdb452 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5cc5a09e01cab3540122fb50308e64792950a6c60a15b3dd575a95b3ab8915e +size 1321 diff --git a/Assets/MPUIKit/Editor/Images/flip_h_3.png.meta b/Assets/MPUIKit/Editor/Images/flip_h_3.png.meta new file mode 100644 index 0000000..1c4b217 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_h_3.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_v_0.png b/Assets/MPUIKit/Editor/Images/flip_v_0.png new file mode 100644 index 0000000..2d1e9ed --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5903fd1e4162e980c4b3c7eec48b5ba14af00e4f73b91e6323b2e5195873ac22 +size 1196 diff --git a/Assets/MPUIKit/Editor/Images/flip_v_0.png.meta b/Assets/MPUIKit/Editor/Images/flip_v_0.png.meta new file mode 100644 index 0000000..aba7ad3 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_0.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_v_1.png b/Assets/MPUIKit/Editor/Images/flip_v_1.png new file mode 100644 index 0000000..0b7df9c --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9418f47980d1875feb0399046a3eb2c67966e6b57b1c397434db2cbb0d5ca963 +size 1194 diff --git a/Assets/MPUIKit/Editor/Images/flip_v_1.png.meta b/Assets/MPUIKit/Editor/Images/flip_v_1.png.meta new file mode 100644 index 0000000..c6c7e59 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_1.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_v_2.png b/Assets/MPUIKit/Editor/Images/flip_v_2.png new file mode 100644 index 0000000..7ba8346 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:885b8f4bfbdcc39ee0c70955d17a3c0f5039394a0372752adeabc76d95374593 +size 1497 diff --git a/Assets/MPUIKit/Editor/Images/flip_v_2.png.meta b/Assets/MPUIKit/Editor/Images/flip_v_2.png.meta new file mode 100644 index 0000000..7f299b3 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_2.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/flip_v_3.png b/Assets/MPUIKit/Editor/Images/flip_v_3.png new file mode 100644 index 0000000..16752ef --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d50b746f32c3eafaf527472874d15e1d04264988a84d7f11fbd201042369395 +size 1129 diff --git a/Assets/MPUIKit/Editor/Images/flip_v_3.png.meta b/Assets/MPUIKit/Editor/Images/flip_v_3.png.meta new file mode 100644 index 0000000..2a20600 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/flip_v_3.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/logo.png b/Assets/MPUIKit/Editor/Images/logo.png new file mode 100644 index 0000000..435cef5 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a63ae7cffcf6fb396df0d9937885241585ddc17b800cf1b35203116c1d58860 +size 9823 diff --git a/Assets/MPUIKit/Editor/Images/logo.png.meta b/Assets/MPUIKit/Editor/Images/logo.png.meta new file mode 100644 index 0000000..a4993f2 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/logo.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_0.png b/Assets/MPUIKit/Editor/Images/rotate_left_0.png new file mode 100644 index 0000000..5eeaa2b --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f55574aed937639da9491a32bfd64810e75a2a1d94c595996e75bc15b6f292c6 +size 815 diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_0.png.meta b/Assets/MPUIKit/Editor/Images/rotate_left_0.png.meta new file mode 100644 index 0000000..41e89f1 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_0.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_1.png b/Assets/MPUIKit/Editor/Images/rotate_left_1.png new file mode 100644 index 0000000..2fc5228 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d270220ab79743b65686ac8a5e926dec8425671bdd1303443a87be090eb11485 +size 814 diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_1.png.meta b/Assets/MPUIKit/Editor/Images/rotate_left_1.png.meta new file mode 100644 index 0000000..19d8be6 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_1.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_2.png b/Assets/MPUIKit/Editor/Images/rotate_left_2.png new file mode 100644 index 0000000..c6075ca --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84d6f55647d3642e2837d945f1b58f7b564d1aea415669dbc5acdfbc48f313f8 +size 819 diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_2.png.meta b/Assets/MPUIKit/Editor/Images/rotate_left_2.png.meta new file mode 100644 index 0000000..5ad853c --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_2.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_3.png b/Assets/MPUIKit/Editor/Images/rotate_left_3.png new file mode 100644 index 0000000..bb7d3a2 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb6af7d896c84bf46450df594be0dcd2e1cb758510354c7dec81700ac5ebd026 +size 804 diff --git a/Assets/MPUIKit/Editor/Images/rotate_left_3.png.meta b/Assets/MPUIKit/Editor/Images/rotate_left_3.png.meta new file mode 100644 index 0000000..061fbfb --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_left_3.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_0.png b/Assets/MPUIKit/Editor/Images/rotate_right_0.png new file mode 100644 index 0000000..624776b --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a322dfba34129dfc7f6dd554c8aee4c998c0cff44e3064f99e0beeb3f28f0ae7 +size 818 diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_0.png.meta b/Assets/MPUIKit/Editor/Images/rotate_right_0.png.meta new file mode 100644 index 0000000..6befbb3 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_0.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_1.png b/Assets/MPUIKit/Editor/Images/rotate_right_1.png new file mode 100644 index 0000000..3749544 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8605d8cac11e7576b1636b52502002962046d1c74501b928f9cc935128bd0fc5 +size 814 diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_1.png.meta b/Assets/MPUIKit/Editor/Images/rotate_right_1.png.meta new file mode 100644 index 0000000..1a3681a --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_1.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_2.png b/Assets/MPUIKit/Editor/Images/rotate_right_2.png new file mode 100644 index 0000000..dde33ae --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:625eecc52a76fa823c9878277db155d24cacd4ff153841e99e52d6f43ebd11b3 +size 821 diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_2.png.meta b/Assets/MPUIKit/Editor/Images/rotate_right_2.png.meta new file mode 100644 index 0000000..efe8173 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_2.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_3.png b/Assets/MPUIKit/Editor/Images/rotate_right_3.png new file mode 100644 index 0000000..a50ea47 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d80c8af5554adfff8b7b43e1eae8610301bea6cc6ea5ac45c4f90ca365b05def +size 796 diff --git a/Assets/MPUIKit/Editor/Images/rotate_right_3.png.meta b/Assets/MPUIKit/Editor/Images/rotate_right_3.png.meta new file mode 100644 index 0000000..fd38eeb --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/rotate_right_3.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/Images/title.png b/Assets/MPUIKit/Editor/Images/title.png new file mode 100644 index 0000000..1fceae0 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/title.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28d119b2c716524a914a377820f50f45b040c2da9aa8705b447821dfacdaa0e2 +size 32072 diff --git a/Assets/MPUIKit/Editor/Images/title.png.meta b/Assets/MPUIKit/Editor/Images/title.png.meta new file mode 100644 index 0000000..af602b1 --- /dev/null +++ b/Assets/MPUIKit/Editor/Images/title.png.meta @@ -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: diff --git a/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef b/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef new file mode 100644 index 0000000..6321ca6 --- /dev/null +++ b/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef @@ -0,0 +1,17 @@ +{ + "name": "MPUIKit.Editor", + "references": [ + "GUID:5b70f83da6937434491f26e0fd0cd099" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef.meta b/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef.meta new file mode 100644 index 0000000..2dca663 --- /dev/null +++ b/Assets/MPUIKit/Editor/MPUIKit.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 64c50969ba90b4463bb322f2967096a1 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts.meta b/Assets/MPUIKit/Editor/Scripts.meta new file mode 100644 index 0000000..222290d --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da5bb45cfcea53d46a0e1d8eadb2dec3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs b/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs new file mode 100644 index 0000000..430a12a --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs @@ -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); + } + + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs.meta b/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs.meta new file mode 100644 index 0000000..80a6974 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/EditorGUILayoutExtended.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6578e090f4183b34f8420ebe855dce58 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/EffectDrawers.meta b/Assets/MPUIKit/Editor/Scripts/EffectDrawers.meta new file mode 100644 index 0000000..4ac6466 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/EffectDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2954915c9a2e49da8fba55e1a2a62a89 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs new file mode 100644 index 0000000..34ec6d2 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs.meta new file mode 100644 index 0000000..c273ca2 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/EffectDrawers/GradeintEffectPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 242b08f96b7b1b549b6a19a05267d72d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs b/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs new file mode 100644 index 0000000..0b20207 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs.meta new file mode 100644 index 0000000..cfd59b5 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPEditorContents.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a6f9388f4adce440beef499dd64fba1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs b/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs new file mode 100644 index 0000000..f7e9731 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs @@ -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(); + 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(); + 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() != 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()) + { + EditorApplication.ExecuteMenuItem("GameObject/UI/Canvas"); + } + + Canvas c = handle.FindComponentOfType(); + 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(); + EditorUtility.SetDirty(obj); + } + else { + Image img = (Image) command.context; + GameObject obj = img.gameObject; + Object.DestroyImmediate(img); + obj.AddComponent(); + 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(); + EditorUtility.SetDirty(obj); + } + else { + Image img = (Image) command.context; + GameObject obj = img.gameObject; + Object.DestroyImmediate(img); + obj.AddComponent(); + 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("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(); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs.meta new file mode 100644 index 0000000..2f8350f --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPEditorUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e892ccdb916743d79dc89600b5d4ce61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs b/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs new file mode 100644 index 0000000..3a5e707 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs @@ -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 + } + } + +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs.meta new file mode 100644 index 0000000..fff9633 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPImageBasicEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f33e7dc5ed3a5604f86b7d66c008e468 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs b/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs new file mode 100644 index 0000000..5d25a20 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs @@ -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(); + 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(); + } + } +} diff --git a/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs.meta new file mode 100644 index 0000000..cac2dd1 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPImageEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c7639e6809ad59f4bb65a8948d16b305 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs b/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs new file mode 100644 index 0000000..fe2e7c4 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs @@ -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(); + } + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs.meta new file mode 100644 index 0000000..24023a1 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPUIKitShaderGUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3baee42b106f43cd8eb1edfa21a94ae5 +timeCreated: 1590741710 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs b/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs new file mode 100644 index 0000000..60919ed --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs @@ -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(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(); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs.meta b/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs.meta new file mode 100644 index 0000000..8f575a9 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/MPUIKitUtilityWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9cd4e467557d59f48822fd363721ec89 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers.meta new file mode 100644 index 0000000..6f1128a --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6137a2ba9e274726810f9f0b17addea6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs new file mode 100644 index 0000000..b5da373 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs.meta new file mode 100644 index 0000000..47fb58c --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/CirclePropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b2a76e1f0ab8461190ccc8f5beaa70e9 +timeCreated: 1586464240 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs new file mode 100644 index 0000000..3ad4f10 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs.meta new file mode 100644 index 0000000..0916ffa --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/HexagonPropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e3e33a21b8af4566a49e820424dc26e2 +timeCreated: 1586503332 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs new file mode 100644 index 0000000..febde7f --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs.meta new file mode 100644 index 0000000..bc23b7c --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/NStarPolygonPropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0e141ee519724007b787256b6fdb8782 +timeCreated: 1586505239 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs new file mode 100644 index 0000000..e0ac0ad --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs.meta new file mode 100644 index 0000000..204892e --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/PentagonPropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b3117b92bdcb4b69a32f19a16ef9e482 +timeCreated: 1586501835 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs new file mode 100644 index 0000000..2e3203c --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs.meta new file mode 100644 index 0000000..b9d9388 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/RectanglePropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d7068ffa19a9492ea7028dbaa23890b3 +timeCreated: 1586499570 \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs new file mode 100644 index 0000000..b5da32b --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs.meta b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs.meta new file mode 100644 index 0000000..ce49601 --- /dev/null +++ b/Assets/MPUIKit/Editor/Scripts/ShapeDrawers/TrianglePropertyDrawer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ef3050eb698744e890c498947ee39173 +timeCreated: 1586497240 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime.meta b/Assets/MPUIKit/Runtime.meta new file mode 100644 index 0000000..dbe454e --- /dev/null +++ b/Assets/MPUIKit/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 71a347ea230e702488b787c090488261 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/MPUIKit.asmdef b/Assets/MPUIKit/Runtime/MPUIKit.asmdef new file mode 100644 index 0000000..606e98d --- /dev/null +++ b/Assets/MPUIKit/Runtime/MPUIKit.asmdef @@ -0,0 +1,3 @@ +{ + "name": "MPUIKit" +} diff --git a/Assets/MPUIKit/Runtime/MPUIKit.asmdef.meta b/Assets/MPUIKit/Runtime/MPUIKit.asmdef.meta new file mode 100644 index 0000000..e699c4b --- /dev/null +++ b/Assets/MPUIKit/Runtime/MPUIKit.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5b70f83da6937434491f26e0fd0cd099 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Resources.meta b/Assets/MPUIKit/Runtime/Resources.meta new file mode 100644 index 0000000..c2b0952 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7143df56a13a7343a4b063f89644fef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders.meta b/Assets/MPUIKit/Runtime/Resources/Shaders.meta new file mode 100644 index 0000000..1bbd161 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad8edb96550859f46802907d97aaaff8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc b/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc new file mode 100644 index 0000000..a25f82f --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc @@ -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 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc.meta b/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc.meta new file mode 100644 index 0000000..0f17735 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/2D_SDF.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ffbce863d4e97d04db0d9865e9f72902 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader new file mode 100644 index 0000000..f161f2c --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader @@ -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" +} diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader.meta b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader.meta new file mode 100644 index 0000000..90e2fae --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImage.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0162a17359546d3479ae73858a9226ab +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader new file mode 100644 index 0000000..93d8b30 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader @@ -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" +} diff --git a/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader.meta b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader.meta new file mode 100644 index 0000000..25a0eb4 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/Shaders/MPImageBasic.shader.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5309a3f903204db8982ae4b1954c6db2 +timeCreated: 1606546667 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png b/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png new file mode 100644 index 0000000..fad18b7 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db10406556d3bdcd15084fa9e0601c9378bf810dad2e8d5e33c4208f77898d9a +size 195 diff --git a/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png.meta b/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png.meta new file mode 100644 index 0000000..12341bd --- /dev/null +++ b/Assets/MPUIKit/Runtime/Resources/mpui_default_empty_sprite.png.meta @@ -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: diff --git a/Assets/MPUIKit/Runtime/Scripts.meta b/Assets/MPUIKit/Runtime/Scripts.meta new file mode 100644 index 0000000..ff8af0d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d777f9201a672da4289932e37ec6ac34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Effects.meta b/Assets/MPUIKit/Runtime/Scripts/Effects.meta new file mode 100644 index 0000000..15fc0cf --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Effects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7fa9108346022b448941984d96434457 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs b/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs new file mode 100644 index 0000000..64ff7f0 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs @@ -0,0 +1,264 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Gradient overlay of the image. + /// + [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; + + /// + /// Enable/Disable Gradient overlay + /// + public bool Enabled { + get => m_Enabled; + set { + m_Enabled = value; + if (ShouldModifySharedMat) { + SharedMat.SetInt(SpEnableGradient, m_Enabled?1:0); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Type of the Gradient. There are three types: Linear, Radial, Corner + /// + public GradientType GradientType { + get => m_GradientType; + set { + m_GradientType = value; + if (ShouldModifySharedMat) { + SharedMat.SetInt(SpGradientType, (int)m_GradientType); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + + } + } + + /// + /// Rotation of the gradient. Only applies for Linear Gradient. + /// + public float Rotation { + get => m_Rotation; + set { + m_Rotation = value; + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpGradientRotation, m_Rotation); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + + } + } + + /// + /// Gradient that will be overlaid onto the image. + /// + public Gradient Gradient { + get => m_Gradient; + set { + m_Gradient = value; + if (ShouldModifySharedMat) { + List Colors = new List(8); + List Alphas = new List(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); + + } + } + + /// + /// 4 Colors for Corner Gradient overlay. + /// [0] => top-left, [1] => top-right + /// [2] => bottom-left, [3] => bottom-right + /// + 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]); + } + } + } + } +} diff --git a/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs.meta new file mode 100644 index 0000000..9c9a11b --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Effects/GradientEffect.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc339dba02e2a204bb8fbf6bf949b948 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Enums.cs b/Assets/MPUIKit/Runtime/Scripts/Enums.cs new file mode 100644 index 0000000..6a98821 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Enums.cs @@ -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 + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Enums.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Enums.cs.meta new file mode 100644 index 0000000..23d9cb5 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Enums.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 546177621794a974cbee7e2628280bfa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs b/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs new file mode 100644 index 0000000..339c25d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs @@ -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); + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs.meta b/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs.meta new file mode 100644 index 0000000..ae29386 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/IMPUIComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b4b38c0ec8d16245b60f2f0f2320058 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/MPImage.cs b/Assets/MPUIKit/Runtime/Scripts/MPImage.cs new file mode 100644 index 0000000..6a9098d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/MPImage.cs @@ -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 + + /// + /// Type of the shape to be drawn. ie: Rectangle, Circle + /// + public DrawShape DrawShape { + get => m_DrawShape; + set { + m_DrawShape = value; + if (material == m_Material) { + m_Material.SetInt(SpDrawShape, (int) m_DrawShape); + } + + base.SetMaterialDirty(); + } + } + + /// + /// Width of the stroke for the drawn shape. 0 is no stroke. + /// + 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(); + } + } + + /// + /// Width of the outline for the drawn shape. 0 is no outline. + /// + 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(); + } + } + + /// + /// Color of the Outline. Has no effect is teh value of the OutlineWidth is 0 + /// + public Color OutlineColor { + get => m_OutlineColor; + set { + m_OutlineColor = value; + if (m_Material == material) { + m_Material.SetColor(SpOutlineColor, m_OutlineColor); + } + + base.SetMaterialDirty(); + } + } + + /// + /// Edge falloff distance of the shape + /// + 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(); + } + } + + /// + /// 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. + /// + 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; + } + + /// + /// Rotation of the shape. + /// + 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(); + } + } + + /// + /// Flips the shape horizontally. + /// + 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(); + } + } + + /// + /// Flips the shape vertically + /// + 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(); + } + } + + /// + /// 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 + /// + 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(); + } + } + + /// + /// Shared material to use to render the shape. the material must use the "MPUI/Procedural Sprite" shader + /// + 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 + /// + /// Type of the image. Only two types are supported. Simple and Filled. + /// Default and fallback value is Simple. + /// + 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 + } +} diff --git a/Assets/MPUIKit/Runtime/Scripts/MPImage.cs.meta b/Assets/MPUIKit/Runtime/Scripts/MPImage.cs.meta new file mode 100644 index 0000000..e1804ee --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/MPImage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 141109fb25f0083469e71ce8cb3e75c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs b/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs new file mode 100644 index 0000000..9f5c3c4 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs @@ -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(); + } + } + + /// + /// Type of the image. Only two types are supported. Simple and Filled. + /// Default and fallback value is Simple. + /// + 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 + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs.meta b/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs.meta new file mode 100644 index 0000000..446ba61 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/MPImageBasic.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fceb93b9d8bf04943b1dd4939eaf6284 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes.meta new file mode 100644 index 0000000..03d415d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39276b906c650414984bc6e7d49b4e97 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs new file mode 100644 index 0000000..7c5929a --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs @@ -0,0 +1,79 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Just a basic circle. + /// + [Serializable] + public struct Circle : IMPUIComponent { + [SerializeField] private float m_Radius; + [SerializeField] private bool m_FitRadius; + + private static readonly int SpRadius = Shader.PropertyToID("_CircleRadius"); + private static readonly int SpFitRadius = Shader.PropertyToID("_CircleFitRadius"); + + /// + /// Radius of the circle. This has no effect if FitToRect is set to true. + /// + public float Radius { + get => m_Radius; + set { + m_Radius = Mathf.Max(value, 0f); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpRadius, m_Radius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + /// + /// Fit the circe to the rect-transform + /// + public bool FitToRect { + get => m_FitRadius; + set { + m_FitRadius = value; + if (ShouldModifySharedMat) { + SharedMat.SetInt(SpFitRadius, m_FitRadius?1:0); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + private float CircleFitRadius => Mathf.Min(RectTransform.rect.width, RectTransform.rect.height) / 2; + + 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; + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + Radius = m_Radius; + FitToRect = m_FitRadius; + } + + public void InitValuesFromMaterial(ref Material material) { + m_Radius = material.GetFloat(SpRadius); + m_FitRadius = material.GetInt(SpFitRadius) == 1; + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) { + material.SetFloat(SpRadius, m_Radius); + material.SetInt(SpFitRadius, m_FitRadius?1:0); + } + + internal void UpdateCircleRadius(RectTransform rectT) { + this.RectTransform = rectT; + if (m_FitRadius) { + m_Radius = CircleFitRadius; + } + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs.meta new file mode 100644 index 0000000..099975e --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Circle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ace3ea082d13834c8cd482daf38afe2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs new file mode 100644 index 0000000..149d25d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs @@ -0,0 +1,105 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Hexagon shape with two opposite parallel equal sides. It is basically a rectangle where two + /// of it's sides are broken into halves and pulled out of the shape that creates two triangle tips + /// left and right of the shape. + /// + [Serializable] + public struct Hexagon: IMPUIComponent { + [SerializeField] private Vector4 m_CornerRadius; + [SerializeField] private bool m_UniformCornerRadius; + [SerializeField] private Vector2 m_TipSize; + [SerializeField] private bool m_UniformTipSize; + [SerializeField] private Vector2 m_TipRadius; + [SerializeField] private bool m_UniformTipRadius; + + /// + /// Sizes of the two tips (the triangular part sticking out of the rectangular part of the shape) + /// x => left tip, y => right tip + /// + public Vector2 TipSize { + get => m_TipSize; + set { + m_TipSize = Vector2.Max(value, Vector2.one); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpHexagonTipSizes, m_TipSize); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Radius of the corner of the tips. + /// x => left tip's corner, y => right tip's corner + /// + public Vector2 TipRadius { + get => m_TipRadius; + set { + m_TipRadius = Vector2.Max(value, Vector2.one); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpHexagonTipRadius, m_TipRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Radius of the four corners of the rectangular part of the shape. + /// Counter-Clockwise from bottom-left + /// x => bottom-left, y => bottom-right + /// z => top-right, w => top-left + /// + public Vector4 CornerRadius { + get => m_CornerRadius; + set { + m_CornerRadius = Vector4.Max(value, Vector4.one); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpHexagonRectCornerRadius, m_CornerRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + private static readonly int SpHexagonTipSizes = Shader.PropertyToID("_HexagonTipSize"); + private static readonly int SpHexagonTipRadius = Shader.PropertyToID("_HexagonTipRadius"); + private static readonly int SpHexagonRectCornerRadius = Shader.PropertyToID("_HexagonCornerRadius"); + + + public Material SharedMat { get; set; } + public bool ShouldModifySharedMat { get; set; } + public RectTransform RectTransform { get; set; } + + + public void Init(Material sharedMat, Material renderMat, RectTransform rectTransform) { + SharedMat = sharedMat; + ShouldModifySharedMat = sharedMat == renderMat; + RectTransform = rectTransform; + + TipRadius = m_TipRadius; + TipSize = m_TipSize; + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + CornerRadius = m_CornerRadius; + TipSize = m_TipSize; + TipRadius = m_TipRadius; + } + + public void InitValuesFromMaterial(ref Material material) { + m_CornerRadius = material.GetVector(SpHexagonRectCornerRadius); + m_TipRadius = material.GetVector(SpHexagonTipRadius); + m_TipSize = material.GetVector(SpHexagonTipSizes); + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) { + material.SetVector(SpHexagonTipSizes, m_TipSize); + material.SetVector(SpHexagonTipRadius, m_TipRadius); + material.SetVector(SpHexagonRectCornerRadius, m_CornerRadius); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs.meta new file mode 100644 index 0000000..e47eee7 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Hexagon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10d0bd6c53038cc46a6a6724f311e8f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs new file mode 100644 index 0000000..4ff3926 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs @@ -0,0 +1,121 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// N-star polygon shape is equal sided uniform polygon shape with the ability to morph + /// to a star corresponding to the original shape. ie: an equilateral pentagon will morph + /// to a five sided star. + /// + [Serializable] + public struct NStarPolygon: IMPUIComponent { + [SerializeField] private float m_SideCount; + [SerializeField] private float m_Inset; + [SerializeField] private float m_CornerRadius; + [SerializeField] private Vector2 m_Offset; + + /// + /// How many sides should there be in the shape. These sides are equal is size. + /// 3 sides create an equilateral triangle, 6 sides create a hexagon and so on + /// Value of SideCount should remain between 3 and 10. + /// + public float SideCount { + get => m_SideCount; + set { + m_SideCount = Mathf.Clamp(value, 3f, 10f); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpNStarPolygonSideCount, m_SideCount); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + Inset = m_Inset; + } + } + + /// + /// Inset is the value that determine how much should the sides go inside the shape + /// and create a concave star shape. Each sides will break into half and their middle + /// point will go towards the center of the shape + /// Value of inset should remain between 2 and (SideCount - 0.01). 2 is default + /// and means no breaking of the sides. + /// + public float Inset { + get => m_Inset; + set { + m_Inset = Mathf.Clamp(value, 2f, SideCount - 0.01f); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpNStarPolygonInset, m_Inset); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Corner Radius of all the corners of the shape. + /// + public float CornerRadius { + get => m_CornerRadius; + set { + m_CornerRadius = Mathf.Max(value, 0); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpNStarPolygonCornerRadius, m_CornerRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Position offset of the shape from the origin. + /// + public Vector2 Offset { + get => m_Offset; + set { + m_Offset = value; + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpNStarPolygonOffset, m_Offset); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + private static readonly int SpNStarPolygonSideCount = Shader.PropertyToID("_NStarPolygonSideCount"); + private static readonly int SpNStarPolygonInset = Shader.PropertyToID("_NStarPolygonInset"); + private static readonly int SpNStarPolygonCornerRadius = Shader.PropertyToID("_NStarPolygonCornerRadius"); + private static readonly int SpNStarPolygonOffset = Shader.PropertyToID("_NStarPolygonOffset"); + + public Material SharedMat { get; set; } + public bool ShouldModifySharedMat { get; set; } + public RectTransform RectTransform { get; set; } + + + public void Init(Material sharedMat, Material renderMat, RectTransform rectTransform) { + SharedMat = sharedMat; + ShouldModifySharedMat = sharedMat == renderMat; + RectTransform = rectTransform; + + OnValidate(); + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + SideCount = m_SideCount; + Inset = m_Inset; + CornerRadius = m_CornerRadius; + Offset = m_Offset; + } + + public void InitValuesFromMaterial(ref Material material) { + m_SideCount = material.GetFloat(SpNStarPolygonSideCount); + m_Inset = material.GetFloat(SpNStarPolygonInset); + m_CornerRadius = material.GetFloat(SpNStarPolygonCornerRadius); + m_Offset = material.GetVector(SpNStarPolygonOffset); + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) { + material.SetFloat(SpNStarPolygonSideCount, m_SideCount); + material.SetFloat(SpNStarPolygonInset, m_Inset); + material.SetFloat(SpNStarPolygonCornerRadius, m_CornerRadius); + material.SetVector(SpNStarPolygonOffset, m_Offset); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs.meta new file mode 100644 index 0000000..c1b9d1d --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/NStarPolygon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 469ccf5eb6d1c89458d9b97be69ac46f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs new file mode 100644 index 0000000..64d74ad --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs @@ -0,0 +1,99 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Pentagon shape with two parallel opposite equal sides. It is basically a rectangle but one of the sides + /// of the rectangle is broken into halves and pulled out. + /// + [Serializable] + public struct Pentagon : IMPUIComponent{ + [SerializeField] private Vector4 m_CornerRadius; + [SerializeField] private bool m_UniformCornerRadius; + [SerializeField] private float m_TipRadius; + [SerializeField] private float m_TipSize; + + /// + /// Radius of the four corners of the rectangular part. Clockwise from top-left + /// x => top-left, y => top-right + /// z => bottom-right, w => bottom-left + /// + public Vector4 CornerRadius { + get => m_CornerRadius; + set { + m_CornerRadius = Vector4.Max(value, Vector4.zero); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpPentagonRectCornerRadius, m_CornerRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Corner radius of the tip. The fifth corner of the pentagon shape. + /// + public float TipRadius { + get => m_TipRadius; + set { + m_TipRadius = Mathf.Max(value, 0.001f); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpPentagonTriangleCornerRadius, m_TipRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + /// + /// Size of the tip (the triangular part sticking out of the rectangular part of the shape) + /// + public float TipSize { + get => m_TipSize; + set { + m_TipSize = Mathf.Max(value, 1); + if (ShouldModifySharedMat) { + SharedMat.SetFloat(SpPentagonTriangleSize, m_TipSize); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + + private static readonly int SpPentagonRectCornerRadius = Shader.PropertyToID("_PentagonCornerRadius"); + private static readonly int SpPentagonTriangleCornerRadius = Shader.PropertyToID("_PentagonTipRadius"); + private static readonly int SpPentagonTriangleSize = Shader.PropertyToID("_PentagonTipSize"); + + + public Material SharedMat { get; set; } + public bool ShouldModifySharedMat { get; set; } + public RectTransform RectTransform { get; set; } + + public void Init(Material sharedMat, Material renderMat, RectTransform rectTransform) { + SharedMat = sharedMat; + ShouldModifySharedMat = sharedMat == renderMat; + RectTransform = rectTransform; + + TipSize = m_TipSize; + TipRadius = m_TipRadius; + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + CornerRadius = m_CornerRadius; + TipSize = m_TipSize; + TipRadius = m_TipRadius; + } + + public void InitValuesFromMaterial(ref Material material) { + m_CornerRadius = material.GetVector(SpPentagonRectCornerRadius); + m_TipSize = material.GetFloat(SpPentagonTriangleSize); + m_TipRadius = material.GetFloat(SpPentagonTriangleCornerRadius); + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) { + material.SetVector(SpPentagonRectCornerRadius, m_CornerRadius); + material.SetFloat(SpPentagonTriangleCornerRadius, m_TipRadius); + material.SetFloat(SpPentagonTriangleSize, m_TipSize); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs.meta new file mode 100644 index 0000000..7018fc4 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Pentagon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 222e2e3f0ac387549937b151aad31ccc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs new file mode 100644 index 0000000..013db10 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs @@ -0,0 +1,77 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Basic Rectangle shape with the same width and height of the rect-transform + /// + [Serializable] + public struct Rectangle : IMPUIComponent{ + [SerializeField] private Vector4 m_CornerRadius; +#if UNITY_EDITOR + [SerializeField] private bool m_UniformCornerRadius; +#endif + /// + /// Radius of the four corners. Counter-Clockwise from bottom-left + /// x => bottom-left, y => bottom-right + /// z => top-right, w => top-left + /// + public Vector4 CornerRadius { + get => m_CornerRadius; + set { + m_CornerRadius = Vector4.Max(value, Vector4.zero); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpRectangleCornerRadius, m_CornerRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + public Material SharedMat { get; set; } + public bool ShouldModifySharedMat { get; set; } + public RectTransform RectTransform { get; set; } + + private static readonly int SpRectangleCornerRadius = Shader.PropertyToID("_RectangleCornerRadius"); + + public void Init(Material sharedMat, Material renderMat, RectTransform rectTransform) { + SharedMat = sharedMat; + ShouldModifySharedMat = sharedMat == renderMat; + RectTransform = rectTransform; + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + CornerRadius = m_CornerRadius; + } + + public void InitValuesFromMaterial(ref Material material) { + m_CornerRadius = material.GetVector(SpRectangleCornerRadius); + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) + { + Vector4 cornerRadius = FixRadius(m_CornerRadius); + material.SetVector(SpRectangleCornerRadius, cornerRadius); + } + + 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; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs.meta new file mode 100644 index 0000000..67e8f9f --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Rectangle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2de3730bcb141af4a913830c6d6892b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs b/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs new file mode 100644 index 0000000..063ef31 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs @@ -0,0 +1,59 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + /// + /// Isosceles triangle where two sides of the triangle are equal. Width and height of the shape is + /// the same as the rect-transform + /// + [Serializable] + public struct Triangle : IMPUIComponent { + + [SerializeField] private Vector3 m_CornerRadius; +#if UNITY_EDITOR + [SerializeField] private bool m_UniformCornerRadius; +#endif + + /// + /// Radius of the three corners. Counter-Clockwise from bottom-left + /// x => bottom-left, y => bottom-right + /// z => top + /// + public Vector3 CornerRadius { + get => m_CornerRadius; + set { + m_CornerRadius = Vector3.Max(value, Vector3.zero); + if (ShouldModifySharedMat) { + SharedMat.SetVector(SpTriangleCornerRadius, m_CornerRadius); + } + OnComponentSettingsChanged?.Invoke(this, EventArgs.Empty); + } + } + + private static readonly int SpTriangleCornerRadius = Shader.PropertyToID("_TriangleCornerRadius"); + + 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; + } + + public event EventHandler OnComponentSettingsChanged; + + public void OnValidate() { + CornerRadius = m_CornerRadius; + } + + public void InitValuesFromMaterial(ref Material material) { + m_CornerRadius = material.GetVector(SpTriangleCornerRadius); + } + + public void ModifyMaterial(ref Material material, params object[] otherProperties) { + material.SetVector(SpTriangleCornerRadius, m_CornerRadius); + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs.meta new file mode 100644 index 0000000..7c34a46 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Shapes/Triangle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95ba47d1d57ac7b48a49e6bf89a54b3f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility.meta b/Assets/MPUIKit/Runtime/Scripts/Utility.meta new file mode 100644 index 0000000..7eadbc8 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bc3ef6245bd1448fb3a15564eec64171 +timeCreated: 1587197957 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs new file mode 100644 index 0000000..6303794 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs @@ -0,0 +1,398 @@ +using System.Text; + +namespace UnityEngine.UI.MPUIKIT { + public static class MPImageHelper { + private static readonly Vector3[] SXy = new Vector3[4]; + private static readonly Vector3[] SUv = new Vector3[4]; + + public static void GenerateSimpleSprite(VertexHelper vh, bool preserveAspect, Canvas canvas, + RectTransform rectTransform, Sprite activeSprite, Color32 color, float falloffDistance) { + vh.Clear(); + + Vector4 v = GetDrawingDimensions(preserveAspect, activeSprite, canvas, rectTransform); + Vector4 uv = (activeSprite != null) + ? Sprites.DataUtility.GetOuterUV(activeSprite) + : new Vector4(0, 0, 1, 1); + + Color32 color32 = color; + vh.Clear(); + + Vector3[] pos = { + new Vector3(v.x, v.y), + new Vector3(v.x, v.w), + new Vector3(v.z, v.w), + new Vector3(v.z, v.y), + }; + + Vector2[] uvs = { + new Vector2(uv.x, uv.y), + new Vector2(uv.x, uv.w), + new Vector2(uv.z, uv.w), + new Vector2(uv.z, uv.y), + }; + + Vector2[] uv1s = + { + new Vector2(0, 0), + new Vector2(0, 1), + new Vector2(1, 1), + new Vector2(1, 0), + }; + + Vector2 size = new Vector2(v.z - v.x, v.w - v.y); + + vh.AddVert(pos[0], color32, uvs[0], uv1s[0], size, Vector2.zero, Vector3.zero, Vector4.zero); + vh.AddVert(pos[1], color32, uvs[1], uv1s[1], size, Vector2.zero, Vector3.zero, Vector4.zero); + vh.AddVert(pos[2], color32, uvs[2], uv1s[2], size, Vector2.zero, Vector3.zero, Vector4.zero); + vh.AddVert(pos[3], color32, uvs[3], uv1s[3], size, Vector2.zero, Vector3.zero, Vector4.zero); + + vh.AddTriangle(0, 1, 2); + vh.AddTriangle(2, 3, 0); + } + + public static void GenerateFilledSprite(VertexHelper toFill, bool preserveAspect, Canvas canvas, + RectTransform rectTransform, Sprite activeSprite, Color32 color, Image.FillMethod fillMethod, + float fillAmount, int fillOrigin, bool fillClockwise, float falloffDistance) { + toFill.Clear(); + + if (fillAmount < 0.001f) + return; + + Vector4 v = GetDrawingDimensions(preserveAspect, activeSprite, canvas, rectTransform); + Vector2 size = new Vector2(v.z - v.x, v.w - v.y); + + Vector4 outer = activeSprite != null + ? Sprites.DataUtility.GetOuterUV(activeSprite) + : new Vector4(0, 0, 1, 1); + UIVertex uiv = UIVertex.simpleVert; + uiv.color = color; + + float tx0 = outer.x; + float ty0 = outer.y; + float tx1 = outer.z; + float ty1 = outer.w; + + // Horizontal and vertical filled sprites are simple -- just end the Image prematurely + if (fillMethod == Image.FillMethod.Horizontal || fillMethod == Image.FillMethod.Vertical) { + if (fillMethod == Image.FillMethod.Horizontal) { + float fill = (tx1 - tx0) * fillAmount; + + if (fillOrigin == 1) { + v.x = v.z - (v.z - v.x) * fillAmount; + tx0 = tx1 - fill; + } + else { + v.z = v.x + (v.z - v.x) * fillAmount; + tx1 = tx0 + fill; + } + } + else if (fillMethod == Image.FillMethod.Vertical) { + float fill = (ty1 - ty0) * fillAmount; + + if (fillOrigin == 1) { + v.y = v.w - (v.w - v.y) * fillAmount; + ty0 = ty1 - fill; + } + else { + v.w = v.y + (v.w - v.y) * fillAmount; + ty1 = ty0 + fill; + } + } + } + + SXy[0] = new Vector2(v.x, v.y); + SXy[1] = new Vector2(v.x, v.w); + SXy[2] = new Vector2(v.z, v.w); + SXy[3] = new Vector2(v.z, v.y); + + SUv[0] = new Vector2(tx0, ty0); + SUv[1] = new Vector2(tx0, ty1); + SUv[2] = new Vector2(tx1, ty1); + SUv[3] = new Vector2(tx1, ty0); + + + { + if (fillAmount < 1f && fillMethod != Image.FillMethod.Horizontal && + fillMethod != Image.FillMethod.Vertical) { + if (fillMethod == Image.FillMethod.Radial90) { + if (RadialCut(SXy, SUv, fillAmount, fillClockwise, fillOrigin)) + AddQuad(toFill, SXy, color, SUv, size); + } + else if (fillMethod == Image.FillMethod.Radial180) { + for (int side = 0; side < 2; ++side) { + float fx0, fx1, fy0, fy1; + int even = fillOrigin > 1 ? 1 : 0; + + if (fillOrigin == 0 || fillOrigin == 2) { + fy0 = 0f; + fy1 = 1f; + if (side == even) { + fx0 = 0f; + fx1 = 0.5f; + } + else { + fx0 = 0.5f; + fx1 = 1f; + } + } + else { + fx0 = 0f; + fx1 = 1f; + if (side == even) { + fy0 = 0.5f; + fy1 = 1f; + } + else { + fy0 = 0f; + fy1 = 0.5f; + } + } + + SXy[0].x = Mathf.Lerp(v.x, v.z, fx0); + SXy[1].x = SXy[0].x; + SXy[2].x = Mathf.Lerp(v.x, v.z, fx1); + SXy[3].x = SXy[2].x; + + SXy[0].y = Mathf.Lerp(v.y, v.w, fy0); + SXy[1].y = Mathf.Lerp(v.y, v.w, fy1); + SXy[2].y = SXy[1].y; + SXy[3].y = SXy[0].y; + + SUv[0].x = Mathf.Lerp(tx0, tx1, fx0); + SUv[1].x = SUv[0].x; + SUv[2].x = Mathf.Lerp(tx0, tx1, fx1); + SUv[3].x = SUv[2].x; + + SUv[0].y = Mathf.Lerp(ty0, ty1, fy0); + SUv[1].y = Mathf.Lerp(ty0, ty1, fy1); + SUv[2].y = SUv[1].y; + SUv[3].y = SUv[0].y; + + float val = fillClockwise ? fillAmount * 2f - side : fillAmount * 2f - (1 - side); + + if (RadialCut(SXy, SUv, Mathf.Clamp01(val), fillClockwise, + ((side + fillOrigin + 3) % 4))) { + AddQuad(toFill, SXy, color, SUv, size); + } + } + } + else if (fillMethod == Image.FillMethod.Radial360) { + for (int corner = 0; corner < 4; ++corner) { + float fx0, fx1, fy0, fy1; + + if (corner < 2) { + fx0 = 0f; + fx1 = 0.5f; + } + else { + fx0 = 0.5f; + fx1 = 1f; + } + + if (corner == 0 || corner == 3) { + fy0 = 0f; + fy1 = 0.5f; + } + else { + fy0 = 0.5f; + fy1 = 1f; + } + + SXy[0].x = Mathf.Lerp(v.x, v.z, fx0); + SXy[1].x = SXy[0].x; + SXy[2].x = Mathf.Lerp(v.x, v.z, fx1); + SXy[3].x = SXy[2].x; + + SXy[0].y = Mathf.Lerp(v.y, v.w, fy0); + SXy[1].y = Mathf.Lerp(v.y, v.w, fy1); + SXy[2].y = SXy[1].y; + SXy[3].y = SXy[0].y; + + SUv[0].x = Mathf.Lerp(tx0, tx1, fx0); + SUv[1].x = SUv[0].x; + SUv[2].x = Mathf.Lerp(tx0, tx1, fx1); + SUv[3].x = SUv[2].x; + + SUv[0].y = Mathf.Lerp(ty0, ty1, fy0); + SUv[1].y = Mathf.Lerp(ty0, ty1, fy1); + SUv[2].y = SUv[1].y; + SUv[3].y = SUv[0].y; + + float val = fillClockwise + ? fillAmount * 4f - ((corner + fillOrigin) % 4) + : fillAmount * 4f - (3 - ((corner + fillOrigin) % 4)); + + if (RadialCut(SXy, SUv, Mathf.Clamp01(val), fillClockwise, ((corner + 2) % 4))) + AddQuad(toFill, SXy, color, SUv, size); + } + } + } + else { + AddQuad(toFill, SXy, color, SUv, size); + } + } + } + + private static void AddQuad(VertexHelper vertexHelper, Vector3[] quadPositions, Color32 color, + Vector3[] quadUVs, Vector2 size) { + int startIndex = vertexHelper.currentVertCount; + + StringBuilder sr = new StringBuilder(); + for (int i = 0; i < 4; ++i) { + vertexHelper.AddVert(quadPositions[i], color, quadUVs[i], quadUVs[i], size, Vector2.zero, + Vector3.zero, Vector4.zero); + sr.AppendLine($"Pos: {quadPositions[i]}, uv: {quadUVs[i]}"); + } + + + vertexHelper.AddTriangle(startIndex, startIndex + 1, startIndex + 2); + vertexHelper.AddTriangle(startIndex + 2, startIndex + 3, startIndex); + } + + private static Vector4 GetDrawingDimensions(bool shouldPreserveAspect, Sprite activeSprite, Canvas canvas, + RectTransform rectTransform) { + var padding = activeSprite == null ? Vector4.zero : Sprites.DataUtility.GetPadding(activeSprite); + var size = activeSprite == null + ? new Vector2(rectTransform.rect.width, rectTransform.rect.height) + : new Vector2(activeSprite.rect.width, activeSprite.rect.height); + + if (size.x <= 0) size.x = 1; + if (size.y <= 0) size.y = 1; + Rect r = GetPixelAdjustedRect(canvas, rectTransform); + //Debug.Log(string.Format("r:{2}, size:{0}, padding:{1}", size, padding, r)); + + int spriteW = Mathf.RoundToInt(size.x); + int spriteH = Mathf.RoundToInt(size.y); + + Vector4 v = new Vector4( + padding.x / spriteW, + padding.y / spriteH, + (spriteW - padding.z) / spriteW, + (spriteH - padding.w) / spriteH); + + if (shouldPreserveAspect && size.sqrMagnitude > 0.0f) { + PreserveSpriteAspectRatio(ref r, rectTransform, size); + } + + v = new Vector4( + r.x + r.width * v.x, + r.y + r.height * v.y, + r.x + r.width * v.z, + r.y + r.height * v.w + ); + + return v; + } + + public static void PreserveSpriteAspectRatio(ref Rect rect, RectTransform rectTransform, Vector2 spriteSize) { + float spriteRatio = spriteSize.x / spriteSize.y; + float rectRatio = rect.width / rect.height; + + if (spriteRatio > rectRatio) { + float oldHeight = rect.height; + rect.height = rect.width * (1.0f / spriteRatio); + rect.y += (oldHeight - rect.height) * rectTransform.pivot.y; + } + else { + float oldWidth = rect.width; + rect.width = rect.height * spriteRatio; + rect.x += (oldWidth - rect.width) * rectTransform.pivot.x; + } + } + + private static Rect GetPixelAdjustedRect(Canvas canvas, RectTransform rectTransform) { + if (!canvas || canvas.renderMode == RenderMode.WorldSpace || canvas.scaleFactor == 0.0f || + !canvas.pixelPerfect) { + return rectTransform.rect; + } + + return RectTransformUtility.PixelAdjustRect(rectTransform, canvas); + } + + private static bool RadialCut(Vector3[] xy, Vector3[] uv, float fill, bool invert, int corner) { + // Nothing to fill + if (fill < 0.001f) return false; + + // Even corners invert the fill direction + if ((corner & 1) == 1) invert = !invert; + + // Nothing to adjust + if (!invert && fill > 0.999f) return true; + + // Convert 0-1 value into 0 to 90 degrees angle in radians + float angle = Mathf.Clamp01(fill); + if (invert) angle = 1f - angle; + angle *= 90f * Mathf.Deg2Rad; + + // Calculate the effective X and Y factors + float cos = Mathf.Cos(angle); + float sin = Mathf.Sin(angle); + + RadialCut(xy, cos, sin, invert, corner); + RadialCut(uv, cos, sin, invert, corner); + return true; + } + + private static void RadialCut(Vector3[] xy, float cos, float sin, bool invert, int corner) { + int i0 = corner; + int i1 = ((corner + 1) % 4); + int i2 = ((corner + 2) % 4); + int i3 = ((corner + 3) % 4); + + if ((corner & 1) == 1) { + if (sin > cos) { + cos /= sin; + sin = 1f; + + if (invert) { + xy[i1].x = Mathf.Lerp(xy[i0].x, xy[i2].x, cos); + xy[i2].x = xy[i1].x; + } + } + else if (cos > sin) { + sin /= cos; + cos = 1f; + + if (!invert) { + xy[i2].y = Mathf.Lerp(xy[i0].y, xy[i2].y, sin); + xy[i3].y = xy[i2].y; + } + } + else { + cos = 1f; + sin = 1f; + } + + if (!invert) xy[i3].x = Mathf.Lerp(xy[i0].x, xy[i2].x, cos); + else xy[i1].y = Mathf.Lerp(xy[i0].y, xy[i2].y, sin); + } + else { + if (cos > sin) { + sin /= cos; + cos = 1f; + + if (!invert) { + xy[i1].y = Mathf.Lerp(xy[i0].y, xy[i2].y, sin); + xy[i2].y = xy[i1].y; + } + } + else if (sin > cos) { + cos /= sin; + sin = 1f; + + if (invert) { + xy[i2].x = Mathf.Lerp(xy[i0].x, xy[i2].x, cos); + xy[i3].x = xy[i2].x; + } + } + else { + cos = 1f; + sin = 1f; + } + + if (invert) xy[i3].y = Mathf.Lerp(xy[i0].y, xy[i2].y, sin); + else xy[i1].x = Mathf.Lerp(xy[i0].x, xy[i2].x, cos); + } + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs.meta new file mode 100644 index 0000000..9fb1aa4 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9ce9faf1c41643d88c5ca734c7187921 +timeCreated: 1587197968 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs new file mode 100644 index 0000000..54d79d5 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs @@ -0,0 +1,41 @@ +using System; +using UnityEngine; + +namespace MPUIKIT { + internal class MPImageUtility { + internal static void FixAdditionalShaderChannelsInCanvas(Canvas canvas) { + Canvas c = canvas; + if (canvas == null) return; + AdditionalCanvasShaderChannels additionalShaderChannels = c.additionalShaderChannels; + additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1; + additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2; + additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord3; + additionalShaderChannels |= AdditionalCanvasShaderChannels.Normal; + additionalShaderChannels |= AdditionalCanvasShaderChannels.Tangent; + c.additionalShaderChannels = additionalShaderChannels; + } + + internal static Vector2 Encode_0_1_16(Vector4 input) { + float e = 255f / 256f; + float m = 65535f; + float ms = m * m; + float n = m - 1; + Vector4 value = input * e * n; + float x = Mathf.Floor(value.x) / m + Mathf.Floor(value.y) / ms; + float y = Mathf.Floor(value.z) / m + Mathf.Floor(value.w) / ms; + return new Vector2(x, y); + } + + private static Sprite _emptySprite; + + internal static Sprite EmptySprite { + get { + if (_emptySprite == null) { + _emptySprite = Resources.Load("mpui_default_empty_sprite"); + } + + return _emptySprite; + } + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs.meta new file mode 100644 index 0000000..6178e42 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPImageUtility.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a3c7a1cdd7824ef29a4473daa6729d91 +timeCreated: 1605871224 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs b/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs new file mode 100644 index 0000000..a07743b --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace MPUIKIT { + public static class MPMaterials { + private const string MpBasicProceduralShaderName = "MPUI/Basic Procedural Image"; + private static string[] MpShapeKeywords = {"CIRCLE", "TRIANGLE", "RECTANGLE", "NSTAR_POLYGON"}; + private const string MpStrokeKeyword = "STROKE"; + private const string MpOutlineKeyword = "OUTLINED"; + private const string MpOutlinedStrokeKeyword = "OUTLINED_STROKE"; + private static Shader _proceduralShader; + internal static Shader MPBasicProceduralShader + { + get { + if (_proceduralShader == null) + _proceduralShader = Shader.Find(MpBasicProceduralShaderName); + return _proceduralShader; + } + } + + private static Material[] _materialDB = new Material[16]; + + internal static ref Material GetMaterial(int shapeIndex, bool stroked, bool outlined) { + int index = shapeIndex * 4; + if (stroked && outlined) index += 3; + else if (outlined) index += 2; + else if (stroked) index += 1; + + ref Material mat = ref _materialDB[index]; + if (mat != null) return ref mat; + + mat = new Material(MPBasicProceduralShader); + string shapeKeyword = MpShapeKeywords[shapeIndex]; + + mat.name = $"Basic Procedural Sprite - {shapeKeyword} {(stroked?MpStrokeKeyword:string.Empty)} {(outlined?MpOutlineKeyword:string.Empty)}"; + mat.EnableKeyword(shapeKeyword); + if(stroked && outlined) mat.EnableKeyword(MpOutlinedStrokeKeyword); + else if(stroked) mat.EnableKeyword(MpStrokeKeyword); + else if(outlined) mat.EnableKeyword(MpOutlineKeyword); + + return ref mat; + } + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs.meta new file mode 100644 index 0000000..3e3bd66 --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPMaterials.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d0b57d41f1b34dc7bb9e3eaecdc328ec +timeCreated: 1607253294 \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs b/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs new file mode 100644 index 0000000..2589ece --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace MPUIKIT { + internal struct MPVertexStream { + internal RectTransform RectTransform; + internal Vector2 Uv1, Uv2, Uv3; + internal Vector3 Normal; + internal Vector4 Tangent; + } +} \ No newline at end of file diff --git a/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs.meta b/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs.meta new file mode 100644 index 0000000..f0f41ff --- /dev/null +++ b/Assets/MPUIKit/Runtime/Scripts/Utility/MPVertexStream.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 166f68c49b8e4a65af6cf7955ca0a34e +timeCreated: 1605871469 \ No newline at end of file diff --git a/Assets/MPUIKit/readme.txt b/Assets/MPUIKit/readme.txt new file mode 100644 index 0000000..1e180d2 --- /dev/null +++ b/Assets/MPUIKit/readme.txt @@ -0,0 +1,2 @@ +Read the Documentation at the website: +https://scrollbie.com/documentations/mpuikit-docs/ \ No newline at end of file diff --git a/Assets/MPUIKit/readme.txt.meta b/Assets/MPUIKit/readme.txt.meta new file mode 100644 index 0000000..46b9d3f --- /dev/null +++ b/Assets/MPUIKit/readme.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f5c469485ab6745caa15ede5fe6d4659 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: