【m】1111
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2206dfe63228d4983a39725c0e940c
|
||||
guid: 52d66146caaa4114ba0f4258e240277d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6884082665aabe549ae4c6d9a142298d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51b888818cbd7184b81f6f9643135c0e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da055a807e845d14bb514ded002fc676
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51132773839ee5b45b08ac9ad19a8b38
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 606cac99b2a6e27418aa01e7eaae56a0
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8495279a91ea6114eba1ca274b91af74
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 303410e7f835f984595c60510bf4b9a2
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90a94cbc0cd73e446807e4ef2d405b1d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a056d76ac19f13841ad836bae9f6c3c2
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 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: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,96 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Loading_ani
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: 21300000, guid: 6884082665aabe549ae4c6d9a142298d, type: 3}
|
||||
- time: 0.083333336
|
||||
value: {fileID: 21300000, guid: 51b888818cbd7184b81f6f9643135c0e, type: 3}
|
||||
- time: 0.16666667
|
||||
value: {fileID: 21300000, guid: da055a807e845d14bb514ded002fc676, type: 3}
|
||||
- time: 0.25
|
||||
value: {fileID: 21300000, guid: 51132773839ee5b45b08ac9ad19a8b38, type: 3}
|
||||
- time: 0.33333334
|
||||
value: {fileID: 21300000, guid: 606cac99b2a6e27418aa01e7eaae56a0, type: 3}
|
||||
- time: 0.41666666
|
||||
value: {fileID: 21300000, guid: 8495279a91ea6114eba1ca274b91af74, type: 3}
|
||||
- time: 0.5
|
||||
value: {fileID: 21300000, guid: 303410e7f835f984595c60510bf4b9a2, type: 3}
|
||||
- time: 0.5833333
|
||||
value: {fileID: 21300000, guid: 90a94cbc0cd73e446807e4ef2d405b1d, type: 3}
|
||||
- time: 0.6666667
|
||||
value: {fileID: 21300000, guid: a056d76ac19f13841ad836bae9f6c3c2, type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
flags: 2
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 2015549526
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
typeID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 1
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: 21300000, guid: 6884082665aabe549ae4c6d9a142298d, type: 3}
|
||||
- {fileID: 21300000, guid: 51b888818cbd7184b81f6f9643135c0e, type: 3}
|
||||
- {fileID: 21300000, guid: da055a807e845d14bb514ded002fc676, type: 3}
|
||||
- {fileID: 21300000, guid: 51132773839ee5b45b08ac9ad19a8b38, type: 3}
|
||||
- {fileID: 21300000, guid: 606cac99b2a6e27418aa01e7eaae56a0, type: 3}
|
||||
- {fileID: 21300000, guid: 8495279a91ea6114eba1ca274b91af74, type: 3}
|
||||
- {fileID: 21300000, guid: 303410e7f835f984595c60510bf4b9a2, type: 3}
|
||||
- {fileID: 21300000, guid: 90a94cbc0cd73e446807e4ef2d405b1d, type: 3}
|
||||
- {fileID: 21300000, guid: a056d76ac19f13841ad836bae9f6c3c2, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.75
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves: []
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8488f417302cba24fa328f9796d39402
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: anim
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 4470429071992645539}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1102 &4177064496324344577
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Loading_ani
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 8488f417302cba24fa328f9796d39402, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &4470429071992645539
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 4177064496324344577}
|
||||
m_Position: {x: 200, y: 0, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: 4177064496324344577}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b32973ea88fca53489cd40f95b13c25f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,240 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if HotUpdate
|
||||
using YooAsset;
|
||||
#endif
|
||||
namespace Stary.Evo.UIFarme
|
||||
{
|
||||
public interface IBasePanel : IController
|
||||
{
|
||||
/// <summary>
|
||||
/// UI信息
|
||||
/// </summary>
|
||||
string UIName { get; set; }
|
||||
/// <summary>
|
||||
/// 绑定这个面板的实例
|
||||
/// </summary>
|
||||
void Initialize(GameObject panelGo);
|
||||
|
||||
/// <summary>
|
||||
/// 初始化面板管理器
|
||||
/// </summary>
|
||||
/// <param name="panelManager"></param>
|
||||
void Initialize(IPanelSystem sysytem);
|
||||
|
||||
/// <summary>
|
||||
/// 虚方法,UI进入时执行的操作,只会执行一次
|
||||
/// </summary>
|
||||
void OnEnter();
|
||||
|
||||
/// <summary>
|
||||
/// 虚方法,UI暂停时执行的操作,只会执行一次
|
||||
/// </summary>
|
||||
void OnPause();
|
||||
|
||||
/// <summary>
|
||||
/// 虚方法,UI继续时执行的操作,只会执行一次
|
||||
/// </summary>
|
||||
void OnResume();
|
||||
|
||||
/// <summary>
|
||||
/// 虚方法,UI退出时执行的操作,只会执行一次
|
||||
/// </summary>
|
||||
void OnExit(float delay = 0f);
|
||||
|
||||
void OnDestroy();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成/获取一个UI对象
|
||||
/// </summary>
|
||||
/// <param name="type">ui信息</param>
|
||||
/// <returns></returns>
|
||||
Task<GameObject> CreatePanel(string panelName, string packageName);
|
||||
|
||||
/// <summary>
|
||||
/// 销毁一个Ui对象
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
void DestoryUI();
|
||||
|
||||
void SetPanelParent(Transform parent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///所有UI面板的父类,包含UI面板的状态信息
|
||||
/// </summary>
|
||||
public abstract class BasePanel : IBasePanel
|
||||
{
|
||||
/// <summary>
|
||||
/// UI信息
|
||||
/// </summary>
|
||||
public string UIName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 面板管理器
|
||||
/// </summary>
|
||||
protected IPanelSystem PanelSystem { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成的父物体
|
||||
/// </summary>
|
||||
protected Transform panelParent { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 缓存该面板所有的Button,Toggle,Slider,InputField,Dropdown,ScroolBar
|
||||
/// </summary>
|
||||
private Dictionary<string, Selectable> selectableDict;
|
||||
|
||||
protected CanvasGroup canvasGroup { get; private set; }
|
||||
|
||||
protected GameObject activePanel { get; private set; }
|
||||
|
||||
protected BasePanel()
|
||||
{
|
||||
selectableDict = new Dictionary<string, Selectable>();
|
||||
}
|
||||
|
||||
public virtual void Initialize(GameObject panelGo)
|
||||
{
|
||||
activePanel = panelGo;
|
||||
Selectable[] selectables = activePanel.GetComponentsInChildren<Selectable>(true);
|
||||
foreach (Selectable item in selectables)
|
||||
{
|
||||
selectableDict[item.name] = item;
|
||||
}
|
||||
|
||||
canvasGroup = UITool.GetOrAddComponent<CanvasGroup>(activePanel);
|
||||
canvasGroup.alpha = 0f;
|
||||
}
|
||||
|
||||
public virtual void Initialize(IPanelSystem sysytem)
|
||||
{
|
||||
PanelSystem = sysytem;
|
||||
}
|
||||
|
||||
|
||||
public virtual void OnEnter()
|
||||
{
|
||||
activePanel.SetActive(true);
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
canvasGroup.DOFade(1f, 1f);
|
||||
}
|
||||
|
||||
public virtual void OnPause()
|
||||
{
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
}
|
||||
|
||||
public virtual void OnResume()
|
||||
{
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
}
|
||||
|
||||
public virtual void OnExit(float delay = 0f)
|
||||
{
|
||||
canvasGroup.DOFade(0f, delay).OnComplete(() =>
|
||||
{
|
||||
activePanel.SetActive(false);
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
});
|
||||
}
|
||||
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
DestoryUI();
|
||||
}
|
||||
|
||||
|
||||
public async Task<GameObject> CreatePanel(string panelName, string packageName)
|
||||
{
|
||||
if (panelParent == null)
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:parent为空,{panelName}自动设置为root节点下,请检查是否正确!!!!!");
|
||||
}
|
||||
|
||||
if (this.activePanel != null)
|
||||
{
|
||||
return activePanel.gameObject;
|
||||
}
|
||||
#if HotUpdate
|
||||
AssetHandle handle = null;
|
||||
if (packageName == null)
|
||||
{
|
||||
handle = YooAssets.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
var package = YooAssets.TryGetPackage(packageName);
|
||||
if (package == null)
|
||||
{
|
||||
handle = YooAssets.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
handle = package.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
}
|
||||
|
||||
await handle.Task;
|
||||
|
||||
activePanel = GameObject.Instantiate(handle.AssetObject as GameObject, panelParent);
|
||||
#else
|
||||
GameObject handle = Resources.Load<GameObject>(panelName);
|
||||
activePanel = GameObject.Instantiate(handle, panelParent);
|
||||
#endif
|
||||
|
||||
|
||||
activePanel.name = this.GetType().Name;
|
||||
|
||||
|
||||
if (!activePanel.GetComponentInChildren<Canvas>() && !activePanel.GetComponentInParent<Canvas>())
|
||||
{
|
||||
Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{panelName}无法正常运行,进程已中断,请检查!!!!!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return activePanel;
|
||||
}
|
||||
|
||||
public void DestoryUI()
|
||||
{
|
||||
if (activePanel != null)
|
||||
{
|
||||
GameObject.Destroy(activePanel);
|
||||
PanelSystem.Get_Dic().Remove(this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPanelParent(Transform parent)
|
||||
{
|
||||
panelParent = parent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取组件:Button,Toggle,Slider,InputField,Dropdown,ScroolBar
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
protected T GetComp<T>(string name) where T : Selectable
|
||||
{
|
||||
selectableDict.TryGetValue(name, out Selectable t);
|
||||
if (t == null)
|
||||
{
|
||||
Debug.LogError($"{this.GetType()}---{name}:在selectableDict不存在");
|
||||
}
|
||||
|
||||
return t as T;
|
||||
}
|
||||
|
||||
public IArchitecture GetArchitecture()
|
||||
{
|
||||
return PanelSystem.GetArchitecture();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.UIFarme
|
||||
{
|
||||
public interface IPanelSystem : ISystem
|
||||
{
|
||||
/// <summary>
|
||||
/// UI的入栈操作,此操作会显示一个面板
|
||||
/// </summary>
|
||||
Task PushQueue<T>(string panelName=null,Transform parent = null, string packageName = null) where T : IBasePanel, new();
|
||||
|
||||
/// <summary>
|
||||
/// UI的入栈操作,此操作会显示一个面板
|
||||
/// </summary>
|
||||
Task PushStack<T>(string panelName=null,Transform parent = null, string packageName = null) where T : IBasePanel, new();
|
||||
|
||||
/// <summary>
|
||||
/// 执行面板的出栈操作,此操作会执行面板的OnExit方法
|
||||
/// </summary>
|
||||
void PopQueue<T>(string panelName=null) where T : IBasePanel, new();
|
||||
|
||||
/// <summary>
|
||||
/// 执行面板的出栈操作,此操作会执行面板的OnExit方法
|
||||
/// </summary>
|
||||
void PopStack();
|
||||
|
||||
/// <summary>
|
||||
/// 面板全部出栈此操作会执行面板的OnExit方法
|
||||
/// </summary>
|
||||
void PopAll();
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent>(TEvent key) where TEvent : IConvertible;
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvalue1>(TEvent key, Tvalue1 value) where TEvent : IConvertible;
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvalue1, Tvalue2>(TEvent key, Tvalue1 value1, Tvalue2 value2)
|
||||
where TEvent : IConvertible;
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvlue1, Tvlue2, Tvlue3>(TEvent key, Tvlue1 value1, Tvlue2 vlue2,
|
||||
Tvlue3 vlue3)
|
||||
where TEvent : IConvertible;
|
||||
|
||||
/// <summary>
|
||||
/// 返回存储面板实例的字典
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Dictionary<string, IBasePanel> Get_Dic();
|
||||
|
||||
IBasePanel GetPanel(string PanelName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 面板管理器,用栈来存储UI
|
||||
/// </summary>
|
||||
public class PanelSystem : AbstractSystem, IPanelSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// 存储普通UI面板
|
||||
/// </summary>
|
||||
private List<IBasePanel> queuePanel;
|
||||
|
||||
/// <summary>
|
||||
/// 存储堆栈UI面板
|
||||
/// </summary>
|
||||
private Stack<IBasePanel> stackPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 存储所有UI信息的字典,每个UI信息都会对应一个GameObject
|
||||
/// </summary>
|
||||
private Dictionary<string, IBasePanel> dicUI;
|
||||
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
stackPanel = new Stack<IBasePanel>();
|
||||
queuePanel = new List<IBasePanel>();
|
||||
dicUI = new Dictionary<string, IBasePanel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UI的入栈操作,此操作会显示一个面板
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="packageName">非热更模式传null</param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public async Task PushQueue<T>(string panelName=null, Transform parent = null, string packageName = null)
|
||||
where T : IBasePanel, new()
|
||||
{
|
||||
var prefabName = typeof(T).Name;
|
||||
if (string.IsNullOrEmpty(panelName))
|
||||
{
|
||||
panelName = typeof(T).Name;
|
||||
}
|
||||
IBasePanel nextPanel = null;
|
||||
if (!dicUI.ContainsKey(panelName))
|
||||
{
|
||||
nextPanel = new T();
|
||||
nextPanel.UIName = panelName;
|
||||
nextPanel.Initialize(this);
|
||||
nextPanel.SetPanelParent(parent);
|
||||
GameObject panelGo = await nextPanel.CreatePanel($"Prefabs_{prefabName}", packageName);
|
||||
///生成面板后,进行初始化操作
|
||||
nextPanel.Initialize(panelGo);
|
||||
dicUI.Add(panelName, nextPanel);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < queuePanel.Count; i++)
|
||||
{
|
||||
if (queuePanel[i].GetType().Name == panelName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nextPanel = dicUI[panelName];
|
||||
}
|
||||
|
||||
queuePanel.Add(nextPanel);
|
||||
nextPanel.OnEnter();
|
||||
//TOOD
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UI的入栈操作,此操作会显示一个面板
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="packageName">非热更模式传null</param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public async Task PushStack<T>(string panelName=null,Transform parent = null, string packageName = null) where T : IBasePanel, new()
|
||||
{
|
||||
var prefabName = typeof(T).Name;
|
||||
if (string.IsNullOrEmpty(panelName))
|
||||
{
|
||||
panelName = typeof(T).Name;
|
||||
}
|
||||
|
||||
IBasePanel nextPanel = null;
|
||||
if (!dicUI.ContainsKey(panelName))
|
||||
{
|
||||
nextPanel = new T();
|
||||
nextPanel.UIName = panelName;
|
||||
nextPanel.Initialize(this);
|
||||
nextPanel.SetPanelParent(parent);
|
||||
GameObject panelGo = await nextPanel.CreatePanel($"Prefabs_{prefabName}", packageName);
|
||||
///生成面板后,进行初始化操作
|
||||
nextPanel.Initialize(panelGo);
|
||||
|
||||
dicUI.Add(panelName, nextPanel);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < stackPanel.Count; i++)
|
||||
{
|
||||
if (queuePanel[i].GetType().Name == panelName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nextPanel = dicUI[panelName];
|
||||
}
|
||||
|
||||
stackPanel.Push(nextPanel);
|
||||
nextPanel.OnEnter();
|
||||
}
|
||||
|
||||
|
||||
public void PopQueue<T>(string panelName=null) where T : IBasePanel, new()
|
||||
{
|
||||
if (string.IsNullOrEmpty(panelName))
|
||||
{
|
||||
panelName = typeof(T).Name;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < queuePanel.Count; i++)
|
||||
{
|
||||
if (queuePanel[i].GetType().Name == panelName)
|
||||
{
|
||||
queuePanel[i].OnExit();
|
||||
queuePanel.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PopStack()
|
||||
{
|
||||
if (stackPanel.Count > 0)
|
||||
{
|
||||
stackPanel.Pop().OnExit();
|
||||
}
|
||||
|
||||
if (stackPanel.Count > 0)
|
||||
{
|
||||
stackPanel.Peek().OnResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void PopAll()
|
||||
{
|
||||
while (stackPanel.Count > 0)
|
||||
stackPanel.Pop().OnExit();
|
||||
foreach (var panel in queuePanel)
|
||||
{
|
||||
panel.OnExit();
|
||||
}
|
||||
|
||||
queuePanel.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent>(TEvent key) where TEvent : IConvertible
|
||||
{
|
||||
this.SendEvent(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvalue1>(TEvent key, Tvalue1 value) where TEvent : IConvertible
|
||||
{
|
||||
this.SendEvent(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvalue1, Tvalue2>(TEvent key, Tvalue1 value1, Tvalue2 value2)
|
||||
where TEvent : IConvertible
|
||||
{
|
||||
this.SendEvent(key, value1, value2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件发送
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void SendPanelEvent<TEvent, Tvlue1, Tvlue2, Tvlue3>(TEvent key, Tvlue1 value1, Tvlue2 vlue2,
|
||||
Tvlue3 vlue3)
|
||||
where TEvent : IConvertible
|
||||
{
|
||||
this.SendEvent(key, value1, vlue2, vlue3);
|
||||
}
|
||||
|
||||
|
||||
public Dictionary<string, IBasePanel> Get_Dic()
|
||||
{
|
||||
if (dicUI.Count > 0)
|
||||
{
|
||||
return dicUI;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IBasePanel GetPanel(string PanelName)
|
||||
{
|
||||
if (dicUI.ContainsKey(PanelName))
|
||||
{
|
||||
return dicUI[PanelName];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
PopAll();
|
||||
stackPanel = null;
|
||||
queuePanel = null;
|
||||
dicUI = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee00776e2fe511d418a91053db3d27fa
|
||||
guid: 9c06dd7c57ad1314eae1902d6cdb444f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a3652d3c1fe0e54c8d3253df95b811b
|
||||
guid: f6e218215da269c45b6b578b4eb0da12
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,268 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
|
||||
public enum AnchorPresets
|
||||
{
|
||||
TopLeft,
|
||||
TopCenter,
|
||||
TopRight,
|
||||
|
||||
MiddleLeft,
|
||||
MiddleCenter,
|
||||
MiddleRight,
|
||||
|
||||
BottomLeft,
|
||||
BottonCenter,
|
||||
BottomRight,
|
||||
BottomStretch,
|
||||
|
||||
VertStretchLeft,
|
||||
VertStretchRight,
|
||||
VertStretchCenter,
|
||||
|
||||
HorStretchTop,
|
||||
HorStretchMiddle,
|
||||
HorStretchBottom,
|
||||
|
||||
StretchAll
|
||||
}
|
||||
|
||||
public enum PivotPresets
|
||||
{
|
||||
TopLeft,
|
||||
TopCenter,
|
||||
TopRight,
|
||||
|
||||
MiddleLeft,
|
||||
MiddleCenter,
|
||||
MiddleRight,
|
||||
|
||||
BottomLeft,
|
||||
BottomCenter,
|
||||
BottomRight,
|
||||
}
|
||||
|
||||
public static class UIExtension
|
||||
{
|
||||
public static void SetAnchor(this RectTransform source, AnchorPresets allign, int offsetX = 0, int offsetY = 0)
|
||||
{
|
||||
source.anchoredPosition = new Vector3(offsetX, offsetY, 0);
|
||||
|
||||
switch (allign)
|
||||
{
|
||||
case (AnchorPresets.TopLeft):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 1);
|
||||
source.anchorMax = new Vector2(0, 1);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.TopCenter):
|
||||
{
|
||||
source.anchorMin = new Vector2(0.5f, 1);
|
||||
source.anchorMax = new Vector2(0.5f, 1);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.TopRight):
|
||||
{
|
||||
source.anchorMin = new Vector2(1, 1);
|
||||
source.anchorMax = new Vector2(1, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case (AnchorPresets.MiddleLeft):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0.5f);
|
||||
source.anchorMax = new Vector2(0, 0.5f);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.MiddleCenter):
|
||||
{
|
||||
source.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
source.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.MiddleRight):
|
||||
{
|
||||
source.anchorMin = new Vector2(1, 0.5f);
|
||||
source.anchorMax = new Vector2(1, 0.5f);
|
||||
break;
|
||||
}
|
||||
|
||||
case (AnchorPresets.BottomLeft):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0);
|
||||
source.anchorMax = new Vector2(0, 0);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.BottonCenter):
|
||||
{
|
||||
source.anchorMin = new Vector2(0.5f, 0);
|
||||
source.anchorMax = new Vector2(0.5f, 0);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.BottomRight):
|
||||
{
|
||||
source.anchorMin = new Vector2(1, 0);
|
||||
source.anchorMax = new Vector2(1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case (AnchorPresets.HorStretchTop):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 1);
|
||||
source.anchorMax = new Vector2(1, 1);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.HorStretchMiddle):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0.5f);
|
||||
source.anchorMax = new Vector2(1, 0.5f);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.HorStretchBottom):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0);
|
||||
source.anchorMax = new Vector2(1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case (AnchorPresets.VertStretchLeft):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0);
|
||||
source.anchorMax = new Vector2(0, 1);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.VertStretchCenter):
|
||||
{
|
||||
source.anchorMin = new Vector2(0.5f, 0);
|
||||
source.anchorMax = new Vector2(0.5f, 1);
|
||||
break;
|
||||
}
|
||||
case (AnchorPresets.VertStretchRight):
|
||||
{
|
||||
source.anchorMin = new Vector2(1, 0);
|
||||
source.anchorMax = new Vector2(1, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case (AnchorPresets.StretchAll):
|
||||
{
|
||||
source.anchorMin = new Vector2(0, 0);
|
||||
source.anchorMax = new Vector2(1, 1);
|
||||
source.sizeDelta = Vector2.zero;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetPivot(this RectTransform source, PivotPresets preset)
|
||||
{
|
||||
|
||||
switch (preset)
|
||||
{
|
||||
case (PivotPresets.TopLeft):
|
||||
{
|
||||
source.pivot = new Vector2(0, 1);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.TopCenter):
|
||||
{
|
||||
source.pivot = new Vector2(0.5f, 1);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.TopRight):
|
||||
{
|
||||
source.pivot = new Vector2(1, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case (PivotPresets.MiddleLeft):
|
||||
{
|
||||
source.pivot = new Vector2(0, 0.5f);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.MiddleCenter):
|
||||
{
|
||||
source.pivot = new Vector2(0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.MiddleRight):
|
||||
{
|
||||
source.pivot = new Vector2(1, 0.5f);
|
||||
break;
|
||||
}
|
||||
|
||||
case (PivotPresets.BottomLeft):
|
||||
{
|
||||
source.pivot = new Vector2(0, 0);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.BottomCenter):
|
||||
{
|
||||
source.pivot = new Vector2(0.5f, 0);
|
||||
break;
|
||||
}
|
||||
case (PivotPresets.BottomRight):
|
||||
{
|
||||
source.pivot = new Vector2(1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static CanvasGroup CreateBlackMask(Transform parent, float alpha = 0, string name = null)
|
||||
{
|
||||
GameObject maskGo = new GameObject("Black Mask");
|
||||
RectTransform rectTransform = maskGo.AddComponent<RectTransform>();
|
||||
rectTransform.SetParentEx(parent);
|
||||
rectTransform.anchorMin = Vector2.zero;
|
||||
rectTransform.anchorMax = Vector2.one;
|
||||
Image image = maskGo.AddComponent<Image>();
|
||||
image.color = Color.black;
|
||||
image.raycastTarget = false;
|
||||
CanvasGroup canvasGroup = maskGo.AddComponent<CanvasGroup>();
|
||||
canvasGroup.alpha = alpha;
|
||||
if(name != null)
|
||||
canvasGroup.name = name;
|
||||
return canvasGroup;
|
||||
}
|
||||
|
||||
public static Canvas CreateLayerCanvas(UILayer layer, bool is3D, Transform parent, Camera camera, float width, float height)
|
||||
{
|
||||
GameObject canvasGo = new GameObject(layer.ToString());
|
||||
RectTransform rectTransform = canvasGo.AddComponent<RectTransform>();
|
||||
rectTransform.SetParentEx(parent);
|
||||
rectTransform.anchorMin = Vector2.zero;
|
||||
rectTransform.anchorMax = Vector2.one;
|
||||
canvasGo.layer = is3D ? Layer.Default : Layer.UI;
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = is3D ? RenderMode.WorldSpace : RenderMode.ScreenSpaceCamera;
|
||||
canvas.overrideSorting = true;
|
||||
canvas.sortingOrder = (int)layer;
|
||||
canvas.worldCamera = camera;
|
||||
canvas.pixelPerfect = false;
|
||||
CanvasScaler canvasScaler = canvasGo.AddComponent<CanvasScaler>();
|
||||
canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
||||
canvasScaler.referenceResolution = new Vector2(height,width);
|
||||
canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.Expand;
|
||||
|
||||
canvasGo.AddComponent<GraphicRaycaster>();
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为方便统一处理点击音效等
|
||||
/// </summary>
|
||||
public static void AddClick(this Button button, UnityAction callback)
|
||||
{
|
||||
button.onClick.AddListener(callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47109d36e16c5ff49b9d9c535cce542f
|
||||
guid: b521dcf8e49760e4fa28db6a6436ebc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab9e1d815209d5e469824bfa1bbc399c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public static class Layer
|
||||
{
|
||||
public const int Default = 0;
|
||||
public const int TransparentFX = 1;
|
||||
public const int IgnoreRaycast = 2;
|
||||
public const int Water = 4;
|
||||
public const int UI = 5;
|
||||
public const int UIRenderToTarget = 6;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd370aabf636e1747a77b8071d92de0a
|
||||
guid: f57fecb20b667bb45a6240fd6b16fc80
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public static class ObjectExtension
|
||||
{
|
||||
private static readonly List<Transform> s_CachedTransforms = new List<Transform>();
|
||||
|
||||
public static T GetOrAddComponent<T>(this Component obj) where T : Component
|
||||
{
|
||||
return obj.gameObject.GetOrAddComponent<T>();
|
||||
}
|
||||
|
||||
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
|
||||
{
|
||||
T t = gameObject.GetComponent<T>();
|
||||
if (t == null)
|
||||
t = gameObject.AddComponent<T>();
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Component GetOrAddComponent(this Component obj, Type type)
|
||||
{
|
||||
return obj.gameObject.GetOrAddComponent(type);
|
||||
}
|
||||
|
||||
public static Component GetOrAddComponent(this GameObject gameObject, Type type)
|
||||
{
|
||||
if (gameObject == null) return null;
|
||||
|
||||
Component component = gameObject.GetComponent(type);
|
||||
if (component == null)
|
||||
component = gameObject.AddComponent(type);
|
||||
return component;
|
||||
}
|
||||
|
||||
public static void SetParentEx(this Transform transform, Transform parent)
|
||||
{
|
||||
transform.SetParent(parent);
|
||||
transform.localPosition = Vector3.zero;
|
||||
transform.localRotation = Quaternion.identity;
|
||||
transform.localScale = Vector3.one;
|
||||
}
|
||||
|
||||
public static void SetLayerRecursively(this GameObject gameObject, int layer)
|
||||
{
|
||||
gameObject.GetComponentsInChildren(true, s_CachedTransforms);
|
||||
for (int i = 0; i < s_CachedTransforms.Count; i++)
|
||||
{
|
||||
s_CachedTransforms[i].gameObject.layer = layer;
|
||||
}
|
||||
s_CachedTransforms.Clear();
|
||||
}
|
||||
|
||||
public static void AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue value)
|
||||
{
|
||||
if (dict.ContainsKey(key))
|
||||
dict[key] = value;
|
||||
else
|
||||
dict.Add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5255d0f8bf44ff44c8ce65055fa5b28f
|
||||
guid: 1255735e746b217478dc63262723567a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,194 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public static class Pool
|
||||
{
|
||||
public readonly static List<PoolBase> AllPool = new List<PoolBase>();
|
||||
|
||||
public static void ReleaseAll()
|
||||
{
|
||||
foreach (var pool in AllPool)
|
||||
{
|
||||
pool.Dispose();
|
||||
}
|
||||
AllPool.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IObject
|
||||
{
|
||||
void OnRelease();
|
||||
}
|
||||
|
||||
public interface PoolBase
|
||||
{
|
||||
void Dispose();
|
||||
}
|
||||
|
||||
public class ObjectPool<T> : PoolBase where T : new()
|
||||
{
|
||||
private static ObjectPool<T> Instance;
|
||||
|
||||
private Stack<T> _pool;
|
||||
|
||||
private ObjectPool() { }
|
||||
|
||||
|
||||
private static void Init()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = new ObjectPool<T>();
|
||||
Instance._pool = new Stack<T>();
|
||||
Pool.AllPool.Add(Instance);
|
||||
}
|
||||
}
|
||||
|
||||
public static T Get()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (Instance._pool.Count > 0)
|
||||
{
|
||||
return Instance._pool.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Release(T obj)
|
||||
{
|
||||
if (obj == null || Instance == null) return;
|
||||
|
||||
if (obj is IObject interfac)
|
||||
{
|
||||
interfac.OnRelease();
|
||||
}
|
||||
Instance._pool.Push(obj);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
if (Instance._pool != null)
|
||||
{
|
||||
Instance._pool.Clear();
|
||||
Instance._pool = null;
|
||||
}
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ListPool<T> : PoolBase
|
||||
{
|
||||
private static ListPool<T> Instance;
|
||||
|
||||
private Stack<List<T>> _pool;
|
||||
|
||||
private ListPool() { }
|
||||
|
||||
private static void Init()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = new ListPool<T>();
|
||||
Instance._pool = new Stack<List<T>>();
|
||||
Pool.AllPool.Add(Instance);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<T> Get()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (Instance._pool.Count > 0)
|
||||
{
|
||||
return Instance._pool.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<T>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Release(List<T> list)
|
||||
{
|
||||
if (list == null || Instance == null) return;
|
||||
list.Clear();
|
||||
Instance._pool.Push(list);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
if (Instance._pool != null)
|
||||
{
|
||||
Instance._pool.Clear();
|
||||
Instance._pool = null;
|
||||
}
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DictionaryPool<Key, Value> : PoolBase
|
||||
{
|
||||
private static DictionaryPool<Key, Value> Instance;
|
||||
|
||||
private Stack<Dictionary<Key, Value>> _pool;
|
||||
|
||||
private DictionaryPool() { }
|
||||
|
||||
private static void Init()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = new DictionaryPool<Key, Value>();
|
||||
Instance._pool = new Stack<Dictionary<Key, Value>>();
|
||||
Pool.AllPool.Add(Instance);
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<Key, Value> Get()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (Instance._pool.Count > 0)
|
||||
{
|
||||
return Instance._pool.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Dictionary<Key, Value>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Release(Dictionary<Key, Value> dict)
|
||||
{
|
||||
if (dict == null || Instance == null) return;
|
||||
dict.Clear();
|
||||
Instance._pool.Push(dict);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
if (Instance._pool != null)
|
||||
{
|
||||
Instance._pool.Clear();
|
||||
Instance._pool = null;
|
||||
}
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59e9f74cfa6aa344c91bcdcc6db78ac6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class PrefabPool
|
||||
{
|
||||
/// <summary>
|
||||
/// 如果名字一样,则使用同一个池子
|
||||
/// </summary>
|
||||
public static Dictionary<string, PrefabPool> s_Pools = new Dictionary<string, PrefabPool>();
|
||||
|
||||
private string _poolName;
|
||||
private GameObject _prefab;
|
||||
private List<GameObject> _pool;
|
||||
private List<GameObject> _useList;
|
||||
|
||||
public GameObject Prefab => _prefab;
|
||||
public List<GameObject> UseList => _useList;
|
||||
|
||||
private PrefabPool() { }
|
||||
|
||||
private void Init(string poolName, GameObject prefab)
|
||||
{
|
||||
_pool = ListPool<GameObject>.Get();
|
||||
_useList = ListPool<GameObject>.Get();
|
||||
_prefab = prefab;
|
||||
_poolName = poolName;
|
||||
}
|
||||
|
||||
public static PrefabPool Get(string poolName)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(poolName))
|
||||
{
|
||||
if (s_Pools.TryGetValue(poolName, out var prefabPool))
|
||||
{
|
||||
return prefabPool;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrefabPool Create(GameObject prefab, string poolName = null)
|
||||
{
|
||||
if (prefab == null) return null;
|
||||
if (!string.IsNullOrEmpty(poolName))
|
||||
{
|
||||
if (s_Pools.TryGetValue(poolName, out var prefabPool))
|
||||
{
|
||||
return prefabPool;
|
||||
}
|
||||
}
|
||||
var pool = new PrefabPool();
|
||||
pool.Init(poolName, prefab);
|
||||
if (!string.IsNullOrEmpty(poolName))
|
||||
{
|
||||
s_Pools.Add(poolName, pool);
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
public GameObject Get(Transform parent = null)
|
||||
{
|
||||
if (_prefab == null) return null;
|
||||
|
||||
GameObject go = null;
|
||||
if (_pool.Count > 0)
|
||||
{
|
||||
go = _pool[0];
|
||||
_pool.RemoveAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
go = GameObject.Instantiate(_prefab);
|
||||
}
|
||||
go.transform.parent = parent;
|
||||
go.transform.localScale = Vector3.one;
|
||||
go.transform.localPosition = Vector3.zero;
|
||||
go.transform.localRotation = Quaternion.identity;
|
||||
go.SetActive(true);
|
||||
go.transform.SetAsLastSibling();
|
||||
_useList.Add(go);
|
||||
return go;
|
||||
}
|
||||
|
||||
public void Recycle(GameObject go)
|
||||
{
|
||||
if (go != null)
|
||||
{
|
||||
go.SetActive(false);
|
||||
_pool.Add(go);
|
||||
_useList.Remove(go);
|
||||
}
|
||||
}
|
||||
|
||||
public void RecycleUseList()
|
||||
{
|
||||
foreach (var go in _useList)
|
||||
{
|
||||
if (go != null)
|
||||
{
|
||||
go.SetActive(false);
|
||||
_pool.Add(go);
|
||||
}
|
||||
}
|
||||
_useList.Clear();
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
foreach (var go in _pool)
|
||||
{
|
||||
if (go != null)
|
||||
{
|
||||
GameObject.Destroy(go);
|
||||
}
|
||||
}
|
||||
_pool.Clear();
|
||||
foreach (var go in _useList)
|
||||
{
|
||||
if (go != null)
|
||||
{
|
||||
GameObject.Destroy(go);
|
||||
}
|
||||
}
|
||||
_useList.Clear();
|
||||
|
||||
ListPool<GameObject>.Release(_pool);
|
||||
ListPool<GameObject>.Release(_useList);
|
||||
|
||||
s_Pools.Remove(_poolName);
|
||||
|
||||
_pool = null;
|
||||
_useList = null;
|
||||
_prefab = null;
|
||||
_poolName = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02cdac12da067fa479f36e34fafd0987
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class Singleton<T> where T : new()
|
||||
{
|
||||
private static T _ServiceContext;
|
||||
private readonly static object lockObj = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 禁止外部进行实例化
|
||||
/// </summary>
|
||||
protected Singleton()
|
||||
{
|
||||
OnInitialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取唯一实例,双锁定防止多线程并发时重复创建实例
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ServiceContext == null)
|
||||
{
|
||||
lock (lockObj)
|
||||
{
|
||||
if (_ServiceContext == null)
|
||||
{
|
||||
_ServiceContext = new T();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _ServiceContext;
|
||||
}
|
||||
}
|
||||
public virtual void OnInitialize() { }
|
||||
|
||||
public void Init() { }
|
||||
}
|
||||
|
||||
|
||||
public class SingletonMono<T> : MonoBehaviour where T : MonoBehaviour
|
||||
{
|
||||
private static T _instance;
|
||||
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = (T)FindObjectOfType(typeof(T));
|
||||
if (_instance == null)
|
||||
{
|
||||
GameObject singleton = new GameObject();
|
||||
_instance = singleton.AddComponent<T>();
|
||||
singleton.name = typeof(T).ToString();
|
||||
DontDestroyOnLoad(singleton);
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
_instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26a0ecd7bd1fa9441a7229d39408180c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class TreeNode
|
||||
{
|
||||
public Dictionary<ulong, TreeNode> childs;
|
||||
public ulong id;
|
||||
public object data;
|
||||
|
||||
public TreeNode Get(ulong id)
|
||||
{
|
||||
if (childs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
childs.TryGetValue(id, out var node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public TreeNode GetOrAdd(ulong id)
|
||||
{
|
||||
if (childs == null)
|
||||
{
|
||||
childs = new Dictionary<ulong, TreeNode>();
|
||||
}
|
||||
if (!childs.TryGetValue(id, out var node))
|
||||
{
|
||||
node = ObjectPool<TreeNode>.Get();
|
||||
node.id = id;
|
||||
childs.Add(id, node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
public void CleanUp()
|
||||
{
|
||||
if (childs != null)
|
||||
{
|
||||
foreach (var item in childs.Values)
|
||||
{
|
||||
item.CleanUp();
|
||||
ObjectPool<TreeNode>.Release(item);
|
||||
}
|
||||
childs.Clear();
|
||||
}
|
||||
id = 0;
|
||||
data = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc97d6286a198a946a032cc4fa7fe2cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1c08d26fe3fa4740b2a4398ea9ee65b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class InstancePool
|
||||
{
|
||||
private static string GameObjectName = "GameObjectPool";
|
||||
private static string RecycleName = "RecyclePool";
|
||||
private Dictionary<string, Stack<GameObject>> _allInstances = new Dictionary<string, Stack<GameObject>>();
|
||||
private Transform _instancePoolTransRoot = null;
|
||||
private Transform _recyclePoolTransRoot = null;
|
||||
|
||||
public InstancePool()
|
||||
{
|
||||
var go = new GameObject(GameObjectName);
|
||||
GameObject.DontDestroyOnLoad(go);
|
||||
|
||||
_instancePoolTransRoot = go.transform;
|
||||
go.SetActive(true);
|
||||
|
||||
_recyclePoolTransRoot = _instancePoolTransRoot.Find(RecycleName);
|
||||
if (_recyclePoolTransRoot == null)
|
||||
{
|
||||
_recyclePoolTransRoot = new GameObject(RecycleName).transform;
|
||||
_recyclePoolTransRoot.SetParent(_instancePoolTransRoot);
|
||||
}
|
||||
|
||||
_recyclePoolTransRoot.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public GameObject Get(string key)
|
||||
{
|
||||
Stack<GameObject> objects = null;
|
||||
if (!_allInstances.TryGetValue(key, out objects))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (objects == null || objects.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return objects.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Recycle(string key, GameObject obj, bool forceDestroy = false)
|
||||
{
|
||||
//强制删除
|
||||
if (forceDestroy)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
GameObject.Destroy(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject.DestroyImmediate(obj);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Stack<GameObject> objects = null;
|
||||
if (!_allInstances.TryGetValue(key, out objects))
|
||||
{
|
||||
objects = new Stack<GameObject>();
|
||||
_allInstances[key] = objects;
|
||||
}
|
||||
|
||||
InitInst(obj, false);
|
||||
objects.Push(obj);
|
||||
}
|
||||
|
||||
public void Clear(string key)
|
||||
{
|
||||
Stack<GameObject> objects = null;
|
||||
if (_allInstances.TryGetValue(key, out objects))
|
||||
{
|
||||
while (objects.Count > 0)
|
||||
{
|
||||
GameObject objToDestroy = objects.Pop();
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
GameObject.Destroy(objToDestroy);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject.DestroyImmediate(objToDestroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
foreach (var item in _allInstances)
|
||||
{
|
||||
while (item.Value.Count > 0)
|
||||
{
|
||||
GameObject objToDestroy = item.Value.Pop();
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
GameObject.Destroy(objToDestroy);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject.DestroyImmediate(objToDestroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_allInstances.Clear();
|
||||
}
|
||||
|
||||
public void InitInst(GameObject inst, bool active = true)
|
||||
{
|
||||
if (inst != null)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
inst.transform.SetParent(_instancePoolTransRoot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
inst.transform.SetParent(_recyclePoolTransRoot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b78b11e8c4a134f478ab61d5c6334deb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 125226ccd07f47c5bf3b94157bf12fc3
|
||||
timeCreated: 1758179120
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae09f872dbca2d84fa2a065b22315aef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6bdd27938945f0449bc8fe7947f2bf2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,135 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's alpha. Works with both UI widgets as well as renderers.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Alpha")]
|
||||
public class TweenAlpha : UITweener
|
||||
{
|
||||
[Range(0f, 1f)] public float from = 1f;
|
||||
[Range(0f, 1f)] public float to = 1f;
|
||||
|
||||
[Tooltip("If used on a renderer, the material should probably be cleaned up after this script gets destroyed...")]
|
||||
public bool autoCleanup = false;
|
||||
|
||||
[Tooltip("Color to adjust")]
|
||||
public string colorProperty;
|
||||
|
||||
[System.NonSerialized] bool mCached = false;
|
||||
[System.NonSerialized] CanvasGroup mRect;
|
||||
[System.NonSerialized] Material mShared;
|
||||
[System.NonSerialized] Material mMat;
|
||||
[System.NonSerialized] Light mLight;
|
||||
[System.NonSerialized] SpriteRenderer mSr;
|
||||
[System.NonSerialized] float mBaseIntensity = 1f;
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float alpha { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
void OnDestroy () { if (autoCleanup && mMat != null && mShared != mMat) { Destroy(mMat); mMat = null; } }
|
||||
|
||||
void Cache ()
|
||||
{
|
||||
mCached = true;
|
||||
mRect = GetComponent<CanvasGroup>();
|
||||
mSr = GetComponent<SpriteRenderer>();
|
||||
|
||||
if (mRect == null && mSr == null)
|
||||
{
|
||||
mLight = GetComponent<Light>();
|
||||
|
||||
if (mLight == null)
|
||||
{
|
||||
var ren = GetComponent<Renderer>();
|
||||
|
||||
if (ren != null)
|
||||
{
|
||||
mShared = ren.sharedMaterial;
|
||||
mMat = ren.material;
|
||||
}
|
||||
|
||||
if (mMat == null) mRect = GetComponentInChildren<CanvasGroup>();
|
||||
}
|
||||
else mBaseIntensity = mLight.intensity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
if (mRect != null) return mRect.alpha;
|
||||
if (mSr != null) return mSr.color.a;
|
||||
if (mMat == null) return 1f;
|
||||
if (string.IsNullOrEmpty(colorProperty)) return mMat.color.a;
|
||||
return mMat.GetColor(colorProperty).a;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
|
||||
if (mRect != null)
|
||||
{
|
||||
mRect.alpha = value;
|
||||
}
|
||||
else if (mSr != null)
|
||||
{
|
||||
var c = mSr.color;
|
||||
c.a = value;
|
||||
mSr.color = c;
|
||||
}
|
||||
else if (mMat != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(colorProperty))
|
||||
{
|
||||
var c = mMat.color;
|
||||
c.a = value;
|
||||
mMat.color = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
var c = mMat.GetColor(colorProperty);
|
||||
c.a = value;
|
||||
mMat.SetColor(colorProperty, c);
|
||||
}
|
||||
}
|
||||
else if (mLight != null)
|
||||
{
|
||||
mLight.intensity = mBaseIntensity * value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = Mathf.Lerp(from, to, factor); }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenAlpha Begin (GameObject go, float duration, float alpha, float delay = 0f)
|
||||
{
|
||||
var comp = UITweener.Begin<TweenAlpha>(go, duration, delay);
|
||||
comp.from = comp.value;
|
||||
comp.to = alpha;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e2747e3775af504da1a4d5a46c5a1ce
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,118 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's color.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Color")]
|
||||
public class TweenColor : UITweener
|
||||
{
|
||||
public Color from = Color.white;
|
||||
public Color to = Color.white;
|
||||
|
||||
bool mCached = false;
|
||||
Graphic mGraphic;
|
||||
Material mMat;
|
||||
Light mLight;
|
||||
SpriteRenderer mSr;
|
||||
|
||||
void Cache ()
|
||||
{
|
||||
mCached = true;
|
||||
mGraphic = GetComponent<Graphic>();
|
||||
if (mGraphic != null) return;
|
||||
|
||||
mSr = GetComponent<SpriteRenderer>();
|
||||
if (mSr != null) return;
|
||||
|
||||
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
|
||||
Renderer ren = renderer;
|
||||
#else
|
||||
Renderer ren = GetComponent<Renderer>();
|
||||
#endif
|
||||
if (ren != null)
|
||||
{
|
||||
mMat = ren.material;
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
|
||||
mLight = light;
|
||||
#else
|
||||
mLight = GetComponent<Light>();
|
||||
#endif
|
||||
if (mLight == null) mGraphic = GetComponentInChildren<Graphic>();
|
||||
}
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public Color color { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public Color value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
if (mGraphic != null) return mGraphic.color;
|
||||
if (mMat != null) return mMat.color;
|
||||
if (mSr != null) return mSr.color;
|
||||
if (mLight != null) return mLight.color;
|
||||
return Color.black;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
if (mGraphic != null) mGraphic.color = value;
|
||||
else if (mMat != null) mMat.color = value;
|
||||
else if (mSr != null) mSr.color = value;
|
||||
else if (mLight != null)
|
||||
{
|
||||
mLight.color = value;
|
||||
mLight.enabled = (value.r + value.g + value.b) > 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = Color.Lerp(from, to, factor); }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenColor Begin (GameObject go, float duration, Color color)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying) return null;
|
||||
#endif
|
||||
TweenColor comp = UITweener.Begin<TweenColor>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = color;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfa4a4a103e4fed43a7e9e9df4a6915c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,66 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the camera's field of view.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Tween/Tween Field of View")]
|
||||
public class TweenFOV : UITweener
|
||||
{
|
||||
public float from = 45f;
|
||||
public float to = 45f;
|
||||
|
||||
Camera mCam;
|
||||
|
||||
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
|
||||
public Camera cachedCamera { get { if (mCam == null) mCam = camera; return mCam; } }
|
||||
#else
|
||||
public Camera cachedCamera { get { if (mCam == null) mCam = GetComponent<Camera>(); return mCam; } }
|
||||
#endif
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float fov { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value { get { return cachedCamera.fieldOfView; } set { cachedCamera.fieldOfView = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = from * (1f - factor) + to * factor; }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenFOV Begin (GameObject go, float duration, float to)
|
||||
{
|
||||
TweenFOV comp = UITweener.Begin<TweenFOV>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = to;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0153adb55685cee4d97c4ee2d52124e5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the Image fill.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(Image))]
|
||||
[AddComponentMenu("Tween/Tween Fill")]
|
||||
public class TweenFill : UITweener
|
||||
{
|
||||
[Range(0f, 1f)] public float from = 1f;
|
||||
[Range(0f, 1f)] public float to = 1f;
|
||||
|
||||
bool mCached = false;
|
||||
Image mSprite;
|
||||
|
||||
void Cache ()
|
||||
{
|
||||
mCached = true;
|
||||
mSprite = GetComponent<Image>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
if (mSprite != null) return mSprite.fillAmount;
|
||||
return 0f;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!mCached) Cache();
|
||||
if (mSprite != null) mSprite.fillAmount = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = Mathf.Lerp(from, to, factor); }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenFill Begin (GameObject go, float duration, float fill)
|
||||
{
|
||||
TweenFill comp = UITweener.Begin<TweenFill>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = fill;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ba7f59a1f412544f85ac3e66f0b5227
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,74 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the widget's size.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[AddComponentMenu("Tween/Tween Height")]
|
||||
public class TweenHeight : UITweener
|
||||
{
|
||||
public float from = 100;
|
||||
public float to = 100;
|
||||
|
||||
[Tooltip("If set, 'from' value will be set to match the specified rectangle")]
|
||||
public RectTransform fromTarget;
|
||||
|
||||
[Tooltip("If set, 'to' value will be set to match the specified rectangle")]
|
||||
public RectTransform toTarget;
|
||||
|
||||
RectTransform mWidget;
|
||||
|
||||
public RectTransform cachedWidget { get { if (mWidget == null) mWidget = GetComponent<RectTransform>(); return mWidget; } }
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float height { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value { get { return cachedWidget.rect.height; } set { cachedWidget.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
if (fromTarget) from = fromTarget.rect.width;
|
||||
if (toTarget) to = toTarget.rect.width;
|
||||
|
||||
value = Mathf.RoundToInt(from * (1f - factor) + to * factor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenHeight Begin (RectTransform widget, float duration, int height)
|
||||
{
|
||||
TweenHeight comp = UITweener.Begin<TweenHeight>(widget.gameObject, duration);
|
||||
comp.from = widget.rect.height;
|
||||
comp.to = height;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66a6ab21c5f860946ade65b47cc0270b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -92
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,65 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the camera's orthographic size.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Tween/Tween Orthographic Size")]
|
||||
public class TweenOrthoSize : UITweener
|
||||
{
|
||||
public float from = 1f;
|
||||
public float to = 1f;
|
||||
|
||||
Camera mCam;
|
||||
|
||||
/// <summary>
|
||||
/// Camera that's being tweened.
|
||||
/// </summary>
|
||||
|
||||
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
|
||||
public Camera cachedCamera { get { if (mCam == null) mCam = camera; return mCam; } }
|
||||
#else
|
||||
public Camera cachedCamera { get { if (mCam == null) mCam = GetComponent<Camera>(); return mCam; } }
|
||||
#endif
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float orthoSize { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value
|
||||
{
|
||||
get { return cachedCamera.orthographicSize; }
|
||||
set { cachedCamera.orthographicSize = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = from * (1f - factor) + to * factor; }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenOrthoSize Begin (GameObject go, float duration, float to)
|
||||
{
|
||||
TweenOrthoSize comp = UITweener.Begin<TweenOrthoSize>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = to;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 365827806a6dd8b4583deeefe6e483c9
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,94 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's position.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Position")]
|
||||
public class TweenPosition : UITweener
|
||||
{
|
||||
public Vector3 from;
|
||||
public Vector3 to;
|
||||
|
||||
[HideInInspector]
|
||||
public bool worldSpace = false;
|
||||
|
||||
Transform mTrans;
|
||||
|
||||
public Transform cachedTransform { get { if (mTrans == null) mTrans = transform; return mTrans; } }
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public Vector3 position { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public Vector3 value
|
||||
{
|
||||
get
|
||||
{
|
||||
return worldSpace ? cachedTransform.position : cachedTransform.localPosition;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (worldSpace) cachedTransform.position = value;
|
||||
else cachedTransform.localPosition = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished) { value = from * (1f - factor) + to * factor; }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenPosition Begin (GameObject go, float duration, Vector3 pos)
|
||||
{
|
||||
TweenPosition comp = UITweener.Begin<TweenPosition>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = pos;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenPosition Begin (GameObject go, float duration, Vector3 pos, bool worldSpace)
|
||||
{
|
||||
TweenPosition comp = UITweener.Begin<TweenPosition>(go, duration);
|
||||
comp.worldSpace = worldSpace;
|
||||
comp.from = comp.value;
|
||||
comp.to = pos;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d166255cacf07b4292b8402b3ddefc5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -98
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's rotation.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Rotation")]
|
||||
public class TweenRotation : UITweener
|
||||
{
|
||||
public Vector3 from;
|
||||
public Vector3 to;
|
||||
public bool quaternionLerp = false;
|
||||
|
||||
Transform mTrans;
|
||||
|
||||
public Transform cachedTransform { get { if (mTrans == null) mTrans = transform; return mTrans; } }
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public Quaternion rotation { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public Quaternion value { get { return cachedTransform.localRotation; } set { cachedTransform.localRotation = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
value = quaternionLerp ? Quaternion.Slerp(Quaternion.Euler(from), Quaternion.Euler(to), factor) :
|
||||
Quaternion.Euler(new Vector3(
|
||||
Mathf.Lerp(from.x, to.x, factor),
|
||||
Mathf.Lerp(from.y, to.y, factor),
|
||||
Mathf.Lerp(from.z, to.z, factor)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenRotation Begin (GameObject go, float duration, Quaternion rot)
|
||||
{
|
||||
TweenRotation comp = UITweener.Begin<TweenRotation>(go, duration);
|
||||
comp.from = comp.value.eulerAngles;
|
||||
comp.to = rot.eulerAngles;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value.eulerAngles; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value.eulerAngles; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = Quaternion.Euler(from); }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = Quaternion.Euler(to); }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04d1b7c9e9a19a24ab67123a43c6544b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -95
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,60 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's local scale.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Scale")]
|
||||
public class TweenScale : UITweener
|
||||
{
|
||||
public Vector3 from = Vector3.one;
|
||||
public Vector3 to = Vector3.one;
|
||||
|
||||
Transform mTrans;
|
||||
|
||||
public Transform cachedTransform { get { if (mTrans == null) mTrans = transform; return mTrans; } }
|
||||
|
||||
public Vector3 value { get { return cachedTransform.localScale; } set { cachedTransform.localScale = value; } }
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public Vector3 scale { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
value = from * (1f - factor) + to * factor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenScale Begin (GameObject go, float duration, Vector3 scale)
|
||||
{
|
||||
TweenScale comp = UITweener.Begin<TweenScale>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = scale;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75e7459110b9666449485c40f25362a5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -94
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the object's position, rotation and scale.
|
||||
/// </summary>
|
||||
|
||||
[AddComponentMenu("Tween/Tween Transform")]
|
||||
public class TweenTransform : UITweener
|
||||
{
|
||||
public Transform from;
|
||||
public Transform to;
|
||||
public bool parentWhenFinished = false;
|
||||
|
||||
Transform mTrans;
|
||||
Vector3 mPos;
|
||||
Quaternion mRot;
|
||||
Vector3 mScale;
|
||||
|
||||
/// <summary>
|
||||
/// Interpolate the position, scale, and rotation.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
if (to != null)
|
||||
{
|
||||
if (mTrans == null)
|
||||
{
|
||||
mTrans = transform;
|
||||
mPos = mTrans.position;
|
||||
mRot = mTrans.rotation;
|
||||
mScale = mTrans.localScale;
|
||||
}
|
||||
|
||||
if (from != null)
|
||||
{
|
||||
mTrans.position = from.position * (1f - factor) + to.position * factor;
|
||||
mTrans.localScale = from.localScale * (1f - factor) + to.localScale * factor;
|
||||
mTrans.rotation = Quaternion.Slerp(from.rotation, to.rotation, factor);
|
||||
}
|
||||
else
|
||||
{
|
||||
mTrans.position = mPos * (1f - factor) + to.position * factor;
|
||||
mTrans.localScale = mScale * (1f - factor) + to.localScale * factor;
|
||||
mTrans.rotation = Quaternion.Slerp(mRot, to.rotation, factor);
|
||||
}
|
||||
|
||||
// Change the parent when finished, if requested
|
||||
if (parentWhenFinished && isFinished) mTrans.parent = to;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation from the current position/rotation/scale to the target transform.
|
||||
/// </summary>
|
||||
|
||||
static public TweenTransform Begin (GameObject go, float duration, Transform to) { return Begin(go, duration, null, to); }
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenTransform Begin (GameObject go, float duration, Transform from, Transform to)
|
||||
{
|
||||
TweenTransform comp = UITweener.Begin<TweenTransform>(go, duration);
|
||||
comp.from = from;
|
||||
comp.to = to;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d805c79a1ab11643bfd9d91e10c195a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the audio source's volume.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
[AddComponentMenu("Tween/Tween Volume")]
|
||||
public class TweenVolume : UITweener
|
||||
{
|
||||
[Range(0f, 1f)] public float from = 1f;
|
||||
[Range(0f, 1f)] public float to = 1f;
|
||||
|
||||
AudioSource mSource;
|
||||
|
||||
/// <summary>
|
||||
/// Cached version of 'audio', as it's always faster to cache.
|
||||
/// </summary>
|
||||
|
||||
public AudioSource audioSource
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mSource == null)
|
||||
{
|
||||
mSource = GetComponent<AudioSource>();
|
||||
|
||||
if (mSource == null)
|
||||
{
|
||||
mSource = GetComponent<AudioSource>();
|
||||
|
||||
if (mSource == null)
|
||||
{
|
||||
Debug.LogError("TweenVolume needs an AudioSource to work with", this);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mSource;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float volume { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Audio source's current volume.
|
||||
/// </summary>
|
||||
|
||||
public float value
|
||||
{
|
||||
get
|
||||
{
|
||||
return audioSource != null ? mSource.volume : 0f;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (audioSource != null) mSource.volume = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
value = from * (1f - factor) + to * factor;
|
||||
mSource.enabled = (mSource.volume > 0.01f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenVolume Begin (GameObject go, float duration, float targetVolume)
|
||||
{
|
||||
TweenVolume comp = UITweener.Begin<TweenVolume>(go, duration);
|
||||
comp.from = comp.value;
|
||||
comp.to = targetVolume;
|
||||
|
||||
if (targetVolume > 0f)
|
||||
{
|
||||
var s = comp.audioSource;
|
||||
s.enabled = true;
|
||||
s.Play();
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17aeef7ce6c142344959e650cab20151
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,75 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tween the widget's size.
|
||||
/// </summary>
|
||||
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[AddComponentMenu("Tween/Tween Width")]
|
||||
public class TweenWidth : UITweener
|
||||
{
|
||||
public float from = 100;
|
||||
public float to = 100;
|
||||
|
||||
[Tooltip("If set, 'from' value will be set to match the specified rectangle")]
|
||||
public RectTransform fromTarget;
|
||||
|
||||
[Tooltip("If set, 'to' value will be set to match the specified rectangle")]
|
||||
public RectTransform toTarget;
|
||||
|
||||
RectTransform mWidget;
|
||||
RectTransform mTable;
|
||||
|
||||
public RectTransform cachedWidget { get { if (mWidget == null) mWidget = GetComponent<RectTransform>(); return mWidget; } }
|
||||
|
||||
[System.Obsolete("Use 'value' instead")]
|
||||
public float width { get { return this.value; } set { this.value = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween's current value.
|
||||
/// </summary>
|
||||
|
||||
public float value { get { return cachedWidget.rect.width; } set { cachedWidget.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Tween the value.
|
||||
/// </summary>
|
||||
|
||||
protected override void OnUpdate (float factor, bool isFinished)
|
||||
{
|
||||
if (fromTarget) from = fromTarget.rect.width;
|
||||
if (toTarget) to = toTarget.rect.width;
|
||||
|
||||
value = Mathf.RoundToInt(from * (1f - factor) + to * factor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public TweenWidth Begin (RectTransform widget, float duration, int width)
|
||||
{
|
||||
var comp = UITweener.Begin<TweenWidth>(widget.gameObject, duration);
|
||||
comp.from = widget.rect.width;
|
||||
comp.to = width;
|
||||
|
||||
if (duration <= 0f)
|
||||
{
|
||||
comp.Sample(1f, true);
|
||||
comp.enabled = false;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
[ContextMenu("Set 'From' to current value")]
|
||||
public override void SetStartToCurrentValue () { from = value; }
|
||||
|
||||
[ContextMenu("Set 'To' to current value")]
|
||||
public override void SetEndToCurrentValue () { to = value; }
|
||||
|
||||
[ContextMenu("Assume value of 'From'")]
|
||||
void SetCurrentValueToStart () { value = from; }
|
||||
|
||||
[ContextMenu("Assume value of 'To'")]
|
||||
void SetCurrentValueToEnd () { value = to; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fe5d396737f89f4ea1534bc147cad2e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -93
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,531 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all tweening operations.
|
||||
/// </summary>
|
||||
|
||||
public abstract class UITweener : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Current tween that triggered the callback function.
|
||||
/// </summary>
|
||||
|
||||
static public UITweener current;
|
||||
|
||||
public enum Method
|
||||
{
|
||||
Linear,
|
||||
EaseIn,
|
||||
EaseOut,
|
||||
EaseInOut,
|
||||
BounceIn,
|
||||
BounceOut,
|
||||
}
|
||||
|
||||
public enum Style
|
||||
{
|
||||
Once,
|
||||
Loop,
|
||||
PingPong,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tweening method used.
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public Method method = Method.Linear;
|
||||
|
||||
/// <summary>
|
||||
/// Does it play once? Does it loop?
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public Style style = Style.Once;
|
||||
|
||||
/// <summary>
|
||||
/// Optional curve to apply to the tween's time factor value.
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public AnimationCurve animationCurve = new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f));
|
||||
|
||||
/// <summary>
|
||||
/// Whether the tween will ignore the timescale, making it work while the game is paused.
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public bool ignoreTimeScale = true;
|
||||
|
||||
/// <summary>
|
||||
/// How long will the tweener wait before starting the tween?
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public float delay = 0f;
|
||||
|
||||
public enum DelayAffects
|
||||
{
|
||||
Forward,
|
||||
Reverse,
|
||||
Both,
|
||||
}
|
||||
|
||||
[HideInInspector]
|
||||
public DelayAffects delayAffects = DelayAffects.Both;
|
||||
|
||||
/// <summary>
|
||||
/// How long is the duration of the tween?
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public float duration = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the tweener will use steeper curves for ease in / out style interpolation.
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public bool steeperCurves = false;
|
||||
|
||||
/// <summary>
|
||||
/// Used by buttons and tween sequences. Group of '0' means not in a sequence.
|
||||
/// </summary>
|
||||
|
||||
[HideInInspector]
|
||||
public int tweenGroup = 0;
|
||||
|
||||
[Tooltip("By default, Update() will be used for tweening. Setting this to 'true' will make the tween happen in FixedUpdate() insted.")]
|
||||
public bool useFixedUpdate = false;
|
||||
|
||||
/// <summary>
|
||||
/// Event delegates called when the animation finishes.
|
||||
/// </summary>
|
||||
|
||||
//[HideInInspector]
|
||||
//public List<EventDelegate> onFinished = new List<EventDelegate>();
|
||||
|
||||
// Deprecated functionality, kept for backwards compatibility
|
||||
[HideInInspector] public GameObject eventReceiver;
|
||||
[HideInInspector] public string callWhenFinished;
|
||||
|
||||
/// <summary>
|
||||
/// Custom time scale for this tween, if desired. Can be used to slow down or speed up the animation.
|
||||
/// </summary>
|
||||
|
||||
[System.NonSerialized] public float timeScale = 1f;
|
||||
|
||||
bool mStarted = false;
|
||||
float mStartTime = 0f;
|
||||
float mDuration = 0f;
|
||||
float mAmountPerDelta = 1000f;
|
||||
float mFactor = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Amount advanced per delta time.
|
||||
/// </summary>
|
||||
|
||||
public float amountPerDelta
|
||||
{
|
||||
get
|
||||
{
|
||||
if (duration == 0f) return 1000f;
|
||||
|
||||
if (mDuration != duration)
|
||||
{
|
||||
mDuration = duration;
|
||||
mAmountPerDelta = Mathf.Abs(1f / duration) * Mathf.Sign(mAmountPerDelta);
|
||||
}
|
||||
return mAmountPerDelta;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tween factor, 0-1 range.
|
||||
/// </summary>
|
||||
|
||||
public float tweenFactor { get { return mFactor; } set { mFactor = Mathf.Clamp01(value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Direction that the tween is currently playing in.
|
||||
/// </summary>
|
||||
|
||||
//public AnimationOrTween.Direction direction { get { return amountPerDelta < 0f ? AnimationOrTween.Direction.Reverse : AnimationOrTween.Direction.Forward; } }
|
||||
|
||||
/// <summary>
|
||||
/// This function is called by Unity when you add a component. Automatically set the starting values for convenience.
|
||||
/// </summary>
|
||||
|
||||
void Reset ()
|
||||
{
|
||||
if (!mStarted)
|
||||
{
|
||||
SetStartToCurrentValue();
|
||||
SetEndToCurrentValue();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update as soon as it's started so that there is no delay.
|
||||
/// </summary>
|
||||
|
||||
protected virtual void Start () { DoUpdate(); }
|
||||
protected void Update () { if (!useFixedUpdate) DoUpdate(); }
|
||||
protected void FixedUpdate () { if (useFixedUpdate) DoUpdate(); }
|
||||
|
||||
/// <summary>
|
||||
/// Update the tweening factor and call the virtual update function.
|
||||
/// </summary>
|
||||
|
||||
protected void DoUpdate ()
|
||||
{
|
||||
float delta = ignoreTimeScale && !useFixedUpdate ? Time.unscaledDeltaTime : Time.deltaTime;
|
||||
float time = ignoreTimeScale && !useFixedUpdate ? Time.unscaledTime : Time.time;
|
||||
|
||||
if (!mStarted)
|
||||
{
|
||||
delta = 0;
|
||||
mStarted = true;
|
||||
mStartTime = time;
|
||||
if (mAmountPerDelta > 0f && (delayAffects == DelayAffects.Both || delayAffects == DelayAffects.Forward)) mStartTime += delay;
|
||||
else if (mAmountPerDelta < 0f && (delayAffects == DelayAffects.Both || delayAffects == DelayAffects.Reverse)) mStartTime += delay;
|
||||
}
|
||||
|
||||
if (time < mStartTime) return;
|
||||
|
||||
// Advance the sampling factor
|
||||
mFactor += (duration == 0f) ? 1f : amountPerDelta * delta * timeScale;
|
||||
|
||||
// Loop style simply resets the play factor after it exceeds 1.
|
||||
if (style == Style.Loop)
|
||||
{
|
||||
if (mFactor > 1f)
|
||||
{
|
||||
mFactor -= Mathf.Floor(mFactor);
|
||||
}
|
||||
}
|
||||
else if (style == Style.PingPong)
|
||||
{
|
||||
// Ping-pong style reverses the direction
|
||||
if (mFactor > 1f)
|
||||
{
|
||||
mFactor = 1f - (mFactor - Mathf.Floor(mFactor));
|
||||
mAmountPerDelta = -mAmountPerDelta;
|
||||
}
|
||||
else if (mFactor < 0f)
|
||||
{
|
||||
mFactor = -mFactor;
|
||||
mFactor -= Mathf.Floor(mFactor);
|
||||
mAmountPerDelta = -mAmountPerDelta;
|
||||
}
|
||||
}
|
||||
|
||||
// If the factor goes out of range and this is a one-time tweening operation, disable the script
|
||||
if ((style == Style.Once) && (duration == 0f || mFactor > 1f || mFactor < 0f))
|
||||
{
|
||||
mFactor = Mathf.Clamp01(mFactor);
|
||||
Sample(mFactor, true);
|
||||
enabled = false;
|
||||
|
||||
if (current != this)
|
||||
{
|
||||
UITweener before = current;
|
||||
current = this;
|
||||
|
||||
//if (onFinished != null)
|
||||
//{
|
||||
// mTemp = onFinished;
|
||||
// onFinished = new List<EventDelegate>();
|
||||
|
||||
// // Notify the listener delegates
|
||||
// EventDelegate.Execute(mTemp);
|
||||
|
||||
// // Re-add the previous persistent delegates
|
||||
// for (int i = 0; i < mTemp.Count; ++i)
|
||||
// {
|
||||
// EventDelegate ed = mTemp[i];
|
||||
// if (ed != null && !ed.oneShot) EventDelegate.Add(onFinished, ed, ed.oneShot);
|
||||
// }
|
||||
// mTemp = null;
|
||||
//}
|
||||
|
||||
// Deprecated legacy functionality support
|
||||
if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
|
||||
eventReceiver.SendMessage(callWhenFinished, this, SendMessageOptions.DontRequireReceiver);
|
||||
|
||||
current = before;
|
||||
}
|
||||
}
|
||||
else Sample(mFactor, false);
|
||||
}
|
||||
|
||||
//List<EventDelegate> mTemp = null;
|
||||
|
||||
/// <summary>
|
||||
/// Convenience function -- set a new OnFinished event delegate (here for to be consistent with RemoveOnFinished).
|
||||
/// </summary>
|
||||
|
||||
//public void SetOnFinished (EventDelegate.Callback del) { EventDelegate.Set(onFinished, del); }
|
||||
|
||||
///// <summary>
|
||||
///// Convenience function -- set a new OnFinished event delegate (here for to be consistent with RemoveOnFinished).
|
||||
///// </summary>
|
||||
|
||||
//public void SetOnFinished (EventDelegate del) { EventDelegate.Set(onFinished, del); }
|
||||
|
||||
///// <summary>
|
||||
///// Convenience function -- add a new OnFinished event delegate (here for to be consistent with RemoveOnFinished).
|
||||
///// </summary>
|
||||
|
||||
//public void AddOnFinished (EventDelegate.Callback del) { EventDelegate.Add(onFinished, del); }
|
||||
|
||||
///// <summary>
|
||||
///// Convenience function -- add a new OnFinished event delegate (here for to be consistent with RemoveOnFinished).
|
||||
///// </summary>
|
||||
|
||||
//public void AddOnFinished (EventDelegate del) { EventDelegate.Add(onFinished, del); }
|
||||
|
||||
///// <summary>
|
||||
///// Remove an OnFinished delegate. Will work even while iterating through the list when the tweener has finished its operation.
|
||||
///// </summary>
|
||||
|
||||
//public void RemoveOnFinished (EventDelegate del)
|
||||
//{
|
||||
// if (onFinished != null) onFinished.Remove(del);
|
||||
// if (mTemp != null) mTemp.Remove(del);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Mark as not started when finished to enable delay on next play.
|
||||
/// </summary>
|
||||
|
||||
protected virtual void OnDisable () { mStarted = false; }
|
||||
|
||||
/// <summary>
|
||||
/// Immediately finish the tween animation, if it's active.
|
||||
/// </summary>
|
||||
|
||||
public void Finish ()
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
Sample(mAmountPerDelta > 0f ? 1f : 0f, true);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sample the tween at the specified factor.
|
||||
/// </summary>
|
||||
|
||||
public void Sample (float factor, bool isFinished)
|
||||
{
|
||||
// Calculate the sampling value
|
||||
float val = Mathf.Clamp01(factor);
|
||||
|
||||
if (method == Method.EaseIn)
|
||||
{
|
||||
val = 1f - Mathf.Sin(0.5f * Mathf.PI * (1f - val));
|
||||
if (steeperCurves) val *= val;
|
||||
}
|
||||
else if (method == Method.EaseOut)
|
||||
{
|
||||
val = Mathf.Sin(0.5f * Mathf.PI * val);
|
||||
|
||||
if (steeperCurves)
|
||||
{
|
||||
val = 1f - val;
|
||||
val = 1f - val * val;
|
||||
}
|
||||
}
|
||||
else if (method == Method.EaseInOut)
|
||||
{
|
||||
const float pi2 = Mathf.PI * 2f;
|
||||
val = val - Mathf.Sin(val * pi2) / pi2;
|
||||
|
||||
if (steeperCurves)
|
||||
{
|
||||
val = val * 2f - 1f;
|
||||
float sign = Mathf.Sign(val);
|
||||
val = 1f - Mathf.Abs(val);
|
||||
val = 1f - val * val;
|
||||
val = sign * val * 0.5f + 0.5f;
|
||||
}
|
||||
}
|
||||
else if (method == Method.BounceIn)
|
||||
{
|
||||
val = BounceLogic(val);
|
||||
}
|
||||
else if (method == Method.BounceOut)
|
||||
{
|
||||
val = 1f - BounceLogic(1f - val);
|
||||
}
|
||||
|
||||
// Call the virtual update
|
||||
OnUpdate((animationCurve != null) ? animationCurve.Evaluate(val) : val, isFinished);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Main Bounce logic to simplify the Sample function
|
||||
/// </summary>
|
||||
|
||||
float BounceLogic (float val)
|
||||
{
|
||||
if (val < 0.363636f) // 0.363636 = (1/ 2.75)
|
||||
{
|
||||
val = 7.5685f * val * val;
|
||||
}
|
||||
else if (val < 0.727272f) // 0.727272 = (2 / 2.75)
|
||||
{
|
||||
val = 7.5625f * (val -= 0.545454f) * val + 0.75f; // 0.545454f = (1.5 / 2.75)
|
||||
}
|
||||
else if (val < 0.909090f) // 0.909090 = (2.5 / 2.75)
|
||||
{
|
||||
val = 7.5625f * (val -= 0.818181f) * val + 0.9375f; // 0.818181 = (2.25 / 2.75)
|
||||
}
|
||||
else
|
||||
{
|
||||
val = 7.5625f * (val -= 0.9545454f) * val + 0.984375f; // 0.9545454 = (2.625 / 2.75)
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play the tween.
|
||||
/// </summary>
|
||||
|
||||
[System.Obsolete("Use PlayForward() instead")]
|
||||
public void Play () { Play(true); }
|
||||
|
||||
/// <summary>
|
||||
/// Play the tween forward.
|
||||
/// </summary>
|
||||
|
||||
[ContextMenu("Play forward")]
|
||||
public void PlayForward () { Play(true); }
|
||||
|
||||
/// <summary>
|
||||
/// Play the tween in reverse.
|
||||
/// </summary>
|
||||
|
||||
[ContextMenu("Play in reverse")]
|
||||
public void PlayReverse () { Play(false); }
|
||||
|
||||
/// <summary>
|
||||
/// Manually activate the tweening process, reversing it if necessary.
|
||||
/// </summary>
|
||||
|
||||
public virtual void Play (bool forward)
|
||||
{
|
||||
mAmountPerDelta = Mathf.Abs(amountPerDelta);
|
||||
if (!forward) mAmountPerDelta = -mAmountPerDelta;
|
||||
|
||||
if (!enabled)
|
||||
{
|
||||
enabled = true;
|
||||
mStarted = false;
|
||||
}
|
||||
|
||||
DoUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manually reset the tweener's state to the beginning.
|
||||
/// If the tween is playing forward, this means the tween's start.
|
||||
/// If the tween is playing in reverse, this means the tween's end.
|
||||
/// </summary>
|
||||
|
||||
public void ResetToBeginning ()
|
||||
{
|
||||
mStarted = false;
|
||||
mFactor = (amountPerDelta < 0f) ? 1f : 0f;
|
||||
Sample(mFactor, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manually start the tweening process, reversing its direction.
|
||||
/// </summary>
|
||||
|
||||
public void Toggle ()
|
||||
{
|
||||
if (mFactor > 0f)
|
||||
{
|
||||
mAmountPerDelta = -amountPerDelta;
|
||||
}
|
||||
else
|
||||
{
|
||||
mAmountPerDelta = Mathf.Abs(amountPerDelta);
|
||||
}
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Actual tweening logic should go here.
|
||||
/// </summary>
|
||||
|
||||
abstract protected void OnUpdate (float factor, bool isFinished);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the tweening operation.
|
||||
/// </summary>
|
||||
|
||||
static public T Begin<T> (GameObject go, float duration, float delay = 0f) where T : UITweener
|
||||
{
|
||||
T comp = go.GetComponent<T>();
|
||||
#if UNITY_FLASH
|
||||
if ((object)comp == null) comp = (T)go.AddComponent<T>();
|
||||
#else
|
||||
// Find the tween with an unset group ID (group ID of 0).
|
||||
if (comp != null && comp.tweenGroup != 0)
|
||||
{
|
||||
comp = null;
|
||||
T[] comps = go.GetComponents<T>();
|
||||
for (int i = 0, imax = comps.Length; i < imax; ++i)
|
||||
{
|
||||
comp = comps[i];
|
||||
if (comp != null && comp.tweenGroup == 0) break;
|
||||
comp = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (comp == null)
|
||||
{
|
||||
comp = go.AddComponent<T>();
|
||||
|
||||
if (comp == null)
|
||||
{
|
||||
//Debug.LogError("Unable to add " + typeof(T) + " to " + NGUITools.GetHierarchy(go), go);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
comp.mStarted = false;
|
||||
comp.mFactor = 0f;
|
||||
comp.duration = duration;
|
||||
comp.mDuration = duration;
|
||||
comp.delay = delay;
|
||||
comp.mAmountPerDelta = duration > 0f ? Mathf.Abs(1f / duration) : 1000f;
|
||||
comp.style = Style.Once;
|
||||
comp.animationCurve = new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f));
|
||||
comp.eventReceiver = null;
|
||||
comp.callWhenFinished = null;
|
||||
//comp.onFinished.Clear();
|
||||
//if (comp.mTemp != null) comp.mTemp.Clear();
|
||||
comp.enabled = true;
|
||||
return comp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the 'from' value to the current one.
|
||||
/// </summary>
|
||||
|
||||
public virtual void SetStartToCurrentValue () { }
|
||||
|
||||
/// <summary>
|
||||
/// Set the 'to' value to the current one.
|
||||
/// </summary>
|
||||
|
||||
public virtual void SetEndToCurrentValue () { }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c96860f5597f2494abb42d29cdca0bcc
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public enum UIAdaptType
|
||||
{
|
||||
All,
|
||||
LeftOrTop,
|
||||
RightOrBottom,
|
||||
}
|
||||
|
||||
public class UIAdapter : MonoBehaviour
|
||||
{
|
||||
public UIAdaptType uIAdaptType = UIAdaptType.All;
|
||||
|
||||
private float cd;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// 为避免旋转屏幕,华为分屏机等导致分辨率变化,且安全区变化的问题,需要持续检测
|
||||
if (Time.time > cd)
|
||||
{
|
||||
InitAdapter();
|
||||
cd = Time.time + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitAdapter()
|
||||
{
|
||||
var safeArea = Screen.safeArea;
|
||||
if (UIManager.Instance != null)
|
||||
{
|
||||
safeArea = UIManager.Instance.GetSafeArea();
|
||||
}
|
||||
var orientation = Screen.orientation;
|
||||
RectTransform rectTransform = transform as RectTransform;
|
||||
rectTransform.sizeDelta = Vector2.zero;
|
||||
if (orientation == ScreenOrientation.LandscapeLeft || orientation == ScreenOrientation.LandscapeRight)
|
||||
{
|
||||
switch (uIAdaptType)
|
||||
{
|
||||
case UIAdaptType.All:
|
||||
rectTransform.anchorMin = new Vector2(safeArea.xMin / Screen.width, 0);
|
||||
rectTransform.anchorMax = new Vector2(safeArea.xMax / Screen.width, 1);
|
||||
break;
|
||||
case UIAdaptType.LeftOrTop:
|
||||
if (orientation == ScreenOrientation.LandscapeLeft)
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(safeArea.xMin / Screen.width, 0);
|
||||
rectTransform.anchorMax = new Vector2(1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, 0);
|
||||
rectTransform.anchorMax = new Vector2(safeArea.xMax / Screen.width, 1);
|
||||
}
|
||||
break;
|
||||
case UIAdaptType.RightOrBottom:
|
||||
if (orientation == ScreenOrientation.LandscapeLeft)
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, 0);
|
||||
rectTransform.anchorMax = new Vector2(safeArea.xMax / Screen.width, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(safeArea.xMin / Screen.width, 0);
|
||||
rectTransform.anchorMax = new Vector2(1, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (orientation == ScreenOrientation.Portrait || orientation == ScreenOrientation.PortraitUpsideDown)
|
||||
{
|
||||
switch (uIAdaptType)
|
||||
{
|
||||
case UIAdaptType.All:
|
||||
rectTransform.anchorMin = new Vector2(0 , safeArea.yMin / Screen.height);
|
||||
rectTransform.anchorMax = new Vector2(1 , safeArea.yMax / Screen.height);
|
||||
break;
|
||||
case UIAdaptType.LeftOrTop:
|
||||
if (orientation == ScreenOrientation.Portrait)
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, 0);
|
||||
rectTransform.anchorMax = new Vector2(1, safeArea.yMax / Screen.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, safeArea.yMin / Screen.height);
|
||||
rectTransform.anchorMax = new Vector2(1, 1);
|
||||
}
|
||||
break;
|
||||
case UIAdaptType.RightOrBottom:
|
||||
if (orientation == ScreenOrientation.Portrait)
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, safeArea.yMin / Screen.height);
|
||||
rectTransform.anchorMax = new Vector2(1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.anchorMin = new Vector2(0, 0);
|
||||
rectTransform.anchorMax = new Vector2(1, safeArea.yMax / Screen.height);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efc1aaf05b906ac48b36dd28888f9aac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dac5f0f85d3930749ac016d6ed29b9dd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 957bc409a9e47584c9c0a315f5c05a0d
|
||||
folderAsset: yes
|
||||
timeCreated: 1525057340
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40733aef832e3a84b84ae9a5b3f74895
|
||||
folderAsset: yes
|
||||
timeCreated: 1521786329
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd170bc15e34a094c8609532aedcc7c9
|
||||
timeCreated: 1521786330
|
||||
licenseType: Pro
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontName: Microsoft YaHei Mono
|
||||
fontNames:
|
||||
- Microsoft YaHei Mono
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e54e612c85cb2f0438f3fc6849b64d93
|
||||
timeCreated: 1525054737
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb2d64fbaaa8623488f623d8f26434cf
|
||||
timeCreated: 1521786517
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1020 B |
@@ -0,0 +1,68 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 086dc3a35eb33bb47af413530fc6ef08
|
||||
timeCreated: 1525056854
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 1022 B |
@@ -0,0 +1,68 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88cc2c445d716b24bbe3d9c0acb15a50
|
||||
timeCreated: 1525056966
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 257f5e1b9bfd2bc488d6eee4c486ed96
|
||||
folderAsset: yes
|
||||
timeCreated: 1525057347
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class ControlBindingAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc9a6b6a055f0641b7a35a2accd6a7b
|
||||
timeCreated: 1521661617
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public interface IBindableUI
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 658cc57fff0c29c40a634f2c5ac937cb
|
||||
timeCreated: 1525934273
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class SubUIBindingAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 745e76df505d0d3479057f4f389793de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,116 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
# else
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class UIBindingPrefabSaveHelper : UnityEditor.AssetModificationProcessor
|
||||
{
|
||||
static UIBindingPrefabSaveHelper()
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
PrefabStage.prefabSaving += OnPrefabStageSaving;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
/// <summary>
|
||||
/// 当点击Perfab编辑场景的Save按钮时修改数据不会立刻保存,因此需要在其执行前主动保存一下
|
||||
/// </summary>
|
||||
/// <param name="go"></param>
|
||||
static void OnPrefabStageSaving(GameObject go)
|
||||
{
|
||||
string path = AssetDatabase.GetAssetPath(go);
|
||||
OnWillSaveAssets(new string[] { path });
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// 保存资源时修正控件绑定数据
|
||||
/// </summary>
|
||||
/// <param name="paths"></param>
|
||||
/// <returns></returns>
|
||||
static string[] OnWillSaveAssets(string[] paths)
|
||||
{
|
||||
GameObject goInHierarchy = Selection.activeGameObject;
|
||||
if(goInHierarchy != null)
|
||||
{
|
||||
// 从根节点开始遍历,以免当前prefab有多个子UI修改时无法被全部修正
|
||||
var rootTran = goInHierarchy.transform;
|
||||
while (rootTran.parent != null)
|
||||
rootTran = rootTran.parent;
|
||||
|
||||
UIControlData[] uiControlData = rootTran.GetComponentsInChildren<UIControlData>();
|
||||
if (uiControlData != null)
|
||||
{
|
||||
foreach (var comp in uiControlData)
|
||||
{
|
||||
comp.CorrectComponents();
|
||||
comp.CheckSubUIs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
public static void SavePrefab(GameObject goInHierarchy)
|
||||
{
|
||||
Object goPrefab = null;
|
||||
GameObject objValid = null;
|
||||
GameObject objToCheck = goInHierarchy;
|
||||
string prefabPath = null;
|
||||
|
||||
do
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
var currPrefab = PrefabUtility.GetCorrespondingObjectFromSource(objToCheck);
|
||||
#else
|
||||
var currPrefab = PrefabUtility.GetPrefabParent(objToCheck);
|
||||
#endif
|
||||
|
||||
if (currPrefab == null)
|
||||
break;
|
||||
|
||||
string currPath = AssetDatabase.GetAssetPath(currPrefab);
|
||||
if (prefabPath == null)
|
||||
prefabPath = currPath;
|
||||
|
||||
if (currPath != prefabPath) // 已经到root或者当前是嵌套prefab并且已经到达上一层prefab
|
||||
break;
|
||||
|
||||
goPrefab = currPrefab;
|
||||
objValid = objToCheck;
|
||||
|
||||
var t = objToCheck.transform.parent;
|
||||
if (t != null)
|
||||
objToCheck = t.gameObject;
|
||||
else
|
||||
break;
|
||||
} while (true);
|
||||
|
||||
if (objValid != null)
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
goPrefab = PrefabUtility.SaveAsPrefabAssetAndConnect(objValid, prefabPath, InteractionMode.AutomatedAction);
|
||||
#else
|
||||
PrefabUtility.ReplacePrefab(goInHierarchy, goPrefab, ReplacePrefabOptions.ConnectToPrefab);
|
||||
#endif
|
||||
else
|
||||
Debug.LogFormat("<color=red>当前对象不属于Prefab, 请将其保存为 Prefab</color>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d989bc73e59c344988d9b2d2e11acb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,740 @@
|
||||
/*
|
||||
URL: https://github.com/Misaka-Mikoto-Tech/UIControlBinding
|
||||
使用方法:
|
||||
UE: 将此脚本添加到UI根节点,与程序协商好需要绑定的控件及其变量名后,将需要绑定的控件拖到脚本上
|
||||
程序: 点此脚本右上角的齿轮,点 "复制代码到剪贴板" 按钮
|
||||
|
||||
UIManager 加载示例:
|
||||
`` C#
|
||||
IBindableUI uiA = Activator.CreateInstance(Type.GetType("UIA")) as IBindableUI;
|
||||
GameObject prefab = Resources.Load<GameObject>("UI/UIA"); // you can get ui config from config file
|
||||
GameObject go = Instantiate(prefab);
|
||||
UIControlData ctrlData = go.GetComponent<UIControlData>();
|
||||
if(ctrlData != null)
|
||||
{
|
||||
ctrlData.BindDataTo(uiA);
|
||||
}
|
||||
``
|
||||
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Text;
|
||||
#if XLUA
|
||||
using XLua;
|
||||
#endif
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine.Playables;
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
/// <summary>
|
||||
/// 单个控件数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CtrlItemData
|
||||
{
|
||||
public string name = string.Empty;
|
||||
#if UNITY_EDITOR
|
||||
[HideInInspector]
|
||||
public string type = string.Empty;
|
||||
#endif
|
||||
public UnityEngine.Object[] targets = new UnityEngine.Object[1];
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单个子UI数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SubUIItemData
|
||||
{
|
||||
public string name = string.Empty;
|
||||
public UIControlData subUIData = null;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 被绑定的UI类字段信息
|
||||
/// </summary>
|
||||
public class UIFieldsInfo
|
||||
{
|
||||
public Type type;
|
||||
public List<FieldInfo> controls = new List<FieldInfo>(10);
|
||||
public List<FieldInfo> subUIs = new List<FieldInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前UI所有的绑定数据以及子UI指定
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
public class UIControlData : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 所有绑定的组件,不允许重名
|
||||
/// </summary>
|
||||
public List<CtrlItemData> ctrlItemDatas;
|
||||
/// <summary>
|
||||
/// 子UI数据
|
||||
/// </summary>
|
||||
public List<SubUIItemData> subUIItemDatas;
|
||||
|
||||
/// <summary>
|
||||
/// 被绑定的UI
|
||||
/// </summary>
|
||||
public List<WeakReference<IBindableUI>> bindUIRefs;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存所有打开过的UI类型的字段数据(如果有需求可以在特定时机清理以节约内存)
|
||||
/// </summary>
|
||||
public static Dictionary<Type, UIFieldsInfo> s_uiFieldsCache = new Dictionary<Type, UIFieldsInfo>();
|
||||
|
||||
#region Editor
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// 已知类型列表,自定义类型可以添加到下面指定区域
|
||||
/// </summary>
|
||||
private static Dictionary<string, Type> _typeMap = new Dictionary<string, Type>()
|
||||
{
|
||||
{ "TextMeshProUGUI", typeof(TMPro.TextMeshProUGUI) },
|
||||
{ "TextMeshPro", typeof(TMPro.TextMeshPro) },
|
||||
{ "TMP_InputField", typeof(TMPro.TMP_InputField) },
|
||||
{ "TMP_Dropdown", typeof(TMPro.TMP_Dropdown) },
|
||||
{ "Text", typeof(Text)},
|
||||
{ "RawImage", typeof(RawImage)},
|
||||
{ "Button", typeof(Button)},
|
||||
{ "Toggle", typeof(Toggle)},
|
||||
{ "Slider", typeof(Slider)},
|
||||
{ "Scrollbar", typeof(Scrollbar)},
|
||||
{ "Dropdown", typeof(Dropdown)},
|
||||
{ "InputField", typeof(InputField)},
|
||||
{ "Canvas", typeof(Canvas)},
|
||||
{ "UIScrollView", typeof(UIScrollView) },
|
||||
{ "ScrollRect", typeof(ScrollRect)},
|
||||
{ "SpriteRenderer", typeof(SpriteRenderer)},
|
||||
{ "GridLayoutGroup", typeof(GridLayoutGroup) },
|
||||
{ "Animation", typeof(Animation) },
|
||||
{ "VideoPlayer", typeof(UnityEngine.Video.VideoPlayer) },
|
||||
{ "CanvasGroup", typeof(CanvasGroup) },
|
||||
{ "PlayableDirector", typeof(PlayableDirector) },
|
||||
{ "UITweener", typeof(UITweener) },
|
||||
|
||||
////////自定义控件类型请放这里////////
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
{ "Image", typeof(Image)},
|
||||
{ "RectTransform", typeof(RectTransform)},
|
||||
{ "Transform", typeof(Transform)},
|
||||
{ "GameObject", typeof(GameObject)},
|
||||
};
|
||||
|
||||
public static string[] GetAllTypeNames()
|
||||
{
|
||||
string[] keys = new string[_typeMap.Count + 1];
|
||||
keys[0] = "自动";
|
||||
_typeMap.Keys.CopyTo(keys, 1);
|
||||
return keys;
|
||||
}
|
||||
|
||||
public static Type[] GetAllTypes()
|
||||
{
|
||||
Type[] types = new Type[_typeMap.Count + 1];
|
||||
types[0] = typeof(UnityEngine.Object);
|
||||
_typeMap.Values.CopyTo(types, 1);
|
||||
return types;
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region BindDataToC#UI
|
||||
/// <summary>
|
||||
/// 将当前数据绑定到某窗口类实例的字段,UI 加载后必须被执行
|
||||
/// </summary>
|
||||
/// <param name="ui">需要绑定数据的 UI</param>
|
||||
public void BindDataTo(IBindableUI ui)
|
||||
{
|
||||
if (ui == null)
|
||||
return;
|
||||
|
||||
#if DEBUG_LOG
|
||||
float time = Time.realtimeSinceStartup;
|
||||
Profiler.BeginSample("BindDataTo");
|
||||
#endif
|
||||
UIFieldsInfo fieldInfos = GetUIFieldsInfo(ui.GetType());
|
||||
|
||||
var controls = fieldInfos.controls;
|
||||
for (int i = 0, imax = controls.Count; i < imax; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BindCtrl(ui, controls[i]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
var subUIs = fieldInfos.subUIs;
|
||||
for (int i = 0, imax = subUIs.Count; i < imax; i++)
|
||||
BindSubUI(ui, subUIs[i]);
|
||||
|
||||
if (bindUIRefs == null)
|
||||
bindUIRefs = new List<WeakReference<IBindableUI>>();
|
||||
|
||||
bindUIRefs.Add(new WeakReference<IBindableUI>(ui));
|
||||
|
||||
#if DEBUG_LOG
|
||||
Profiler.EndSample();
|
||||
float span = Time.realtimeSinceStartup - time;
|
||||
if (span > 0.002f)
|
||||
Debug.LogWarningFormat("BindDataTo {0} 耗时{1}ms", ui.GetType().Name, span * 1000f);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void BindCtrl(IBindableUI ui, FieldInfo fi)
|
||||
{
|
||||
int itemIdx = GetCtrlIndex(fi.Name);
|
||||
if (itemIdx == -1)
|
||||
{
|
||||
Debug.LogWarningFormat("can not find binding control of name [{0}] in prefab", fi.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
var objs = ctrlItemDatas[itemIdx];
|
||||
|
||||
Type fieldType = fi.FieldType;
|
||||
if (fieldType.IsArray)
|
||||
{
|
||||
Array arrObj = Array.CreateInstance(fieldType.GetElementType(), objs.targets.Length);
|
||||
|
||||
// 给数组元素设置数据
|
||||
for (int j = 0, jmax = objs.targets.Length; j < jmax; j++)
|
||||
{
|
||||
if (objs.targets[j] != null)
|
||||
arrObj.SetValue(objs.targets[j], j);
|
||||
else
|
||||
Debug.LogErrorFormat("Component {0}[{1}] is null", objs.name, j);
|
||||
}
|
||||
fi.SetValue(ui, arrObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object component = GetComponent(itemIdx);
|
||||
if (component != null)
|
||||
fi.SetValue(ui, component);
|
||||
else
|
||||
Debug.LogErrorFormat("Component {0} is null", objs.name);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindSubUI(IBindableUI ui, FieldInfo fi)
|
||||
{
|
||||
int subUIIdx = GetSubUIIndex(fi.Name);
|
||||
if(subUIIdx == -1)
|
||||
{
|
||||
Debug.LogErrorFormat("can not find binding subUI of name [{0}] in prefab", fi.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
fi.SetValue(ui, subUIItemDatas[subUIIdx].subUIData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定UI类的字段信息
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private static UIFieldsInfo GetUIFieldsInfo(Type type)
|
||||
{
|
||||
UIFieldsInfo uIFieldsInfo;
|
||||
if (s_uiFieldsCache.TryGetValue(type, out uIFieldsInfo))
|
||||
return uIFieldsInfo;
|
||||
|
||||
uIFieldsInfo = new UIFieldsInfo() { type = type };
|
||||
FieldInfo[] fis = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
for(int i = 0, imax = fis.Length; i < imax; i++)
|
||||
{
|
||||
FieldInfo fi = fis[i];
|
||||
|
||||
if (fi.IsDefined(typeof(ControlBindingAttribute), false))
|
||||
uIFieldsInfo.controls.Add(fi);
|
||||
else if (fi.IsDefined(typeof(SubUIBindingAttribute), false))
|
||||
uIFieldsInfo.subUIs.Add(fi);
|
||||
}
|
||||
|
||||
s_uiFieldsCache.Add(type, uIFieldsInfo);
|
||||
|
||||
return uIFieldsInfo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region UnBind
|
||||
private static List<UIControlData> s_tmpControlDataForUnbind = new List<UIControlData>();
|
||||
/// <summary>
|
||||
/// 解除指定UI及其子节点自动绑定字段的引用
|
||||
/// </summary>
|
||||
/// <param name="uiGo"></param>
|
||||
public static void UnBindUI(GameObject uiGo)
|
||||
{
|
||||
if (uiGo == null)
|
||||
return;
|
||||
|
||||
#if DEBUG_LOG
|
||||
float time = Time.realtimeSinceStartup;
|
||||
Profiler.BeginSample("UnBindUI");
|
||||
#endif
|
||||
|
||||
uiGo.GetComponentsInChildren(true, s_tmpControlDataForUnbind);
|
||||
for (int i = 0, imax = s_tmpControlDataForUnbind.Count; i < imax; i++)
|
||||
{
|
||||
UIControlData controlData = s_tmpControlDataForUnbind[i];
|
||||
if (controlData.bindUIRefs == null)
|
||||
continue;
|
||||
|
||||
List<WeakReference<IBindableUI>> bindUIRefs = controlData.bindUIRefs;
|
||||
for (int j = 0, jmax = bindUIRefs.Count; j < jmax; j++)
|
||||
{
|
||||
WeakReference<IBindableUI> bindUIRef = bindUIRefs[j];
|
||||
IBindableUI bindUI;
|
||||
if (!bindUIRef.TryGetTarget(out bindUI))
|
||||
continue;
|
||||
}
|
||||
|
||||
controlData.bindUIRefs = null;
|
||||
}
|
||||
s_tmpControlDataForUnbind.Clear();
|
||||
|
||||
#if DEBUG_LOG
|
||||
Profiler.EndSample();
|
||||
float span = Time.realtimeSinceStartup - time;
|
||||
if (span > 0.002f)
|
||||
Debug.LogWarningFormat("UnBindUI {0} 耗时{1}ms", uiGo.name, span * 1000f);
|
||||
#endif
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get,不建议使用
|
||||
|
||||
/// <summary>
|
||||
/// 找到指定名称的第一个组件, 不存在返回 null
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public T GetComponent<T>(string name) where T : Component
|
||||
{
|
||||
int idx = GetCtrlIndex(name);
|
||||
if (idx == -1)
|
||||
return null;
|
||||
|
||||
var targets = ctrlItemDatas[idx].targets;
|
||||
if (targets.Length == 0)
|
||||
return null;
|
||||
|
||||
return targets[0] as T;
|
||||
}
|
||||
|
||||
public new UnityEngine.Object GetComponent(string name)
|
||||
{
|
||||
int idx = GetCtrlIndex(name);
|
||||
if (idx == -1)
|
||||
return null;
|
||||
|
||||
var targets = ctrlItemDatas[idx].targets;
|
||||
if (targets.Length == 0)
|
||||
return null;
|
||||
|
||||
return targets[0];
|
||||
}
|
||||
|
||||
public UnityEngine.Object GetComponent(int idx)
|
||||
{
|
||||
if (idx == -1 || idx >= ctrlItemDatas.Count)
|
||||
return null;
|
||||
|
||||
var targets = ctrlItemDatas[idx].targets;
|
||||
if (targets.Length == 0)
|
||||
return null;
|
||||
|
||||
return targets[0];
|
||||
}
|
||||
|
||||
public UnityEngine.Object[] GetComponents(string name)
|
||||
{
|
||||
int idx = GetCtrlIndex(name);
|
||||
if (idx == -1)
|
||||
return null;
|
||||
|
||||
return ctrlItemDatas[idx].targets;
|
||||
}
|
||||
|
||||
public UnityEngine.Object[] GetComponents(int idx)
|
||||
{
|
||||
if (idx == -1 || idx >= ctrlItemDatas.Count)
|
||||
return null;
|
||||
|
||||
return ctrlItemDatas[idx].targets;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int GetCtrlIndex(string name)
|
||||
{
|
||||
for (int i = 0, imax = ctrlItemDatas.Count; i < imax; i++)
|
||||
{
|
||||
CtrlItemData item = ctrlItemDatas[i];
|
||||
if (item.name == name)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int GetSubUIIndex(string name)
|
||||
{
|
||||
for(int i = 0, imax = subUIItemDatas.Count; i < imax; i++)
|
||||
{
|
||||
SubUIItemData item = subUIItemDatas[i];
|
||||
if (item.name == name)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region For Editor
|
||||
#if UNITY_EDITOR
|
||||
|
||||
public bool dataHasChanged = false;
|
||||
|
||||
public bool CorrectComponents()
|
||||
{
|
||||
if (ctrlItemDatas == null) return true;
|
||||
|
||||
bool isOK = true;
|
||||
for(int i = 0, imax = ctrlItemDatas.Count; i < imax; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ctrlItemDatas[i].name)) // TODO Check if is a valid varible name
|
||||
{
|
||||
Debug.LogErrorFormat("[{1}]第 {0} 个控件没有名字,请修正", i + 1, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int j = ctrlItemDatas.Count - 1; j >= 0; j--)
|
||||
{
|
||||
if(ctrlItemDatas[i].name == ctrlItemDatas[j].name && i != j)
|
||||
{
|
||||
Debug.LogErrorFormat("[{3}]控件名字 [{0}] 第 {1} 项与第 {2} 项重复,请修正", ctrlItemDatas[i].name, i + 1, j + 1, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isOK = ReplaceTargetsToUIComponent();
|
||||
if(isOK)
|
||||
Debug.LogFormat("[{0}]控件绑定修正完毕", gameObject.name);
|
||||
|
||||
return isOK;
|
||||
}
|
||||
|
||||
public bool CheckSubUIs()
|
||||
{
|
||||
for (int i = 0, imax = subUIItemDatas.Count; i < imax; i++)
|
||||
{
|
||||
var subUI = subUIItemDatas[i];
|
||||
if(subUI != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(subUI.name))
|
||||
{
|
||||
Debug.LogErrorFormat("[{0}]第 {1} 个子UI没有设置名字, 请修正", gameObject.name, i + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(subUI.subUIData == null)
|
||||
{
|
||||
Debug.LogErrorFormat("[{0}]第 {1} 个子UI没有赋值, 请修正", gameObject.name, i + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 必须拖当前 Prefab 下的子UI
|
||||
if (!IsInCurrentPrefab(subUI.subUIData.transform))
|
||||
{
|
||||
Debug.LogErrorFormat("[{0}]第 {1} 个子UI [{2}]不是当前 Prefab 下的对象,请修正", gameObject.name, i + 1, subUI.name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("internal error at ControlBinding, pls contact author");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 由于自动拖上去的对象永远都是 GameObject,所以我们需要把它修正为正确的对象类型
|
||||
/// </summary>
|
||||
private bool ReplaceTargetsToUIComponent()
|
||||
{
|
||||
for (int i = 0, imax = ctrlItemDatas.Count; i < imax; i++)
|
||||
{
|
||||
var objs = ctrlItemDatas[i].targets;
|
||||
Type type = null;
|
||||
for(int j = 0, jmax = objs.Length; j < jmax; j++)
|
||||
{
|
||||
if(objs[j] == null)
|
||||
{
|
||||
Debug.LogErrorFormat("[{2}]控件名字 [{0}] 第 {1} 项为空,请修正", ctrlItemDatas[i].name, j + 1, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObject go = objs[j] as GameObject;
|
||||
if (go == null)
|
||||
go = (objs[j] as Component).gameObject;
|
||||
|
||||
// 必须拖当前 Prefab 下的控件
|
||||
if (!IsInCurrentPrefab(go.transform))
|
||||
{
|
||||
Debug.LogErrorFormat("[{2}]控件名字 [{0}] 第 {1} 项不是当前 Prefab 下的控件,请修正", ctrlItemDatas[i].name, j + 1, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
UnityEngine.Object correctComponent = FindCorrectComponent(go, ctrlItemDatas[i].type);
|
||||
if(correctComponent == null)
|
||||
{
|
||||
Debug.LogErrorFormat("[{3}]控件 [{0}] 第 {1} 项不是 {2} 类型,请修正", ctrlItemDatas[i].name, j + 1, ctrlItemDatas[i].type, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (type == null) // 当前变量的第一个控件时执行
|
||||
{
|
||||
if (string.IsNullOrEmpty(ctrlItemDatas[i].type))
|
||||
{
|
||||
type = correctComponent.GetType();
|
||||
}else
|
||||
{
|
||||
if(!_typeMap.TryGetValue(ctrlItemDatas[i].type, out type))
|
||||
{
|
||||
Debug.LogError("Internal Error, pls contact author");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(correctComponent.GetType() != type && !correctComponent.GetType().IsSubclassOf(type))
|
||||
{
|
||||
Debug.LogErrorFormat("[{2}]控件名字 [{0}] 第 {1} 项与第 1 项的类型不同,请修正", ctrlItemDatas[i].name, j + 1, gameObject.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (objs[j] != correctComponent)
|
||||
dataHasChanged = true;
|
||||
|
||||
objs[j] = correctComponent;
|
||||
}
|
||||
|
||||
if(type.Name != ctrlItemDatas[i].type)
|
||||
{
|
||||
ctrlItemDatas[i].type = type.Name;
|
||||
//#if UNITY_2019_1_OR_NEWER
|
||||
// EditorUtility.ClearDirty(this);
|
||||
//#endif
|
||||
EditorUtility.SetDirty(this);
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(this);
|
||||
}
|
||||
ctrlItemDatas[i].type = type.Name;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsInCurrentPrefab(Transform t)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (t == transform)
|
||||
return true;
|
||||
t = t.parent;
|
||||
} while (t != null);
|
||||
return false;
|
||||
}
|
||||
|
||||
private UnityEngine.Object FindCorrectComponent(GameObject go, string typename)
|
||||
{
|
||||
if (typename == "GameObject")
|
||||
return go;
|
||||
|
||||
List<Component> components = new List<Component>();
|
||||
go.GetComponents(components);
|
||||
|
||||
Func<Type, Component> getSpecialTypeComp = (Type t) =>
|
||||
{
|
||||
foreach (var comp in components)
|
||||
{
|
||||
Type compType = comp.GetType();
|
||||
if (compType == t || compType.IsSubclassOf(t))
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Component newComp = null;
|
||||
|
||||
if (string.IsNullOrEmpty(typename))
|
||||
{
|
||||
// 类型名为空则为自动类型,在 _typeMap 里从上往下找
|
||||
foreach (var kv in _typeMap)
|
||||
{
|
||||
newComp = getSpecialTypeComp(kv.Value);
|
||||
if (newComp != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{// 指定了类型名则只找指定类型的控件
|
||||
Type type = null;
|
||||
if (_typeMap.TryGetValue(typename, out type))
|
||||
{
|
||||
newComp = getSpecialTypeComp(type);
|
||||
}
|
||||
}
|
||||
|
||||
return newComp;
|
||||
}
|
||||
|
||||
private bool IsNeedSave()
|
||||
{
|
||||
foreach(var ctrl in ctrlItemDatas)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ctrl.type))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
[ContextMenu("复制代码到剪贴板(Private)")]
|
||||
public void CopyCodeToClipBoardPrivate()
|
||||
{
|
||||
CopyCodeToClipBoardImpl("private");
|
||||
}
|
||||
|
||||
[ContextMenu("复制代码到剪贴板(Protected)")]
|
||||
public void CopyCodeToClipBoardProtected()
|
||||
{
|
||||
CopyCodeToClipBoardImpl("protected");
|
||||
}
|
||||
|
||||
[ContextMenu("复制代码到剪贴板(Public)")]
|
||||
public void CopyCodeToClipBoardPublic()
|
||||
{
|
||||
CopyCodeToClipBoardImpl("public");
|
||||
}
|
||||
|
||||
private void CopyCodeToClipBoardImpl(string accessLevel)
|
||||
{
|
||||
// 调用保存资源会导致 prefab 发生变化,因此只有有需要时才保存
|
||||
if (IsNeedSave())
|
||||
UIBindingPrefabSaveHelper.SavePrefab(gameObject);
|
||||
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.AppendLine("#region 控件绑定变量声明,自动生成请勿手改");
|
||||
sb.AppendLine("\t\t#pragma warning disable 0649"); // 变量未赋值
|
||||
|
||||
foreach (var ctrl in ctrlItemDatas)
|
||||
{
|
||||
if (ctrl.targets.Length == 0)
|
||||
continue;
|
||||
|
||||
if (ctrl.targets.Length == 1)
|
||||
sb.AppendFormat("\t\t[ControlBinding]\r\n\t\t{0} {1} {2};\r\n", accessLevel, ctrl.type, ctrl.name);
|
||||
else
|
||||
sb.AppendFormat("\t\t[ControlBinding]\r\n\t\t{0} {1}[] {2};\r\n", accessLevel, ctrl.type, ctrl.name);
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
foreach(var subUI in subUIItemDatas)
|
||||
{
|
||||
sb.AppendFormat("\t\t[SubUIBinding]\r\n\t\t{0} UIControlData {1};\r\n", accessLevel, subUI.name);
|
||||
}
|
||||
sb.AppendLine("\t\t#pragma warning restore 0649");
|
||||
sb.Append("#endregion\r\n\r\n");
|
||||
|
||||
UnityEngine.GUIUtility.systemCopyBuffer = sb.ToString();
|
||||
}
|
||||
|
||||
[ContextMenu("复制代码到剪贴板(Lua)")]
|
||||
public void CopyCodeToClipBoardLua()
|
||||
{
|
||||
// 调用保存资源会导致 prefab 发生变化,因此只有有需要时才保存
|
||||
if (IsNeedSave())
|
||||
UIBindingPrefabSaveHelper.SavePrefab(gameObject);
|
||||
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.Append("-- 控件绑定变量声明,自动生成请勿手改\r\n");
|
||||
|
||||
foreach (var ctrl in ctrlItemDatas)
|
||||
{
|
||||
if (ctrl.targets.Length == 0)
|
||||
continue;
|
||||
|
||||
sb.AppendFormat("local {0}\r\n", ctrl.name);
|
||||
}
|
||||
|
||||
sb.AppendFormat("\r\n");
|
||||
sb.AppendFormat("-- SubUI\r\n");
|
||||
foreach (var subUI in subUIItemDatas)
|
||||
{
|
||||
sb.AppendFormat("local {0}\r\n", subUI.name);
|
||||
}
|
||||
sb.Append("-- 控件绑定定义结束\r\n\r\n");
|
||||
|
||||
UnityEngine.GUIUtility.systemCopyBuffer = sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
public void SetDirty()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(gameObject);
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetPrefabStage(gameObject);
|
||||
#else
|
||||
var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetPrefabStage(gameObject);
|
||||
#endif
|
||||
if (prefabStage != null)
|
||||
{
|
||||
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(prefabStage.scene);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bec254e92978598418e38c0641bcd88c
|
||||
timeCreated: 1521658864
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||