com.kyrylokuzyk.primetween 1.3.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/Documentation/material_prop_block.png +0 -0
- package/Documentation/material_prop_block.png.meta +130 -0
- package/Documentation/tween_animation_component.png +0 -0
- package/Documentation/tween_animation_component.png.meta +3 -0
- package/Documentation/tween_animation_inspector.png +0 -0
- package/Documentation/tween_animation_inspector.png.meta +3 -0
- package/Editor/Icons/d_state.png +0 -0
- package/Editor/Icons/d_state.png.meta +130 -0
- package/Editor/Icons/state.png +0 -0
- package/Editor/Icons/state.png.meta +130 -0
- package/Editor/Icons.meta +8 -0
- package/Editor/PrimeTween.Editor.asmdef +1 -1
- package/Editor/Tests/PrimeTween.Tests.Editor.asmdef +1 -1
- package/Editor/ValueContainerStartEndPropDrawer.cs +18 -5
- package/Runtime/Internal/Constants.cs +2 -0
- package/Runtime/Internal/CoroutinesSupport.cs +43 -35
- package/Runtime/Internal/PrimeTweenManager.cs +22 -10
- package/Runtime/Internal/TweenData.cs +1 -1
- package/Runtime/Internal/TweenGenerated.cs +447 -447
- package/Runtime/Internal/TweenMethods.cs +2 -2
- package/Runtime/Internal/UnmanagedTweenData.cs +0 -4
- package/Runtime/Internal/Utils.cs +166 -166
- package/Runtime/PrimeTween.Runtime.asmdef +1 -1
- package/Tests/PrimeTween.Tests.asmdef +1 -1
- package/Tests/Tweens.cs +25 -4
- package/Tests/YieldInstructionsClash_.cs +2 -3
- package/changelog.md +12 -0
- package/package.json +2 -2
- package/readme.md +87 -20
package/.attestation.p7m
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 07eb16170b8675a4692a02dbb545b790
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 13
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 1
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
flipGreenChannel: 0
|
|
24
|
+
isReadable: 0
|
|
25
|
+
streamingMipmaps: 0
|
|
26
|
+
streamingMipmapsPriority: 0
|
|
27
|
+
vTOnly: 0
|
|
28
|
+
ignoreMipmapLimit: 0
|
|
29
|
+
grayScaleToAlpha: 0
|
|
30
|
+
generateCubemap: 6
|
|
31
|
+
cubemapConvolution: 0
|
|
32
|
+
seamlessCubemap: 0
|
|
33
|
+
textureFormat: 1
|
|
34
|
+
maxTextureSize: 2048
|
|
35
|
+
textureSettings:
|
|
36
|
+
serializedVersion: 2
|
|
37
|
+
filterMode: 1
|
|
38
|
+
aniso: 1
|
|
39
|
+
mipBias: 0
|
|
40
|
+
wrapU: 0
|
|
41
|
+
wrapV: 0
|
|
42
|
+
wrapW: 0
|
|
43
|
+
nPOTScale: 1
|
|
44
|
+
lightmap: 0
|
|
45
|
+
compressionQuality: 50
|
|
46
|
+
spriteMode: 0
|
|
47
|
+
spriteExtrude: 1
|
|
48
|
+
spriteMeshType: 1
|
|
49
|
+
alignment: 0
|
|
50
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
51
|
+
spritePixelsToUnits: 100
|
|
52
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
53
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
54
|
+
alphaUsage: 1
|
|
55
|
+
alphaIsTransparency: 0
|
|
56
|
+
spriteTessellationDetail: -1
|
|
57
|
+
textureType: 0
|
|
58
|
+
textureShape: 1
|
|
59
|
+
singleChannelComponent: 0
|
|
60
|
+
flipbookRows: 1
|
|
61
|
+
flipbookColumns: 1
|
|
62
|
+
maxTextureSizeSet: 0
|
|
63
|
+
compressionQualitySet: 0
|
|
64
|
+
textureFormatSet: 0
|
|
65
|
+
ignorePngGamma: 0
|
|
66
|
+
applyGammaDecoding: 0
|
|
67
|
+
swizzle: 50462976
|
|
68
|
+
cookieLightType: 0
|
|
69
|
+
platformSettings:
|
|
70
|
+
- serializedVersion: 4
|
|
71
|
+
buildTarget: DefaultTexturePlatform
|
|
72
|
+
maxTextureSize: 2048
|
|
73
|
+
resizeAlgorithm: 0
|
|
74
|
+
textureFormat: -1
|
|
75
|
+
textureCompression: 1
|
|
76
|
+
compressionQuality: 50
|
|
77
|
+
crunchedCompression: 0
|
|
78
|
+
allowsAlphaSplitting: 0
|
|
79
|
+
overridden: 0
|
|
80
|
+
ignorePlatformSupport: 0
|
|
81
|
+
androidETC2FallbackOverride: 0
|
|
82
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
83
|
+
- serializedVersion: 4
|
|
84
|
+
buildTarget: Standalone
|
|
85
|
+
maxTextureSize: 2048
|
|
86
|
+
resizeAlgorithm: 0
|
|
87
|
+
textureFormat: -1
|
|
88
|
+
textureCompression: 1
|
|
89
|
+
compressionQuality: 50
|
|
90
|
+
crunchedCompression: 0
|
|
91
|
+
allowsAlphaSplitting: 0
|
|
92
|
+
overridden: 0
|
|
93
|
+
ignorePlatformSupport: 0
|
|
94
|
+
androidETC2FallbackOverride: 0
|
|
95
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
96
|
+
- serializedVersion: 4
|
|
97
|
+
buildTarget: Android
|
|
98
|
+
maxTextureSize: 2048
|
|
99
|
+
resizeAlgorithm: 0
|
|
100
|
+
textureFormat: -1
|
|
101
|
+
textureCompression: 1
|
|
102
|
+
compressionQuality: 50
|
|
103
|
+
crunchedCompression: 0
|
|
104
|
+
allowsAlphaSplitting: 0
|
|
105
|
+
overridden: 0
|
|
106
|
+
ignorePlatformSupport: 0
|
|
107
|
+
androidETC2FallbackOverride: 0
|
|
108
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
109
|
+
spriteSheet:
|
|
110
|
+
serializedVersion: 2
|
|
111
|
+
sprites: []
|
|
112
|
+
outline: []
|
|
113
|
+
customData:
|
|
114
|
+
physicsShape: []
|
|
115
|
+
bones: []
|
|
116
|
+
spriteID:
|
|
117
|
+
internalID: 0
|
|
118
|
+
vertices: []
|
|
119
|
+
indices:
|
|
120
|
+
edges: []
|
|
121
|
+
weights: []
|
|
122
|
+
secondaryTextures: []
|
|
123
|
+
spriteCustomMetadata:
|
|
124
|
+
entries: []
|
|
125
|
+
nameFileIdTable: {}
|
|
126
|
+
mipmapLimitGroupName:
|
|
127
|
+
pSDRemoveMatte: 0
|
|
128
|
+
userData:
|
|
129
|
+
assetBundleName:
|
|
130
|
+
assetBundleVariant:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 65e62c88b7b0740439a7c4c5811cb5e7
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 13
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 0
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
flipGreenChannel: 0
|
|
24
|
+
isReadable: 0
|
|
25
|
+
streamingMipmaps: 0
|
|
26
|
+
streamingMipmapsPriority: 0
|
|
27
|
+
vTOnly: 0
|
|
28
|
+
ignoreMipmapLimit: 0
|
|
29
|
+
grayScaleToAlpha: 0
|
|
30
|
+
generateCubemap: 6
|
|
31
|
+
cubemapConvolution: 0
|
|
32
|
+
seamlessCubemap: 0
|
|
33
|
+
textureFormat: 1
|
|
34
|
+
maxTextureSize: 2048
|
|
35
|
+
textureSettings:
|
|
36
|
+
serializedVersion: 2
|
|
37
|
+
filterMode: 1
|
|
38
|
+
aniso: 1
|
|
39
|
+
mipBias: 0
|
|
40
|
+
wrapU: 1
|
|
41
|
+
wrapV: 1
|
|
42
|
+
wrapW: 1
|
|
43
|
+
nPOTScale: 0
|
|
44
|
+
lightmap: 0
|
|
45
|
+
compressionQuality: 50
|
|
46
|
+
spriteMode: 0
|
|
47
|
+
spriteExtrude: 1
|
|
48
|
+
spriteMeshType: 1
|
|
49
|
+
alignment: 0
|
|
50
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
51
|
+
spritePixelsToUnits: 100
|
|
52
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
53
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
54
|
+
alphaUsage: 1
|
|
55
|
+
alphaIsTransparency: 1
|
|
56
|
+
spriteTessellationDetail: -1
|
|
57
|
+
textureType: 2
|
|
58
|
+
textureShape: 1
|
|
59
|
+
singleChannelComponent: 0
|
|
60
|
+
flipbookRows: 1
|
|
61
|
+
flipbookColumns: 1
|
|
62
|
+
maxTextureSizeSet: 0
|
|
63
|
+
compressionQualitySet: 0
|
|
64
|
+
textureFormatSet: 0
|
|
65
|
+
ignorePngGamma: 0
|
|
66
|
+
applyGammaDecoding: 0
|
|
67
|
+
swizzle: 50462976
|
|
68
|
+
cookieLightType: 0
|
|
69
|
+
platformSettings:
|
|
70
|
+
- serializedVersion: 4
|
|
71
|
+
buildTarget: DefaultTexturePlatform
|
|
72
|
+
maxTextureSize: 64
|
|
73
|
+
resizeAlgorithm: 0
|
|
74
|
+
textureFormat: -1
|
|
75
|
+
textureCompression: 1
|
|
76
|
+
compressionQuality: 50
|
|
77
|
+
crunchedCompression: 0
|
|
78
|
+
allowsAlphaSplitting: 0
|
|
79
|
+
overridden: 0
|
|
80
|
+
ignorePlatformSupport: 0
|
|
81
|
+
androidETC2FallbackOverride: 0
|
|
82
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
83
|
+
- serializedVersion: 4
|
|
84
|
+
buildTarget: Standalone
|
|
85
|
+
maxTextureSize: 2048
|
|
86
|
+
resizeAlgorithm: 0
|
|
87
|
+
textureFormat: -1
|
|
88
|
+
textureCompression: 1
|
|
89
|
+
compressionQuality: 50
|
|
90
|
+
crunchedCompression: 0
|
|
91
|
+
allowsAlphaSplitting: 0
|
|
92
|
+
overridden: 0
|
|
93
|
+
ignorePlatformSupport: 0
|
|
94
|
+
androidETC2FallbackOverride: 0
|
|
95
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
96
|
+
- serializedVersion: 4
|
|
97
|
+
buildTarget: Android
|
|
98
|
+
maxTextureSize: 2048
|
|
99
|
+
resizeAlgorithm: 0
|
|
100
|
+
textureFormat: -1
|
|
101
|
+
textureCompression: 1
|
|
102
|
+
compressionQuality: 50
|
|
103
|
+
crunchedCompression: 0
|
|
104
|
+
allowsAlphaSplitting: 0
|
|
105
|
+
overridden: 0
|
|
106
|
+
ignorePlatformSupport: 0
|
|
107
|
+
androidETC2FallbackOverride: 0
|
|
108
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
109
|
+
spriteSheet:
|
|
110
|
+
serializedVersion: 2
|
|
111
|
+
sprites: []
|
|
112
|
+
outline: []
|
|
113
|
+
customData:
|
|
114
|
+
physicsShape: []
|
|
115
|
+
bones: []
|
|
116
|
+
spriteID:
|
|
117
|
+
internalID: 0
|
|
118
|
+
vertices: []
|
|
119
|
+
indices:
|
|
120
|
+
edges: []
|
|
121
|
+
weights: []
|
|
122
|
+
secondaryTextures: []
|
|
123
|
+
spriteCustomMetadata:
|
|
124
|
+
entries: []
|
|
125
|
+
nameFileIdTable: {}
|
|
126
|
+
mipmapLimitGroupName:
|
|
127
|
+
pSDRemoveMatte: 0
|
|
128
|
+
userData:
|
|
129
|
+
assetBundleName:
|
|
130
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 60130589774ea9b44a3400de50c16e83
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 13
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 0
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
flipGreenChannel: 0
|
|
24
|
+
isReadable: 0
|
|
25
|
+
streamingMipmaps: 0
|
|
26
|
+
streamingMipmapsPriority: 0
|
|
27
|
+
vTOnly: 0
|
|
28
|
+
ignoreMipmapLimit: 0
|
|
29
|
+
grayScaleToAlpha: 0
|
|
30
|
+
generateCubemap: 6
|
|
31
|
+
cubemapConvolution: 0
|
|
32
|
+
seamlessCubemap: 0
|
|
33
|
+
textureFormat: 1
|
|
34
|
+
maxTextureSize: 2048
|
|
35
|
+
textureSettings:
|
|
36
|
+
serializedVersion: 2
|
|
37
|
+
filterMode: 1
|
|
38
|
+
aniso: 1
|
|
39
|
+
mipBias: 0
|
|
40
|
+
wrapU: 1
|
|
41
|
+
wrapV: 1
|
|
42
|
+
wrapW: 1
|
|
43
|
+
nPOTScale: 0
|
|
44
|
+
lightmap: 0
|
|
45
|
+
compressionQuality: 50
|
|
46
|
+
spriteMode: 0
|
|
47
|
+
spriteExtrude: 1
|
|
48
|
+
spriteMeshType: 1
|
|
49
|
+
alignment: 0
|
|
50
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
51
|
+
spritePixelsToUnits: 100
|
|
52
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
53
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
54
|
+
alphaUsage: 1
|
|
55
|
+
alphaIsTransparency: 1
|
|
56
|
+
spriteTessellationDetail: -1
|
|
57
|
+
textureType: 2
|
|
58
|
+
textureShape: 1
|
|
59
|
+
singleChannelComponent: 0
|
|
60
|
+
flipbookRows: 1
|
|
61
|
+
flipbookColumns: 1
|
|
62
|
+
maxTextureSizeSet: 0
|
|
63
|
+
compressionQualitySet: 0
|
|
64
|
+
textureFormatSet: 0
|
|
65
|
+
ignorePngGamma: 0
|
|
66
|
+
applyGammaDecoding: 0
|
|
67
|
+
swizzle: 50462976
|
|
68
|
+
cookieLightType: 0
|
|
69
|
+
platformSettings:
|
|
70
|
+
- serializedVersion: 4
|
|
71
|
+
buildTarget: DefaultTexturePlatform
|
|
72
|
+
maxTextureSize: 64
|
|
73
|
+
resizeAlgorithm: 0
|
|
74
|
+
textureFormat: -1
|
|
75
|
+
textureCompression: 1
|
|
76
|
+
compressionQuality: 50
|
|
77
|
+
crunchedCompression: 0
|
|
78
|
+
allowsAlphaSplitting: 0
|
|
79
|
+
overridden: 0
|
|
80
|
+
ignorePlatformSupport: 0
|
|
81
|
+
androidETC2FallbackOverride: 0
|
|
82
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
83
|
+
- serializedVersion: 4
|
|
84
|
+
buildTarget: Standalone
|
|
85
|
+
maxTextureSize: 2048
|
|
86
|
+
resizeAlgorithm: 0
|
|
87
|
+
textureFormat: -1
|
|
88
|
+
textureCompression: 1
|
|
89
|
+
compressionQuality: 50
|
|
90
|
+
crunchedCompression: 0
|
|
91
|
+
allowsAlphaSplitting: 0
|
|
92
|
+
overridden: 0
|
|
93
|
+
ignorePlatformSupport: 0
|
|
94
|
+
androidETC2FallbackOverride: 0
|
|
95
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
96
|
+
- serializedVersion: 4
|
|
97
|
+
buildTarget: Android
|
|
98
|
+
maxTextureSize: 2048
|
|
99
|
+
resizeAlgorithm: 0
|
|
100
|
+
textureFormat: -1
|
|
101
|
+
textureCompression: 1
|
|
102
|
+
compressionQuality: 50
|
|
103
|
+
crunchedCompression: 0
|
|
104
|
+
allowsAlphaSplitting: 0
|
|
105
|
+
overridden: 0
|
|
106
|
+
ignorePlatformSupport: 0
|
|
107
|
+
androidETC2FallbackOverride: 0
|
|
108
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
109
|
+
spriteSheet:
|
|
110
|
+
serializedVersion: 2
|
|
111
|
+
sprites: []
|
|
112
|
+
outline: []
|
|
113
|
+
customData:
|
|
114
|
+
physicsShape: []
|
|
115
|
+
bones: []
|
|
116
|
+
spriteID:
|
|
117
|
+
internalID: 0
|
|
118
|
+
vertices: []
|
|
119
|
+
indices:
|
|
120
|
+
edges: []
|
|
121
|
+
weights: []
|
|
122
|
+
secondaryTextures: []
|
|
123
|
+
spriteCustomMetadata:
|
|
124
|
+
entries: []
|
|
125
|
+
nameFileIdTable: {}
|
|
126
|
+
mipmapLimitGroupName:
|
|
127
|
+
pSDRemoveMatte: 0
|
|
128
|
+
userData:
|
|
129
|
+
assetBundleName:
|
|
130
|
+
assetBundleVariant:
|
|
@@ -69,10 +69,10 @@ public class ValueContainerStartEndPropDrawer : PropertyDrawer {
|
|
|
69
69
|
prop.Next(true);
|
|
70
70
|
var tweenType = (TweenType)prop.enumValueIndex;
|
|
71
71
|
prop.Next(false);
|
|
72
|
-
Draw(ref pos, prop, tweenType, true, true, _startValueGuiContent, _endValueGuiContent);
|
|
72
|
+
Draw(ref pos, prop, tweenType, true, true, _startValueGuiContent, _endValueGuiContent, null);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
internal static
|
|
75
|
+
internal static (int, TweenAnimation.ValueWrapper)? Draw(ref Rect pos, SerializedProperty prop, TweenType tweenType, bool drawStartFromCurrentToggle, bool invert, GUIContent startValueLabel, GUIContent endValueLabel, int? highlightId) {
|
|
76
76
|
var propType = Utils.TweenTypeToTweenData(tweenType).Item1;
|
|
77
77
|
Assert.AreNotEqual(PropType.None, propType);
|
|
78
78
|
|
|
@@ -113,19 +113,20 @@ public class ValueContainerStartEndPropDrawer : PropertyDrawer {
|
|
|
113
113
|
}
|
|
114
114
|
float height = GetSingleItemHeight(propType, startValueLabel);
|
|
115
115
|
using (new EditorGUI.DisabledScope(disableGui)) {
|
|
116
|
-
DrawValueContainer(ref pos, prop, propType, startValueLabel, height);
|
|
116
|
+
DrawValueContainer(ref pos, prop, propType, startValueLabel, height, null);
|
|
117
117
|
prop.Next(false);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing;
|
|
121
|
-
DrawValueContainer(ref pos, prop, propType, endValueLabel, height);
|
|
121
|
+
var endValueIfFocused = DrawValueContainer(ref pos, prop, propType, endValueLabel, height, highlightId);
|
|
122
122
|
pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing;
|
|
123
123
|
|
|
124
124
|
pos.x -= toggleWidth;
|
|
125
125
|
pos.width += toggleWidth;
|
|
126
|
+
return endValueIfFocused;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
static
|
|
129
|
+
static (int, TweenAnimation.ValueWrapper)? DrawValueContainer(ref Rect pos, SerializedProperty prop, PropType propType, GUIContent guiContent, float height, int? highlightId) {
|
|
129
130
|
Assert.IsNotNull(guiContent);
|
|
130
131
|
var root = prop.Copy();
|
|
131
132
|
prop.Next(true);
|
|
@@ -140,7 +141,18 @@ public class ValueContainerStartEndPropDrawer : PropertyDrawer {
|
|
|
140
141
|
pos.height = height;
|
|
141
142
|
|
|
142
143
|
using (var scope = new CustomPropertyScope(pos, guiContent, root)) {
|
|
144
|
+
Color origColor = GUI.backgroundColor;
|
|
145
|
+
int idBefore = GUIUtility.GetControlID(FocusType.Keyboard);
|
|
146
|
+
if (highlightId == idBefore) {
|
|
147
|
+
GUI.backgroundColor = EditorGUIUtility.isProSkin ? new Color(2f, 0.9f, 0.9f, 1f) : new Color(1f, 0.9f, 0.9f, 1f);
|
|
148
|
+
}
|
|
143
149
|
TweenAnimation.ValueWrapper newVal = DrawField(pos);
|
|
150
|
+
int idAfter = GUIUtility.GetControlID(FocusType.Keyboard);
|
|
151
|
+
GUI.backgroundColor = origColor;
|
|
152
|
+
|
|
153
|
+
bool isFocused = GUIUtility.keyboardControl > idBefore
|
|
154
|
+
&& GUIUtility.keyboardControl < idAfter;
|
|
155
|
+
|
|
144
156
|
TweenAnimation.ValueWrapper DrawField(Rect position) {
|
|
145
157
|
switch (propType) {
|
|
146
158
|
case PropType.Float:
|
|
@@ -179,6 +191,7 @@ public class ValueContainerStartEndPropDrawer : PropertyDrawer {
|
|
|
179
191
|
}
|
|
180
192
|
}
|
|
181
193
|
}
|
|
194
|
+
return isFocused ? (idBefore, newVal) : ((int, TweenAnimation.ValueWrapper)?)null;
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
}
|
|
@@ -61,5 +61,7 @@ namespace PrimeTween {
|
|
|
61
61
|
"NOTE: PrimeTween doesn't clear the MaterialPropertyBlock after animation completion to preserve the animated property at its endValue.\n" +
|
|
62
62
|
"As a result, directly modifying the Material property will have no effect since the MaterialPropertyBlock takes precedence.\n" +
|
|
63
63
|
"To modify the sharedMaterial property after animation completion, call 'renderer.SetPropertyBlock(null)' to clear the override.";
|
|
64
|
+
internal const string coroutineFinishedError = "IEnumerator.MoveNext() was called after animation coroutine has finished. This is not allowed.";
|
|
65
|
+
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using JetBrains.Annotations;
|
|
4
|
+
using UnityEngine;
|
|
4
5
|
|
|
5
6
|
namespace PrimeTween {
|
|
6
7
|
public partial struct Tween : IEnumerator {
|
|
7
|
-
/// <summary>Use this method to wait for
|
|
8
|
+
/// <summary>Use this method to wait for an animation in coroutines.<br/>
|
|
9
|
+
/// NOTE: stopping a coroutine early with StopCoroutine() (or destroying the parent MonoBehaviour) will prevent PrimeTween from reusing the returned IEnumerator and will leave it to GC to clean.<br/>
|
|
10
|
+
/// This means that stopping the coroutine while it's waiting for an animation will produce a small amount of GC garbage. Consider using `while (animation.isAlive) yield return null;` instead to prevent allocations in this case.</summary>
|
|
8
11
|
/// <example><code>
|
|
9
12
|
/// IEnumerator Coroutine() {
|
|
10
13
|
/// yield return Tween.Delay(1).ToYieldInstruction();
|
|
@@ -15,12 +18,18 @@ namespace PrimeTween {
|
|
|
15
18
|
if (!isAlive || !TryManipulate()) {
|
|
16
19
|
return Array.Empty<object>().GetEnumerator();
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
CoroutineIterator result;
|
|
23
|
+
var pool = PrimeTweenManager.Instance._coroutineIterators;
|
|
24
|
+
if (pool.Count > 0) {
|
|
25
|
+
result = pool[pool.Count - 1];
|
|
26
|
+
pool.RemoveAt(pool.Count - 1);
|
|
27
|
+
} else {
|
|
28
|
+
result = new CoroutineIterator();
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
Assert.IsFalse(result._tween.IsCreated);
|
|
31
|
+
result._tween = this;
|
|
32
|
+
return result;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
bool IEnumerator.MoveNext() {
|
|
@@ -38,25 +47,26 @@ namespace PrimeTween {
|
|
|
38
47
|
void IEnumerator.Reset() => throw new NotSupportedException();
|
|
39
48
|
}
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/// <example><code>
|
|
44
|
-
/// IEnumerator Coroutine() {
|
|
45
|
-
/// var sequence = Sequence.Create(Tween.Delay(1)).ChainCallback(() => Debug.Log("Done!"));
|
|
46
|
-
/// yield return sequence.ToYieldInstruction();
|
|
47
|
-
/// }
|
|
48
|
-
/// </code></example>
|
|
49
|
-
[NotNull]
|
|
50
|
-
public IEnumerator ToYieldInstruction() => root.ToYieldInstruction();
|
|
50
|
+
internal class CoroutineIterator : IEnumerator {
|
|
51
|
+
internal Tween _tween;
|
|
51
52
|
|
|
52
53
|
bool IEnumerator.MoveNext() {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
if (!_tween.IsCreated) {
|
|
55
|
+
Debug.LogError(Constants.coroutineFinishedError);
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (_tween.isAlive) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
// Return to pool only when a coroutine is iterated to the end. Else, leave the CoroutineIterator to be cleaned by GC
|
|
62
|
+
_tween = default;
|
|
63
|
+
PrimeTweenManager.Instance._coroutineIterators.Add(this);
|
|
64
|
+
return false;
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
object IEnumerator.Current {
|
|
58
68
|
get {
|
|
59
|
-
Assert.IsTrue(isAlive);
|
|
69
|
+
Assert.IsTrue(_tween.isAlive);
|
|
60
70
|
return null;
|
|
61
71
|
}
|
|
62
72
|
}
|
|
@@ -64,27 +74,25 @@ namespace PrimeTween {
|
|
|
64
74
|
void IEnumerator.Reset() => throw new NotSupportedException();
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
public partial struct Sequence : IEnumerator {
|
|
78
|
+
/// <inheritdoc cref="Tween.ToYieldInstruction"/>
|
|
79
|
+
/// <example><code>
|
|
80
|
+
/// IEnumerator Coroutine() {
|
|
81
|
+
/// var sequence = Sequence.Create(Tween.Delay(1)).ChainCallback(() => Debug.Log("Done!"));
|
|
82
|
+
/// yield return sequence.ToYieldInstruction();
|
|
83
|
+
/// }
|
|
84
|
+
/// </code></example>
|
|
85
|
+
[NotNull]
|
|
86
|
+
public IEnumerator ToYieldInstruction() => root.ToYieldInstruction();
|
|
75
87
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
88
|
+
bool IEnumerator.MoveNext() {
|
|
89
|
+
PrimeTweenManager.Instance.WarnStructBoxingInCoroutineOnce(id, root.tween);
|
|
90
|
+
return isAlive;
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
object IEnumerator.Current {
|
|
85
94
|
get {
|
|
86
|
-
Assert.IsTrue(
|
|
87
|
-
Assert.IsTrue(data.isInCoroutine);
|
|
95
|
+
Assert.IsTrue(isAlive);
|
|
88
96
|
return null;
|
|
89
97
|
}
|
|
90
98
|
}
|