Compare commits
459 Commits
Author | SHA1 | Date | |
---|---|---|---|
2784544884 | |||
c39a02a1c2 | |||
4c397ab2f7 | |||
6b3a9c9f0a | |||
1c1560f17f | |||
0699bc5614 | |||
d86da00258 | |||
d1ad68debe | |||
b937285a74 | |||
69fe03475b | |||
e5956f2b34 | |||
fdb4ab55a3 | |||
e30df8bdbc | |||
251b7bc352 | |||
61b72107ae | |||
d6208f19fb | |||
93d9fdd4b8 | |||
8670482c04 | |||
d2b71e41c9 | |||
29a8ac2136 | |||
a9fc5130bb | |||
b51c7d2352 | |||
56fd0936bb | |||
2b3898655f | |||
1b30d3e62c | |||
bdbb1fcb07 | |||
659f2165ff | |||
a5439430fb | |||
0f683e403c | |||
cf6a7a795b | |||
f664708165 | |||
a7be55f2b0 | |||
398cec1fc5 | |||
a8b9ba0af4 | |||
f54564c567 | |||
a2c5850fcd | |||
f4411629e4 | |||
17d620ff0c | |||
5887b1267a | |||
400723d83b | |||
07babcb0ff | |||
f7bfe07660 | |||
3690adf5dd | |||
48349b598d | |||
d6e3d3ad00 | |||
c57c82bdd1 | |||
4bc921d47e | |||
8907dd19b0 | |||
2221658e7a | |||
916c55b4b2 | |||
3d8a4a64a9 | |||
6cb36a7064 | |||
1fc5ea8ac6 | |||
6fd8e44d10 | |||
ff19b45a9f | |||
f467832115 | |||
0a25b5260d | |||
c877437ab6 | |||
676d19f452 | |||
fd7c1e6635 | |||
c98536e8ab | |||
a013d59379 | |||
2e69035618 | |||
072703efe7 | |||
0c796c4d7a | |||
ee4b0c5483 | |||
ba7a458e7c | |||
06d9df304e | |||
578e10bbd7 | |||
c685e634d5 | |||
824f401b77 | |||
aafc326f95 | |||
88a6410439 | |||
d6e1b19d32 | |||
6fa459e5d3 | |||
bde6216295 | |||
e03dbef5ff | |||
e2c683567e | |||
89f391f040 | |||
92a3d5018f | |||
d510fec57b | |||
054b17811d | |||
94d5f7f82e | |||
0e4445e52b | |||
c5214dd477 | |||
ed2c216cf4 | |||
609645c108 | |||
d280d27a0a | |||
5b727065f3 | |||
7aa2577059 | |||
c1b7e9ab55 | |||
99384397ed | |||
a2391aeb22 | |||
2207c80951 | |||
bf578d7cb9 | |||
0bc57c368f | |||
b64f85aaa2 | |||
93fa2f2d7e | |||
d72216de8b | |||
df5133a91a | |||
88b959a118 | |||
310bf91fbd | |||
699f47f98d | |||
24e881b138 | |||
2eef1b5c4e | |||
c18ceb50d4 | |||
27ca1a7292 | |||
dc59176eac | |||
aec7470ff8 | |||
983cba6843 | |||
871782e73f | |||
9aaa96fe10 | |||
22190a29c1 | |||
613ca467d0 | |||
536a3066b2 | |||
43488cd002 | |||
a11ccbd39c | |||
76df4929a7 | |||
505b826627 | |||
26a8675922 | |||
b89e1f983e | |||
717e77b47e | |||
2f10c79dee | |||
55f7790f89 | |||
ae5f4a8c16 | |||
1851bd3c54 | |||
6d74685cb7 | |||
03fd7f6d01 | |||
28c878f3e5 | |||
7736eba14d | |||
2e54b38d2b | |||
da60dc0903 | |||
215f72b3b5 | |||
a93c081dd8 | |||
456782930a | |||
ba3cbbd64c | |||
dfc3e9ca06 | |||
f567a2b78e | |||
c7e7bd8a77 | |||
67720fd0e1 | |||
1a30149942 | |||
a755cc13bd | |||
9a51cf1b56 | |||
256c656e9c | |||
2ac7f05316 | |||
28d46dbabe | |||
18b3e0bc84 | |||
23f2e7c1f2 | |||
998713b41f | |||
3561354231 | |||
0cccb170c1 | |||
d2480b8a6f | |||
6837d3f7ee | |||
3ecf3b4bfc | |||
1da8647ff1 | |||
2f19e8daad | |||
07f62c7aeb | |||
39db8dfa45 | |||
f04cd370f1 | |||
5c4acd54ce | |||
82dbc5c479 | |||
1f1663d714 | |||
a3c5392caa | |||
6c983cc2cb | |||
3bf3fdac3d | |||
f2f3dba098 | |||
3728360dd2 | |||
887837bb3d | |||
99b4c2dfc1 | |||
e59769158a | |||
ba3238614b | |||
a115999aab | |||
393947db9f | |||
e9b2a7f894 | |||
9c73455761 | |||
59c2210359 | |||
4fab20953a | |||
ee7b0f5081 | |||
33ee7a9a87 | |||
900bd7b77a | |||
6bd32c9aef | |||
13893b2853 | |||
23789c15eb | |||
a1f7418d32 | |||
274a823d02 | |||
ba6239068a | |||
ff8c925f32 | |||
2a6a33e60c | |||
8910b1f4a0 | |||
36dddea4d9 | |||
6a648c2dcd | |||
2d4087dc89 | |||
f91aacd78e | |||
9c08cbf0d2 | |||
88d35e4eaf | |||
675ce68073 | |||
db0165d145 | |||
7015426300 | |||
0d4cc5e208 | |||
e7ce0985fb | |||
eb6dafbd60 | |||
b6e238780e | |||
c7ea6f1d4b | |||
4a5b2a6889 | |||
b84d645aee | |||
67b44db1ae | |||
ee4399109a | |||
87ef534f59 | |||
87362b47c5 | |||
f60ba1088d | |||
abb7ad6f24 | |||
880b475c07 | |||
4707c40e6a | |||
7f87c23da2 | |||
6df10837fe | |||
42cb54de1d | |||
9fd685b8b3 | |||
b364005741 | |||
7d938de409 | |||
bb4ecfcd8c | |||
ff410529b0 | |||
fdc55a8e3b | |||
fc8512ff63 | |||
1b1ed42a1b | |||
b437925f92 | |||
c04e50e959 | |||
314cdb9935 | |||
77c91d015a | |||
291a018c13 | |||
18ff4b8e16 | |||
7714c277fd | |||
d6c2ac6be6 | |||
682fe38d40 | |||
3e525842cb | |||
3dd25b51a8 | |||
041c1e374e | |||
16b1d323dc | |||
c4d5e5f480 | |||
187f07d2c9 | |||
4e9d7e5b87 | |||
7df5b15e2e | |||
4863aa0ae7 | |||
eb53c3465b | |||
f683d61298 | |||
fbd03c8037 | |||
da68c8b877 | |||
c0744a3464 | |||
3ca3746cec | |||
5e76ddf2cd | |||
dca1ba304e | |||
8dd32afb74 | |||
313824b4bb | |||
b166c0f5ef | |||
300e44bd4b | |||
ab6f983392 | |||
596c6395e4 | |||
404a36f9b8 | |||
1711fbadf7 | |||
84b7a6d183 | |||
6d0fd0f9ec | |||
b407ba88c4 | |||
bd256ba1a6 | |||
623c53f79a | |||
969fdc8069 | |||
cbc874dd72 | |||
450bd52095 | |||
5727fcf177 | |||
8ab0c2698b | |||
6c7b52d93c | |||
91f55cd9a3 | |||
a1ce459a0e | |||
9700992c3a | |||
f9a1ea72fe | |||
507b656eab | |||
c16776aee9 | |||
e109e0bd24 | |||
776a615464 | |||
5514b6cf37 | |||
8932d1b8d0 | |||
10988847b3 | |||
c4b139c7a4 | |||
130896df1f | |||
5d5c519a1d | |||
3d1a11f78b | |||
cc985844cd | |||
feffbaa5a6 | |||
d0f0c8ce6d | |||
3fdc236b1d | |||
46870e163a | |||
601f64cc61 | |||
c015b60dc3 | |||
5e01b654bd | |||
2304257201 | |||
02794d88b9 | |||
9f73c8ffad | |||
c1c354959d | |||
94428d9e18 | |||
5198ecec1f | |||
6779b88055 | |||
c5dab3a232 | |||
a7608bcd7e | |||
be64bc76b5 | |||
39bc34fd42 | |||
4185303bd2 | |||
3280693e8f | |||
29432feabc | |||
86559c681e | |||
79f11b9c33 | |||
5b9149cb34 | |||
9d6bdd968f | |||
bc4fec33ef | |||
09e917dbe8 | |||
1003a0e199 | |||
e3a805b855 | |||
4222176979 | |||
43c87fba70 | |||
d0a23aaf30 | |||
a09a5686d7 | |||
609bb317d0 | |||
898fb7d557 | |||
c39f258a19 | |||
4fdd4e1935 | |||
7662011d60 | |||
c24372b308 | |||
5e4c53113a | |||
4f93995bbd | |||
5b14466059 | |||
1d3aa85446 | |||
6efe70d751 | |||
555c88855c | |||
105aacc133 | |||
ea9000f2b0 | |||
4e851d9b73 | |||
0a1e512f41 | |||
a7baef2c9d | |||
723ec937ad | |||
7c77ba83f8 | |||
6da4b96b24 | |||
e8f8593555 | |||
2b5bc5dd08 | |||
cf6186aa16 | |||
4d7773a2ac | |||
e8f74399f2 | |||
ca72f7adb5 | |||
5e19a8b886 | |||
a416f772d4 | |||
989a6b5554 | |||
732af15d9b | |||
8cdab36cd6 | |||
44180c7e0f | |||
e589e37640 | |||
94107de97d | |||
13c55dc23e | |||
617eddc030 | |||
7475b19547 | |||
0049ace91a | |||
356f4df9a9 | |||
ff5928b556 | |||
1f0ac2a2e9 | |||
95628f07d1 | |||
3bead4f1b3 | |||
ec9b23f797 | |||
8175ca7e82 | |||
451ebbe91a | |||
da2313ab57 | |||
c5571e7d17 | |||
959157255f | |||
06d8012675 | |||
571320630b | |||
207dee9932 | |||
d7b0ca77e9 | |||
e55642cdeb | |||
595fd74662 | |||
3f7becf580 | |||
5d17555744 | |||
e6d94f248c | |||
b0c70bc62e | |||
8eb0b11027 | |||
7f2cfe94c1 | |||
e4524bda0b | |||
226fb15eb1 | |||
645c4af2f2 | |||
6e0f41c7fd | |||
b9001ed9b2 | |||
04abf59521 | |||
251f92532d | |||
f5df56687b | |||
b582da90e5 | |||
815f48fe06 | |||
1470fa87dd | |||
4b4356aaab | |||
a8658856ca | |||
1477e907e6 | |||
f559cea826 | |||
d363042036 | |||
69e4ecd0a9 | |||
35d2e06625 | |||
358e654f51 | |||
d16548e570 | |||
c7201dd62c | |||
e43a0e62b7 | |||
4bcf76819c | |||
31155c909c | |||
ab2670358a | |||
3da70bdccc | |||
e370e1937c | |||
d9f6dd33d4 | |||
e5d6e549bd | |||
145c0ce6c8 | |||
a0174b94c6 | |||
109b489104 | |||
784c3fc338 | |||
77d6ac2caf | |||
321af22775 | |||
39ef9815e8 | |||
bb3afba11f | |||
e4fa160a90 | |||
34df9e2257 | |||
cfdb5f021e | |||
d08eea5c1e | |||
ce30b5427b | |||
e38fed89e9 | |||
d4b12bf3f7 | |||
40d75a91c6 | |||
388a41cb55 | |||
3b23f78960 | |||
4fce8369f0 | |||
373554912a | |||
46039f6a12 | |||
9b872654d5 | |||
2c4ac3191c | |||
20632d9b54 | |||
28cad97bbb | |||
75652ecff1 | |||
1734cf9b72 | |||
5eb9786a7c | |||
16be67dc75 | |||
a7dfaa4558 | |||
3b65dbea5b | |||
3ed7e566dd | |||
f3549353f3 | |||
78bb820f9e | |||
b954dda676 | |||
1be5cc77ca | |||
bf942cbe45 | |||
79bfd6764c | |||
dcc92bb024 | |||
15e9217f93 | |||
79240fdfe8 | |||
678e145271 | |||
5cdf10874e | |||
777b7d9c34 | |||
34b17f3111 | |||
fd9e2ce409 | |||
cd8aa0e65c | |||
5240408f00 | |||
a7e6522a57 | |||
d89e5a2e68 | |||
05124ac406 |
@@ -1,6 +1,9 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -68,3 +68,4 @@ crashlytics-build.properties
|
||||
/UserSettings
|
||||
/*.zip
|
||||
*.lnk
|
||||
/HybridCLRData
|
||||
|
Binary file not shown.
431
Assets/Animations/IConfig.anim
Normal file
431
Assets/Animations/IConfig.anim
Normal file
@@ -0,0 +1,431 @@
|
||||
%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: IConfig
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/MainContents
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
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: 1063882198
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 512889948
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 135068749
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3949350096
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1301050145
|
||||
attribute: 2089119715
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1301050145
|
||||
attribute: 2711263438
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.016666668
|
||||
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:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/MainContents
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66a6563760d5cfa47ac1057052043fa7
|
||||
timeCreated: 1610937108
|
||||
licenseType: Free
|
||||
guid: 2e0c61e29fd90f04b9e41265d93e2029
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
305
Assets/Animations/TConfig_Main.anim
Normal file
305
Assets/Animations/TConfig_Main.anim
Normal file
@@ -0,0 +1,305 @@
|
||||
%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: TConfig_Main
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/MainContents
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
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: 1063882198
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 512889948
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1301050145
|
||||
attribute: 2711263438
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1301050145
|
||||
attribute: 2089119715
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.33333334
|
||||
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:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/MainContents
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f86f8c4276028f142acd0a4c66dab3d1
|
||||
timeCreated: 1594270006
|
||||
licenseType: Pro
|
||||
guid: d815e4d844e6a1c4d849e96e199f8881
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
224
Assets/Animations/TMain_Config.anim
Normal file
224
Assets/Animations/TMain_Config.anim
Normal file
@@ -0,0 +1,224 @@
|
||||
%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: TMain_Config
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
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: 1301050145
|
||||
attribute: 2089119715
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1301050145
|
||||
attribute: 2711263438
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 1063882198
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.33333334
|
||||
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:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: -1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMin.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_AnchorMax.x
|
||||
path: Contents
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Contents/Config
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
8
Assets/Animations/TMain_Config.anim.meta
Normal file
8
Assets/Animations/TMain_Config.anim.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82867c59112ff5a419fbea2ebff2d3b9
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
Binary file not shown.
368
Assets/Animations/TSettings_.anim
Normal file
368
Assets/Animations/TSettings_.anim
Normal file
@@ -0,0 +1,368 @@
|
||||
%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: TSettings_
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0.88
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Pivot.y
|
||||
path: Settings
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.5019608
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Color.a
|
||||
path: SettingsOverlay
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
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: 135068749
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 473154195
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 473154195
|
||||
attribute: 2952582672
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 135068749
|
||||
attribute: 304273561
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
typeID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3949350096
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.33333334
|
||||
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:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0.88
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Pivot.y
|
||||
path: Settings
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.5019608
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Color.a
|
||||
path: SettingsOverlay
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
368
Assets/Animations/T_Settings.anim
Normal file
368
Assets/Animations/T_Settings.anim
Normal file
@@ -0,0 +1,368 @@
|
||||
%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: T_Settings
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.88
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Pivot.y
|
||||
path: Settings
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0.5019608
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Color.a
|
||||
path: SettingsOverlay
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
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: 473154195
|
||||
attribute: 2952582672
|
||||
script: {fileID: 0}
|
||||
typeID: 224
|
||||
customType: 28
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 135068749
|
||||
attribute: 304273561
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
typeID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 3949350096
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 473154195
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 135068749
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.33333334
|
||||
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:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.88
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Pivot.y
|
||||
path: Settings
|
||||
classID: 224
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: SettingsOverlay
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 0.5019608
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Color.a
|
||||
path: SettingsOverlay
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 0.33333334
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Settings/OverlayBack
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@@ -1,8 +0,0 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyCompany("Cryville")]
|
||||
[assembly: AssemblyCopyright("Copyright © Cryville 2020-2022")]
|
||||
[assembly: AssemblyDefaultAlias("Cosmo Resona")]
|
||||
[assembly: AssemblyProduct("Cosmo Resona")]
|
||||
[assembly: AssemblyTitle("Cosmo Resona")]
|
||||
[assembly: AssemblyVersion("0.5.0")]
|
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common {
|
||||
/// <summary>
|
||||
|
@@ -13,7 +13,7 @@ namespace Cryville.Common {
|
||||
public static Binder CreateBinderOfType(Type type) {
|
||||
var l = type.GetCustomAttributes(typeof(BinderAttribute), true);
|
||||
if (l.Length > 0) {
|
||||
return (Binder)ReflectionHelper.InvokeEmptyConstructor(
|
||||
return (Binder)Activator.CreateInstance(
|
||||
((BinderAttribute)l[0]).BinderType
|
||||
);
|
||||
}
|
||||
@@ -33,12 +33,12 @@ namespace Cryville.Common {
|
||||
public override object ChangeType(object value, Type type, CultureInfo culture) {
|
||||
if (value == null)
|
||||
return null;
|
||||
else if (type == value.GetType())
|
||||
else if (type.IsAssignableFrom(value.GetType()))
|
||||
return value;
|
||||
else if (type.IsEnum && value is string) {
|
||||
return Enum.Parse(type, (string)value);
|
||||
}
|
||||
throw new InvalidCastException();
|
||||
throw new InvalidCastException(string.Format("Cannot cast {0} to {1}", value.GetType(), type));
|
||||
}
|
||||
|
||||
public override void ReorderArgumentArray(ref object[] args, object state) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Cryville.Common.Buffers {
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// A resource pool that allows reusing instances of arrays of type <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
|
90
Assets/Cryville/Common/Buffers/CategorizedPool.cs
Normal file
90
Assets/Cryville/Common/Buffers/CategorizedPool.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// A set of resource pools categorized by a category type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TCategory">The category type.</typeparam>
|
||||
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
|
||||
public abstract class CategorizedPool<TCategory, TObject> where TObject : class {
|
||||
/// <summary>
|
||||
/// The set of underlying pools.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>The <see cref="Rent(TCategory)" /> and <see cref="Return(TCategory, TObject)" /> method select an underlying pool directly from this set with the category as the key. When overridden, this set must be available since construction.</para>
|
||||
/// </remarks>
|
||||
protected abstract IReadOnlyDictionary<TCategory, ObjectPool<TObject>> Buckets { get; }
|
||||
/// <summary>
|
||||
/// The count of objects rented from the set of pools.
|
||||
/// </summary>
|
||||
public int RentedCount { get; private set; }
|
||||
/// <summary>
|
||||
/// Rents an object from the pool.
|
||||
/// </summary>
|
||||
/// <param name="category">The category.</param>
|
||||
/// <returns>The rented object.</returns>
|
||||
public TObject Rent(TCategory category) {
|
||||
var obj = Buckets[category].Rent();
|
||||
RentedCount++;
|
||||
return obj;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a rented object to the pool.
|
||||
/// </summary>
|
||||
/// <param name="category">The category.</param>
|
||||
/// <param name="obj">The object to return.</param>
|
||||
public void Return(TCategory category, TObject obj) {
|
||||
Buckets[category].Return(obj);
|
||||
--RentedCount;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// A utility to access a categorized pool, representing a single unit that uses a shared categorized pool.
|
||||
/// </summary>
|
||||
/// <typeparam name="TCategory">The category type.</typeparam>
|
||||
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
|
||||
public class CategorizedPoolAccessor<TCategory, TObject> where TObject : class {
|
||||
readonly CategorizedPool<TCategory, TObject> _pool;
|
||||
static readonly SimpleObjectPool<Dictionary<TObject, TCategory>> _dictPool
|
||||
= new SimpleObjectPool<Dictionary<TObject, TCategory>>(1024);
|
||||
Dictionary<TObject, TCategory> _rented;
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="CategorizedPoolAccessor{TCategory, TObject}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="pool">The categorized pool.</param>
|
||||
public CategorizedPoolAccessor(CategorizedPool<TCategory, TObject> pool) {
|
||||
_pool = pool;
|
||||
}
|
||||
/// <summary>
|
||||
/// Rents an object from the pool.
|
||||
/// </summary>
|
||||
/// <param name="category">The category.</param>
|
||||
/// <returns>The rented object.</returns>
|
||||
public TObject Rent(TCategory category) {
|
||||
var obj = _pool.Rent(category);
|
||||
if (_rented == null) _rented = _dictPool.Rent();
|
||||
_rented.Add(obj, category);
|
||||
return obj;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a rented object to the pool.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to return.</param>
|
||||
public void Return(TObject obj) {
|
||||
_pool.Return(_rented[obj], obj);
|
||||
_rented.Remove(obj);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns all objects rented by this accessor to the pool.
|
||||
/// </summary>
|
||||
public void ReturnAll() {
|
||||
if (_rented == null) return;
|
||||
foreach (var obj in _rented) {
|
||||
_pool.Return(obj.Value, obj.Key);
|
||||
}
|
||||
_rented.Clear();
|
||||
_dictPool.Return(_rented);
|
||||
_rented = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ed0687e714ce1042921c0057f42039f
|
||||
guid: ec18f22479042d747b88c093aa90c5c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Cryville.Common.Buffers {
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// A resource pool that allows reusing instances of type <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
@@ -14,6 +14,10 @@
|
||||
_objs = new T[capacity];
|
||||
}
|
||||
/// <summary>
|
||||
/// The count of objects rented from the pool.
|
||||
/// </summary>
|
||||
public int RentedCount { get { return _index; } }
|
||||
/// <summary>
|
||||
/// Rents a object from the pool.
|
||||
/// </summary>
|
||||
/// <returns>The rented object.</returns>
|
||||
@@ -31,12 +35,20 @@
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to return.</param>
|
||||
public void Return(T obj) {
|
||||
if (_index > 0) _objs[--_index] = obj;
|
||||
if (_index > 0) {
|
||||
Reset(obj);
|
||||
_objs[--_index] = obj;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructs a new instance of type <typeparamref name="T" />.
|
||||
/// </summary>
|
||||
/// <returns>The new instance.</returns>
|
||||
protected abstract T Construct();
|
||||
/// <summary>
|
||||
/// Resets an object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object.</param>
|
||||
protected virtual void Reset(T obj) { }
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace Cryville.Common.Buffers {
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// A resource pool that allows reusing instances of type <typeparamref name="T" />, which has a parameterless constructor.
|
||||
/// </summary>
|
||||
|
135
Assets/Cryville/Common/Buffers/TargetString.cs
Normal file
135
Assets/Cryville/Common/Buffers/TargetString.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// An auto-resized <see cref="char" /> array as a variable-length string used as a target that is modified frequently.
|
||||
/// </summary>
|
||||
public class TargetString : IEnumerable<char> {
|
||||
public event Action OnUpdate;
|
||||
char[] _arr;
|
||||
bool _invalidated;
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="TargetString" /> class with a capacity of 16.
|
||||
/// </summary>
|
||||
public TargetString() : this(16) { }
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="TargetString" /> class.
|
||||
/// </summary>
|
||||
/// <param name="capacity">The initial capacity of the string.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity" /> is less than or equal to 0.</exception>
|
||||
public TargetString(int capacity) {
|
||||
if (capacity <= 0) throw new ArgumentOutOfRangeException("capacity");
|
||||
_arr = new char[capacity];
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets one of the characters in the string.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the character.</param>
|
||||
/// <returns>The character at the given index.</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="index" /> is less than 0 or not less than <see cref="Length" />.</exception>
|
||||
/// <remarks>
|
||||
/// <para>Set <see cref="Length" /> to a desired value before updating the characters.</para>
|
||||
/// <para>Call <see cref=" Validate" /> after all the characters are updated.</para>
|
||||
/// </remarks>
|
||||
public char this[int index] {
|
||||
get {
|
||||
if (index < 0 || index >= m_length)
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
return _arr[index];
|
||||
}
|
||||
set {
|
||||
if (index < 0 || index >= m_length)
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
if (_arr[index] == value) return;
|
||||
_arr[index] = value;
|
||||
_invalidated = true;
|
||||
}
|
||||
}
|
||||
int m_length;
|
||||
/// <summary>
|
||||
/// The length of the string.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
|
||||
public int Length {
|
||||
get {
|
||||
return m_length;
|
||||
}
|
||||
set {
|
||||
if (Length < 0) throw new ArgumentOutOfRangeException("length");
|
||||
if (m_length == value) return;
|
||||
if (_arr.Length < value) {
|
||||
var len = _arr.Length;
|
||||
while (len < value) len *= 2;
|
||||
var arr2 = new char[len];
|
||||
Array.Copy(_arr, arr2, m_length);
|
||||
_arr = arr2;
|
||||
}
|
||||
m_length = value;
|
||||
_invalidated = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Validates the string.
|
||||
/// </summary>
|
||||
public void Validate() {
|
||||
if (!_invalidated) return;
|
||||
_invalidated = false;
|
||||
var ev = OnUpdate;
|
||||
if (ev != null) ev.Invoke();
|
||||
}
|
||||
internal char[] TrustedAsArray() { return _arr; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that iterates through the <see cref="TargetString" />.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Enumerator" /> for the <see cref="TargetString" />.</returns>
|
||||
public Enumerator GetEnumerator() {
|
||||
return new Enumerator(this);
|
||||
}
|
||||
IEnumerator<char> IEnumerable<char>.GetEnumerator() {
|
||||
return new Enumerator(this);
|
||||
}
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
return new Enumerator(this);
|
||||
}
|
||||
|
||||
public struct Enumerator : IEnumerator<char> {
|
||||
readonly TargetString _self;
|
||||
int _index;
|
||||
internal Enumerator(TargetString self) {
|
||||
_self = self;
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
public char Current {
|
||||
get {
|
||||
if (_index < 0)
|
||||
throw new InvalidOperationException(_index == -1 ? "Enum not started" : "Enum ended");
|
||||
return _self[_index];
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current { get { return Current; } }
|
||||
|
||||
public void Dispose() {
|
||||
_index = -2;
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
if (_index == -2) return false;
|
||||
_index++;
|
||||
if (_index >= _self.Length) {
|
||||
_index = -2;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6a3a023271b82a4985d1bbcc86e6fa8
|
||||
guid: f0fc34ac257793d4883a9cfcdb6941b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@@ -1,9 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfd44d1c0681e4842a1f031556519042
|
||||
guid: c4ef48e4a4983de4e9c31483df2a918e
|
||||
folderAsset: yes
|
||||
timeCreated: 1637936550
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/Collections/Generic.meta
Normal file
8
Assets/Cryville/Common/Collections/Generic.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ec674235c0dd6744af2dab2b58dd53c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/Collections/Generic/IPairList.cs
Normal file
8
Assets/Cryville/Common/Collections/Generic/IPairList.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common.Collections.Generic {
|
||||
public interface IPairList<TKey, TValue> : IList<KeyValuePair<TKey, TValue>> {
|
||||
void Add(TKey key, TValue value);
|
||||
void Insert(int index, TKey key, TValue value);
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 499dc47d3f108de4eb80b2d73e5851c5
|
||||
timeCreated: 1608801352
|
||||
licenseType: Free
|
||||
guid: 73fb17b484b343242bcce27c15ed7d44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
50
Assets/Cryville/Common/Collections/Generic/PairCollection.cs
Normal file
50
Assets/Cryville/Common/Collections/Generic/PairCollection.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Cryville.Common.Collections.Generic {
|
||||
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairCollectionDebugView<,>))]
|
||||
public struct PairCollection<TKey, TValue> : IDisposable {
|
||||
public void Dispose() { }
|
||||
readonly IPairList<TKey, TValue> _pairList;
|
||||
readonly IDictionary<TKey, TValue> _dictionary;
|
||||
public PairCollection(object collection) : this() {
|
||||
var type = collection.GetType();
|
||||
if (typeof(IPairList<TKey, TValue>).IsAssignableFrom(type)) _pairList = (IPairList<TKey, TValue>)collection;
|
||||
else if (typeof(IDictionary<TKey, TValue>).IsAssignableFrom(type)) _dictionary = (IDictionary<TKey, TValue>)collection;
|
||||
else throw new ArgumentException("Parameter is not a pair collection");
|
||||
}
|
||||
public int Count {
|
||||
get {
|
||||
if (_pairList != null) return _pairList.Count;
|
||||
else return _dictionary.Count;
|
||||
}
|
||||
}
|
||||
public void Add(TKey key, TValue value) {
|
||||
if (_pairList != null) _pairList.Add(key, value);
|
||||
else _dictionary.Add(key, value);
|
||||
}
|
||||
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int index) {
|
||||
if (_pairList != null) _pairList.CopyTo(array, index);
|
||||
else _dictionary.CopyTo(array, index);
|
||||
}
|
||||
|
||||
public static bool IsPairCollection(Type type) {
|
||||
return typeof(IPairList<TKey, TValue>).IsAssignableFrom(type) || typeof(IDictionary<TKey, TValue>).IsAssignableFrom(type);
|
||||
}
|
||||
}
|
||||
internal class PairCollectionDebugView<TKey, TValue> {
|
||||
readonly PairCollection<TKey, TValue> _self;
|
||||
public PairCollectionDebugView(PairCollection<TKey, TValue> self) {
|
||||
_self = self;
|
||||
}
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
public KeyValuePair<TKey, TValue>[] Items {
|
||||
get {
|
||||
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[_self.Count];
|
||||
_self.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2517e8f040bd36f46948e5fafaf5335c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
48
Assets/Cryville/Common/Collections/Generic/PairList.cs
Normal file
48
Assets/Cryville/Common/Collections/Generic/PairList.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Cryville.Common.Collections.Generic {
|
||||
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairListDebugView<,>))]
|
||||
public class PairList<TKey, TValue> : List<KeyValuePair<TKey, TValue>>, IPairList<TKey, TValue>, IPairList {
|
||||
public void Add(TKey key, TValue value) {
|
||||
Add(new KeyValuePair<TKey, TValue>(key, value));
|
||||
}
|
||||
|
||||
public void Add(object key, object value) {
|
||||
try {
|
||||
Add((TKey)key, (TValue)value);
|
||||
}
|
||||
catch (InvalidCastException) {
|
||||
throw new ArgumentException("Wrong key type or value type");
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(int index, TKey key, TValue value) {
|
||||
Insert(index, new KeyValuePair<TKey, TValue>(key, value));
|
||||
}
|
||||
|
||||
public void Insert(int index, object key, object value) {
|
||||
try {
|
||||
Insert(index, (TKey)key, (TValue)value);
|
||||
}
|
||||
catch (InvalidCastException) {
|
||||
throw new ArgumentException("Wrong key type or value type");
|
||||
}
|
||||
}
|
||||
}
|
||||
internal class PairListDebugView<TKey, TValue> {
|
||||
readonly PairList<TKey, TValue> _self;
|
||||
public PairListDebugView(PairList<TKey, TValue> self) {
|
||||
_self = self;
|
||||
}
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
public KeyValuePair<TKey, TValue>[] Items {
|
||||
get {
|
||||
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[_self.Count];
|
||||
_self.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Collections/Generic/PairList.cs.meta
Normal file
11
Assets/Cryville/Common/Collections/Generic/PairList.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9ed5ea8b7b1a934287e7ec5971166c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
106
Assets/Cryville/Common/Collections/HashHelpers.cs
Normal file
106
Assets/Cryville/Common/Collections/HashHelpers.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Cryville.Common.Collections {
|
||||
internal static class HashHelpers {
|
||||
#if FEATURE_RANDOMIZED_STRING_HASHING
|
||||
public const int HashCollisionThreshold = 100;
|
||||
public static bool s_UseRandomizedStringHashing = String.UseRandomizedHashing();
|
||||
#endif
|
||||
|
||||
// Table of prime numbers to use as hash table sizes.
|
||||
// A typical resize algorithm would pick the smallest prime number in this array
|
||||
// that is larger than twice the previous capacity.
|
||||
// Suppose our Hashtable currently has capacity x and enough elements are added
|
||||
// such that a resize needs to occur. Resizing first computes 2x then finds the
|
||||
// first prime in the table greater than 2x, i.e. if primes are ordered
|
||||
// p_1, p_2, ..., p_i, ..., it finds p_n such that p_n-1 < 2x < p_n.
|
||||
// Doubling is important for preserving the asymptotic complexity of the
|
||||
// hashtable operations such as add. Having a prime guarantees that double
|
||||
// hashing does not lead to infinite loops. IE, your hash function will be
|
||||
// h1(key) + i*h2(key), 0 <= i < size. h2 and the size must be relatively prime.
|
||||
public static readonly int[] primes = {
|
||||
3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919,
|
||||
1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591,
|
||||
17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363, 156437,
|
||||
187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403, 968897, 1162687, 1395263,
|
||||
1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559, 5999471, 7199369};
|
||||
|
||||
// Used by Hashtable and Dictionary's SeralizationInfo .ctor's to store the SeralizationInfo
|
||||
// object until OnDeserialization is called.
|
||||
private static ConditionalWeakTable<object, SerializationInfo> s_SerializationInfoTable;
|
||||
|
||||
internal static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable {
|
||||
get {
|
||||
if (s_SerializationInfoTable == null) {
|
||||
ConditionalWeakTable<object, SerializationInfo> newTable = new ConditionalWeakTable<object, SerializationInfo>();
|
||||
Interlocked.CompareExchange(ref s_SerializationInfoTable, newTable, null);
|
||||
}
|
||||
|
||||
return s_SerializationInfoTable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
public static bool IsPrime(int candidate) {
|
||||
if ((candidate & 1) != 0) {
|
||||
int limit = (int)System.Math.Sqrt (candidate);
|
||||
for (int divisor = 3; divisor <= limit; divisor += 2) {
|
||||
if ((candidate % divisor) == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return (candidate == 2);
|
||||
}
|
||||
|
||||
internal const Int32 HashPrime = 101;
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
public static int GetPrime(int min) {
|
||||
if (min < 0)
|
||||
throw new ArgumentException("Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.");
|
||||
Contract.EndContractBlock();
|
||||
|
||||
for (int i = 0; i < primes.Length; i++) {
|
||||
int prime = primes[i];
|
||||
if (prime >= min) return prime;
|
||||
}
|
||||
|
||||
//outside of our predefined table.
|
||||
//compute the hard way.
|
||||
for (int i = (min | 1); i < Int32.MaxValue; i += 2) {
|
||||
if (IsPrime(i) && ((i - 1) % HashPrime != 0))
|
||||
return i;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
public static int GetMinPrime() {
|
||||
return primes[0];
|
||||
}
|
||||
|
||||
// Returns size of hashtable to grow to.
|
||||
public static int ExpandPrime(int oldSize) {
|
||||
int newSize = 2 * oldSize;
|
||||
|
||||
// Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow.
|
||||
// Note that this check works even when _items.Length overflowed thanks to the (uint) cast
|
||||
if ((uint)newSize > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) {
|
||||
Contract.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength");
|
||||
return MaxPrimeArrayLength;
|
||||
}
|
||||
|
||||
return GetPrime(newSize);
|
||||
}
|
||||
|
||||
|
||||
// This is the maximum prime smaller than Array.MaxArrayLength
|
||||
public const int MaxPrimeArrayLength = 0x7FEFFFFD;
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Collections/HashHelpers.cs.meta
Normal file
11
Assets/Cryville/Common/Collections/HashHelpers.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7fe2c6f3299681448c1a546cce4dc65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/Collections/IPairList.cs
Normal file
8
Assets/Cryville/Common/Collections/IPairList.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace Cryville.Common.Collections {
|
||||
public interface IPairList : IList {
|
||||
void Add(object key, object value);
|
||||
void Insert(int index, object key, object value);
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Collections/IPairList.cs.meta
Normal file
11
Assets/Cryville/Common/Collections/IPairList.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 046617672d437de4ab7e644a55defd3b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
51
Assets/Cryville/Common/Collections/PairCollection.cs
Normal file
51
Assets/Cryville/Common/Collections/PairCollection.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Cryville.Common.Collections {
|
||||
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairCollectionDebugView))]
|
||||
public struct PairCollection : IDisposable {
|
||||
public void Dispose() { }
|
||||
readonly IPairList _pairList;
|
||||
readonly IDictionary _dictionary;
|
||||
public PairCollection(object collection) : this() {
|
||||
var type = collection.GetType();
|
||||
if (typeof(IPairList).IsAssignableFrom(type)) _pairList = (IPairList)collection;
|
||||
else if (typeof(IDictionary).IsAssignableFrom(type)) _dictionary = (IDictionary)collection;
|
||||
else throw new ArgumentException("Parameter is not a pair collection");
|
||||
}
|
||||
public int Count {
|
||||
get {
|
||||
if (_pairList != null) return _pairList.Count;
|
||||
else return _dictionary.Count;
|
||||
}
|
||||
}
|
||||
public void Add(object key, object value) {
|
||||
if (_pairList != null) _pairList.Add(key, value);
|
||||
else _dictionary.Add(key, value);
|
||||
}
|
||||
public void CopyTo(KeyValuePair<object, object>[] array, int index) {
|
||||
if (_pairList != null) _pairList.CopyTo(array, index);
|
||||
else _dictionary.CopyTo(array, index);
|
||||
}
|
||||
|
||||
public static bool IsPairCollection(Type type) {
|
||||
return typeof(IPairList).IsAssignableFrom(type) || typeof(IDictionary).IsAssignableFrom(type);
|
||||
}
|
||||
}
|
||||
internal class PairCollectionDebugView {
|
||||
readonly PairCollection _self;
|
||||
public PairCollectionDebugView(PairCollection self) {
|
||||
_self = self;
|
||||
}
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
public KeyValuePair<object, object>[] Items {
|
||||
get {
|
||||
KeyValuePair<object, object>[] array = new KeyValuePair<object, object>[_self.Count];
|
||||
_self.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Collections/PairCollection.cs.meta
Normal file
11
Assets/Cryville/Common/Collections/PairCollection.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f87dfb8f6a1f5640b6deae741cd715c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
29
Assets/Cryville/Common/Collections/PairList.cs
Normal file
29
Assets/Cryville/Common/Collections/PairList.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Cryville.Common.Collections {
|
||||
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairListDebugView))]
|
||||
public class PairList : List<KeyValuePair<object, object>>, IPairList {
|
||||
public void Add(object key, object value) {
|
||||
Add(new KeyValuePair<object, object>(key, value));
|
||||
}
|
||||
|
||||
public void Insert(int index, object key, object value) {
|
||||
Insert(index, new KeyValuePair<object, object>(key, value));
|
||||
}
|
||||
}
|
||||
internal class PairListDebugView {
|
||||
readonly PairList _self;
|
||||
public PairListDebugView(PairList self) {
|
||||
_self = self;
|
||||
}
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
public KeyValuePair<object, object>[] Items {
|
||||
get {
|
||||
KeyValuePair<object, object>[] array = new KeyValuePair<object, object>[_self.Count];
|
||||
_self.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Collections/PairList.cs.meta
Normal file
11
Assets/Cryville/Common/Collections/PairList.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57fc9f037c1fda5449e2a365a835c82c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/Collections/Specialized.meta
Normal file
8
Assets/Cryville/Common/Collections/Specialized.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f68b44d5226a73441b94e7dd5873529f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1037
Assets/Cryville/Common/Collections/Specialized/IntKeyedDictionary.cs
Normal file
1037
Assets/Cryville/Common/Collections/Specialized/IntKeyedDictionary.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 634536d804abc784394d4ac028a77879
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.ComponentModel {
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.ComponentModel {
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.ComponentModel {
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.ComponentModel {
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
|
||||
|
26
Assets/Cryville/Common/Coroutine.cs
Normal file
26
Assets/Cryville/Common/Coroutine.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Cryville.Common {
|
||||
public class Coroutine {
|
||||
readonly IEnumerator<float> _enumerator;
|
||||
readonly Stopwatch _stopwatch = new Stopwatch();
|
||||
public float Progress { get; private set; }
|
||||
public Coroutine(IEnumerator<float> enumerator) {
|
||||
_enumerator = enumerator;
|
||||
}
|
||||
public bool TickOnce() {
|
||||
if (!_enumerator.MoveNext()) return false;
|
||||
Progress = _enumerator.Current;
|
||||
return true;
|
||||
}
|
||||
public bool Tick(double minTime) {
|
||||
_stopwatch.Restart();
|
||||
while (_stopwatch.Elapsed.TotalSeconds < minTime) {
|
||||
if (!_enumerator.MoveNext()) return false;
|
||||
Progress = _enumerator.Current;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Coroutine.cs.meta
Normal file
11
Assets/Cryville/Common/Coroutine.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 387adc7d494be0147b7cb930bc2e726b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/Culture.meta
Normal file
8
Assets/Cryville/Common/Culture.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 520554ce9a8205b4b91e0ff2b8011673
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
37
Assets/Cryville/Common/Culture/ScriptUtils.cs
Normal file
37
Assets/Cryville/Common/Culture/ScriptUtils.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common.Culture {
|
||||
public static class ScriptUtils {
|
||||
public static string[] Scripts = new string[] { "adlm", "afak", "aghb", "ahom", "arab", "aran", "armi", "armn", "avst", "bali", "bamu", "bass", "batk", "beng", "bhks", "blis", "bopo", "brah", "brai", "bugi", "buhd", "cakm", "cans", "cari", "cham", "cher", "chrs", "cirt", "copt", "cpmn", "cprt", "cyrl", "cyrs", "deva", "diak", "dogr", "dsrt", "dupl", "egyd", "egyh", "egyp", "elba", "elym", "ethi", "geok", "geor", "glag", "gong", "gonm", "goth", "gran", "grek", "gujr", "guru", "hanb", "hang", "hani", "hano", "hans", "hant", "hatr", "hebr", "hira", "hluw", "hmng", "hmnp", "hrkt", "hung", "inds", "ital", "jamo", "java", "jpan", "jurc", "kali", "kana", "khar", "khmr", "khoj", "kitl", "kits", "knda", "kore", "kpel", "kthi", "lana", "laoo", "latf", "latg", "latn", "leke", "lepc", "limb", "lina", "linb", "lisu", "loma", "lyci", "lydi", "mahj", "maka", "mand", "mani", "marc", "maya", "medf", "mend", "merc", "mero", "mlym", "modi", "mong", "moon", "mroo", "mtei", "mult", "mymr", "nand", "narb", "nbat", "newa", "nkdb", "nkgb", "nkoo", "nshu", "ogam", "olck", "orkh", "orya", "osge", "osma", "ougr", "palm", "pauc", "pcun", "pelm", "perm", "phag", "phli", "phlp", "phlv", "phnx", "piqd", "plrd", "prti", "psin", "qaaa", "qaai", "qabx", "ranj", "rjng", "rohg", "roro", "runr", "samr", "sara", "sarb", "saur", "sgnw", "shaw", "shrd", "shui", "sidd", "sind", "sinh", "sogd", "sogo", "sora", "soyo", "sund", "sylo", "syrc", "syre", "syrj", "syrn", "tagb", "takr", "tale", "talu", "taml", "tang", "tavt", "telu", "teng", "tfng", "tglg", "thaa", "thai", "tibt", "tirh", "toto", "ugar", "vaii", "visp", "wara", "wcho", "wole", "xpeo", "xsux", "yezi", "yiii", "zanb", "zinh", "zmth", "zsye", "zsym", "zxxx", "zyyy", "zzzz", };
|
||||
public static string UltimateFallbackScript = "zyyy";
|
||||
public static Dictionary<string, string[]> FallbackScriptMap = new Dictionary<string, string[]> {
|
||||
{ "aran", new string[] { "arab" } }, { "cyrs", new string[] { "cyrl" } },
|
||||
{ "hanb", new string[] { "hant", "bopo" } }, { "hans", new string[] { "hani" } }, { "hant", new string[] { "hani" } },
|
||||
{ "hrkt", new string[] { "hira", "kana" } }, { "jpan", new string[] { "hani", "hira", "kana" } },
|
||||
{ "jamo", new string[] { "hang" } }, { "kore", new string[] { "hang", "hani" } },
|
||||
{ "latf", new string[] { "latn" } }, { "latg", new string[] { "latn" } },
|
||||
{ "syre", new string[] { "syrc" } }, { "syrj", new string[] { "syrc" } }, { "syrn", new string[] { "syrc" } },
|
||||
{ "zsye", new string[] { "zsym" } },
|
||||
};
|
||||
public static void FillKeysWithScripts(IDictionary dict, Func<object> value) {
|
||||
foreach (var s in Scripts) dict.Add(s, value());
|
||||
}
|
||||
public static IEnumerable<string> EnumerateFallbackScripts(string script) {
|
||||
if (string.IsNullOrEmpty(script)) throw new ArgumentNullException("script");
|
||||
script = script.ToLower();
|
||||
if (script == UltimateFallbackScript) {
|
||||
yield return null;
|
||||
yield break;
|
||||
}
|
||||
string[] fblist;
|
||||
if (FallbackScriptMap.TryGetValue(script, out fblist)) {
|
||||
foreach (var fb in fblist) {
|
||||
yield return fb;
|
||||
}
|
||||
}
|
||||
else yield return UltimateFallbackScript;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Culture/ScriptUtils.cs.meta
Normal file
11
Assets/Cryville/Common/Culture/ScriptUtils.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae9dab8f520fadc4194032f523ca87c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common {
|
||||
public class FileStringAttribute : Attribute {
|
||||
|
113
Assets/Cryville/Common/Font/FontFile.cs
Normal file
113
Assets/Cryville/Common/Font/FontFile.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using Cryville.Common.IO;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class FontFile : IEnumerable<Typeface> {
|
||||
public abstract int Count { get; }
|
||||
public abstract Typeface this[int index] { get; }
|
||||
protected FileInfo File { get; private set; }
|
||||
protected BinaryReader Reader { get; private set; }
|
||||
public FontFile(FileInfo file) {
|
||||
File = file;
|
||||
Reader = new BinaryReaderBE(new FileStream(file.FullName, FileMode.Open, FileAccess.Read));
|
||||
}
|
||||
public void Close() { Reader.Close(); }
|
||||
|
||||
public static FontFile Create(FileInfo file) {
|
||||
switch (file.Extension) {
|
||||
case ".ttf": case ".otf": return new FontFileTTF(file);
|
||||
case ".ttc": case ".otc": return new FontFileTTC(file);
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Enumerator GetEnumerator() {
|
||||
return new Enumerator(this);
|
||||
}
|
||||
IEnumerator<Typeface> IEnumerable<Typeface>.GetEnumerator() {
|
||||
return GetEnumerator();
|
||||
}
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public struct Enumerator : IEnumerator<Typeface> {
|
||||
readonly FontFile _self;
|
||||
int _index;
|
||||
internal Enumerator(FontFile self) {
|
||||
_self = self;
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
public Typeface Current {
|
||||
get {
|
||||
if (_index < 0)
|
||||
throw new InvalidOperationException(_index == -1 ? "Enum not started" : "Enum ended");
|
||||
return _self[_index];
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current { get { return Current; } }
|
||||
|
||||
public void Dispose() {
|
||||
_index = -2;
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
if (_index == -2) return false;
|
||||
_index++;
|
||||
if (_index >= _self.Count) {
|
||||
_index = -2;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class FontFileTTF : FontFile {
|
||||
public override int Count { get { return 1; } }
|
||||
public override Typeface this[int index] {
|
||||
get {
|
||||
if (index != 0) throw new ArgumentOutOfRangeException("index");
|
||||
try {
|
||||
return new TypefaceTTF(Reader, File, index);
|
||||
}
|
||||
catch (Exception) {
|
||||
throw new InvalidDataException("Invalid font");
|
||||
}
|
||||
}
|
||||
}
|
||||
public FontFileTTF(FileInfo file) : base(file) { }
|
||||
}
|
||||
public class FontFileTTC : FontFile {
|
||||
readonly IReadOnlyList<uint> _offsets;
|
||||
public override int Count { get { return _offsets.Count; } }
|
||||
public override Typeface this[int index] {
|
||||
get {
|
||||
if (index < 0 || index >= Count) throw new ArgumentOutOfRangeException("index");
|
||||
Reader.BaseStream.Position = _offsets[index];
|
||||
try {
|
||||
return new TypefaceTTF(Reader, File, index);
|
||||
}
|
||||
catch (Exception) {
|
||||
throw new InvalidDataException("Invalid font");
|
||||
}
|
||||
}
|
||||
}
|
||||
public FontFileTTC(FileInfo file) : base(file) {
|
||||
try {
|
||||
_offsets = new TTCHeader(Reader, 0).GetItems();
|
||||
}
|
||||
catch (Exception) {
|
||||
throw new InvalidDataException("Invalid font");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Font/FontFile.cs.meta
Normal file
11
Assets/Cryville/Common/Font/FontFile.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9f44ccf8ddd364418b4f4965414ff9c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
63
Assets/Cryville/Common/Font/FontManager.cs
Normal file
63
Assets/Cryville/Common/Font/FontManager.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class FontManager {
|
||||
public IReadOnlyDictionary<string, IReadOnlyCollection<Typeface>> MapFullNameToTypeface { get; private set; }
|
||||
public IReadOnlyDictionary<string, IReadOnlyCollection<Typeface>> MapNameToTypefaces { get; private set; }
|
||||
public FontManager() {
|
||||
var map1 = new Dictionary<string, List<Typeface>>();
|
||||
var map2 = new Dictionary<string, List<Typeface>>();
|
||||
foreach (var f in EnumerateAllTypefaces()) {
|
||||
List<Typeface> set1;
|
||||
if (!map1.TryGetValue(f.FullName, out set1)) {
|
||||
map1.Add(f.FullName, set1 = new List<Typeface>());
|
||||
}
|
||||
set1.Add(f);
|
||||
List<Typeface> set2;
|
||||
if (!map2.TryGetValue(f.FamilyName, out set2)) {
|
||||
map2.Add(f.FamilyName, set2 = new List<Typeface>());
|
||||
}
|
||||
set2.Add(f);
|
||||
}
|
||||
MapFullNameToTypeface = map1.ToDictionary(i => i.Key, i => (IReadOnlyCollection<Typeface>)i.Value);
|
||||
MapNameToTypefaces = map2.ToDictionary(i => i.Key, i => (IReadOnlyCollection<Typeface>)i.Value);
|
||||
}
|
||||
protected abstract IEnumerable<Typeface> EnumerateAllTypefaces();
|
||||
protected static IEnumerable<Typeface> ScanDirectoryForTypefaces(string dir) {
|
||||
foreach (var f in new DirectoryInfo(dir).EnumerateFiles()) {
|
||||
FontFile file;
|
||||
try {
|
||||
file = FontFile.Create(f);
|
||||
}
|
||||
catch (InvalidDataException) {
|
||||
continue;
|
||||
}
|
||||
if (file == null) continue;
|
||||
var enumerator = file.GetEnumerator();
|
||||
while (enumerator.MoveNext()) {
|
||||
Typeface ret;
|
||||
try {
|
||||
ret = enumerator.Current;
|
||||
}
|
||||
catch (InvalidDataException) {
|
||||
continue;
|
||||
}
|
||||
yield return ret;
|
||||
}
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public class FontManagerAndroid : FontManager {
|
||||
protected override IEnumerable<Typeface> EnumerateAllTypefaces() {
|
||||
return ScanDirectoryForTypefaces("/system/fonts");
|
||||
}
|
||||
}
|
||||
public class FontManagerWindows : FontManager {
|
||||
protected override IEnumerable<Typeface> EnumerateAllTypefaces() {
|
||||
return ScanDirectoryForTypefaces("C:/Windows/Fonts");
|
||||
}
|
||||
}
|
||||
}
|
329
Assets/Cryville/Common/Font/FontMatcher.cs
Normal file
329
Assets/Cryville/Common/Font/FontMatcher.cs
Normal file
@@ -0,0 +1,329 @@
|
||||
using Cryville.Common.Culture;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class FontMatcher {
|
||||
protected FontManager Manager { get; private set; }
|
||||
public FontMatcher(FontManager manafer) { Manager = manafer; }
|
||||
public abstract IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false);
|
||||
}
|
||||
public class FallbackListFontMatcher : FontMatcher {
|
||||
public Dictionary<string, List<string>> MapScriptToTypefaces = new Dictionary<string, List<string>>();
|
||||
public void LoadDefaultWindowsFallbackList() {
|
||||
if (Environment.OSVersion.Platform != PlatformID.Win32NT) return;
|
||||
MapScriptToTypefaces.Clear();
|
||||
ScriptUtils.FillKeysWithScripts(MapScriptToTypefaces, () => new List<string>());
|
||||
// Reference: https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "SimSun"); // Custom
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "SimHei"); // Custom
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Microsoft YaHei"); // Custom
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Arial");
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Times New Roman");
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Segoe UI"); // Custom
|
||||
MapScriptToTypefaces["arab"].Insert(0, "Tahoma");
|
||||
MapScriptToTypefaces["cyrl"].Insert(0, "Times New Roman");
|
||||
MapScriptToTypefaces["grek"].Insert(0, "Times New Roman");
|
||||
MapScriptToTypefaces["hebr"].Insert(0, "David");
|
||||
MapScriptToTypefaces["jpan"].Insert(0, "MS PGothic");
|
||||
MapScriptToTypefaces["latn"].Insert(0, "Times New Roman");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "SimSun");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "SimHei"); // Custom
|
||||
MapScriptToTypefaces["thai"].Insert(0, "Tahoma");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "PMingLiU");
|
||||
// Reference: https://learn.microsoft.com/en-us/globalization/input/font-support
|
||||
var ver = Environment.OSVersion.Version;
|
||||
if (ver >= new Version(5, 0)) { // Windows 2000
|
||||
MapScriptToTypefaces["armn"].Insert(0, "Sylfaen");
|
||||
MapScriptToTypefaces["deva"].Insert(0, "Mangal");
|
||||
MapScriptToTypefaces["geor"].Insert(0, "Sylfaen");
|
||||
MapScriptToTypefaces["taml"].Insert(0, "Latha");
|
||||
}
|
||||
if (ver >= new Version(5, 1)) { // Windows XP
|
||||
MapScriptToTypefaces["gujr"].Insert(0, "Shruti");
|
||||
MapScriptToTypefaces["guru"].Insert(0, "Raavi");
|
||||
MapScriptToTypefaces["knda"].Insert(0, "Tunga");
|
||||
MapScriptToTypefaces["syrc"].Insert(0, "Estrangelo Edessa");
|
||||
MapScriptToTypefaces["telu"].Insert(0, "Gautami");
|
||||
MapScriptToTypefaces["thaa"].Insert(0, "MV Boli");
|
||||
// SP2
|
||||
MapScriptToTypefaces["beng"].Insert(0, "Vrinda");
|
||||
MapScriptToTypefaces["mlym"].Insert(0, "Kartika");
|
||||
}
|
||||
if (ver >= new Version(6, 0)) { // Windows Vista
|
||||
MapScriptToTypefaces["cans"].Insert(0, "Euphemia");
|
||||
MapScriptToTypefaces["cher"].Insert(0, "Plantagenet");
|
||||
MapScriptToTypefaces["ethi"].Insert(0, "Nyala");
|
||||
MapScriptToTypefaces["khmr"].Insert(0, "DaunPenh MoolBoran");
|
||||
MapScriptToTypefaces["laoo"].Insert(0, "DokChampa");
|
||||
MapScriptToTypefaces["mong"].Insert(0, "Mongolian Baiti");
|
||||
MapScriptToTypefaces["orya"].Insert(0, "Kalinga");
|
||||
MapScriptToTypefaces["sinh"].Insert(0, "Iskoola Pota");
|
||||
MapScriptToTypefaces["tibt"].Insert(0, "Microsoft Himalaya");
|
||||
MapScriptToTypefaces["yiii"].Insert(0, "Microsoft Yi Baiti");
|
||||
MapScriptToTypefaces["arab"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["cyrl"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["grek"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["latn"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["hans"].Add("SimSun-ExtB");
|
||||
MapScriptToTypefaces["hant"].Add("MingLiU-ExtB");
|
||||
MapScriptToTypefaces["hant"].Add("MingLiU_HKSCS-ExtB");
|
||||
MapScriptToTypefaces["arab"].Add("Microsoft Uighur");
|
||||
MapScriptToTypefaces["zmth"].Insert(0, "Cambria Math");
|
||||
// Reference: https://en.wikipedia.org/wiki/List_of_CJK_fonts
|
||||
MapScriptToTypefaces["jpan"].Insert(0, "Meiryo");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "Microsoft YaHei");
|
||||
}
|
||||
if (ver >= new Version(6, 1)) { // Windows 7
|
||||
MapScriptToTypefaces["brai"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["dsrt"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["talu"].Insert(0, "Microsoft New Tai Lue");
|
||||
MapScriptToTypefaces["ogam"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["osma"].Insert(0, "Ebrima");
|
||||
MapScriptToTypefaces["phag"].Insert(0, "Microsoft PhagsPa");
|
||||
MapScriptToTypefaces["runr"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["zsym"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["tale"].Insert(0, "Microsoft Tai Le");
|
||||
MapScriptToTypefaces["tfng"].Insert(0, "Ebrima");
|
||||
MapScriptToTypefaces["vaii"].Insert(0, "Ebrima");
|
||||
}
|
||||
if (ver >= new Version(6, 2)) { // Windows 8
|
||||
MapScriptToTypefaces["glag"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["goth"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["hang"].Add("Malgun Gothic");
|
||||
MapScriptToTypefaces["ital"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["lisu"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["mymr"].Insert(0, "Myanmar Text");
|
||||
MapScriptToTypefaces["nkoo"].Insert(0, "Ebrima");
|
||||
MapScriptToTypefaces["orkh"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["ethi"].Insert(0, "Ebrima");
|
||||
MapScriptToTypefaces["cans"].Insert(0, "Gadugi");
|
||||
MapScriptToTypefaces["hant"].Insert(0, "Microsoft JhengHei UI");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "Microsoft YaHei UI");
|
||||
MapScriptToTypefaces["beng"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["deva"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["gujr"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["guru"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
|
||||
MapScriptToTypefaces["knda"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
|
||||
MapScriptToTypefaces["mlym"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["orya"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["sinh"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
|
||||
MapScriptToTypefaces["taml"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
|
||||
MapScriptToTypefaces["telu"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["armn"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["geor"].Insert(0, "Segoe UI");
|
||||
MapScriptToTypefaces["hebr"].Insert(0, "Segoe UI");
|
||||
}
|
||||
if (ver >= new Version(6, 3)) { // Windows 8.1
|
||||
MapScriptToTypefaces["bugi"].Insert(0, "Leelawadee UI");
|
||||
MapScriptToTypefaces["copt"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["java"].Insert(0, "Javanese Text");
|
||||
MapScriptToTypefaces["merc"].Insert(0, "Segoe UI Symbol");
|
||||
MapScriptToTypefaces["olck"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["sora"].Insert(0, "Nirmala UI");
|
||||
MapScriptToTypefaces["khmr"].Insert(0, "Leelawadee UI");
|
||||
MapScriptToTypefaces["laoo"].Insert(0, "Leelawadee UI");
|
||||
MapScriptToTypefaces["thai"].Insert(0, "Leelawadee UI");
|
||||
MapScriptToTypefaces["zsye"].Insert(0, "Segoe UI Emoji");
|
||||
}
|
||||
if (ver >= new Version(10, 0)) { // Windows 10
|
||||
MapScriptToTypefaces["brah"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["cari"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["cprt"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["egyp"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["armi"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["phli"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["prti"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["khar"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["lyci"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["lydi"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["phnx"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["xpeo"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["sarb"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["shaw"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["xsux"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["ugar"].Insert(0, "Segoe UI Historic");
|
||||
// Segoe UI Symbol -> Segoe UI Historic
|
||||
MapScriptToTypefaces["glag"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["goth"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["merc"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["ogam"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["ital"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["orkh"].Insert(0, "Segoe UI Historic");
|
||||
MapScriptToTypefaces["runr"].Insert(0, "Segoe UI Historic");
|
||||
//
|
||||
MapScriptToTypefaces["jpan"].Insert(0, "Yu Gothic UI");
|
||||
MapScriptToTypefaces["zsym"].Add("Segoe MDL2 Assets");
|
||||
}
|
||||
}
|
||||
public void LoadDefaultAndroidFallbackList() {
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix) return;
|
||||
MapScriptToTypefaces.Clear();
|
||||
ScriptUtils.FillKeysWithScripts(MapScriptToTypefaces, () => new List<string>());
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK TC"); // TODO Modify default fallback
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK JP");
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK SC");
|
||||
MapScriptToTypefaces["zyyy"].Insert(0, "Roboto");
|
||||
MapScriptToTypefaces["zsye"].Insert(0, "Noto Color Emoji");
|
||||
MapScriptToTypefaces["zsye"].Add("Noto Color Emoji Flags");
|
||||
MapScriptToTypefaces["arab"].Insert(0, "Noto Naskh Arabic");
|
||||
MapScriptToTypefaces["adlm"].Insert(0, "Noto Sans Adlam");
|
||||
MapScriptToTypefaces["ahom"].Insert(0, "Noto Sans Ahom");
|
||||
MapScriptToTypefaces["hluw"].Insert(0, "Noto Sans Anatolian Hieroglyphs");
|
||||
MapScriptToTypefaces["armn"].Insert(0, "Noto Sans Armenian");
|
||||
MapScriptToTypefaces["avst"].Insert(0, "Noto Sans Avestan");
|
||||
MapScriptToTypefaces["bali"].Insert(0, "Noto Sans Balinese");
|
||||
MapScriptToTypefaces["bamu"].Insert(0, "Noto Sans Bamum");
|
||||
MapScriptToTypefaces["bass"].Insert(0, "Noto Sans Bassa Vah");
|
||||
MapScriptToTypefaces["batk"].Insert(0, "Noto Sans Batak");
|
||||
MapScriptToTypefaces["beng"].Insert(0, "Noto Sans Bengali");
|
||||
MapScriptToTypefaces["bhks"].Insert(0, "Noto Sans Bhaiksuki");
|
||||
MapScriptToTypefaces["brah"].Insert(0, "Noto Sans Brahmi");
|
||||
MapScriptToTypefaces["bugi"].Insert(0, "Noto Sans Buginese");
|
||||
MapScriptToTypefaces["buhd"].Insert(0, "Noto Sans Buhid");
|
||||
MapScriptToTypefaces["jpan"].Insert(0, "Noto Sans CJK JP");
|
||||
MapScriptToTypefaces["kore"].Insert(0, "Noto Sans CJK KR");
|
||||
MapScriptToTypefaces["hans"].Insert(0, "Noto Sans CJK SC");
|
||||
MapScriptToTypefaces["hant"].Insert(0, "Noto Sans CJK TC");
|
||||
MapScriptToTypefaces["hant"].Add("Noto Sans CJK HK");
|
||||
MapScriptToTypefaces["cans"].Insert(0, "Noto Sans Canadian Aboriginal");
|
||||
MapScriptToTypefaces["cari"].Insert(0, "Noto Sans Carian");
|
||||
MapScriptToTypefaces["cakm"].Insert(0, "Noto Sans Chakma");
|
||||
MapScriptToTypefaces["cham"].Insert(0, "Noto Sans Cham");
|
||||
MapScriptToTypefaces["cher"].Insert(0, "Noto Sans Cherokee");
|
||||
MapScriptToTypefaces["copt"].Insert(0, "Noto Sans Coptic");
|
||||
MapScriptToTypefaces["xsux"].Insert(0, "Noto Sans Cuneiform");
|
||||
MapScriptToTypefaces["cprt"].Insert(0, "Noto Sans Cypriot");
|
||||
MapScriptToTypefaces["dsrt"].Insert(0, "Noto Sans Deseret");
|
||||
MapScriptToTypefaces["deva"].Insert(0, "Noto Sans Devanagari");
|
||||
MapScriptToTypefaces["egyp"].Insert(0, "Noto Sans Egyptian Hieroglyphs");
|
||||
MapScriptToTypefaces["elba"].Insert(0, "Noto Sans Elbasan");
|
||||
MapScriptToTypefaces["ethi"].Insert(0, "Noto Sans Ethiopic");
|
||||
MapScriptToTypefaces["geor"].Insert(0, "Noto Sans Georgian");
|
||||
MapScriptToTypefaces["glag"].Insert(0, "Noto Sans Glagolitic");
|
||||
MapScriptToTypefaces["goth"].Insert(0, "Noto Sans Gothic");
|
||||
MapScriptToTypefaces["gran"].Insert(0, "Noto Sans Grantha");
|
||||
MapScriptToTypefaces["gujr"].Insert(0, "Noto Sans Gujarati");
|
||||
MapScriptToTypefaces["gong"].Insert(0, "Noto Sans Gunjala Gondi");
|
||||
MapScriptToTypefaces["guru"].Insert(0, "Noto Sans Gurmukhi");
|
||||
MapScriptToTypefaces["rohg"].Insert(0, "Noto Sans Hanifi Rohingya");
|
||||
MapScriptToTypefaces["hano"].Insert(0, "Noto Sans Hanunoo");
|
||||
MapScriptToTypefaces["hatr"].Insert(0, "Noto Sans Hatran");
|
||||
MapScriptToTypefaces["hebr"].Insert(0, "Noto Sans Hebrew");
|
||||
MapScriptToTypefaces["armi"].Insert(0, "Noto Sans Imperial Aramaic");
|
||||
MapScriptToTypefaces["phli"].Insert(0, "Noto Sans Inscriptional Pahlavi");
|
||||
MapScriptToTypefaces["prti"].Insert(0, "Noto Sans Inscriptional Parthian");
|
||||
MapScriptToTypefaces["java"].Insert(0, "Noto Sans Javanese");
|
||||
MapScriptToTypefaces["kthi"].Insert(0, "Noto Sans Kaithi");
|
||||
MapScriptToTypefaces["knda"].Insert(0, "Noto Sans Kannada");
|
||||
MapScriptToTypefaces["kali"].Insert(0, "Noto Sans KayahLi");
|
||||
MapScriptToTypefaces["khar"].Insert(0, "Noto Sans Kharoshthi");
|
||||
MapScriptToTypefaces["khmr"].Insert(0, "Noto Sans Khmer");
|
||||
MapScriptToTypefaces["khoj"].Insert(0, "Noto Sans Khojki");
|
||||
MapScriptToTypefaces["laoo"].Insert(0, "Noto Sans Lao");
|
||||
MapScriptToTypefaces["lepc"].Insert(0, "Noto Sans Lepcha");
|
||||
MapScriptToTypefaces["limb"].Insert(0, "Noto Sans Limbu");
|
||||
MapScriptToTypefaces["lina"].Insert(0, "Noto Sans Linear A");
|
||||
MapScriptToTypefaces["linb"].Insert(0, "Noto Sans Linear B");
|
||||
MapScriptToTypefaces["lisu"].Insert(0, "Noto Sans Lisu");
|
||||
MapScriptToTypefaces["lyci"].Insert(0, "Noto Sans Lycian");
|
||||
MapScriptToTypefaces["lydi"].Insert(0, "Noto Sans Lydian");
|
||||
MapScriptToTypefaces["mlym"].Insert(0, "Noto Sans Malayalam");
|
||||
MapScriptToTypefaces["mand"].Insert(0, "Noto Sans Mandiac");
|
||||
MapScriptToTypefaces["mani"].Insert(0, "Noto Sans Manichaean");
|
||||
MapScriptToTypefaces["marc"].Insert(0, "Noto Sans Marchen");
|
||||
MapScriptToTypefaces["gonm"].Insert(0, "Noto Sans Masaram Gondi");
|
||||
MapScriptToTypefaces["medf"].Insert(0, "Noto Sans Medefaidrin");
|
||||
MapScriptToTypefaces["mtei"].Insert(0, "Noto Sans Meetei Mayek");
|
||||
MapScriptToTypefaces["merc"].Insert(0, "Noto Sans Meroitic");
|
||||
MapScriptToTypefaces["mero"].Insert(0, "Noto Sans Meroitic");
|
||||
MapScriptToTypefaces["plrd"].Insert(0, "Noto Sans Miao");
|
||||
MapScriptToTypefaces["modi"].Insert(0, "Noto Sans Modi");
|
||||
MapScriptToTypefaces["mong"].Insert(0, "Noto Sans Mongolian");
|
||||
MapScriptToTypefaces["mroo"].Insert(0, "Noto Sans Mro");
|
||||
MapScriptToTypefaces["mult"].Insert(0, "Noto Sans Multani");
|
||||
MapScriptToTypefaces["mymr"].Insert(0, "Noto Sans Myanmar");
|
||||
MapScriptToTypefaces["nkoo"].Insert(0, "Noto Sans Nko");
|
||||
MapScriptToTypefaces["nbat"].Insert(0, "Noto Sans Nabataean");
|
||||
MapScriptToTypefaces["talu"].Insert(0, "Noto Sans New Tai Lue");
|
||||
MapScriptToTypefaces["newa"].Insert(0, "Noto Sans Newa");
|
||||
MapScriptToTypefaces["ogam"].Insert(0, "Noto Sans Ogham");
|
||||
MapScriptToTypefaces["olck"].Insert(0, "Noto Sans Ol Chiki");
|
||||
MapScriptToTypefaces["ital"].Insert(0, "Noto Sans Old Italian");
|
||||
MapScriptToTypefaces["narb"].Insert(0, "Noto Sans Old North Arabian");
|
||||
MapScriptToTypefaces["perm"].Insert(0, "Noto Sans Old Permic");
|
||||
MapScriptToTypefaces["xpeo"].Insert(0, "Noto Sans Old Persian");
|
||||
MapScriptToTypefaces["sarb"].Insert(0, "Noto Sans Old South Arabian");
|
||||
MapScriptToTypefaces["orkh"].Insert(0, "Noto Sans Old Turkic");
|
||||
MapScriptToTypefaces["orya"].Insert(0, "Noto Sans Oriya");
|
||||
MapScriptToTypefaces["osge"].Insert(0, "Noto Sans Osage");
|
||||
MapScriptToTypefaces["osma"].Insert(0, "Noto Sans Osmanya");
|
||||
MapScriptToTypefaces["hmng"].Insert(0, "Noto Sans Pahawh Hmong");
|
||||
MapScriptToTypefaces["palm"].Insert(0, "Noto Sans Palmyrene");
|
||||
MapScriptToTypefaces["pauc"].Insert(0, "Noto Sans Pau Cin Hau");
|
||||
MapScriptToTypefaces["phag"].Insert(0, "Noto Sans Phags Pa");
|
||||
MapScriptToTypefaces["phnx"].Insert(0, "Noto Sans Phoenician");
|
||||
MapScriptToTypefaces["rjng"].Insert(0, "Noto Sans Rejang");
|
||||
MapScriptToTypefaces["runr"].Insert(0, "Noto Sans Runic");
|
||||
MapScriptToTypefaces["samr"].Insert(0, "Noto Sans Samaritan");
|
||||
MapScriptToTypefaces["saur"].Insert(0, "Noto Sans Saurashtra");
|
||||
MapScriptToTypefaces["shrd"].Insert(0, "Noto Sans Sharada");
|
||||
MapScriptToTypefaces["shaw"].Insert(0, "Noto Sans Shavian");
|
||||
MapScriptToTypefaces["sinh"].Insert(0, "Noto Sans Sinhala");
|
||||
MapScriptToTypefaces["sora"].Insert(0, "Noto Sans Sora Sompeng");
|
||||
MapScriptToTypefaces["soyo"].Insert(0, "Noto Sans Soyombo");
|
||||
MapScriptToTypefaces["sund"].Insert(0, "Noto Sans Sundanese");
|
||||
MapScriptToTypefaces["sylo"].Insert(0, "Noto Sans Syloti Nagri");
|
||||
MapScriptToTypefaces["zsym"].Insert(0, "Noto Sans Symbols");
|
||||
MapScriptToTypefaces["syrn"].Insert(0, "Noto Sans Syriac Eastern");
|
||||
MapScriptToTypefaces["syre"].Insert(0, "Noto Sans Syriac Estrangela");
|
||||
MapScriptToTypefaces["syrj"].Insert(0, "Noto Sans Syriac Western");
|
||||
MapScriptToTypefaces["tglg"].Insert(0, "Noto Sans Tagalog");
|
||||
MapScriptToTypefaces["tagb"].Insert(0, "Noto Sans Tagbanwa");
|
||||
MapScriptToTypefaces["tale"].Insert(0, "Noto Sans Tai Le");
|
||||
MapScriptToTypefaces["lana"].Insert(0, "Noto Sans Tai Tham");
|
||||
MapScriptToTypefaces["tavt"].Insert(0, "Noto Sans Tai Viet");
|
||||
MapScriptToTypefaces["takr"].Insert(0, "Noto Sans Takri");
|
||||
MapScriptToTypefaces["taml"].Insert(0, "Noto Sans Tamil");
|
||||
MapScriptToTypefaces["telu"].Insert(0, "Noto Sans Telugu");
|
||||
MapScriptToTypefaces["thaa"].Insert(0, "Noto Sans Thaana");
|
||||
MapScriptToTypefaces["thai"].Insert(0, "Noto Sans Thai");
|
||||
MapScriptToTypefaces["tfng"].Insert(0, "Noto Sans Tifinagh");
|
||||
MapScriptToTypefaces["ugar"].Insert(0, "Noto Sans Ugaritic");
|
||||
MapScriptToTypefaces["vaii"].Insert(0, "Noto Sans Vai");
|
||||
MapScriptToTypefaces["wcho"].Insert(0, "Noto Sans Wancho");
|
||||
MapScriptToTypefaces["wara"].Insert(0, "Noto Sans Warang Citi");
|
||||
MapScriptToTypefaces["yiii"].Insert(0, "Noto Sans Yi");
|
||||
}
|
||||
public FallbackListFontMatcher(FontManager manager) : base(manager) { }
|
||||
public override IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false) {
|
||||
if (string.IsNullOrEmpty(script)) script = ScriptUtils.UltimateFallbackScript;
|
||||
List<string> candidates;
|
||||
IEnumerable<string> candidateScripts = new string[] { script };
|
||||
while (candidateScripts != null) {
|
||||
foreach (var candidateScript in candidateScripts) {
|
||||
if (MapScriptToTypefaces.TryGetValue(candidateScript, out candidates)) {
|
||||
foreach (var candidate in candidates) {
|
||||
IReadOnlyCollection<Typeface> typefaces1;
|
||||
if (Manager.MapFullNameToTypeface.TryGetValue(candidate, out typefaces1)) {
|
||||
foreach (var typeface in typefaces1) {
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
if (distinctFamily) continue;
|
||||
IReadOnlyCollection<Typeface> typefaces2;
|
||||
if (Manager.MapNameToTypefaces.TryGetValue(candidate, out typefaces2)) {
|
||||
foreach (var typeface in typefaces2) {
|
||||
if (typefaces1.Contains(typeface)) continue;
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
candidateScripts = ScriptUtils.EnumerateFallbackScripts(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Font/FontMatcher.cs.meta
Normal file
11
Assets/Cryville/Common/Font/FontMatcher.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afcde0ad1865db24da79ca1ce7256791
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
222
Assets/Cryville/Common/Font/FontTable.cs
Normal file
222
Assets/Cryville/Common/Font/FontTable.cs
Normal file
@@ -0,0 +1,222 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class FontTable<T> {
|
||||
protected UInt32 Offset { get; private set; }
|
||||
protected BinaryReader Reader { get; private set; }
|
||||
|
||||
protected FontTable(BinaryReader reader, UInt32 offset) {
|
||||
Reader = reader;
|
||||
Offset = offset;
|
||||
reader.BaseStream.Position = offset;
|
||||
}
|
||||
public abstract IReadOnlyList<T> GetItems();
|
||||
}
|
||||
public abstract class FontTable<T, U> : FontTable<T> {
|
||||
protected FontTable(BinaryReader reader, UInt32 offset) : base(reader, offset) { }
|
||||
public abstract U GetSubTable(T item);
|
||||
}
|
||||
public sealed class TTCHeader : FontTable<UInt32, TableDirectory> {
|
||||
readonly String ttcTag;
|
||||
readonly UInt16 majorVersion;
|
||||
readonly UInt16 minorVersion;
|
||||
readonly UInt32 numFonts;
|
||||
readonly List<UInt32> tableDirectoryOffsets = new List<UInt32>();
|
||||
readonly String dsigTag;
|
||||
readonly UInt32 dsigLength;
|
||||
readonly UInt32 dsigOffset;
|
||||
public TTCHeader(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
ttcTag = reader.ReadTag();
|
||||
if (ttcTag != "ttcf") throw new NotImplementedException();
|
||||
majorVersion = reader.ReadUInt16();
|
||||
minorVersion = reader.ReadUInt16();
|
||||
numFonts = reader.ReadUInt32();
|
||||
for (UInt32 i = 0; i < numFonts; i++) tableDirectoryOffsets.Add(reader.ReadUInt32());
|
||||
if (majorVersion == 2) {
|
||||
dsigTag = reader.ReadTag();
|
||||
dsigLength = reader.ReadUInt32();
|
||||
dsigOffset = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
public override IReadOnlyList<UInt32> GetItems() {
|
||||
return tableDirectoryOffsets;
|
||||
}
|
||||
public override TableDirectory GetSubTable(UInt32 item) {
|
||||
var i = item;
|
||||
return new TableDirectory(Reader, i);
|
||||
}
|
||||
}
|
||||
public sealed class TableDirectory : FontTable<TableRecord, object> {
|
||||
readonly UInt32 sfntVersion;
|
||||
readonly UInt16 numTables;
|
||||
readonly UInt16 searchRange;
|
||||
readonly UInt16 entrySelector;
|
||||
readonly UInt16 rangeShift;
|
||||
readonly List<TableRecord> tableRecords = new List<TableRecord>();
|
||||
public TableDirectory(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
sfntVersion = reader.ReadUInt32();
|
||||
numTables = reader.ReadUInt16();
|
||||
searchRange = reader.ReadUInt16();
|
||||
entrySelector = reader.ReadUInt16();
|
||||
rangeShift = reader.ReadUInt16();
|
||||
for (int i = 0; i < numTables; i++)
|
||||
tableRecords.Add(new TableRecord {
|
||||
tableTag = reader.ReadTag(),
|
||||
checksum = reader.ReadUInt32(),
|
||||
offset = reader.ReadUInt32(),
|
||||
length = reader.ReadUInt32(),
|
||||
});
|
||||
}
|
||||
public override IReadOnlyList<TableRecord> GetItems() {
|
||||
return tableRecords;
|
||||
}
|
||||
public override object GetSubTable(TableRecord item) {
|
||||
switch (item.tableTag) {
|
||||
case "name": return new NameTable(Reader, item.offset);
|
||||
case "meta": return new MetaTable(Reader, item.offset);
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
public struct TableRecord {
|
||||
public string tableTag;
|
||||
public UInt32 checksum;
|
||||
public UInt32 offset;
|
||||
public UInt32 length;
|
||||
}
|
||||
public sealed class NameTable : FontTable<NameRecord> {
|
||||
readonly UInt16 version;
|
||||
readonly UInt16 count;
|
||||
readonly UInt16 storageOffset;
|
||||
readonly List<NameRecord> nameRecord = new List<NameRecord>();
|
||||
readonly UInt16 langTagCount;
|
||||
readonly List<LangTagRecord> langTagRecord = new List<LangTagRecord>();
|
||||
public NameTable(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
version = reader.ReadUInt16();
|
||||
count = reader.ReadUInt16();
|
||||
storageOffset = reader.ReadUInt16();
|
||||
for (UInt16 i = 0; i < count; i++)
|
||||
nameRecord.Add(new NameRecord {
|
||||
platformID = reader.ReadUInt16(),
|
||||
encodingID = reader.ReadUInt16(),
|
||||
languageID = reader.ReadUInt16(),
|
||||
nameID = (NameID)reader.ReadUInt16(),
|
||||
length = reader.ReadUInt16(),
|
||||
stringOffset = reader.ReadUInt16(),
|
||||
});
|
||||
if (version == 1) {
|
||||
langTagCount = reader.ReadUInt16();
|
||||
for (UInt16 i = 0; i < langTagCount; i++)
|
||||
langTagRecord.Add(new LangTagRecord {
|
||||
length = reader.ReadUInt16(),
|
||||
langTagOffset = reader.ReadUInt16(),
|
||||
});
|
||||
}
|
||||
UInt32 origin = (UInt32)reader.BaseStream.Position;
|
||||
for (int i = 0; i < nameRecord.Count; i++) nameRecord[i] = nameRecord[i].Load(reader, origin);
|
||||
for (int i = 0; i < langTagRecord.Count; i++) langTagRecord[i] = langTagRecord[i].Load(reader, origin);
|
||||
}
|
||||
public sealed override IReadOnlyList<NameRecord> GetItems() {
|
||||
return nameRecord;
|
||||
}
|
||||
}
|
||||
public struct NameRecord {
|
||||
public UInt16 platformID;
|
||||
public UInt16 encodingID;
|
||||
public UInt16 languageID;
|
||||
public NameID nameID;
|
||||
public UInt16 length;
|
||||
public UInt16 stringOffset;
|
||||
public String value { get; private set; }
|
||||
public NameRecord Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + stringOffset;
|
||||
Encoding encoding;
|
||||
switch (platformID) {
|
||||
case 0: encoding = Encoding.BigEndianUnicode; break;
|
||||
case 3: encoding = Encoding.BigEndianUnicode; break;
|
||||
default: return this;
|
||||
}
|
||||
value = encoding.GetString(reader.ReadBytes(length));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public enum NameID : UInt16 {
|
||||
CopyrightNotice = 0,
|
||||
FontFamilyName = 1,
|
||||
FontSubfamilyName = 2,
|
||||
UniqueFontIdentifier = 3,
|
||||
FullFontName = 4,
|
||||
VersionString = 5,
|
||||
PostScriptName = 6,
|
||||
Trademark = 7,
|
||||
ManufacturerName = 8,
|
||||
Designer = 9,
|
||||
Description = 10,
|
||||
URLVendor = 11,
|
||||
URLDesigner = 12,
|
||||
LicenseDescription = 13,
|
||||
LicenseInfoURL = 14,
|
||||
|
||||
TypographicFamilyName = 16,
|
||||
TypographicSubfamilyName = 17,
|
||||
CompatibleFull = 18,
|
||||
SampleText = 19,
|
||||
PostScriptCIDFindfontName = 20,
|
||||
WWSFamilyName = 21,
|
||||
WWSSubfamilyName = 22,
|
||||
LightBackgroundPalette = 23,
|
||||
DarkBackgroundPalette = 24,
|
||||
VariationsPostScriptNamePrefix = 25,
|
||||
}
|
||||
public struct LangTagRecord {
|
||||
public UInt16 length;
|
||||
public UInt16 langTagOffset;
|
||||
public String value { get; private set; }
|
||||
public LangTagRecord Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + langTagOffset;
|
||||
value = Encoding.BigEndianUnicode.GetString(reader.ReadBytes(length));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public sealed class MetaTable : FontTable<DataMap> {
|
||||
readonly UInt32 version;
|
||||
readonly UInt32 flags;
|
||||
readonly UInt32 dataMapCount;
|
||||
readonly List<DataMap> dataMaps = new List<DataMap>();
|
||||
public MetaTable(BinaryReader reader, UInt32 offset) : base(reader, offset) {
|
||||
version = reader.ReadUInt32();
|
||||
flags = reader.ReadUInt32();
|
||||
reader.ReadUInt32();
|
||||
dataMapCount = reader.ReadUInt32();
|
||||
for (UInt32 i = 0; i < dataMapCount; i++)
|
||||
dataMaps.Add(new DataMap {
|
||||
tag = reader.ReadTag(),
|
||||
dataOffset = reader.ReadUInt32(),
|
||||
dataLength = reader.ReadUInt32(),
|
||||
});
|
||||
for (int i = 0; i < dataMaps.Count; i++) dataMaps[i] = dataMaps[i].Load(reader, offset);
|
||||
}
|
||||
public sealed override IReadOnlyList<DataMap> GetItems() {
|
||||
return dataMaps;
|
||||
}
|
||||
}
|
||||
public struct DataMap {
|
||||
public String tag;
|
||||
public UInt32 dataOffset;
|
||||
public UInt32 dataLength;
|
||||
public String value { get; private set; }
|
||||
public DataMap Load(BinaryReader reader, UInt32 origin) {
|
||||
reader.BaseStream.Position = origin + dataOffset;
|
||||
value = Encoding.ASCII.GetString(reader.ReadBytes((int)dataLength));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public static class BinaryReaderExtensions {
|
||||
public static string ReadTag(this BinaryReader reader) {
|
||||
return Encoding.ASCII.GetString(reader.ReadBytes(4));
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Font/FontTable.cs.meta
Normal file
11
Assets/Cryville/Common/Font/FontTable.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eed6aa2387582346b7b21c6f8de5e1f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,9 +0,0 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public static class FontUtil {
|
||||
/*public static string MatchFontNameWithLang(string lang) {
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
31
Assets/Cryville/Common/Font/Typeface.cs
Normal file
31
Assets/Cryville/Common/Font/Typeface.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cryville.Common.Font {
|
||||
public abstract class Typeface {
|
||||
public FileInfo File { get; private set; }
|
||||
public int IndexInFile { get; private set; }
|
||||
public string FamilyName { get; protected set; }
|
||||
public string SubfamilyName { get; protected set; }
|
||||
public string FullName { get; protected set; }
|
||||
protected abstract void GetName(BinaryReader reader);
|
||||
|
||||
public Typeface(BinaryReader reader, FileInfo file, int index) {
|
||||
File = file;
|
||||
IndexInFile = index;
|
||||
GetName(reader);
|
||||
}
|
||||
}
|
||||
public class TypefaceTTF : Typeface {
|
||||
public TypefaceTTF(BinaryReader reader, FileInfo file, int index)
|
||||
: base(reader, file, index) { }
|
||||
|
||||
protected override void GetName(BinaryReader reader) {
|
||||
var dir = new TableDirectory(reader, (uint)reader.BaseStream.Position);
|
||||
var nameTable = (NameTable)dir.GetSubTable((from i in dir.GetItems() where i.tableTag == "name" select i).Single());
|
||||
FamilyName = (from i in nameTable.GetItems() where i.nameID == NameID.FontFamilyName && i.value != null select i.value).First();
|
||||
SubfamilyName = (from i in nameTable.GetItems() where i.nameID == NameID.FontSubfamilyName && i.value != null select i.value).First();
|
||||
FullName = (from i in nameTable.GetItems() where i.nameID == NameID.FullFontName && i.value != null select i.value).First();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Font/Typeface.cs.meta
Normal file
11
Assets/Cryville/Common/Font/Typeface.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0968fc12b50cffb4682f0c28d0d14703
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Cryville/Common/IO.meta
Normal file
8
Assets/Cryville/Common/IO.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaa0d8cecafb37b46a6abe372cfefd93
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
75
Assets/Cryville/Common/IO/BinaryReaderBE.cs
Normal file
75
Assets/Cryville/Common/IO/BinaryReaderBE.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Common.IO {
|
||||
public class BinaryReaderBE : BinaryReader {
|
||||
readonly byte[] m_buffer = new byte[8];
|
||||
|
||||
public BinaryReaderBE(Stream input) : base(input) { }
|
||||
|
||||
public BinaryReaderBE(Stream input, Encoding encoding) : base(input, encoding) { }
|
||||
|
||||
public BinaryReaderBE(Stream input, Encoding encoding, bool leaveOpen) : base(input, encoding, leaveOpen) { }
|
||||
|
||||
public override short ReadInt16() {
|
||||
FillBuffer(2);
|
||||
return (short)(m_buffer[1] | (m_buffer[0] << 8));
|
||||
}
|
||||
public override ushort ReadUInt16() {
|
||||
FillBuffer(2);
|
||||
return (ushort)(m_buffer[1] | (m_buffer[0] << 8));
|
||||
}
|
||||
|
||||
public override int ReadInt32() {
|
||||
FillBuffer(4);
|
||||
return m_buffer[3] | (m_buffer[2] << 8) | (m_buffer[1] << 16) | (m_buffer[0] << 24);
|
||||
}
|
||||
public override uint ReadUInt32() {
|
||||
FillBuffer(4);
|
||||
return (uint)(m_buffer[3] | (m_buffer[2] << 8) | (m_buffer[1] << 16) | (m_buffer[0] << 24));
|
||||
}
|
||||
|
||||
public override long ReadInt64() {
|
||||
FillBuffer(8);
|
||||
uint num = (uint)(m_buffer[7] | (m_buffer[6] << 8) | (m_buffer[5] << 16) | (m_buffer[4] << 24));
|
||||
uint num2 = (uint)(m_buffer[3] | (m_buffer[2] << 8) | (m_buffer[1] << 16) | (m_buffer[0] << 24));
|
||||
return (long)(((ulong)num2 << 32) | num);
|
||||
}
|
||||
public override ulong ReadUInt64() {
|
||||
FillBuffer(8);
|
||||
uint num = (uint)(m_buffer[7] | (m_buffer[6] << 8) | (m_buffer[5] << 16) | (m_buffer[4] << 24));
|
||||
uint num2 = (uint)(m_buffer[3] | (m_buffer[2] << 8) | (m_buffer[1] << 16) | (m_buffer[0] << 24));
|
||||
return ((ulong)num2 << 32) | num;
|
||||
}
|
||||
protected new void FillBuffer(int numBytes) {
|
||||
if (m_buffer != null && (numBytes < 0 || numBytes > m_buffer.Length)) {
|
||||
throw new ArgumentOutOfRangeException("numBytes", "Requested numBytes is larger than the internal buffer size");
|
||||
}
|
||||
|
||||
int num = 0, num2;
|
||||
if (BaseStream == null) {
|
||||
throw new IOException("File not open");
|
||||
}
|
||||
|
||||
if (numBytes == 1) {
|
||||
num2 = BaseStream.ReadByte();
|
||||
if (num2 == -1) {
|
||||
throw new EndOfStreamException("The end of the stream is reached before numBytes could be read");
|
||||
}
|
||||
m_buffer[0] = (byte)num2;
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
num2 = BaseStream.Read(m_buffer, num, numBytes - num);
|
||||
if (num2 == 0) {
|
||||
throw new EndOfStreamException("The end of the stream is reached before numBytes could be read");
|
||||
}
|
||||
|
||||
num += num2;
|
||||
}
|
||||
while (num < numBytes);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/IO/BinaryReaderBE.cs.meta
Normal file
11
Assets/Cryville/Common/IO/BinaryReaderBE.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aee537c74ab935940b54cb5d784b7f56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common {
|
||||
public struct Identifier : IEquatable<Identifier> {
|
||||
public static Identifier Empty = new Identifier(0);
|
||||
public int Key { get; private set; }
|
||||
public object Name { get { return IdentifierManager.SharedInstance.Retrieve(Key); } }
|
||||
public Identifier(int key) {
|
||||
@@ -24,11 +25,11 @@ namespace Cryville.Common {
|
||||
if (Key == 0) return "";
|
||||
return Name.ToString();
|
||||
}
|
||||
public static implicit operator Identifier(string identifier) {
|
||||
return new Identifier(identifier);
|
||||
public static bool operator ==(Identifier lhs, Identifier rhs) {
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
public static implicit operator string(Identifier identifier) {
|
||||
return identifier.ToString();
|
||||
public static bool operator !=(Identifier lhs, Identifier rhs) {
|
||||
return !lhs.Equals(rhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Common {
|
||||
/// <summary>
|
||||
@@ -10,10 +10,10 @@ namespace Cryville.Common {
|
||||
/// </summary>
|
||||
public static IdentifierManager SharedInstance = new IdentifierManager();
|
||||
|
||||
Dictionary<object, int> _idents = new Dictionary<object, int>();
|
||||
List<object> _ids = new List<object>();
|
||||
readonly Dictionary<object, int> _idents = new Dictionary<object, int>();
|
||||
readonly List<object> _ids = new List<object>();
|
||||
|
||||
object _syncRoot = new object();
|
||||
readonly object _syncRoot = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="IdentifierManager" /> class.
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Common {
|
||||
@@ -40,7 +41,7 @@ namespace Cryville.Common {
|
||||
public static void Create(string key, Logger logger) {
|
||||
Instances[key] = logger;
|
||||
if (logPath != null) {
|
||||
Files[key] = new StreamWriter(logPath + "/" + ((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() + "-" + key + ".log") {
|
||||
Files[key] = new StreamWriter(logPath + "/" + ((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString(CultureInfo.InvariantCulture) + "-" + key + ".log") {
|
||||
AutoFlush = true
|
||||
};
|
||||
}
|
||||
|
@@ -54,16 +54,13 @@ namespace Cryville.Common.Math {
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a <see cref="System.Single" /> column vector and fills it with polynomial coefficients.
|
||||
/// Fills a <see cref="System.Single" /> column vector with polynomial coefficients.
|
||||
/// </summary>
|
||||
/// <param name="size">The size of the column vector.</param>
|
||||
/// <param name="vec">The column vector.</param>
|
||||
/// <param name="num">The base number.</param>
|
||||
/// <returns>A <see cref="System.Single" /> column vector filled with polynomial coefficients.</returns>
|
||||
public static ColumnVector<float> WithPolynomialCoefficients(int size, float num) {
|
||||
var m = new ColumnVector<float>(size);
|
||||
for (var i = 0; i < size; i++)
|
||||
m[i] = (float)System.Math.Pow(num, i);
|
||||
return m;
|
||||
public static void FillWithPolynomialCoefficients(ColumnVector<float> vec, float num) {
|
||||
for (var i = 0; i < vec.Size; i++)
|
||||
vec[i] = (float)System.Math.Pow(num, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
Assets/Cryville/Common/Math/CubicBezier.cs
Normal file
27
Assets/Cryville/Common/Math/CubicBezier.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using SMath = System.Math;
|
||||
|
||||
namespace Cryville.Common.Math {
|
||||
// Ported from https://github.com/arian/cubic-bezier/blob/master/index.js
|
||||
public static class CubicBezier {
|
||||
public static float Evaluate(float t, float x1, float y1, float x2, float y2, float epsilon) {
|
||||
float x = t, t0 = 0, t1 = 1, t2 = x;
|
||||
|
||||
if (t2 < t0) return Curve(t0, y1, y2);
|
||||
if (t2 > t1) return Curve(t1, y1, y2);
|
||||
|
||||
while (t0 < t1) {
|
||||
float tx = Curve(t2, x1, x2);
|
||||
if (SMath.Abs(tx - x) < epsilon) return Curve(t2, y1, y2);
|
||||
if (x > tx) t0 = t2;
|
||||
else t1 = t2;
|
||||
t2 = (t1 - t0) * .5f + t0;
|
||||
}
|
||||
|
||||
return Curve(t2, y1, y2);
|
||||
}
|
||||
static float Curve(float t, float p1, float p2) {
|
||||
float v = 1 - t;
|
||||
return 3 * v * v * t * p1 + 3 * v * t * t * p2 + t * t * t;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Math/CubicBezier.cs.meta
Normal file
11
Assets/Cryville/Common/Math/CubicBezier.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17dd6f775fc965f43960da7166b55b87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
78
Assets/Cryville/Common/Math/FractionUtils.cs
Normal file
78
Assets/Cryville/Common/Math/FractionUtils.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.Math {
|
||||
/// <summary>
|
||||
/// Provides a set of <see langword="static" /> methods related to fractions.
|
||||
/// </summary>
|
||||
public static class FractionUtils {
|
||||
/// <summary>
|
||||
/// Converts a <see cref="double" /> decimal to a fraction.
|
||||
/// </summary>
|
||||
/// <param name="value">The decimal.</param>
|
||||
/// <param name="error">The error.</param>
|
||||
/// <param name="n">The numerator.</param>
|
||||
/// <param name="d">The denominator.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="value" /> is less than 0 or <paramref name="error" /> is not greater than 0 or greater than 1.</exception>
|
||||
public static void ToFraction(double value, double error, out int n, out int d) {
|
||||
if (value < 0.0)
|
||||
throw new ArgumentOutOfRangeException("value", "Must be >= 0.");
|
||||
if (error <= 0.0 || error > 1.0)
|
||||
throw new ArgumentOutOfRangeException("error", "Must be > 0 and <= 1.");
|
||||
|
||||
int num = (int)System.Math.Floor(value);
|
||||
value -= num;
|
||||
|
||||
if (value < error) { n = num; d = 1; return; }
|
||||
if (1 - error < value) { n = num + 1; d = 1; return; }
|
||||
|
||||
int lower_n = 0;
|
||||
int lower_d = 1;
|
||||
int upper_n = 1;
|
||||
int upper_d = 1;
|
||||
while (true) {
|
||||
int middle_n = lower_n + upper_n;
|
||||
int middle_d = lower_d + upper_d;
|
||||
|
||||
if (middle_d * (value + error) < middle_n) {
|
||||
upper_n = middle_n;
|
||||
upper_d = middle_d;
|
||||
}
|
||||
else if (middle_n < (value - error) * middle_d) {
|
||||
lower_n = middle_n;
|
||||
lower_d = middle_d;
|
||||
}
|
||||
else {
|
||||
n = num * middle_d + middle_n;
|
||||
d = middle_d;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the greatest common divisor (GCD) of two integers.
|
||||
/// </summary>
|
||||
/// <param name="n">The first integer.</param>
|
||||
/// <param name="d">The second integer.</param>
|
||||
/// <returns>The greatest common divisor (GCD) of the two integers.</returns>
|
||||
public static int GreatestCommonDivisor(int n, int d) {
|
||||
while (d != 0) {
|
||||
int t = d;
|
||||
d = n % d;
|
||||
n = t;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simplifies a fraction.
|
||||
/// </summary>
|
||||
/// <param name="n">The numerator.</param>
|
||||
/// <param name="d">The denominator.</param>
|
||||
public static void Simplify(ref int n, ref int d) {
|
||||
var gcd = GreatestCommonDivisor(n, d);
|
||||
n /= gcd;
|
||||
d /= gcd;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Math/FractionUtils.cs.meta
Normal file
11
Assets/Cryville/Common/Math/FractionUtils.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6829ada596979a545a935785eeea2972
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,9 +1,13 @@
|
||||
namespace Cryville.Common.Math {
|
||||
using UnsafeIL;
|
||||
|
||||
namespace Cryville.Common.Math {
|
||||
/// <summary>
|
||||
/// Represents a square matrix.
|
||||
/// </summary>
|
||||
public class SquareMatrix {
|
||||
readonly float[,] content;
|
||||
readonly float[,] buffer;
|
||||
readonly int[] refl;
|
||||
/// <summary>
|
||||
/// The size of the matrix.
|
||||
/// </summary>
|
||||
@@ -17,6 +21,8 @@
|
||||
/// <param name="size">The size of the matrix.</param>
|
||||
public SquareMatrix(int size) {
|
||||
content = new float[size, size];
|
||||
buffer = new float[size, size];
|
||||
refl = new int[size];
|
||||
Size = size;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -34,42 +40,43 @@
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The vector type.</typeparam>
|
||||
/// <param name="v">The column vector.</param>
|
||||
/// <param name="result">The result column vector.</param>
|
||||
/// <param name="o">The column operator.</param>
|
||||
/// <returns>The column vector eliminated.</returns>
|
||||
public ColumnVector<T> Eliminate<T>(ColumnVector<T> v, IVectorOperator<T> o) {
|
||||
public void Eliminate<T>(ColumnVector<T> v, ColumnVector<T> result, IVectorOperator<T> o) {
|
||||
int s = Size;
|
||||
float[,] d = (float[,])content.Clone();
|
||||
int[] refl = new int[s];
|
||||
for (int i = 0; i < s; i++)
|
||||
refl[i] = i;
|
||||
FillBuffer();
|
||||
for (int i = 0; i < s; i++) refl[i] = i;
|
||||
for (int r = 0; r < s; r++) {
|
||||
for (int r0 = r; r0 < s; r0++)
|
||||
if (d[refl[r0], r] != 0) {
|
||||
if (buffer[refl[r0], r] != 0) {
|
||||
refl[r] = r0;
|
||||
refl[r0] = r;
|
||||
break;
|
||||
}
|
||||
int or = refl[r];
|
||||
float sf0 = d[or, r];
|
||||
float sf0 = buffer[or, r];
|
||||
for (int c0 = r; c0 < s; c0++)
|
||||
d[or, c0] /= sf0;
|
||||
buffer[or, c0] /= sf0;
|
||||
v[or] = o.ScalarMultiply(1 / sf0, v[or]);
|
||||
for (int r1 = r + 1; r1 < s; r1++) {
|
||||
int or1 = refl[r1];
|
||||
float sf1 = d[or1, r];
|
||||
float sf1 = buffer[or1, r];
|
||||
for (int c1 = r; c1 < s; c1++)
|
||||
d[or1, c1] -= d[or, c1] * sf1;
|
||||
buffer[or1, c1] -= buffer[or, c1] * sf1;
|
||||
v[or1] = o.Add(v[or1], o.ScalarMultiply(-sf1, v[or]));
|
||||
}
|
||||
}
|
||||
T[] res = new T[s];
|
||||
for (int r2 = s - 1; r2 >= 0; r2--) {
|
||||
var v2 = v[refl[r2]];
|
||||
for (int c2 = r2 + 1; c2 < s; c2++)
|
||||
v2 = o.Add(v2, o.ScalarMultiply(-d[refl[r2], c2], res[refl[c2]]));
|
||||
res[refl[r2]] = v2;
|
||||
v2 = o.Add(v2, o.ScalarMultiply(-buffer[refl[r2], c2], result[refl[c2]]));
|
||||
result[refl[r2]] = v2;
|
||||
}
|
||||
}
|
||||
unsafe void FillBuffer() {
|
||||
fixed (void* ptrc = content, ptrb = buffer) {
|
||||
Unsafe.CopyBlock(ptrb, ptrc, (uint)(Size * Size * sizeof(float)));
|
||||
}
|
||||
return new ColumnVector<T>(res);
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a square matrix and fills it with polynomial coefficients.
|
||||
|
@@ -77,7 +77,7 @@ namespace Cryville.Common.Network {
|
||||
encoding = Encoding.UTF8;
|
||||
payload = encoding.GetBytes(body);
|
||||
headers.Add("Content-Encoding", encoding.EncodingName);
|
||||
headers.Add("Content-Length", payload.Length.ToString());
|
||||
headers.Add("Content-Length", payload.Length.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
string request_line = string.Format(
|
||||
"{0} {1} {2}\r\n", method, uri, Version
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -19,9 +19,7 @@ namespace Cryville.Common.Network {
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override void Flush() {
|
||||
// Do nothing
|
||||
}
|
||||
public override void Flush() { }
|
||||
|
||||
public abstract byte[] ReadToEnd();
|
||||
|
||||
@@ -132,4 +130,4 @@ namespace Cryville.Common.Network {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ namespace Cryville.Common.Network {
|
||||
}
|
||||
|
||||
private class InternalTlsClient : DefaultTlsClient {
|
||||
string _host;
|
||||
readonly string _host;
|
||||
|
||||
public InternalTlsClient(string host, TlsCrypto crypto) : base(crypto) {
|
||||
_host = host;
|
||||
@@ -92,9 +92,7 @@ namespace Cryville.Common.Network {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void NotifyServerCertificate(TlsServerCertificate serverCertificate) {
|
||||
// Do nothing
|
||||
}
|
||||
public void NotifyServerCertificate(TlsServerCertificate serverCertificate) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,21 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// Indicates that the attributed member is an element list.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>An element list is a <see cref="System.Collections.IDictionary" /> or <see cref="Cryville.Common.Collections.IPairList" /> that represents a collection of PDT elements. There must be at most one element list in a class.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public class ElementListAttribute : Attribute { }
|
||||
public class ComponentListAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the attributed member is a property list.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>A property list is a <see cref="System.Collections.IDictionary" /> or <see cref="Cryville.Common.Collections.IPairList" /> that represents a collection of PDT properties. There must be at most one property list in a class.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public class PropertyListAttribute : Attribute { }
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
@@ -16,22 +17,23 @@ namespace Cryville.Common.Pdt {
|
||||
readonly StackFrame[] _stack = new StackFrame[256];
|
||||
readonly byte[] _mem = new byte[0x100000];
|
||||
bool _revokepttconst;
|
||||
LinkedListNode<PdtInstruction> _rip;
|
||||
LinkedListNode<PdtInstruction> _ip;
|
||||
/// <summary>
|
||||
/// Evaluates an expression and passes the result to a target operator.
|
||||
/// </summary>
|
||||
/// <param name="target">The target operator.</param>
|
||||
/// <param name="exp">The expression to evaluate.</param>
|
||||
public void Evaluate(PdtOperator target, PdtExpression exp) {
|
||||
/// <returns>Whether the evaluaton succeeded.</returns>
|
||||
public bool Evaluate(PdtOperator target, PdtExpression exp) {
|
||||
_framecount = 0;
|
||||
_goffset = 0;
|
||||
_revokepttconst = false;
|
||||
for (_rip = exp.Instructions.First; _rip != null; _rip = _rip.Next)
|
||||
_rip.Value.Execute(this);
|
||||
Operate(target, _framecount, true);
|
||||
for (_ip = exp.Instructions.First; _ip != null; _ip = _ip.Next)
|
||||
_ip.Value.Execute(this);
|
||||
if (exp.IsPotentialConstant) {
|
||||
exp.IsConstant = exp.IsPotentialConstant = !_revokepttconst;
|
||||
}
|
||||
return Operate(target, _framecount, true);
|
||||
}
|
||||
/// <summary>
|
||||
/// Patches an expression with a lefthand variable and a compound operator.
|
||||
@@ -53,8 +55,10 @@ namespace Cryville.Common.Pdt {
|
||||
List<PdtInstruction.Collapse> ct;
|
||||
var cols = new Dictionary<LinkedListNode<PdtInstruction>, List<PdtInstruction.Collapse>>();
|
||||
var il = exp.Instructions;
|
||||
for (_rip = il.First; _rip != null; _rip = _rip == null ? il.First : _rip.Next) {
|
||||
var i = _rip.Value;
|
||||
_ip = il.First;
|
||||
while (_ip != null) {
|
||||
bool nextFlag = false;
|
||||
var i = _ip.Value;
|
||||
if (i is PdtInstruction.Operate) {
|
||||
int fc0 = _framecount;
|
||||
int fc1 = ((PdtInstruction.Operate)i).Signature.ParamCount;
|
||||
@@ -70,29 +74,36 @@ namespace Cryville.Common.Pdt {
|
||||
}
|
||||
else {
|
||||
var frame = _stack[_framecount - 1];
|
||||
_rip = il.AddAfter(_rip, new PdtInstruction.PushConstant(frame.Type, _mem, frame.Offset, frame.Length));
|
||||
for (var j = 0; j <= fc1; j++) il.Remove(_rip.Previous);
|
||||
ReplaceIP(il, new PdtInstruction.PushConstant(frame.Type, _mem, frame.Offset, frame.Length), cols);
|
||||
for (var j = 0; j < fc1; j++) il.Remove(_ip.Previous);
|
||||
}
|
||||
}
|
||||
else if (i is PdtInstruction.Collapse) {
|
||||
var t = (PdtInstruction.Collapse)i;
|
||||
try {
|
||||
var pins = _rip;
|
||||
var pins = _ip;
|
||||
i.Execute(this);
|
||||
if (_rip == pins) {
|
||||
_rip = _rip.Next;
|
||||
il.Remove(_rip.Previous);
|
||||
il.Remove(_rip.Previous);
|
||||
_rip = _rip.Previous;
|
||||
if (_stack[_framecount - 1].Type == PdtInternalType.Error) {
|
||||
throw new EvaluationFailureException();
|
||||
}
|
||||
if (_ip == pins) {
|
||||
_ip = _ip.Next;
|
||||
il.Remove(_ip.Previous);
|
||||
il.Remove(_ip.Previous);
|
||||
_ip = _ip.Previous;
|
||||
if (_ip == null) {
|
||||
_ip = il.First;
|
||||
nextFlag = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_rip = pins.Previous;
|
||||
while (_rip.Next != t.Target) il.Remove(_rip.Next);
|
||||
il.Remove(_rip.Next);
|
||||
_ip = pins.Previous;
|
||||
while (_ip.Next != t.Target) il.Remove(_ip.Next);
|
||||
il.Remove(_ip.Next);
|
||||
if (cols.TryGetValue(t.Target, out ct)) {
|
||||
foreach (var u in ct) u.Target = _rip;
|
||||
foreach (var u in ct) u.Target = _ip;
|
||||
cols.Remove(t.Target);
|
||||
cols.Add(_rip, ct);
|
||||
cols.Add(_ip, ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,13 +115,12 @@ namespace Cryville.Common.Pdt {
|
||||
else if (i is PdtInstruction.PushVariable) {
|
||||
i.Execute(this);
|
||||
var frame = _stack[_framecount - 1];
|
||||
if (frame.Type != PdtInternalType.Undefined) {
|
||||
_rip = il.AddAfter(_rip, new PdtInstruction.PushConstant(frame.Type, _mem, frame.Offset, frame.Length));
|
||||
il.Remove(_rip.Previous);
|
||||
if (frame.Type != PdtInternalType.Undefined && frame.Type != PdtInternalType.Error) {
|
||||
ReplaceIP(il, new PdtInstruction.PushConstant(frame.Type, _mem, frame.Offset, frame.Length), cols);
|
||||
}
|
||||
}
|
||||
else i.Execute(this);
|
||||
if (_rip != null && cols.TryGetValue(_rip, out ct)) {
|
||||
if (_ip != null && cols.TryGetValue(_ip, out ct)) {
|
||||
unsafe {
|
||||
fixed (StackFrame* frame = &_stack[_framecount - 1]) {
|
||||
frame->Type = PdtInternalType.Error;
|
||||
@@ -119,6 +129,7 @@ namespace Cryville.Common.Pdt {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nextFlag) _ip = _ip.Next;
|
||||
}
|
||||
exp.IsConstant = true;
|
||||
exp.IsPotentialConstant = true;
|
||||
@@ -132,6 +143,13 @@ namespace Cryville.Common.Pdt {
|
||||
}
|
||||
}
|
||||
}
|
||||
void ReplaceIP(LinkedList<PdtInstruction> il, PdtInstruction ins, Dictionary<LinkedListNode<PdtInstruction>, List<PdtInstruction.Collapse>> cols) {
|
||||
List<PdtInstruction.Collapse> cins;
|
||||
if (cols.TryGetValue(_ip, out cins)) cols.Remove(_ip);
|
||||
_ip = il.AddAfter(_ip, ins);
|
||||
il.Remove(_ip.Previous);
|
||||
if (cins != null) cols.Add(_ip, cins);
|
||||
}
|
||||
/// <summary>
|
||||
/// Revokes the potential constant mark of the current expression.
|
||||
/// </summary>
|
||||
@@ -147,10 +165,10 @@ namespace Cryville.Common.Pdt {
|
||||
_goffset += value.Length;
|
||||
}
|
||||
}
|
||||
internal unsafe void PushVariable(int name) {
|
||||
internal unsafe void PushVariable(int name, bool forced) {
|
||||
fixed (StackFrame* frame = &_stack[_framecount++]) {
|
||||
byte[] value;
|
||||
GetVariable(name, out frame->Type, out value);
|
||||
GetVariable(name, forced, out frame->Type, out value);
|
||||
frame->Offset = _goffset;
|
||||
frame->Length = value.Length;
|
||||
Array.Copy(value, 0, _mem, _goffset, value.Length);
|
||||
@@ -161,16 +179,17 @@ namespace Cryville.Common.Pdt {
|
||||
/// Gets a variable of the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the variable.</param>
|
||||
/// <param name="forced">Whether to produce an error stack instead of an identifier stack if the variable is not found.</param>
|
||||
/// <param name="type">The type of the variable.</param>
|
||||
/// <param name="value">The value of the variable.</param>
|
||||
protected abstract void GetVariable(int name, out int type, out byte[] value);
|
||||
protected abstract void GetVariable(int name, bool forced, out int type, out byte[] value);
|
||||
internal void Operate(PdtOperatorSignature sig) {
|
||||
PdtOperator op;
|
||||
try { op = GetOperator(sig); }
|
||||
catch (Exception) {
|
||||
catch (Exception ex) {
|
||||
for (int i = 0; i < sig.ParamCount; i++)
|
||||
DiscardStack();
|
||||
throw;
|
||||
throw new EvaluationFailureException(string.Format("Failed to get operator {0}", sig), ex);
|
||||
}
|
||||
Operate(op, sig.ParamCount);
|
||||
}
|
||||
@@ -182,23 +201,34 @@ namespace Cryville.Common.Pdt {
|
||||
/// <returns>An operator of the specific name.</returns>
|
||||
/// <remarks>The parameter count of the returned operator does not necessarily equal to <paramref name="pc" />.</remarks>
|
||||
protected abstract PdtOperator GetOperator(PdtOperatorSignature sig);
|
||||
unsafe void Operate(PdtOperator op, int pc, bool noset = false) {
|
||||
unsafe bool Operate(PdtOperator op, int pc, bool noset = false) {
|
||||
fixed (byte* pmem = _mem) {
|
||||
op.Begin(this);
|
||||
op.Begin(this, pc);
|
||||
for (int i = 0; i < pc; i++) {
|
||||
var frame = _stack[--_framecount];
|
||||
if (frame.Type == PdtInternalType.Error) {
|
||||
_framecount -= pc - i;
|
||||
_stack[_framecount++] = new StackFrame { Type = PdtInternalType.Error, Offset = _goffset, Length = 0 };
|
||||
return false;
|
||||
}
|
||||
op.LoadOperand(new PdtVariableMemory(frame.Type, pmem + frame.Offset, frame.Length));
|
||||
_goffset -= frame.Length;
|
||||
}
|
||||
op.Call(pmem + _goffset, noset);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
internal unsafe void Collapse(int name, LinkedListNode<PdtInstruction> target) {
|
||||
fixed (byte* pmem = _mem) {
|
||||
var frame = _stack[--_framecount];
|
||||
if (frame.Type == PdtInternalType.Error) {
|
||||
_stack[_framecount++] = new StackFrame { Type = PdtInternalType.Error, Offset = _goffset, Length = 0 };
|
||||
_ip = target;
|
||||
return;
|
||||
}
|
||||
if (Collapse(name, new PdtVariableMemory(frame.Type, pmem + frame.Offset, frame.Length))) {
|
||||
_framecount++;
|
||||
_rip = target;
|
||||
_ip = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,4 +252,18 @@ namespace Cryville.Common.Pdt {
|
||||
_goffset -= _stack[--_framecount].Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The exception that is thrown when the evaluation of a <see cref="PdtExpression" /> fails.
|
||||
/// </summary>
|
||||
public class EvaluationFailureException : Exception {
|
||||
/// <inheritdoc />
|
||||
public EvaluationFailureException() : base("Evaluation failed") { }
|
||||
/// <inheritdoc />
|
||||
public EvaluationFailureException(string message) : base(message) { }
|
||||
/// <inheritdoc />
|
||||
public EvaluationFailureException(string message, Exception innerException) : base(message, innerException) { }
|
||||
/// <inheritdoc />
|
||||
protected EvaluationFailureException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// Whether the value of this expression is constant.
|
||||
/// </summary>
|
||||
/// <remarks>The value of this property is <c>false</c> until it is optimized.</remarks>
|
||||
/// <remarks>The value of this property is <see langword="false" /> until it is optimized.</remarks>
|
||||
public bool IsConstant { get; internal set; }
|
||||
internal bool IsPotentialConstant;
|
||||
internal PdtExpression(LinkedList<PdtInstruction> ins) {
|
||||
@@ -51,13 +51,14 @@ namespace Cryville.Common.Pdt {
|
||||
}
|
||||
public class PushVariable : PdtInstruction {
|
||||
public int Name { get; private set; }
|
||||
public PushVariable(int name) { Name = name; }
|
||||
public PushVariable(string name) : this(IdentifierManager.SharedInstance.Request(name)) { }
|
||||
public bool Forced { get; private set; }
|
||||
public PushVariable(int name, bool forced = false) { Name = name; Forced = forced; }
|
||||
public PushVariable(string name, bool forced = false) : this(IdentifierManager.SharedInstance.Request(name)) { Forced = forced; }
|
||||
internal override void Execute(PdtEvaluatorBase etor) {
|
||||
etor.PushVariable(Name);
|
||||
etor.PushVariable(Name, Forced);
|
||||
}
|
||||
public override string ToString() {
|
||||
return string.Format("pushv {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||
return string.Format(Forced ? "pushv ?{0}" : "pushv {0}", IdentifierManager.SharedInstance.Retrieve(Name));
|
||||
}
|
||||
}
|
||||
public class Operate : PdtInstruction {
|
||||
@@ -90,8 +91,8 @@ namespace Cryville.Common.Pdt {
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class PdtInterpreter<T> {
|
||||
readonly static Dictionary<char, int> OP_PRIORITY = new Dictionary<char, int> {
|
||||
public partial class PdtInterpreter {
|
||||
static readonly Dictionary<char, int> OP_PRIORITY = new Dictionary<char, int> {
|
||||
{ '@', 7 },
|
||||
{ '*', 6 }, { '/', 6 }, { '%', 6 },
|
||||
{ '+', 5 }, { '-', 5 },
|
||||
@@ -102,7 +103,7 @@ namespace Cryville.Common.Pdt {
|
||||
{ ',', 0 },
|
||||
{ '$', -1 },
|
||||
};
|
||||
readonly static Dictionary<char, int> OP_TYPE = new Dictionary<char, int> {
|
||||
static readonly Dictionary<char, int> OP_TYPE = new Dictionary<char, int> {
|
||||
{ '@', 0 },
|
||||
{ '*', 0 }, { '/', 0 }, { '%', 0 },
|
||||
{ '+', 0 }, { '-', 0 },
|
||||
@@ -114,7 +115,7 @@ namespace Cryville.Common.Pdt {
|
||||
{ '$', -1 },
|
||||
};
|
||||
|
||||
readonly static PdtExpression _emptyexp;
|
||||
static readonly PdtExpression _emptyexp;
|
||||
static PdtInterpreter() {
|
||||
var ins = new LinkedList<PdtInstruction>();
|
||||
ins.AddLast(new PdtInstruction.PushConstant(
|
||||
@@ -142,7 +143,7 @@ namespace Cryville.Common.Pdt {
|
||||
public override string ToString() {
|
||||
return string.Format("0x{0:x4}: {1}", Type, Value);
|
||||
}
|
||||
public readonly static PdtExpToken EmptyOperator = new PdtExpToken {
|
||||
public static readonly PdtExpToken EmptyOperator = new PdtExpToken {
|
||||
Type = 0x0080,
|
||||
Value = "$",
|
||||
};
|
||||
@@ -194,7 +195,7 @@ namespace Cryville.Common.Pdt {
|
||||
default: pc++; break;
|
||||
}
|
||||
}
|
||||
else if (OP_TYPE[t2.Value[0]] == 1) {
|
||||
if (OP_TYPE[t2.Value[0]] == 1) {
|
||||
colp = new Dictionary<LinkedListNode<PdtInstruction>, string> { { ins.Last, t2.Value } };
|
||||
}
|
||||
t1 = t2;
|
||||
@@ -239,7 +240,11 @@ namespace Cryville.Common.Pdt {
|
||||
if (defs.TryGetValue(buf.Value.Value, out def)) {
|
||||
foreach (var i in def.Instructions) ins.AddLast(i);
|
||||
}
|
||||
else ins.AddLast(new PdtInstruction.PushVariable(buf.Value.Value));
|
||||
else {
|
||||
var name = buf.Value.Value;
|
||||
if (name[0] == '?') ins.AddLast(new PdtInstruction.PushVariable(name.Substring(1), true));
|
||||
else ins.AddLast(new PdtInstruction.PushVariable(name));
|
||||
}
|
||||
buf = null;
|
||||
TryPushAdjMul(ins, ref flag);
|
||||
}
|
||||
|
59
Assets/Cryville/Common/Pdt/PdtFragmentInterpreter.cs
Normal file
59
Assets/Cryville/Common/Pdt/PdtFragmentInterpreter.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// Interpreter for fragments in Property Definition Tree (PDT) file format.
|
||||
/// </summary>
|
||||
public class PdtFragmentInterpreter : PdtInterpreter {
|
||||
public PdtFragmentInterpreter() : base(null, new EmptyBinder()) { }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the new source string for the fragment interpreter and resets the position.
|
||||
/// </summary>
|
||||
/// <param name="value">The new source string.</param>
|
||||
public void SetSource(string value) {
|
||||
Source = value;
|
||||
Position = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The binder.
|
||||
/// </summary>
|
||||
public Binder Binder {
|
||||
get { return _binder; }
|
||||
set { _binder = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the current character and increments the position.
|
||||
/// </summary>
|
||||
/// <returns>The current character.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
public new char GetChar() { return base.GetChar(); }
|
||||
/// <summary>
|
||||
/// Reads an identifier.
|
||||
/// </summary>
|
||||
/// <returns>An identifier.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
public new string GetIdentifier() { return base.GetIdentifier(); }
|
||||
/// <summary>
|
||||
/// Reads a number.
|
||||
/// </summary>
|
||||
/// <returns>A number.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
public new string GetNumber() { return base.GetNumber(); }
|
||||
/// <summary>
|
||||
/// Reads a string.
|
||||
/// </summary>
|
||||
/// <returns>A string.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
public new string GetString() { return base.GetString(); }
|
||||
/// <summary>
|
||||
/// Reads an expression.
|
||||
/// </summary>
|
||||
/// <returns>An expression.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
public new PdtExpression GetExp() { return base.GetExp(); }
|
||||
}
|
||||
}
|
11
Assets/Cryville/Common/Pdt/PdtFragmentInterpreter.cs.meta
Normal file
11
Assets/Cryville/Common/Pdt/PdtFragmentInterpreter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7088ba23ed4b424eadaf664be48e376
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,4 +1,4 @@
|
||||
namespace Cryville.Common.Pdt {
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// The identifiers of the internal types of PDT.
|
||||
/// </summary>
|
||||
@@ -6,30 +6,30 @@
|
||||
/// <summary>
|
||||
/// Error type.
|
||||
/// </summary>
|
||||
public readonly static int Error = 0x00525245;
|
||||
public const int Error = 0x00525245;
|
||||
/// <summary>
|
||||
/// Array of a same variable-length type, with a suffix indicating the element count and the element type.
|
||||
/// </summary>
|
||||
public readonly static int Array = 0x00525241;
|
||||
public const int Array = 0x00525241;
|
||||
/// <summary>
|
||||
/// Null type.
|
||||
/// </summary>
|
||||
public readonly static int Null = 0x4c4c554e;
|
||||
public const int Null = 0x4c4c554e;
|
||||
/// <summary>
|
||||
/// IEEE 754 32-bit floating-point number.
|
||||
/// </summary>
|
||||
public readonly static int Number = 0x004d554e;
|
||||
public const int Number = 0x004d554e;
|
||||
/// <summary>
|
||||
/// A sequence of UTF-16 code units, with a prefix indicating the number of the code units.
|
||||
/// </summary>
|
||||
public readonly static int String = 0x00525453;
|
||||
public const int String = 0x00525453;
|
||||
/// <summary>
|
||||
/// A sequence of UTF-16 code units, with a prefix indicating the number of the code units, representing the name of an undefined variable.
|
||||
/// </summary>
|
||||
public readonly static int Undefined = 0x00444e55;
|
||||
public const int Undefined = 0x00444e55;
|
||||
/// <summary>
|
||||
/// Vector of a same constant-length type, with a suffix indicating the element type.
|
||||
/// </summary>
|
||||
public readonly static int Vector = 0x00434556;
|
||||
public const int Vector = 0x00434556;
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cryville.Common.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using CMath = System.Math;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// Interpreter for Property Definition Tree (PDT) file format.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The object type represented by the PDT.</typeparam>
|
||||
public partial class PdtInterpreter<T> {
|
||||
public partial class PdtInterpreter {
|
||||
/// <summary>
|
||||
/// The character category map.
|
||||
/// </summary>
|
||||
@@ -27,16 +28,16 @@ namespace Cryville.Common.Pdt {
|
||||
/// <item><term><c>0x1000</c></term><description>End of Key</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
readonly static int[] cm = new int[] {
|
||||
static readonly int[] cm = new int[] {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0001, 0x0080, 0x0100, 0x0000, 0x0030, 0x0080, 0x0080, 0x0000, 0x0200, 0x0400, 0x0080, 0x0080, 0x0080, 0x0080, 0x0040, 0x0080,
|
||||
0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x1000, 0x1800, 0x0080, 0x0080, 0x0080, 0x0000,
|
||||
0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x1000, 0x1800, 0x0080, 0x0080, 0x0080, 0x0030,
|
||||
0x0080, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030,
|
||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0080, 0x0000, 0x0080, 0x0030,
|
||||
0x0000, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
|
||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x1000, 0x0080, 0x1000, 0x0000, 0x0000,
|
||||
0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x1000, 0x0080, 0x1000, 0x0080, 0x0000,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -44,52 +45,102 @@ namespace Cryville.Common.Pdt {
|
||||
/// </summary>
|
||||
/// <param name="src">The source string.</param>
|
||||
/// <returns>The interpreted object.</returns>
|
||||
public static T Interpret(string src) {
|
||||
return Interpret(src, BinderAttribute.CreateBinderOfType(typeof(T)));
|
||||
public static T Interpret<T>(string src) {
|
||||
return Interpret<T>(src, BinderAttribute.CreateBinderOfType(typeof(T)));
|
||||
}
|
||||
/// <summary>
|
||||
/// Interprets a source string to an object of type <typeparamref name="T" /> with a binder.
|
||||
/// Interprets a source string to an object of type <typeparamref name="T"/> with a binder.
|
||||
/// </summary>
|
||||
/// <param name="src">The source string.</param>
|
||||
/// <param name="binder">The binder.</param>
|
||||
/// <returns>The interpreted object.</returns>
|
||||
public static T Interpret(string src, Binder binder) {
|
||||
return new PdtInterpreter<T>(src, binder).Interpret();
|
||||
public static T Interpret<T>(string src, Binder binder) {
|
||||
return (T)new PdtInterpreter(src, binder).Interpret(typeof(T));
|
||||
}
|
||||
|
||||
readonly string _src;
|
||||
readonly Binder _binder;
|
||||
protected int Position { get; private set; }
|
||||
/// <summary>
|
||||
/// The source string.
|
||||
/// </summary>
|
||||
public string Source { get; protected set; }
|
||||
protected Binder _binder;
|
||||
/// <summary>
|
||||
/// The current position in the string being parsed by the interpreter.
|
||||
/// </summary>
|
||||
public int Position { get; protected set; }
|
||||
#pragma warning disable IDE1006
|
||||
protected char cc { get { return _src[Position]; } }
|
||||
/// <summary>
|
||||
/// The character at the current position.
|
||||
/// </summary>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected char cc { get { return Source[Position]; } }
|
||||
/// <summary>
|
||||
/// The category of the character.
|
||||
/// </summary>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected int ct { get { return cm[cc]; } }
|
||||
protected string tokenb(int flag) { // Token Whitelist
|
||||
/// <summary>
|
||||
/// Reads a token until a character of type <paramref name="flag" /> is met.
|
||||
/// </summary>
|
||||
/// <param name="flag">The type filter.</param>
|
||||
/// <returns>A token from the current position (inclusive) to the next character of type <paramref name="flag" /> (exclusive).</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">No character of type <paramref name="flag" /> is met.</exception>
|
||||
protected string tokenb(int flag) {
|
||||
int sp = Position;
|
||||
while ((ct & flag) == 0) Position++;
|
||||
return _src.Substring(sp, Position - sp);
|
||||
return Source.Substring(sp, Position - sp);
|
||||
}
|
||||
protected string tokenw(int flag) { // Token Whitelist
|
||||
/// <summary>
|
||||
/// Reads a token until a character that is not of type <paramref name="flag" /> is met.
|
||||
/// </summary>
|
||||
/// <param name="flag">The type filter.</param>
|
||||
/// <returns>A token from the current position (inclusive) to the next character that is not of type <paramref name="flag" /> (exclusive).</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">No character that is not of type <paramref name="flag" /> is met.</exception>
|
||||
protected string tokenw(int flag) {
|
||||
int sp = Position;
|
||||
while ((ct & flag) != 0) Position++;
|
||||
return _src.Substring(sp, Position - sp);
|
||||
return Source.Substring(sp, Position - sp);
|
||||
}
|
||||
/// <summary>
|
||||
/// Skips over whitespaces.
|
||||
/// </summary>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected void ws() {
|
||||
while ((ct & 0x0001) != 0) Position++;
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
|
||||
/// <summary>
|
||||
/// Reads the current character and increments the position.
|
||||
/// </summary>
|
||||
/// <returns>The current character.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected char GetChar() {
|
||||
char r = cc;
|
||||
Position++;
|
||||
return r;
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads an identifier.
|
||||
/// </summary>
|
||||
/// <returns>An identifier.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected string GetIdentifier() {
|
||||
if ((ct & 0x0020) == 0) return "";
|
||||
return tokenw(0x0010);
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads a number.
|
||||
/// </summary>
|
||||
/// <returns>A number.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected string GetNumber() {
|
||||
return tokenw(0x0040);
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads a string.
|
||||
/// </summary>
|
||||
/// <returns>A string.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected string GetString() {
|
||||
int sp = Position;
|
||||
do {
|
||||
@@ -97,8 +148,13 @@ namespace Cryville.Common.Pdt {
|
||||
Position++;
|
||||
} while (ct != 0x0100);
|
||||
Position++;
|
||||
return Regex.Replace(_src.Substring(sp + 1, Position - sp - 2), @"\\(.)", "$1");
|
||||
return Regex.Replace(Source.Substring(sp + 1, Position - sp - 2), @"\\(.)", "$1");
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads an expression.
|
||||
/// </summary>
|
||||
/// <returns>An expression.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
||||
protected PdtExpression GetExp() {
|
||||
var ins = new LinkedList<PdtInstruction>();
|
||||
int _;
|
||||
@@ -108,23 +164,34 @@ namespace Cryville.Common.Pdt {
|
||||
|
||||
readonly Dictionary<string, PdtExpression> defs = new Dictionary<string, PdtExpression>();
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="PdtInterpreter{T}" /> class.
|
||||
/// Creates an instance of the <see cref="PdtInterpreter" /> class.
|
||||
/// </summary>
|
||||
/// <param name="src">The source string.</param>
|
||||
/// <param name="binder">The binder. May be <c>null</c>.</param>
|
||||
public PdtInterpreter(string src, Binder binder) {
|
||||
_src = src;
|
||||
Source = src;
|
||||
_binder = binder;
|
||||
if (_binder == null)
|
||||
_binder = BinderAttribute.CreateBinderOfType(typeof(T));
|
||||
}
|
||||
int[] m_formatVersion;
|
||||
public int[] GetFormatVersion() {
|
||||
if (m_formatVersion == null) InterpretDirectives();
|
||||
return m_formatVersion;
|
||||
}
|
||||
/// <summary>
|
||||
/// Interprets the source to an object of type <typeparamref name="T" />.
|
||||
/// Interprets the source to an object.
|
||||
/// </summary>
|
||||
/// <param name="type">The output type.</param>
|
||||
/// <returns>The interpreted object.</returns>
|
||||
public T Interpret() {
|
||||
InterpretDirectives();
|
||||
return (T)InterpretObject(typeof(T));
|
||||
public object Interpret(Type type) {
|
||||
try {
|
||||
if (m_formatVersion == null) InterpretDirectives();
|
||||
if (_binder == null)
|
||||
_binder = BinderAttribute.CreateBinderOfType(type);
|
||||
return InterpretObject(type);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new PdtParsingException(this, ex);
|
||||
}
|
||||
}
|
||||
void InterpretDirectives() {
|
||||
bool flag = false;
|
||||
@@ -138,7 +205,10 @@ namespace Cryville.Common.Pdt {
|
||||
break;
|
||||
case "format":
|
||||
ws();
|
||||
if (GetNumber() != "1")
|
||||
m_formatVersion = (from i in GetNumber().Split('.') select int.Parse(i)).ToArray();
|
||||
if (m_formatVersion.Length == 0)
|
||||
throw new FormatException("Invalid format version");
|
||||
if (m_formatVersion[0] != 1)
|
||||
throw new NotSupportedException("Format not supported");
|
||||
flag = true;
|
||||
break;
|
||||
@@ -158,75 +228,102 @@ namespace Cryville.Common.Pdt {
|
||||
if (!flag) throw new FormatException("Format directive not found");
|
||||
}
|
||||
object InterpretObject(Type type) {
|
||||
var result = ReflectionHelper.InvokeEmptyConstructor(type);
|
||||
bool dictflag = ReflectionHelper.IsGenericDictionary(type);
|
||||
var result = Activator.CreateInstance(type);
|
||||
bool pcflag = PairCollection.IsPairCollection(type);
|
||||
while (true) {
|
||||
try { ws(); }
|
||||
catch (IndexOutOfRangeException) { return result; }
|
||||
if (cc == '}') {
|
||||
GetChar();
|
||||
return result;
|
||||
}
|
||||
object pkey = InterpretKey(type);
|
||||
char c = GetChar();
|
||||
switch (c) {
|
||||
case '{':
|
||||
if (dictflag) {
|
||||
var ktype = type.GetGenericArguments()[0];
|
||||
var ptype = type.GetGenericArguments()[1];
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = InterpretObject(ptype);
|
||||
((IDictionary)result).Add(key, value);
|
||||
}
|
||||
else {
|
||||
MemberInfo prop;
|
||||
bool flag = ReflectionHelper.TryFindMemberWithAttribute<ElementListAttribute>(type, out prop);
|
||||
if (!flag && pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
||||
Type ptype = ReflectionHelper.GetMemberType(prop);
|
||||
if (ReflectionHelper.IsGenericDictionary(ptype)) {
|
||||
var ktype = ptype.GetGenericArguments()[0];
|
||||
var vtype = ptype.GetGenericArguments()[1];
|
||||
if (flag) {
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = InterpretObject(vtype);
|
||||
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
||||
}
|
||||
else ReflectionHelper.SetValue(prop, result, InterpretObject(ptype));
|
||||
}
|
||||
else ReflectionHelper.SetValue(prop, result, InterpretObject(ptype));
|
||||
}
|
||||
InterpretObjectInternal<ElementListAttribute>(pcflag, type, pkey, result, type => InterpretObject(type));
|
||||
break;
|
||||
case ':':
|
||||
case ';':
|
||||
var exp = c == ';' ? _emptyexp : GetExp();
|
||||
if (dictflag) {
|
||||
var ktype = type.GetGenericArguments()[0];
|
||||
var vtype = type.GetGenericArguments()[1];
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = _binder.ChangeType(exp, vtype, null);
|
||||
((IDictionary)result).Add(key, value);
|
||||
}
|
||||
else {
|
||||
MemberInfo prop;
|
||||
bool flag = ReflectionHelper.TryFindMemberWithAttribute<PropertyListAttribute>(type, out prop);
|
||||
if (!flag && pkey is string) prop = ReflectionHelper.GetMember(type, (string)pkey);
|
||||
var ptype = ReflectionHelper.GetMemberType(prop);
|
||||
if (!typeof(IDictionary).IsAssignableFrom(ptype)) {
|
||||
object value = _binder.ChangeType(exp, ptype, null);
|
||||
ReflectionHelper.SetValue(prop, result, value, _binder);
|
||||
}
|
||||
else {
|
||||
var ktype = ptype.GetGenericArguments()[0];
|
||||
var vtype = ptype.GetGenericArguments()[1];
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = _binder.ChangeType(exp, vtype, null);
|
||||
((IDictionary)ReflectionHelper.GetValue(prop, result)).Add(key, value);
|
||||
}
|
||||
}
|
||||
InterpretObjectInternal<PropertyListAttribute>(pcflag, type, pkey, result, type => _binder.ChangeType(exp, type, null));
|
||||
break;
|
||||
case '}':
|
||||
return result;
|
||||
default:
|
||||
throw new InvalidOperationException("Internal error: Invalid key interpretation");
|
||||
}
|
||||
}
|
||||
}
|
||||
void InterpretObjectInternal<T>(bool pcflag, Type type, object pkey, object result, Func<Type, object> vfunc) where T : Attribute {
|
||||
if (pcflag) {
|
||||
using (var collection = new PairCollection(result)) {
|
||||
var ktype = type.GetGenericArguments()[0];
|
||||
var ptype = type.GetGenericArguments()[1];
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = vfunc(ptype);
|
||||
collection.Add(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MemberInfo prop = null;
|
||||
bool flag = false;
|
||||
if (pkey is string) prop = ReflectionHelper.TryGetMember(type, (string)pkey);
|
||||
if (prop == null) flag = ReflectionHelper.TryFindMemberWithAttribute<T>(type, out prop);
|
||||
if (prop == null) throw new MissingMemberException(string.Format("The property \"{0}\" is not found", pkey));
|
||||
Type ptype = ReflectionHelper.GetMemberType(prop);
|
||||
if (flag) {
|
||||
var origCollection = ReflectionHelper.GetValue(prop, result);
|
||||
if (origCollection == null) {
|
||||
ReflectionHelper.SetValue(prop, result, origCollection = Activator.CreateInstance(ptype));
|
||||
}
|
||||
using (var collection = new PairCollection(origCollection)) {
|
||||
var ktype = ptype.GetGenericArguments()[0];
|
||||
var vtype = ptype.GetGenericArguments()[1];
|
||||
object key = _binder.ChangeType(pkey, ktype, null);
|
||||
object value = vfunc(vtype);
|
||||
collection.Add(key, value);
|
||||
}
|
||||
}
|
||||
else ReflectionHelper.SetValue(prop, result, vfunc(ptype), _binder);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Interprets a key from the current position.
|
||||
/// </summary>
|
||||
/// <returns>The interpreted key.</returns>
|
||||
protected virtual object InterpretKey(Type type) {
|
||||
return tokenb(0x1000).Trim();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The exception that is thrown when the interpretation of a PDT fails.
|
||||
/// </summary>
|
||||
public class PdtParsingException : Exception {
|
||||
public PdtParsingException(PdtInterpreter interpreter) : this(interpreter, null) { }
|
||||
public PdtParsingException(PdtInterpreter interpreter, Exception innerException)
|
||||
: base(GenerateMessage(interpreter, innerException), innerException) { }
|
||||
static string GenerateMessage(PdtInterpreter interpreter, Exception innerException) {
|
||||
string src = interpreter.Source;
|
||||
int pos = interpreter.Position;
|
||||
if (pos >= src.Length) return "Failed to interpret the PDT: There are some missing or redundant tokens";
|
||||
int lineStartPos = src.LastIndexOf('\n', pos) + 1;
|
||||
int previewStartPos = src.LastIndexOf('\n', pos, CMath.Min(64, pos));
|
||||
if (previewStartPos == -1) {
|
||||
previewStartPos = pos - 64;
|
||||
if (previewStartPos < 0) previewStartPos = 0;
|
||||
}
|
||||
else previewStartPos++;
|
||||
int previewEndPos = src.IndexOf('\n', pos, CMath.Min(64, src.Length - pos));
|
||||
if (previewEndPos == -1) {
|
||||
previewEndPos = pos + 64;
|
||||
if (previewEndPos > src.Length) previewEndPos = src.Length;
|
||||
}
|
||||
return string.Format(
|
||||
"Failed to interpret the PDT at line {0}, position {1}: {2}\n{3}",
|
||||
src.Take(interpreter.Position).Count(c => c == '\n') + 1,
|
||||
pos - lineStartPos + 1,
|
||||
innerException == null ? "Unknown error" : innerException.Message,
|
||||
src.Substring(previewStartPos, previewEndPos - previewStartPos)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// PDT operator.
|
||||
/// </summary>
|
||||
public unsafe abstract class PdtOperator {
|
||||
public abstract unsafe class PdtOperator {
|
||||
byte* _prmem;
|
||||
int _loadindex;
|
||||
readonly PdtVariableMemory[] _operands;
|
||||
/// <summary>
|
||||
/// The count of the operands loaded.
|
||||
/// </summary>
|
||||
protected int LoadedOperandCount { get { return ParamCount - _loadindex; } }
|
||||
protected int LoadedOperandCount { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the operand at the specified index.
|
||||
/// </summary>
|
||||
@@ -19,47 +19,45 @@ namespace Cryville.Common.Pdt {
|
||||
/// <returns>The operand at the specified index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException"><paramref name="index" /> is not less than <see cref="LoadedOperandCount" /> or less than 0.</exception>
|
||||
protected PdtVariableMemory GetOperand(int index) {
|
||||
if (index >= LoadedOperandCount || index < 0) throw new IndexOutOfRangeException();
|
||||
if (index >= LoadedOperandCount || index < 0)
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
int i = index + _loadindex;
|
||||
return _operands[i];
|
||||
}
|
||||
internal int ParamCount { get; private set; }
|
||||
readonly int _pc;
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="PdtOperator" /> class.
|
||||
/// </summary>
|
||||
/// <param name="pc">The suggested parameter count.</param>
|
||||
protected PdtOperator(int pc) {
|
||||
ParamCount = pc;
|
||||
_pc = pc;
|
||||
_operands = new PdtVariableMemory[pc];
|
||||
}
|
||||
PdtEvaluatorBase _etor;
|
||||
bool _failure = false;
|
||||
bool _rfreq = true;
|
||||
internal void Begin(PdtEvaluatorBase etor) {
|
||||
internal void Begin(PdtEvaluatorBase etor, int pc) {
|
||||
_etor = etor;
|
||||
_failure = false;
|
||||
_loadindex = ParamCount;
|
||||
_loadindex = LoadedOperandCount = pc;
|
||||
}
|
||||
internal void LoadOperand(PdtVariableMemory mem) {
|
||||
if (_loadindex == 0) return;
|
||||
_operands[--_loadindex] = mem;
|
||||
if (--_loadindex >= _pc) return;
|
||||
_operands[_loadindex] = mem;
|
||||
}
|
||||
internal void Call(byte* prmem, bool noset) {
|
||||
_prmem = prmem;
|
||||
_rfreq = false;
|
||||
try { Execute(); } catch (Exception ex) {
|
||||
if (_rfreq) _etor.DiscardStack();
|
||||
throw new InvalidOperationException("Evaluation failed", ex);
|
||||
throw new EvaluationFailureException("Evaluation failed", ex);
|
||||
}
|
||||
if (_failure) {
|
||||
if (_rfreq) _etor.DiscardStack();
|
||||
throw new InvalidOperationException("Evaluation failed");
|
||||
}
|
||||
if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set");
|
||||
if (!_rfreq && !noset) throw new EvaluationFailureException("Return frame not set");
|
||||
}
|
||||
/// <summary>
|
||||
/// Executes the operator.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>When overridden, this method reads operands by calling <see cref="GetOperand(int)" />, and writes the result to the frame obtained by calling <see cref="GetReturnFrame(int, int)" />.</para>
|
||||
/// </remarks>
|
||||
protected abstract void Execute();
|
||||
/// <summary>
|
||||
/// Gets a return frame.
|
||||
@@ -69,10 +67,7 @@ namespace Cryville.Common.Pdt {
|
||||
/// <returns>The return frame.</returns>
|
||||
/// <exception cref="InvalidOperationException">The return frame has already been requested.</exception>
|
||||
protected PdtVariableMemory GetReturnFrame(int type, int len) {
|
||||
if (_rfreq) {
|
||||
_failure = true;
|
||||
throw new InvalidOperationException("Return frame already requested");
|
||||
}
|
||||
if (_rfreq) throw new InvalidOperationException("Return frame requested twice");
|
||||
_rfreq = true;
|
||||
return _etor.StackAlloc(type, _prmem, len);
|
||||
}
|
||||
@@ -121,4 +116,4 @@ namespace Cryville.Common.Pdt {
|
||||
return string.Format("{0}({1})", IdentifierManager.SharedInstance.Retrieve(Name), ParamCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using UnsafeIL;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
/// <summary>
|
||||
/// Span on the memory of a <see cref="PdtEvaluatorBase" />.
|
||||
/// </summary>
|
||||
public unsafe struct PdtVariableMemory {
|
||||
public unsafe struct PdtVariableMemory : IEquatable<PdtVariableMemory> {
|
||||
readonly byte* _ptr;
|
||||
/// <summary>
|
||||
/// The length of the span.
|
||||
@@ -42,10 +43,20 @@ namespace Cryville.Common.Pdt {
|
||||
/// <param name="dest">The destination buffer.</param>
|
||||
/// <param name="destOffset">The offset on the destination buffer to start copying to.</param>
|
||||
/// <param name="length">The length to copy.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="length" /> is greater than the length of the span.</exception>
|
||||
public void CopyTo(byte* dest, int destOffset, int length) {
|
||||
if (length > Length) throw new ArgumentOutOfRangeException("length");
|
||||
for (int i = 0; i < length; i++)
|
||||
dest[destOffset + i] = _ptr[i];
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public bool Equals(PdtVariableMemory obj) {
|
||||
if (Type != obj.Type || Length != obj.Length) return false;
|
||||
for (int i = 0; i < Length; i++) {
|
||||
if (*(_ptr + i) != *(obj._ptr + i)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the memory of the span as a number.
|
||||
/// </summary>
|
||||
@@ -118,10 +129,43 @@ namespace Cryville.Common.Pdt {
|
||||
throw new InvalidCastException("Not an identifier");
|
||||
return *(int*)(_ptr + offset);
|
||||
}
|
||||
internal void* TrustedAsOfLength(int len) {
|
||||
if (Length < len)
|
||||
throw new InvalidCastException("Type not matched");
|
||||
return _ptr;
|
||||
/// <summary>
|
||||
/// Gets the memory of the span as an instance of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The specified type.</typeparam>
|
||||
/// <param name="offset">The offset on the span to start reading from.</param>
|
||||
/// <returns>An instance of the specified type.</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> is not less than the length of the span.</exception>
|
||||
/// <exception cref="InvalidCastException">The length of the span is not sufficient.</exception>
|
||||
/// <remarks>
|
||||
/// <para>Use <see cref="AsNumber(int)" /> instead while reading an unaligned number.</para>
|
||||
/// </remarks>
|
||||
public T As<T>(int offset = 0) {
|
||||
var len = Unsafe.SizeOf<T>();
|
||||
if (offset >= Length)
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
if (offset + len > Length)
|
||||
throw new InvalidCastException("Frame length not sufficient");
|
||||
return Unsafe.Read<T>(_ptr + offset);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the memory of the span to an instance of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The specified type.</typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="offset">The offset from the start of the span.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> is not less than the length of the span.</exception>
|
||||
/// <exception cref="InvalidCastException">The length of the span is not sufficient.</exception>
|
||||
/// <remarks>
|
||||
/// <para>Use <see cref="SetNumber(float, int)" /> instead while writing an unaligned number.</para>
|
||||
/// </remarks>
|
||||
public void Set<T>(T value, int offset = 0) {
|
||||
var len = Unsafe.SizeOf<T>();
|
||||
if (offset >= Length)
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
if (offset + len > Length)
|
||||
throw new InvalidCastException("Frame length not sufficient");
|
||||
Unsafe.Write(_ptr + offset, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the array suffix.
|
||||
|
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 925f95cb7c6644a4695b2701d42e1ea2
|
||||
folderAsset: yes
|
||||
timeCreated: 1606989037
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user