├── Assets ├── TextMesh Pro │ ├── Resources │ │ ├── LineBreaking Leading Characters.txt │ │ ├── LineBreaking Following Characters.txt │ │ ├── Shaders │ │ │ ├── TMPro.cginc.meta │ │ │ ├── TMP_Bitmap.shader.meta │ │ │ ├── TMP_SDF.shader.meta │ │ │ ├── TMP_SDF Overlay.shader.meta │ │ │ ├── TMP_SDF-Mobile.shader.meta │ │ │ ├── TMP_SDF-Surface.shader.meta │ │ │ ├── TMPro_Properties.cginc.meta │ │ │ ├── TMPro_Surface.cginc.meta │ │ │ ├── TMP_Bitmap-Mobile.shader.meta │ │ │ ├── TMP_Bitmap-Custom-Atlas.shader.meta │ │ │ ├── TMP_SDF-Mobile Overlay.shader.meta │ │ │ ├── TMP_SDF-Surface-Mobile.shader.meta │ │ │ ├── TMP_Sprite.shader.meta │ │ │ ├── TMP_SDF-Mobile Masking.shader.meta │ │ │ ├── TMPro.cginc │ │ │ ├── TMP_Sprite.shader │ │ │ ├── TMPro_Properties.cginc │ │ │ ├── TMP_SDF-Surface-Mobile.shader │ │ │ ├── TMP_Bitmap.shader │ │ │ ├── TMP_Bitmap-Custom-Atlas.shader │ │ │ ├── TMP_Bitmap-Mobile.shader │ │ │ ├── TMPro_Surface.cginc │ │ │ ├── TMP_SDF-Surface.shader │ │ │ ├── TMP_SDF-Mobile Overlay.shader │ │ │ ├── TMP_SDF-Mobile.shader │ │ │ └── TMP_SDF-Mobile Masking.shader │ │ ├── TMP Settings.asset.meta │ │ ├── Sprite Assets │ │ │ └── EmojiOne.asset.meta │ │ ├── LineBreaking Following Characters.txt.meta │ │ ├── LineBreaking Leading Characters.txt.meta │ │ ├── Shaders.meta │ │ ├── Fonts & Materials │ │ │ ├── LiberationSans SDF.asset.meta │ │ │ ├── LiberationSans SDF - Outline.mat.meta │ │ │ ├── LiberationSans SDF - Drop Shadow.mat.meta │ │ │ ├── LiberationSans SDF - Outline.mat │ │ │ └── LiberationSans SDF - Drop Shadow.mat │ │ ├── Sprite Assets.meta │ │ ├── Style Sheets.meta │ │ ├── Style Sheets │ │ │ ├── Default Style Sheet.asset.meta │ │ │ └── Default Style Sheet.asset │ │ ├── Fonts & Materials.meta │ │ └── TMP Settings.asset │ ├── Sprites │ │ ├── EmojiOne.png │ │ ├── EmojiOne Attribution.txt.meta │ │ ├── EmojiOne Attribution.txt │ │ ├── EmojiOne.json.meta │ │ └── EmojiOne.json │ ├── Documentation │ │ ├── TextMesh Pro User Guide 2016.pdf │ │ └── TextMesh Pro User Guide 2016.pdf.meta │ ├── Resources.meta │ ├── Sprites.meta │ └── Documentation.meta ├── TextTyper │ ├── Examples │ │ ├── UITextDisplay.wav │ │ ├── TextTyperExample.unity.meta │ │ ├── RedBlueGames.TextTyper.Examples.asmdef.meta │ │ ├── TextTyperTester.cs.meta │ │ ├── TextTyperConfig.asset.meta │ │ ├── ExampleCurveLibrary.asset.meta │ │ ├── ExampleShakeLibrary.asset.meta │ │ ├── SpeedTyperConfig.asset.meta │ │ ├── RedBlueGames.TextTyper.Examples.asmdef │ │ ├── UITextDisplay.wav.meta │ │ ├── SpeedTyperConfig.asset │ │ ├── TextTyperConfig.asset │ │ ├── ExampleShakeLibrary.asset │ │ └── TextTyperTester.cs │ ├── LICENSE.meta │ ├── README.md.meta │ ├── package.json.meta │ ├── Animation.meta │ ├── Examples.meta │ ├── RedBlueGames.TextTyper.asmdef.meta │ ├── Tests │ │ ├── RedBlueGames.TextTyper.Tests.asmdef.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── RichTextTagTests.cs.meta │ │ │ ├── TextTagParserTests.cs.meta │ │ │ ├── RichTextTagTests.cs │ │ │ └── TextTagParserTests.cs │ │ └── RedBlueGames.TextTyper.Tests.asmdef │ ├── Tests.meta │ ├── TextSymbol.cs.meta │ ├── PoolableList{T}.cs.meta │ ├── TextTyperConfig.cs.meta │ ├── TypableCharacter.cs.meta │ ├── Animation │ │ ├── CurveLibrary.cs.meta │ │ ├── ShakeLibrary.cs.meta │ │ ├── TextAnimation.cs.meta │ │ ├── CurveAnimation.cs.meta │ │ ├── ShakeAnimation.cs.meta │ │ ├── ShakeLibrary.cs │ │ ├── ShakeAnimation.cs │ │ ├── CurveAnimation.cs │ │ ├── CurveLibrary.cs │ │ └── TextAnimation.cs │ ├── RichTextTag.cs.meta │ ├── TextTagParser.cs.meta │ ├── package.json │ ├── RedBlueGames.TextTyper.asmdef │ ├── TextTyper.cs.meta │ ├── TextTyperConfig.cs │ ├── LICENSE │ ├── TypableCharacter.cs │ ├── PoolableList{T}.cs │ ├── TextSymbol.cs │ ├── README.md │ ├── TextTagParser.cs │ └── RichTextTag.cs ├── TextMesh Pro.meta ├── Editor.meta ├── TextTyper.meta └── Editor │ ├── RBPackageExporter.cs.meta │ └── RBPackageExporter.cs ├── ProjectSettings ├── ProjectVersion.txt ├── NavMeshLayers.asset ├── ClusterInputManager.asset ├── PresetManager.asset ├── EditorBuildSettings.asset ├── NetworkManager.asset ├── TimeManager.asset ├── XRSettings.asset ├── VFXManager.asset ├── AudioManager.asset ├── EditorSettings.asset ├── TagManager.asset ├── DynamicsManager.asset ├── UnityConnectSettings.asset ├── NavMeshAreas.asset ├── GraphicsSettings.asset ├── Physics2DSettings.asset ├── QualitySettings.asset └── InputManager.asset ├── README-Images └── ss_chat_watermarked.gif ├── LICENSE ├── .vscode ├── launch.json └── settings.json ├── .gitignore ├── Packages └── manifest.json ├── README.md └── .editorconfig /Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt: -------------------------------------------------------------------------------- 1 | ([{〔〈《「『【〘〖〝‘“⦅«$—…‥〳〴〵\[({£¥"々〇〉》」$⦆¥₩ # -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.4.28f1 2 | m_EditorVersionWithRevision: 2019.4.28f1 (1381962e9d08) 3 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laicasaane/unity-text-typer/HEAD/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /README-Images/ss_chat_watermarked.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laicasaane/unity-text-typer/HEAD/README-Images/ss_chat_watermarked.gif -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites/EmojiOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laicasaane/unity-text-typer/HEAD/Assets/TextMesh Pro/Sprites/EmojiOne.png -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/UITextDisplay.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laicasaane/unity-text-typer/HEAD/Assets/TextTyper/Examples/UITextDisplay.wav -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/TextTyperExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40aeae9d2c740cb48a4080f1b87ca99b 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt: -------------------------------------------------------------------------------- 1 | )]}〕〉》」』】〙〗〟’”⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、%,.:;。!?]):;=}¢°"†‡℃〆%,. -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laicasaane/unity-text-typer/HEAD/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /Assets/TextTyper/LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 308aff08acd84e547b8fe991ffc532d0 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextTyper/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d82c83731eb0ee47a531279540cb979 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextTyper/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28a95a77904d02a468d583617710f9fa 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f54d1bd14bd3ca042bd867b519fee8cc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 243e06394e614e5d99fab26083b707fa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 407bc68d299748449bbf7f48ee690f8d 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0603b6d5186471b96c778c3949c7ce2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18d5f287a3c797f4c947eca42ed31b38 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acaeb807e00744640b76fb971545cf60 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Documentation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e7e8f5a82a3a134e91c54efd2274ea9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 128e987d567d4e2c824d754223b3f3b0 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68e6db2ebdc24f95958faec2be5558d6 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 381dcb09d5029d14897e55f98031fca5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd89cf5b9246416f84610a006f916af7 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe393ace9b354375a9cb14cdbbc28be4 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7ada0af4f174f0694ca6a487b8f543d 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3997e2241185407d80309a82f9148466 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d930090c0cd643c7b55f19a38538c162 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt: -------------------------------------------------------------------------------- 1 | This sample of beautiful emojis are provided by EmojiOne https://www.emojione.com/ 2 | 3 | Please visit their website to view the complete set of their emojis and review their licensing terms. -------------------------------------------------------------------------------- /Assets/TextTyper/RedBlueGames.TextTyper.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c096cab62d05ec409ff0f19cda6274f 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e3b057af24249748ff873be7fafee47 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72ddb92a9915646dfa918e325e5b8a52 3 | folderAsset: yes 4 | timeCreated: 1480965209 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b8d251f9af63b746bf2f7ffe00ebb9b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48bb5f55d8670e349b6e614913f9d910 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a02a7d8c237544f1962732b55a9aebf1 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85187c2149c549c5b33f0cdb02836b17 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites/EmojiOne.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f05276190cf498a8153f6cbe761d4e6 3 | timeCreated: 1480316860 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/RedBlueGames.TextTyper.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f71b13f7330352744b85d59c7ef81bd2 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextTyper.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6540f04dbeb3d4c799d91fc2a728bc19 3 | folderAsset: yes 4 | timeCreated: 1480964855 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/RedBlueGames.TextTyper.Examples.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54c11e069b3018f4ea11ecc63ca8ff7a 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/TextTyperTester.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ece93e789392cab498408406d4438896 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/TMP Settings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f5b5dff67a942289a9defa416b206f3 3 | timeCreated: 1436653997 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa16fe06d59914d849d8082bc2cfbdc4 3 | folderAsset: yes 4 | timeCreated: 1480773231 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/TextTyperConfig.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ada8fdf4267aff249911b434bab3d2de 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4cf31917defde46cfb64978fb42bf8fa 3 | folderAsset: yes 4 | timeCreated: 1480773236 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c41005c129ba4d66911b75229fd70b45 3 | timeCreated: 1480316912 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/ExampleCurveLibrary.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1807857dbc33603469f5046b18ae0aae 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/ExampleShakeLibrary.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a6156b25fcccac4e97ef1c8d23def06 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/SpeedTyperConfig.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47e2c9f723f8de84bb3c611ad6258e98 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fade42e8bc714b018fac513c043d323b 3 | timeCreated: 1425440388 4 | licenseType: Store 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d82c1b31c7e74239bff1220585707d2b 3 | timeCreated: 1425440388 4 | licenseType: Store 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99f836c9cb9345dba2e72c4a1f2d0695 3 | folderAsset: yes 4 | timeCreated: 1436068007 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f586378b4e144a9851e7b34d9b748ee 3 | timeCreated: 1484171803 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Sprite Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 512a49d95c0c4332bdd98131869c23c9 3 | folderAsset: yes 4 | timeCreated: 1441876896 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Style Sheets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4aecb92fff08436c8303b10eab8da368 3 | folderAsset: yes 4 | timeCreated: 1441876950 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f952c082cb03451daed3ee968ac6c63e 3 | timeCreated: 1432805430 4 | licenseType: Store 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 731f1baa9d144a9897cb1d341c2092b8 3 | folderAsset: yes 4 | timeCreated: 1442040525 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79459efec17a4d00a321bdcc27bbc385 3 | timeCreated: 1484172856 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e73a58f6e2794ae7b1b7e50b7fb811b0 3 | timeCreated: 1484172806 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf81c85f95fe47e1a27f6ae460cf182c 3 | timeCreated: 1450517184 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc1ede39bf3643ee8e493720e4259791 3 | timeCreated: 1463704911 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextSymbol.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38054ab7d6137044ba88e33d11068002 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/PoolableList{T}.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b1b56feb78c42a4fafc4c646e67f7e1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextTyperConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e18d894606c1ed4083dc08d8a0d8080 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/TypableCharacter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ca2ed3b9dd88614aae1612d3774e2d5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/CurveLibrary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b3c7f099297a574fb0c50c5811b9d8c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/ShakeLibrary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 866de5792f341d54d8e3b55427645926 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/TextAnimation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b562a45be4798c48bb8c912338a5485 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Editor/RBPackageExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83d87573060fb44fba118749ae2724c5 3 | timeCreated: 1480009765 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TextTyper/RichTextTag.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65fc1ffea80354d8886372d9be39e988 3 | timeCreated: 1480713558 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextTagParser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 067e8034ef9f449c6bfb7b6fe26b0a3c 3 | timeCreated: 1488807547 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/Editor/RichTextTagTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c657a22146554595bab298c35a43f51 3 | timeCreated: 1480773242 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/Editor/TextTagParserTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa7143360c0f04e0ba96b18c8b979562 3 | timeCreated: 1488844575 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TextTyper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Laicasaane (https://github.com/laicasaane/)", 3 | "description": "Text typing effect for Unity uGUI Text components", 4 | "displayName": "TextTyper", 5 | "license": "MIT", 6 | "name": "com.laicasaane.texttyper", 7 | "version": "3.1.0", 8 | "type": "library", 9 | "unity": "2018.3" 10 | } 11 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/CurveAnimation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25949e0d00539a240bdf6993052f9936 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - curveLibrary: {fileID: 11400000, guid: 1807857dbc33603469f5046b18ae0aae, type: 2} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TextTyper/RedBlueGames.TextTyper.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RedBlueGames.TextTyper", 3 | "references": [ 4 | "Unity.TextMeshPro" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/ShakeAnimation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b49648f095d6e484394992ac11efba07 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - textMesh: {instanceID: 0} 8 | - shakeLibrary: {fileID: 11400000, guid: 9a6156b25fcccac4e97ef1c8d23def06, type: 2} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextTyper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40868536fcc3c2c458788a1cd1298e8f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - shakeLibrary: {fileID: 11400000, guid: 9a6156b25fcccac4e97ef1c8d23def06, type: 2} 8 | - curveLibrary: {fileID: 11400000, guid: 1807857dbc33603469f5046b18ae0aae, type: 2} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/RedBlueGames.TextTyper.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RedBlueGames.TextTyper.Tests", 3 | "references": [ 4 | "RedBlueGames.TextTyper" 5 | ], 6 | "optionalUnityReferences": [ 7 | "TestAssemblies" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 1 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/RedBlueGames.TextTyper.Examples.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RedBlueGames.TextTyper.Examples", 3 | "references": [ 4 | "RedBlueGames.TextTyper", 5 | "Unity.TextMeshPro" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [ 14 | "UNITY_EDITOR || ENABLE_TEXTTYPER_EXAMPLES" 15 | ], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/UITextDisplay.wav.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4457c27178d8e4ec2aef0a0406b75e06 3 | timeCreated: 1480972864 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/SpeedTyperConfig.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 9e18d894606c1ed4083dc08d8a0d8080, type: 3} 13 | m_Name: SpeedTyperConfig 14 | m_EditorClassIdentifier: 15 | PrintDelay: 0.002 16 | PrintAmount: 5 17 | PunctuationDelayMultiplier: 1 18 | punctuations: [] 19 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/TextTyperConfig.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 9e18d894606c1ed4083dc08d8a0d8080, type: 3} 13 | m_Name: TextTyperConfig 14 | m_EditorClassIdentifier: 15 | PrintDelay: 0.04 16 | PunctuationDelayMultiplier: 8 17 | punctuations: 18 | - . 19 | - ',' 20 | - '!' 21 | - '?' 22 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | m_AutoSyncTransforms: 1 21 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/ExampleShakeLibrary.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 866de5792f341d54d8e3b55427645926, type: 3} 13 | m_Name: ExampleShakeLibrary 14 | m_EditorClassIdentifier: 15 | ShakePresets: 16 | - Name: LightPos 17 | xPosStrength: 2 18 | yPosStrength: 2 19 | RotationStrength: 0 20 | ScaleStrength: 0 21 | - Name: LightRot 22 | xPosStrength: 0 23 | yPosStrength: 0 24 | RotationStrength: 15 25 | ScaleStrength: 0 26 | - Name: FullShake 27 | xPosStrength: 3 28 | yPosStrength: 3 29 | RotationStrength: 20 30 | ScaleStrength: 0.3 31 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextTyperConfig.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | [CreateAssetMenu(menuName = "Text Typer/Config", fileName = "TextTyperConfig")] 7 | public sealed class TextTyperConfig : ScriptableObject 8 | { 9 | [Tooltip("The delay time between each print")] 10 | public float PrintDelay = 0.02f; 11 | 12 | [Tooltip("The amount of characters to be printed each time")] 13 | public int PrintAmount = 1; 14 | 15 | [Tooltip("The delay time will be multiplied by this when the character is a punctuation mark")] 16 | public float PunctuationDelayMultiplier = 8f; 17 | 18 | [SerializeField] 19 | private List punctuations = new List 20 | { 21 | ".", 22 | ",", 23 | "!", 24 | "?" 25 | }; 26 | 27 | public List Punctuations 28 | { 29 | get { return this.punctuations; } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Woosung Jeon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Assets/TextTyper/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Woosung Jeon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Unity Editor", 9 | "type": "unity", 10 | "path": "/Users/erowe/Development/unity-text-typer/Library/EditorInstance.json", 11 | "request": "launch" 12 | }, 13 | { 14 | "name": "Windows Player", 15 | "type": "unity", 16 | "request": "launch" 17 | }, 18 | { 19 | "name": "OSX Player", 20 | "type": "unity", 21 | "request": "launch" 22 | }, 23 | { 24 | "name": "Linux Player", 25 | "type": "unity", 26 | "request": "launch" 27 | }, 28 | { 29 | "name": "iOS Player", 30 | "type": "unity", 31 | "request": "launch" 32 | }, 33 | { 34 | "name": "Android Player", 35 | "type": "unity", 36 | "request": "launch" 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /Assets/TextTyper/TypableCharacter.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | /// 4 | /// This class represents a printed character moment, which should correspond with a 5 | /// delay in the text typer. It became necessary to make this a class when I had 6 | /// to account for Sprite tags which are replaced by a sprite that counts as a "visble" 7 | /// character. These sprites would not be in the Text string stripped of tags, 8 | /// so this allows us to track and print them with a delay. 9 | /// 10 | public class TypableCharacter 11 | { 12 | public float Delay; 13 | 14 | private string value; 15 | private bool isSprite; 16 | 17 | public void InitializeAsSprite() 18 | { 19 | this.value = string.Empty; 20 | this.isSprite = true; 21 | this.Delay = 0f; 22 | } 23 | 24 | public void InitializeAsCharacter(string value) 25 | { 26 | this.value = value ?? string.Empty; 27 | this.isSprite = false; 28 | this.Delay = 0f; 29 | } 30 | 31 | public override string ToString() 32 | { 33 | return this.isSprite ? Sprite : this.value; 34 | } 35 | 36 | private const string Sprite = nameof(Sprite); 37 | } 38 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | [Ll]ogs/ 7 | 8 | # Never ignore folders inside Assets 9 | ![Aa]ssets/**/Library/ 10 | 11 | # Never ignore Assets meta data 12 | ![Aa]ssets/**/*.meta 13 | 14 | # Uncomment this line if you wish to ignore the asset store tools plugin 15 | # [Aa]ssets/AssetStoreTools* 16 | 17 | # Visual Studio cache directory 18 | .vs/ 19 | .vscode/ 20 | .vsconfig 21 | 22 | # Rider cache directory 23 | .idea/ 24 | [Aa]ssets/Plugins/Editor/JetBrains/ 25 | [Aa]ssets/Plugins/Editor/JetBrains.meta 26 | 27 | # Gradle cache directory 28 | .gradle/ 29 | 30 | # Autogenerated VS/MD/Consulo solution and project files 31 | ExportedObj/ 32 | .consulo/ 33 | *.csproj 34 | *.unityproj 35 | *.sln 36 | *.suo 37 | *.tmp 38 | *.user 39 | *.userprefs 40 | *.pidb 41 | *.booproj 42 | *.svd 43 | *.pdb 44 | *.mdb 45 | *.opendb 46 | *.VC.db 47 | .leu 48 | 49 | # Unity3D generated meta files 50 | *.pidb.meta 51 | *.pdb.meta 52 | *.mdb.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | 64 | [Aa]ssets/**/addressables_content_state.bin 65 | [Aa]ssets/**/addressables_content_state.bin.meta 66 | [Aa]ssets/AddressableAssetsData/Windows.meta 67 | 68 | [Pp]ackages/packages-lock.json 69 | [Pp]rojectSettings/PackageManagerSettings.asset 70 | [Pp]rojectSettings/ProjectVersion.txt -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_LegacyDeferred: 14 | m_Mode: 1 15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 16 | m_AlwaysIncludedShaders: 17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 23 | m_PreloadedShaders: [] 24 | m_ShaderSettings: 25 | useScreenSpaceShadows: 1 26 | m_BuildTargetShaderSettings: [] 27 | m_LightmapStripping: 0 28 | m_FogStripping: 0 29 | m_LightmapKeepPlain: 1 30 | m_LightmapKeepDirCombined: 1 31 | m_LightmapKeepDirSeparate: 1 32 | m_LightmapKeepDynamicPlain: 1 33 | m_LightmapKeepDynamicDirCombined: 1 34 | m_LightmapKeepDynamicDirSeparate: 1 35 | m_FogKeepLinear: 1 36 | m_FogKeepExp: 1 37 | m_FogKeepExp2: 1 38 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": 3 | { 4 | "**/.DS_Store":true, 5 | "**/.git":true, 6 | "**/.gitignore":true, 7 | "**/.gitmodules":true, 8 | "**/*.booproj":true, 9 | "**/*.pidb":true, 10 | "**/*.suo":true, 11 | "**/*.user":true, 12 | "**/*.userprefs":true, 13 | "**/*.unityproj":true, 14 | "**/*.dll":true, 15 | "**/*.exe":true, 16 | "**/*.pdf":true, 17 | "**/*.mid":true, 18 | "**/*.midi":true, 19 | "**/*.wav":true, 20 | "**/*.gif":true, 21 | "**/*.ico":true, 22 | "**/*.jpg":true, 23 | "**/*.jpeg":true, 24 | "**/*.png":true, 25 | "**/*.psd":true, 26 | "**/*.tga":true, 27 | "**/*.tif":true, 28 | "**/*.tiff":true, 29 | "**/*.3ds":true, 30 | "**/*.3DS":true, 31 | "**/*.fbx":true, 32 | "**/*.FBX":true, 33 | "**/*.lxo":true, 34 | "**/*.LXO":true, 35 | "**/*.ma":true, 36 | "**/*.MA":true, 37 | "**/*.obj":true, 38 | "**/*.OBJ":true, 39 | "**/*.asset":true, 40 | "**/*.cubemap":true, 41 | "**/*.flare":true, 42 | "**/*.mat":true, 43 | "**/*.meta":true, 44 | "**/*.prefab":true, 45 | "**/*.unity":true, 46 | "build/":true, 47 | "Build/":true, 48 | "Library/":true, 49 | "library/":true, 50 | "obj/":true, 51 | "Obj/":true, 52 | "ProjectSettings/":true, 53 | "temp/":true, 54 | "Temp/":true 55 | } 56 | } -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.2d.sprite": "1.0.0", 4 | "com.unity.2d.tilemap": "1.0.0", 5 | "com.unity.ide.rider": "1.2.1", 6 | "com.unity.ide.visualstudio": "2.0.8", 7 | "com.unity.ide.vscode": "1.2.3", 8 | "com.unity.multiplayer-hlapi": "1.0.8", 9 | "com.unity.test-framework": "1.1.24", 10 | "com.unity.textmeshpro": "2.1.4", 11 | "com.unity.timeline": "1.2.18", 12 | "com.unity.ugui": "1.0.0", 13 | "com.unity.xr.legacyinputhelpers": "2.1.7", 14 | "com.unity.modules.ai": "1.0.0", 15 | "com.unity.modules.androidjni": "1.0.0", 16 | "com.unity.modules.animation": "1.0.0", 17 | "com.unity.modules.assetbundle": "1.0.0", 18 | "com.unity.modules.audio": "1.0.0", 19 | "com.unity.modules.cloth": "1.0.0", 20 | "com.unity.modules.director": "1.0.0", 21 | "com.unity.modules.imageconversion": "1.0.0", 22 | "com.unity.modules.imgui": "1.0.0", 23 | "com.unity.modules.jsonserialize": "1.0.0", 24 | "com.unity.modules.particlesystem": "1.0.0", 25 | "com.unity.modules.physics": "1.0.0", 26 | "com.unity.modules.physics2d": "1.0.0", 27 | "com.unity.modules.screencapture": "1.0.0", 28 | "com.unity.modules.terrain": "1.0.0", 29 | "com.unity.modules.terrainphysics": "1.0.0", 30 | "com.unity.modules.tilemap": "1.0.0", 31 | "com.unity.modules.ui": "1.0.0", 32 | "com.unity.modules.uielements": "1.0.0", 33 | "com.unity.modules.umbra": "1.0.0", 34 | "com.unity.modules.unityanalytics": "1.0.0", 35 | "com.unity.modules.unitywebrequest": "1.0.0", 36 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 37 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 38 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 39 | "com.unity.modules.unitywebrequestwww": "1.0.0", 40 | "com.unity.modules.vehicles": "1.0.0", 41 | "com.unity.modules.video": "1.0.0", 42 | "com.unity.modules.vr": "1.0.0", 43 | "com.unity.modules.wind": "1.0.0", 44 | "com.unity.modules.xr": "1.0.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Assets/TextTyper/PoolableList{T}.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace RedBlueGames.Tools.TextTyper 4 | { 5 | public interface IGetter 6 | { 7 | T Get(); 8 | } 9 | 10 | public interface IAction 11 | { 12 | void Invoke(T item); 13 | } 14 | 15 | public class PoolableList 16 | { 17 | private readonly Queue pool = new Queue(); 18 | private readonly IGetter getter; 19 | private readonly List list; 20 | 21 | public int Count 22 | { 23 | get { return this.list.Count; } 24 | } 25 | 26 | public PoolableList(IGetter getter) 27 | { 28 | this.list = new List(); 29 | this.getter = getter; 30 | } 31 | 32 | public void ReturnAll() 33 | { 34 | for (var i = 0; i < this.list.Count; i++) 35 | { 36 | this.pool.Enqueue(this.list[i]); 37 | } 38 | 39 | this.list.Clear(); 40 | } 41 | 42 | public void ReturnAll() where TOnReturn : IAction, new() 43 | { 44 | var onReturn = new TOnReturn(); 45 | 46 | for (var i = 0; i < this.list.Count; i++) 47 | { 48 | var item = this.list[i]; 49 | 50 | onReturn.Invoke(item); 51 | this.pool.Enqueue(item); 52 | } 53 | 54 | this.list.Clear(); 55 | } 56 | 57 | public T GetItem() 58 | { 59 | var item = this.pool.Count > 0 ? this.pool.Dequeue() : this.getter.Get(); 60 | this.list.Add(item); 61 | 62 | return item; 63 | } 64 | 65 | public T GetItem() where TOnGet : IAction, new() 66 | { 67 | var item = this.pool.Count > 0 ? this.pool.Dequeue() : this.getter.Get(); 68 | this.list.Add(item); 69 | 70 | new TOnGet().Invoke(item); 71 | 72 | return item; 73 | } 74 | 75 | public void GetUnsafe(out List list, out int count) 76 | { 77 | list = this.list; 78 | count = this.list.Count; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/ShakeLibrary.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using UnityEngine; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | [Serializable] 8 | public class ShakePreset 9 | { 10 | [Tooltip("Name identifying this preset. Can also be used as a ShakeLibrary indexer key.")] 11 | public string Name; 12 | 13 | [Range(0, 20)] 14 | [Tooltip("Amount of x-axis shake to apply during animation")] 15 | public float xPosStrength = 0f; 16 | 17 | [Range(0, 20)] 18 | [Tooltip("Amount of y-axis shake to apply during animation")] 19 | public float yPosStrength = 0f; 20 | 21 | [Range(0, 90)] 22 | [Tooltip("Amount of rotational shake to apply during animation")] 23 | public float RotationStrength = 0f; 24 | 25 | [Range(0, 10)] 26 | [Tooltip("Amount of scale shake to apply during animation")] 27 | public float ScaleStrength = 0f; 28 | } 29 | 30 | [CreateAssetMenu(fileName = "ShakeLibrary", menuName = "Text Typer/Shake Library", order = 1)] 31 | public class ShakeLibrary : ScriptableObject 32 | { 33 | public List ShakePresets; 34 | 35 | /// 36 | /// Get the ShakePreset from this library with the provided key/name 37 | /// 38 | /// Key/name identifying the desired ShakePreset 39 | /// Matching ShakePreset 40 | public ShakePreset this[string key] 41 | { 42 | get 43 | { 44 | var preset = this.FindPresetOrNull(key); 45 | if (preset == null) 46 | { 47 | throw new KeyNotFoundException(); 48 | } 49 | else 50 | { 51 | return preset; 52 | } 53 | } 54 | } 55 | 56 | public bool ContainsKey(string key) 57 | { 58 | return this.FindPresetOrNull(key) != null; 59 | } 60 | 61 | private ShakePreset FindPresetOrNull(string key) 62 | { 63 | foreach (var preset in this.ShakePresets) 64 | { 65 | if (preset.Name.ToUpper() == key.ToUpper()) 66 | { 67 | return preset; 68 | } 69 | } 70 | 71 | return null; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc: -------------------------------------------------------------------------------- 1 | float2 UnpackUV(float uv) 2 | { 3 | float2 output; 4 | output.x = floor(uv / 4096); 5 | output.y = uv - 4096 * output.x; 6 | 7 | return output * 0.001953125; 8 | } 9 | 10 | fixed4 GetColor(half d, fixed4 faceColor, fixed4 outlineColor, half outline, half softness) 11 | { 12 | half faceAlpha = 1-saturate((d - outline * 0.5 + softness * 0.5) / (1.0 + softness)); 13 | half outlineAlpha = saturate((d + outline * 0.5)) * sqrt(min(1.0, outline)); 14 | 15 | faceColor.rgb *= faceColor.a; 16 | outlineColor.rgb *= outlineColor.a; 17 | 18 | faceColor = lerp(faceColor, outlineColor, outlineAlpha); 19 | 20 | faceColor *= faceAlpha; 21 | 22 | return faceColor; 23 | } 24 | 25 | float3 GetSurfaceNormal(float4 h, float bias) 26 | { 27 | bool raisedBevel = step(1, fmod(_ShaderFlags, 2)); 28 | 29 | h += bias+_BevelOffset; 30 | 31 | float bevelWidth = max(.01, _OutlineWidth+_BevelWidth); 32 | 33 | // Track outline 34 | h -= .5; 35 | h /= bevelWidth; 36 | h = saturate(h+.5); 37 | 38 | if(raisedBevel) h = 1 - abs(h*2.0 - 1.0); 39 | h = lerp(h, sin(h*3.141592/2.0), _BevelRoundness); 40 | h = min(h, 1.0-_BevelClamp); 41 | h *= _Bevel * bevelWidth * _GradientScale * -2.0; 42 | 43 | float3 va = normalize(float3(1.0, 0.0, h.y - h.x)); 44 | float3 vb = normalize(float3(0.0, -1.0, h.w - h.z)); 45 | 46 | return cross(va, vb); 47 | } 48 | 49 | float3 GetSurfaceNormal(float2 uv, float bias, float3 delta) 50 | { 51 | // Read "height field" 52 | float4 h = {tex2D(_MainTex, uv - delta.xz).a, 53 | tex2D(_MainTex, uv + delta.xz).a, 54 | tex2D(_MainTex, uv - delta.zy).a, 55 | tex2D(_MainTex, uv + delta.zy).a}; 56 | 57 | return GetSurfaceNormal(h, bias); 58 | } 59 | 60 | float3 GetSpecular(float3 n, float3 l) 61 | { 62 | float spec = pow(max(0.0, dot(n, l)), _Reflectivity); 63 | return _SpecularColor.rgb * spec * _SpecularPower; 64 | } 65 | 66 | float4 GetGlowColor(float d, float scale) 67 | { 68 | float glow = d - (_GlowOffset*_ScaleRatioB) * 0.5 * scale; 69 | float t = lerp(_GlowInner, (_GlowOuter * _ScaleRatioB), step(0.0, glow)) * 0.5 * scale; 70 | glow = saturate(abs(glow/(1.0 + t))); 71 | glow = 1.0-pow(glow, _GlowPower); 72 | glow *= sqrt(min(1.0, t)); // Fade off glow thinner than 1 screen pixel 73 | return float4(_GlowColor.rgb, saturate(_GlowColor.a * glow * 2)); 74 | } 75 | 76 | float4 BlendARGB(float4 overlying, float4 underlying) 77 | { 78 | overlying.rgb *= overlying.a; 79 | underlying.rgb *= underlying.a; 80 | float3 blended = overlying.rgb + ((1-overlying.a)*underlying.rgb); 81 | float alpha = underlying.a + (1-underlying.a)*overlying.a; 82 | return float4(blended, alpha); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/ShakeAnimation.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using TMPro; 4 | using UnityEngine; 5 | 6 | [RequireComponent(typeof(TextMeshProUGUI))] 7 | public class ShakeAnimation : TextAnimation 8 | { 9 | [SerializeField] 10 | [Tooltip("The library of ShakePresets that can be used by this component.")] 11 | private ShakeLibrary shakeLibrary = null; 12 | 13 | [SerializeField] 14 | [Tooltip("The name (key) of the ShakePreset this animation should use.")] 15 | private string shakePresetKey = string.Empty; 16 | 17 | private ShakePreset shakePreset; 18 | 19 | /// 20 | /// Load a particular ShakePreset animation into this Component 21 | /// 22 | /// The library of ShakePresets that can be used by this component 23 | /// The name (key) of the ShakePreset this animation should use 24 | public void LoadPreset(ShakeLibrary library, string presetKey) 25 | { 26 | this.shakeLibrary = library; 27 | this.shakePresetKey = presetKey; 28 | this.shakePreset = library[presetKey]; 29 | } 30 | 31 | protected override void OnEnable() 32 | { 33 | if (this.shakeLibrary != null && !string.IsNullOrEmpty(this.shakePresetKey)) 34 | { 35 | LoadPreset(this.shakeLibrary, this.shakePresetKey); 36 | } 37 | 38 | base.OnEnable(); 39 | } 40 | 41 | protected override void Animate(int characterIndex, out Vector2 translation, out float rotation, out float scale) 42 | { 43 | translation = Vector2.zero; 44 | rotation = 0f; 45 | scale = 1f; 46 | 47 | // Do nothing if a ShakePreset has not been configured yet 48 | if (this.shakePreset == null) 49 | { 50 | return; 51 | } 52 | 53 | if (characterIndex >= this.FirstCharToAnimate && characterIndex <= this.LastCharToAnimate) 54 | { 55 | float randomX = Random.Range(-this.shakePreset.xPosStrength, this.shakePreset.xPosStrength); 56 | float randomY = Random.Range(-this.shakePreset.yPosStrength, this.shakePreset.yPosStrength); 57 | translation = new Vector2(randomX, randomY); 58 | 59 | rotation = Random.Range(-this.shakePreset.RotationStrength, this.shakePreset.RotationStrength); 60 | 61 | scale = 1f + Random.Range(-this.shakePreset.ScaleStrength, this.shakePreset.ScaleStrength); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextSymbol.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using UnityEngine; 4 | 5 | public class TextSymbol 6 | { 7 | public TextSymbol Initialize(string character) 8 | { 9 | this.Tag = null; 10 | this.Character = character ?? string.Empty; 11 | 12 | return this; 13 | } 14 | 15 | public TextSymbol Initialize(RichTextTag tag) 16 | { 17 | this.Character = null; 18 | this.Tag = tag; 19 | 20 | return this; 21 | } 22 | 23 | public string Character { get; private set; } 24 | 25 | public RichTextTag Tag { get; private set; } 26 | 27 | public int Length 28 | { 29 | get 30 | { 31 | return this.Text.Length; 32 | } 33 | } 34 | 35 | public string Text 36 | { 37 | get 38 | { 39 | if (this.IsTag) 40 | { 41 | return this.Tag.TagText; 42 | } 43 | else 44 | { 45 | return this.Character; 46 | } 47 | } 48 | } 49 | 50 | public bool IsTag 51 | { 52 | get 53 | { 54 | return this.Tag != null; 55 | } 56 | } 57 | 58 | /// 59 | /// Gets a value indicating this Symbol represents a Sprite, which is treated 60 | /// as a visible character by TextMeshPro. 61 | /// See Issue #35 for details. 62 | /// 63 | /// 64 | public bool IsReplacedWithSprite 65 | { 66 | get 67 | { 68 | return this.IsTag && this.Tag.TagType == "sprite"; 69 | } 70 | } 71 | 72 | public float GetFloatParameter(float defaultValue = 0f) 73 | { 74 | if (!this.IsTag) 75 | { 76 | Debug.LogWarning("Attempted to retrieve parameter from symbol that is not a tag."); 77 | return defaultValue; 78 | } 79 | 80 | float paramValue; 81 | if (!float.TryParse(this.Tag.Parameter, out paramValue)) 82 | { 83 | var warning = string.Format( 84 | "Found Invalid parameter format in tag [{0}]. " + 85 | "Parameter [{1}] does not parse to a float.", 86 | this.Tag, 87 | this.Tag.Parameter); 88 | Debug.LogWarning(warning); 89 | paramValue = defaultValue; 90 | } 91 | 92 | return paramValue; 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Sprite" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Sprite Texture", 2D) = "white" {} 6 | _Color ("Tint", Color) = (1,1,1,1) 7 | 8 | _StencilComp ("Stencil Comparison", Float) = 8 9 | _Stencil ("Stencil ID", Float) = 0 10 | _StencilOp ("Stencil Operation", Float) = 0 11 | _StencilWriteMask ("Stencil Write Mask", Float) = 255 12 | _StencilReadMask ("Stencil Read Mask", Float) = 255 13 | 14 | _ColorMask ("Color Mask", Float) = 15 15 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 16 | 17 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 18 | } 19 | 20 | SubShader 21 | { 22 | Tags 23 | { 24 | "Queue"="Transparent" 25 | "IgnoreProjector"="True" 26 | "RenderType"="Transparent" 27 | "PreviewType"="Plane" 28 | "CanUseSpriteAtlas"="True" 29 | } 30 | 31 | Stencil 32 | { 33 | Ref [_Stencil] 34 | Comp [_StencilComp] 35 | Pass [_StencilOp] 36 | ReadMask [_StencilReadMask] 37 | WriteMask [_StencilWriteMask] 38 | } 39 | 40 | Cull Off 41 | Lighting Off 42 | ZWrite Off 43 | ZTest [unity_GUIZTestMode] 44 | Blend SrcAlpha OneMinusSrcAlpha 45 | ColorMask [_ColorMask] 46 | 47 | Pass 48 | { 49 | CGPROGRAM 50 | #pragma vertex vert 51 | #pragma fragment frag 52 | 53 | #include "UnityCG.cginc" 54 | #include "UnityUI.cginc" 55 | 56 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 57 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 58 | 59 | struct appdata_t 60 | { 61 | float4 vertex : POSITION; 62 | float4 color : COLOR; 63 | float2 texcoord : TEXCOORD0; 64 | }; 65 | 66 | struct v2f 67 | { 68 | float4 vertex : SV_POSITION; 69 | fixed4 color : COLOR; 70 | half2 texcoord : TEXCOORD0; 71 | float4 worldPosition : TEXCOORD1; 72 | }; 73 | 74 | fixed4 _Color; 75 | fixed4 _TextureSampleAdd; 76 | float4 _ClipRect; 77 | 78 | v2f vert(appdata_t IN) 79 | { 80 | v2f OUT; 81 | OUT.worldPosition = IN.vertex; 82 | OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); 83 | 84 | OUT.texcoord = IN.texcoord; 85 | 86 | #ifdef UNITY_HALF_TEXEL_OFFSET 87 | OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1); 88 | #endif 89 | 90 | OUT.color = IN.color * _Color; 91 | return OUT; 92 | } 93 | 94 | sampler2D _MainTex; 95 | 96 | fixed4 frag(v2f IN) : SV_Target 97 | { 98 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; 99 | 100 | #if UNITY_UI_CLIP_RECT 101 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); 102 | #endif 103 | 104 | #ifdef UNITY_UI_ALPHACLIP 105 | clip (color.a - 0.001); 106 | #endif 107 | 108 | return color; 109 | } 110 | ENDCG 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/CurveAnimation.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using TMPro; 4 | using UnityEngine; 5 | 6 | [RequireComponent(typeof(TextMeshProUGUI))] 7 | public class CurveAnimation : TextAnimation 8 | { 9 | [SerializeField] 10 | [Tooltip("The library of CurvePresets that can be used by this component.")] 11 | private CurveLibrary curveLibrary = null; 12 | 13 | [SerializeField] 14 | [Tooltip("The name (key) of the CurvePreset this animation should use.")] 15 | private string curvePresetKey = string.Empty; 16 | 17 | private CurvePreset curvePreset; 18 | 19 | private float timeAnimationStarted; 20 | 21 | /// 22 | /// Load a particular CurvePreset animation into this Component 23 | /// 24 | /// The library of CurvePresets that can be used by this component 25 | /// The name (key) of the CurvePreset this animation should use 26 | public void LoadPreset(CurveLibrary library, string presetKey) 27 | { 28 | this.curveLibrary = library; 29 | this.curvePresetKey = presetKey; 30 | this.curvePreset = library[presetKey]; 31 | } 32 | 33 | protected override void OnEnable() 34 | { 35 | if (this.curveLibrary != null && !string.IsNullOrEmpty(this.curvePresetKey)) 36 | { 37 | LoadPreset(this.curveLibrary, this.curvePresetKey); 38 | } 39 | 40 | this.timeAnimationStarted = this.TimeForTimeScale; 41 | base.OnEnable(); 42 | } 43 | 44 | protected override void Animate(int characterIndex, out Vector2 translation, out float rotation, out float scale) 45 | { 46 | translation = Vector2.zero; 47 | rotation = 0f; 48 | scale = 1f; 49 | 50 | // Do nothing if a CurvePreset has not been configured yet 51 | if (this.curvePreset == null) 52 | { 53 | return; 54 | } 55 | 56 | if (characterIndex >= this.FirstCharToAnimate && characterIndex <= this.LastCharToAnimate) 57 | { 58 | // Calculate a t based on time since the animation started, 59 | // but offset per character (to produce wave effects) 60 | float t = this.TimeForTimeScale - this.timeAnimationStarted + (characterIndex * this.curvePreset.timeOffsetPerChar); 61 | 62 | float xPos = this.curvePreset.xPosCurve.Evaluate(t) * this.curvePreset.xPosMultiplier; 63 | float yPos = this.curvePreset.yPosCurve.Evaluate(t) * this.curvePreset.yPosMultiplier; 64 | 65 | translation = new Vector2(xPos, yPos); 66 | 67 | rotation = this.curvePreset.rotationCurve.Evaluate(t) * this.curvePreset.rotationMultiplier; 68 | scale += this.curvePreset.scaleCurve.Evaluate(t) * this.curvePreset.scaleMultiplier; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/CurveLibrary.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using UnityEngine; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | [Serializable] 8 | public class CurvePreset 9 | { 10 | [Tooltip("Name identifying this preset. Can also be used as a CurveLibrary indexer key.")] 11 | public string Name; 12 | 13 | [Tooltip("Time offset between each character when calculating animation transform. 0 makes all characters move together. Other values produce a 'wave' effect.")] 14 | [Range(0f, 0.5f)] 15 | public float timeOffsetPerChar = 0f; 16 | 17 | [Tooltip("Curve showing x-position delta over time")] 18 | public AnimationCurve xPosCurve; 19 | [Tooltip("x-position curve is multiplied by this value")] 20 | [Range(0, 20)] 21 | public float xPosMultiplier = 0f; 22 | 23 | [Tooltip("Curve showing y-position delta over time")] 24 | public AnimationCurve yPosCurve; 25 | [Tooltip("y-position curve is multiplied by this value")] 26 | [Range(0, 20)] 27 | public float yPosMultiplier = 0f; 28 | 29 | [Tooltip("Curve showing 2D rotation delta over time")] 30 | public AnimationCurve rotationCurve; 31 | [Tooltip("2D rotation curve is multiplied by this value")] 32 | [Range(0, 90)] 33 | public float rotationMultiplier = 0f; 34 | 35 | [Tooltip("Curve showing uniform scale delta over time")] 36 | public AnimationCurve scaleCurve; 37 | [Tooltip("Uniform scale curve is multiplied by this value")] 38 | [Range(0, 10)] 39 | public float scaleMultiplier = 0f; 40 | } 41 | 42 | [CreateAssetMenu(fileName = "CurveLibrary", menuName = "Text Typer/Curve Library", order = 1)] 43 | public class CurveLibrary : ScriptableObject 44 | { 45 | public List CurvePresets; 46 | 47 | /// 48 | /// Get the CurvePreset from this library with the provided key/name 49 | /// 50 | /// Key/name identifying the desired CurvePreset 51 | /// Matching CurvePreset 52 | public CurvePreset this[string key] 53 | { 54 | get 55 | { 56 | var preset = this.FindPresetOrNull(key); 57 | if (preset == null) 58 | { 59 | throw new KeyNotFoundException(); 60 | } 61 | else 62 | { 63 | return preset; 64 | } 65 | } 66 | } 67 | 68 | public bool ContainsKey(string key) 69 | { 70 | return this.FindPresetOrNull(key) != null; 71 | } 72 | 73 | private CurvePreset FindPresetOrNull(string key) 74 | { 75 | foreach (var preset in this.CurvePresets) 76 | { 77 | if (preset.Name.ToUpper() == key.ToUpper()) 78 | { 79 | return preset; 80 | } 81 | } 82 | 83 | return null; 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/Editor/RichTextTagTests.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper.Tests 2 | { 3 | using UnityEngine; 4 | using UnityEditor; 5 | using NUnit.Framework; 6 | 7 | public class RichTextTagTests 8 | { 9 | [Test] 10 | public void Constructor_OpeningTag_Parses() 11 | { 12 | //Arrange 13 | var tag = ""; 14 | 15 | //Act 16 | var richTextTag = new RichTextTag(tag); 17 | 18 | //Assert 19 | Assert.AreEqual(tag, richTextTag.TagText); 20 | Assert.AreEqual("b", richTextTag.TagType); 21 | Assert.IsFalse(richTextTag.IsClosingTag); 22 | Assert.AreEqual("", richTextTag.ClosingTagText); 23 | Assert.AreEqual(string.Empty, richTextTag.Parameter); 24 | } 25 | 26 | [Test] 27 | public void Constructor_TagAndParameter_Parses() 28 | { 29 | //Arrange 30 | var tag = ""; 31 | 32 | //Act 33 | var richTextTag = new RichTextTag(tag); 34 | 35 | //Assert 36 | Assert.AreEqual(tag, richTextTag.TagText); 37 | Assert.AreEqual("color", richTextTag.TagType); 38 | Assert.IsFalse(richTextTag.IsClosingTag); 39 | Assert.AreEqual("", richTextTag.ClosingTagText); 40 | Assert.AreEqual("#FFFFFFFF", richTextTag.Parameter); 41 | } 42 | 43 | [Test] 44 | public void Constructor_TagAndParameterWithQuotes_Parses() 45 | { 46 | //Arrange 47 | var tag = ""; 48 | 49 | //Act 50 | var richTextTag = new RichTextTag(tag); 51 | 52 | //Assert 53 | Assert.AreEqual(tag, richTextTag.TagText); 54 | Assert.AreEqual("color", richTextTag.TagType); 55 | Assert.IsFalse(richTextTag.IsClosingTag); 56 | Assert.AreEqual("", richTextTag.ClosingTagText); 57 | Assert.AreEqual("red", richTextTag.Parameter); 58 | } 59 | 60 | [Test] 61 | public void Constructor_ClosingTag_Parses() 62 | { 63 | //Arrange 64 | var tag = ""; 65 | 66 | //Act 67 | var richTextTag = new RichTextTag(tag); 68 | 69 | //Assert 70 | Assert.AreEqual(tag, richTextTag.TagText); 71 | Assert.AreEqual("color", richTextTag.TagType); 72 | Assert.IsTrue(richTextTag.IsClosingTag); 73 | Assert.AreEqual("", richTextTag.ClosingTagText); 74 | Assert.AreEqual(string.Empty, richTextTag.Parameter); 75 | } 76 | 77 | [Test] 78 | public void RemoveUnityTags_SpriteTagWithValue_ReturnsTaglessText() 79 | { 80 | var builder = new System.Text.StringBuilder(); 81 | var textToType = "This string has a sprite."; 82 | var generatedText = TextTagParser.RemoveUnityTags(textToType); 83 | 84 | var expectedText = "This string has a sprite."; 85 | 86 | Assert.AreEqual(expectedText, generatedText); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc: -------------------------------------------------------------------------------- 1 | // UI Editable properties 2 | uniform sampler2D _FaceTex; // Alpha : Signed Distance 3 | uniform float _FaceUVSpeedX; 4 | uniform float _FaceUVSpeedY; 5 | uniform fixed4 _FaceColor; // RGBA : Color + Opacity 6 | uniform float _FaceDilate; // v[ 0, 1] 7 | uniform float _OutlineSoftness; // v[ 0, 1] 8 | 9 | uniform sampler2D _OutlineTex; // RGBA : Color + Opacity 10 | uniform float _OutlineUVSpeedX; 11 | uniform float _OutlineUVSpeedY; 12 | uniform fixed4 _OutlineColor; // RGBA : Color + Opacity 13 | uniform float _OutlineWidth; // v[ 0, 1] 14 | 15 | uniform float _Bevel; // v[ 0, 1] 16 | uniform float _BevelOffset; // v[-1, 1] 17 | uniform float _BevelWidth; // v[-1, 1] 18 | uniform float _BevelClamp; // v[ 0, 1] 19 | uniform float _BevelRoundness; // v[ 0, 1] 20 | 21 | uniform sampler2D _BumpMap; // Normal map 22 | uniform float _BumpOutline; // v[ 0, 1] 23 | uniform float _BumpFace; // v[ 0, 1] 24 | 25 | uniform samplerCUBE _Cube; // Cube / sphere map 26 | uniform fixed4 _ReflectFaceColor; // RGB intensity 27 | uniform fixed4 _ReflectOutlineColor; 28 | //uniform float _EnvTiltX; // v[-1, 1] 29 | //uniform float _EnvTiltY; // v[-1, 1] 30 | uniform float3 _EnvMatrixRotation; 31 | uniform float4x4 _EnvMatrix; 32 | 33 | uniform fixed4 _SpecularColor; // RGB intensity 34 | uniform float _LightAngle; // v[ 0,Tau] 35 | uniform float _SpecularPower; // v[ 0, 1] 36 | uniform float _Reflectivity; // v[ 5, 15] 37 | uniform float _Diffuse; // v[ 0, 1] 38 | uniform float _Ambient; // v[ 0, 1] 39 | 40 | uniform fixed4 _UnderlayColor; // RGBA : Color + Opacity 41 | uniform float _UnderlayOffsetX; // v[-1, 1] 42 | uniform float _UnderlayOffsetY; // v[-1, 1] 43 | uniform float _UnderlayDilate; // v[-1, 1] 44 | uniform float _UnderlaySoftness; // v[ 0, 1] 45 | 46 | uniform fixed4 _GlowColor; // RGBA : Color + Intesity 47 | uniform float _GlowOffset; // v[-1, 1] 48 | uniform float _GlowOuter; // v[ 0, 1] 49 | uniform float _GlowInner; // v[ 0, 1] 50 | uniform float _GlowPower; // v[ 1, 1/(1+4*4)] 51 | 52 | // API Editable properties 53 | uniform float _ShaderFlags; 54 | uniform float _WeightNormal; 55 | uniform float _WeightBold; 56 | 57 | uniform float _ScaleRatioA; 58 | uniform float _ScaleRatioB; 59 | uniform float _ScaleRatioC; 60 | 61 | uniform float _VertexOffsetX; 62 | uniform float _VertexOffsetY; 63 | 64 | //uniform float _UseClipRect; 65 | uniform float _MaskID; 66 | uniform sampler2D _MaskTex; 67 | uniform float4 _MaskCoord; 68 | uniform float4 _ClipRect; // bottom left(x,y) : top right(z,w) 69 | //uniform float _MaskWipeControl; 70 | //uniform float _MaskEdgeSoftness; 71 | //uniform fixed4 _MaskEdgeColor; 72 | //uniform bool _MaskInverse; 73 | 74 | uniform float _MaskSoftnessX; 75 | uniform float _MaskSoftnessY; 76 | 77 | // Font Atlas properties 78 | uniform sampler2D _MainTex; 79 | uniform float _TextureWidth; 80 | uniform float _TextureHeight; 81 | uniform float _GradientScale; 82 | uniform float _ScaleX; 83 | uniform float _ScaleY; 84 | uniform float _PerspectiveFilter; 85 | -------------------------------------------------------------------------------- /Assets/TextTyper/Tests/Editor/TextTagParserTests.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper.Tests 2 | { 3 | using UnityEditor; 4 | using UnityEngine; 5 | using NUnit.Framework; 6 | 7 | public class TextTagParserTests 8 | { 9 | private static readonly string[] UnityTags = new string[] 10 | { 11 | "b", 12 | "i", 13 | "s", 14 | "u", 15 | "br", 16 | "nobr", 17 | "size", 18 | "color", 19 | "style", 20 | "width", 21 | "align", 22 | "alpha", 23 | "cspace", 24 | "font", 25 | "indent", 26 | "line-height", 27 | "line-indent", 28 | "link", 29 | "lowercase", 30 | "uppercase", 31 | "smallcaps", 32 | "margin", 33 | "mark", 34 | "mspace", 35 | "noparse", 36 | "page", 37 | "pos", 38 | "space", 39 | "sprite", 40 | "sup", 41 | "sub", 42 | "voffset", 43 | "gradient" 44 | }; 45 | 46 | [Test] 47 | public void RemoveCustomTags_EmptyString_ReturnsEmpty() 48 | { 49 | var textToType = string.Empty; 50 | var generatedText = TextTagParser.RemoveCustomTags(textToType); 51 | 52 | var expectedText = textToType; 53 | 54 | Assert.AreEqual(expectedText, generatedText); 55 | } 56 | 57 | [Test] 58 | public void RemoveCustomTags_OnlyUnityRichTextTags_ReturnsUnityTags() 59 | { 60 | var textToType = ""; 61 | var generatedText = TextTagParser.RemoveCustomTags(textToType); 62 | 63 | var expectedText = textToType; 64 | 65 | Assert.AreEqual(expectedText, generatedText); 66 | } 67 | 68 | [Test] 69 | public void RemoveCustomTags_OnlyCustomRichTextTags_ReturnsEmpty() 70 | { 71 | var textToType = ""; 72 | var generatedText = TextTagParser.RemoveCustomTags(textToType); 73 | 74 | var expectedText = string.Empty; 75 | 76 | Assert.AreEqual(expectedText, generatedText); 77 | } 78 | 79 | [Test] 80 | public void RemoveUnityTags_AllUnityTags_ReturnsNoTags() 81 | { 82 | var builder = new System.Text.StringBuilder(); 83 | var expectedTextBuilder = new System.Text.StringBuilder(); 84 | 85 | for (int i = 0; i < UnityTags.Length; ++i) 86 | { 87 | var tag = UnityTags[i]; 88 | builder.Append($"<{tag}>{i}"); 89 | expectedTextBuilder.Append($"{i}"); 90 | } 91 | 92 | var textToType = builder.ToString(); 93 | var generatedText = TextTagParser.RemoveUnityTags(textToType); 94 | 95 | var expectedText = expectedTextBuilder.ToString(); 96 | 97 | Assert.AreEqual(expectedText, generatedText); 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: LiberationSans SDF - Outline 10 | m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} 11 | m_ShaderKeywords: OUTLINE_ON 12 | m_LightmapFlags: 5 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: 3000 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _Cube: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _FaceTex: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _MainTex: 34 | m_Texture: {fileID: 2846298, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _OutlineTex: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | m_Floats: 42 | - _Ambient: 0.5 43 | - _Bevel: 0.5 44 | - _BevelClamp: 0 45 | - _BevelOffset: 0 46 | - _BevelRoundness: 0 47 | - _BevelWidth: 0 48 | - _BumpFace: 0 49 | - _BumpOutline: 0 50 | - _ColorMask: 15 51 | - _Diffuse: 0.5 52 | - _FaceDilate: 0.1 53 | - _FaceUVSpeedX: 0 54 | - _FaceUVSpeedY: 0 55 | - _GlowInner: 0.05 56 | - _GlowOffset: 0 57 | - _GlowOuter: 0.05 58 | - _GlowPower: 0.75 59 | - _GradientScale: 10 60 | - _LightAngle: 3.1416 61 | - _MaskSoftnessX: 0 62 | - _MaskSoftnessY: 0 63 | - _OutlineSoftness: 0 64 | - _OutlineUVSpeedX: 0 65 | - _OutlineUVSpeedY: 0 66 | - _OutlineWidth: 0.1 67 | - _PerspectiveFilter: 0.875 68 | - _Reflectivity: 10 69 | - _ScaleRatioA: 0.9 70 | - _ScaleRatioB: 0.73125 71 | - _ScaleRatioC: 0.64125 72 | - _ScaleX: 1 73 | - _ScaleY: 1 74 | - _ShaderFlags: 0 75 | - _SpecularPower: 2 76 | - _Stencil: 0 77 | - _StencilComp: 8 78 | - _StencilOp: 0 79 | - _StencilReadMask: 255 80 | - _StencilWriteMask: 255 81 | - _TextureHeight: 1024 82 | - _TextureWidth: 1024 83 | - _UnderlayDilate: 0 84 | - _UnderlayOffsetX: 0 85 | - _UnderlayOffsetY: 0 86 | - _UnderlaySoftness: 0 87 | - _VertexOffsetX: 0 88 | - _VertexOffsetY: 0 89 | - _WeightBold: 0.75 90 | - _WeightNormal: 0 91 | m_Colors: 92 | - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} 93 | - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} 94 | - _FaceColor: {r: 1, g: 1, b: 1, a: 1} 95 | - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} 96 | - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} 97 | - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} 98 | - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} 99 | - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} 100 | - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} 101 | - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} 102 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: LiberationSans SDF - Drop Shadow 10 | m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} 11 | m_ShaderKeywords: OUTLINE_ON UNDERLAY_ON 12 | m_LightmapFlags: 5 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _Cube: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _FaceTex: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _MainTex: 34 | m_Texture: {fileID: 2846298, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _OutlineTex: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | m_Floats: 42 | - _Ambient: 0.5 43 | - _Bevel: 0.5 44 | - _BevelClamp: 0 45 | - _BevelOffset: 0 46 | - _BevelRoundness: 0 47 | - _BevelWidth: 0 48 | - _BumpFace: 0 49 | - _BumpOutline: 0 50 | - _ColorMask: 15 51 | - _Diffuse: 0.5 52 | - _DiffusePower: 1 53 | - _FaceDilate: 0.1 54 | - _FaceUVSpeedX: 0 55 | - _FaceUVSpeedY: 0 56 | - _GlowInner: 0.05 57 | - _GlowOffset: 0 58 | - _GlowOuter: 0.05 59 | - _GlowPower: 0.75 60 | - _GradientScale: 10 61 | - _LightAngle: 3.1416 62 | - _MaskSoftnessX: 0 63 | - _MaskSoftnessY: 0 64 | - _OutlineSoftness: 0 65 | - _OutlineUVSpeedX: 0 66 | - _OutlineUVSpeedY: 0 67 | - _OutlineWidth: 0.1 68 | - _PerspectiveFilter: 0.875 69 | - _Reflectivity: 10 70 | - _ScaleRatioA: 0.9 71 | - _ScaleRatioB: 0.73125 72 | - _ScaleRatioC: 0.64125 73 | - _ScaleX: 1 74 | - _ScaleY: 1 75 | - _ShaderFlags: 0 76 | - _SpecularPower: 2 77 | - _Stencil: 0 78 | - _StencilComp: 8 79 | - _StencilOp: 0 80 | - _StencilReadMask: 255 81 | - _StencilWriteMask: 255 82 | - _TextureHeight: 1024 83 | - _TextureWidth: 1024 84 | - _UnderlayDilate: 0 85 | - _UnderlayOffsetX: 0.5 86 | - _UnderlayOffsetY: -0.5 87 | - _UnderlaySoftness: 0.05 88 | - _VertexOffsetX: 0 89 | - _VertexOffsetY: 0 90 | - _WeightBold: 0.75 91 | - _WeightNormal: 0 92 | m_Colors: 93 | - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} 94 | - _Color: {r: 1, g: 1, b: 1, a: 1} 95 | - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} 96 | - _FaceColor: {r: 1, g: 1, b: 1, a: 1} 97 | - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} 98 | - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} 99 | - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} 100 | - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} 101 | - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} 102 | - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} 103 | - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} 104 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/TMP Settings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 2705215ac5b84b70bacc50632be6e391, type: 3} 12 | m_Name: TMP Settings 13 | m_EditorClassIdentifier: 14 | m_enableWordWrapping: 1 15 | m_enableKerning: 1 16 | m_enableExtraPadding: 0 17 | m_enableTintAllSprites: 0 18 | m_enableParseEscapeCharacters: 1 19 | m_missingGlyphCharacter: 0 20 | m_warningsDisabled: 0 21 | m_defaultFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} 22 | m_defaultFontAssetPath: Fonts & Materials/ 23 | m_defaultFontSize: 36 24 | m_defaultAutoSizeMinRatio: 0.5 25 | m_defaultAutoSizeMaxRatio: 2 26 | m_defaultTextMeshProTextContainerSize: {x: 20, y: 5} 27 | m_defaultTextMeshProUITextContainerSize: {x: 200, y: 50} 28 | m_autoSizeTextContainer: 0 29 | m_fallbackFontAssets: [] 30 | m_matchMaterialPreset: 1 31 | m_defaultSpriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45, 32 | type: 2} 33 | m_defaultSpriteAssetPath: Sprite Assets/ 34 | m_defaultColorGradientPresetsPath: Color Gradient Presets/ 35 | m_enableEmojiSupport: 1 36 | m_defaultStyleSheet: {fileID: 11400000, guid: f952c082cb03451daed3ee968ac6c63e, 37 | type: 2} 38 | m_leadingCharacters: {fileID: 4900000, guid: d82c1b31c7e74239bff1220585707d2b, type: 3} 39 | m_followingCharacters: {fileID: 4900000, guid: fade42e8bc714b018fac513c043d323b, 40 | type: 3} 41 | m_FontCreatorRecentSettings: 42 | - sourceFontFileName: 43 | sourceFontFileGUID: edcaa01543603ae4cb6b2edf25967e21 44 | pointSizeSamplingMode: 1 45 | pointSize: 109 46 | padding: 12 47 | packingMode: 0 48 | atlasWidth: 128 49 | atlasHeight: 128 50 | characterSetSelectionMode: 5 51 | characterSequence: 64 52 | fontStyle: 0 53 | fontStyleModifier: 2 54 | renderMode: 281 55 | includeFontFeatures: 0 56 | referenceFontAssetGUID: 903613a9fe4b65946aa20dfcce07abec 57 | - sourceFontFileName: 58 | sourceFontFileGUID: edcaa01543603ae4cb6b2edf25967e21 59 | pointSizeSamplingMode: 0 60 | pointSize: 108 61 | padding: 12 62 | packingMode: 0 63 | atlasWidth: 128 64 | atlasHeight: 128 65 | characterSetSelectionMode: 5 66 | characterSequence: 64 67 | fontStyle: 0 68 | fontStyleModifier: 2 69 | renderMode: 2090 70 | includeFontFeatures: 0 71 | referenceFontAssetGUID: 70cf10c1d306ada42aa6cd7268db990d 72 | - sourceFontFileName: 73 | sourceFontFileGUID: edcaa01543603ae4cb6b2edf25967e21 74 | pointSizeSamplingMode: 1 75 | pointSize: 109 76 | padding: 12 77 | packingMode: 0 78 | atlasWidth: 128 79 | atlasHeight: 128 80 | characterSetSelectionMode: 5 81 | characterSequence: 64 82 | fontStyle: 0 83 | fontStyleModifier: 2 84 | renderMode: 329 85 | includeFontFeatures: 0 86 | referenceFontAssetGUID: 396d465a5821ead47b589b228da7e980 87 | - sourceFontFileName: 88 | sourceFontFileGUID: edcaa01543603ae4cb6b2edf25967e21 89 | pointSizeSamplingMode: 1 90 | pointSize: 338 91 | padding: 36 92 | packingMode: 0 93 | atlasWidth: 4096 94 | atlasHeight: 4096 95 | characterSetSelectionMode: 1 96 | characterSequence: 32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633 97 | fontStyle: 0 98 | fontStyleModifier: 2 99 | renderMode: 329 100 | includeFontFeatures: 0 101 | referenceFontAssetGUID: 3a4171c252e1112499af739474d9f48e 102 | m_CreationSettingsSelectionIndex: 0 103 | m_CreationSettingsIndex: 0 104 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader: -------------------------------------------------------------------------------- 1 | // Simplified version of the SDF Surface shader : 2 | // - No support for Bevel, Bump or envmap 3 | // - Diffuse only lighting 4 | // - Fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. 5 | 6 | Shader "TextMeshPro/Mobile/Distance Field (Surface)" { 7 | 8 | Properties { 9 | _FaceTex ("Fill Texture", 2D) = "white" {} 10 | _FaceColor ("Fill Color", Color) = (1,1,1,1) 11 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 12 | 13 | _OutlineColor ("Outline Color", Color) = (0,0,0,1) 14 | _OutlineTex ("Outline Texture", 2D) = "white" {} 15 | _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 16 | _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 17 | 18 | _GlowColor ("Color", Color) = (0, 1, 0, 0.5) 19 | _GlowOffset ("Offset", Range(-1,1)) = 0 20 | _GlowInner ("Inner", Range(0,1)) = 0.05 21 | _GlowOuter ("Outer", Range(0,1)) = 0.05 22 | _GlowPower ("Falloff", Range(1, 0)) = 0.75 23 | 24 | _WeightNormal ("Weight Normal", float) = 0 25 | _WeightBold ("Weight Bold", float) = 0.5 26 | 27 | // Should not be directly exposed to the user 28 | _ShaderFlags ("Flags", float) = 0 29 | _ScaleRatioA ("Scale RatioA", float) = 1 30 | _ScaleRatioB ("Scale RatioB", float) = 1 31 | _ScaleRatioC ("Scale RatioC", float) = 1 32 | 33 | _MainTex ("Font Atlas", 2D) = "white" {} 34 | _TextureWidth ("Texture Width", float) = 512 35 | _TextureHeight ("Texture Height", float) = 512 36 | _GradientScale ("Gradient Scale", float) = 5.0 37 | _ScaleX ("Scale X", float) = 1.0 38 | _ScaleY ("Scale Y", float) = 1.0 39 | _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 40 | 41 | _VertexOffsetX ("Vertex OffsetX", float) = 0 42 | _VertexOffsetY ("Vertex OffsetY", float) = 0 43 | 44 | //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) 45 | //_MaskSoftness ("Mask Softness", float) = 0 46 | } 47 | 48 | SubShader { 49 | 50 | Tags { 51 | "Queue"="Transparent" 52 | "IgnoreProjector"="True" 53 | "RenderType"="Transparent" 54 | } 55 | 56 | LOD 300 57 | Cull [_CullMode] 58 | 59 | CGPROGRAM 60 | #pragma surface PixShader Lambert alpha:blend vertex:VertShader noforwardadd nolightmap nodirlightmap 61 | #pragma target 3.0 62 | #pragma shader_feature __ GLOW_ON 63 | 64 | #include "TMPro_Properties.cginc" 65 | #include "TMPro.cginc" 66 | 67 | half _FaceShininess; 68 | half _OutlineShininess; 69 | 70 | struct Input 71 | { 72 | fixed4 color : COLOR; 73 | float2 uv_MainTex; 74 | float2 uv2_FaceTex; 75 | float2 uv2_OutlineTex; 76 | float2 param; // Weight, Scale 77 | float3 viewDirEnv; 78 | }; 79 | 80 | #include "TMPro_Surface.cginc" 81 | 82 | ENDCG 83 | 84 | // Pass to render object as a shadow caster 85 | Pass 86 | { 87 | Name "Caster" 88 | Tags { "LightMode" = "ShadowCaster" } 89 | Offset 1, 1 90 | 91 | Fog {Mode Off} 92 | ZWrite On ZTest LEqual Cull Off 93 | 94 | CGPROGRAM 95 | #pragma vertex vert 96 | #pragma fragment frag 97 | #pragma multi_compile_shadowcaster 98 | #include "UnityCG.cginc" 99 | 100 | struct v2f { 101 | V2F_SHADOW_CASTER; 102 | float2 uv : TEXCOORD1; 103 | float2 uv2 : TEXCOORD3; 104 | float alphaClip : TEXCOORD2; 105 | }; 106 | 107 | uniform float4 _MainTex_ST; 108 | uniform float4 _OutlineTex_ST; 109 | float _OutlineWidth; 110 | float _FaceDilate; 111 | float _ScaleRatioA; 112 | 113 | v2f vert( appdata_base v ) 114 | { 115 | v2f o; 116 | TRANSFER_SHADOW_CASTER(o) 117 | o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); 118 | o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); 119 | o.alphaClip = o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; 120 | return o; 121 | } 122 | 123 | uniform sampler2D _MainTex; 124 | 125 | float4 frag(v2f i) : COLOR 126 | { 127 | fixed4 texcol = tex2D(_MainTex, i.uv).a; 128 | clip(texcol.a - i.alphaClip); 129 | SHADOW_CASTER_FRAGMENT(i) 130 | } 131 | ENDCG 132 | } 133 | } 134 | 135 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 136 | } 137 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Bitmap" { 2 | 3 | Properties { 4 | _MainTex ("Font Atlas", 2D) = "white" {} 5 | _FaceTex ("Font Texture", 2D) = "white" {} 6 | _FaceColor ("Text Color", Color) = (1,1,1,1) 7 | 8 | _VertexOffsetX ("Vertex OffsetX", float) = 0 9 | _VertexOffsetY ("Vertex OffsetY", float) = 0 10 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 11 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 12 | 13 | _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 14 | 15 | _StencilComp("Stencil Comparison", Float) = 8 16 | _Stencil("Stencil ID", Float) = 0 17 | _StencilOp("Stencil Operation", Float) = 0 18 | _StencilWriteMask("Stencil Write Mask", Float) = 255 19 | _StencilReadMask("Stencil Read Mask", Float) = 255 20 | 21 | _ColorMask("Color Mask", Float) = 15 22 | } 23 | 24 | SubShader{ 25 | 26 | Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } 27 | 28 | Stencil 29 | { 30 | Ref[_Stencil] 31 | Comp[_StencilComp] 32 | Pass[_StencilOp] 33 | ReadMask[_StencilReadMask] 34 | WriteMask[_StencilWriteMask] 35 | } 36 | 37 | 38 | Lighting Off 39 | Cull [_CullMode] 40 | ZTest [unity_GUIZTestMode] 41 | ZWrite Off 42 | Fog { Mode Off } 43 | Blend SrcAlpha OneMinusSrcAlpha 44 | ColorMask[_ColorMask] 45 | 46 | Pass { 47 | CGPROGRAM 48 | #pragma vertex vert 49 | #pragma fragment frag 50 | 51 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 52 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 53 | 54 | 55 | #include "UnityCG.cginc" 56 | 57 | struct appdata_t { 58 | float4 vertex : POSITION; 59 | fixed4 color : COLOR; 60 | float2 texcoord0 : TEXCOORD0; 61 | float2 texcoord1 : TEXCOORD1; 62 | }; 63 | 64 | struct v2f { 65 | float4 vertex : SV_POSITION; 66 | fixed4 color : COLOR; 67 | float2 texcoord0 : TEXCOORD0; 68 | float2 texcoord1 : TEXCOORD1; 69 | float4 mask : TEXCOORD2; 70 | }; 71 | 72 | uniform sampler2D _MainTex; 73 | uniform sampler2D _FaceTex; 74 | uniform float4 _FaceTex_ST; 75 | uniform fixed4 _FaceColor; 76 | 77 | uniform float _VertexOffsetX; 78 | uniform float _VertexOffsetY; 79 | uniform float4 _ClipRect; 80 | uniform float _MaskSoftnessX; 81 | uniform float _MaskSoftnessY; 82 | 83 | float2 UnpackUV(float uv) 84 | { 85 | float2 output; 86 | output.x = floor(uv / 4096); 87 | output.y = uv - 4096 * output.x; 88 | 89 | return output * 0.001953125; 90 | } 91 | 92 | v2f vert (appdata_t v) 93 | { 94 | float4 vert = v.vertex; 95 | vert.x += _VertexOffsetX; 96 | vert.y += _VertexOffsetY; 97 | 98 | vert.xy += (vert.w * 0.5) / _ScreenParams.xy; 99 | 100 | float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); 101 | 102 | fixed4 faceColor = v.color; 103 | faceColor *= _FaceColor; 104 | 105 | v2f OUT; 106 | OUT.vertex = vPosition; 107 | OUT.color = faceColor; 108 | OUT.texcoord0 = v.texcoord0; 109 | OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); 110 | float2 pixelSize = vPosition.w; 111 | pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); 112 | 113 | // Clamp _ClipRect to 16bit. 114 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 115 | OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); 116 | 117 | return OUT; 118 | } 119 | 120 | fixed4 frag (v2f IN) : SV_Target 121 | { 122 | fixed4 color = tex2D(_MainTex, IN.texcoord0); 123 | color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); 124 | 125 | // Alternative implementation to UnityGet2DClipping with support for softness. 126 | #if UNITY_UI_CLIP_RECT 127 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 128 | color *= m.x * m.y; 129 | #endif 130 | 131 | #if UNITY_UI_ALPHACLIP 132 | clip(color.a - 0.001); 133 | #endif 134 | 135 | return color; 136 | } 137 | ENDCG 138 | } 139 | } 140 | 141 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 142 | } 143 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Bitmap Custom Atlas" { 2 | 3 | Properties { 4 | _MainTex ("Font Atlas", 2D) = "white" {} 5 | _FaceTex ("Font Texture", 2D) = "white" {} 6 | _FaceColor ("Text Color", Color) = (1,1,1,1) 7 | 8 | _VertexOffsetX ("Vertex OffsetX", float) = 0 9 | _VertexOffsetY ("Vertex OffsetY", float) = 0 10 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 11 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 12 | 13 | _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 14 | _Padding ("Padding", float) = 0 15 | 16 | _StencilComp("Stencil Comparison", Float) = 8 17 | _Stencil("Stencil ID", Float) = 0 18 | _StencilOp("Stencil Operation", Float) = 0 19 | _StencilWriteMask("Stencil Write Mask", Float) = 255 20 | _StencilReadMask("Stencil Read Mask", Float) = 255 21 | 22 | _ColorMask("Color Mask", Float) = 15 23 | } 24 | 25 | SubShader{ 26 | 27 | Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } 28 | 29 | Stencil 30 | { 31 | Ref[_Stencil] 32 | Comp[_StencilComp] 33 | Pass[_StencilOp] 34 | ReadMask[_StencilReadMask] 35 | WriteMask[_StencilWriteMask] 36 | } 37 | 38 | 39 | Lighting Off 40 | Cull [_CullMode] 41 | ZTest [unity_GUIZTestMode] 42 | ZWrite Off 43 | Fog { Mode Off } 44 | Blend SrcAlpha OneMinusSrcAlpha 45 | ColorMask[_ColorMask] 46 | 47 | Pass { 48 | CGPROGRAM 49 | #pragma vertex vert 50 | #pragma fragment frag 51 | 52 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 53 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 54 | 55 | 56 | #include "UnityCG.cginc" 57 | 58 | struct appdata_t { 59 | float4 vertex : POSITION; 60 | fixed4 color : COLOR; 61 | float2 texcoord0 : TEXCOORD0; 62 | float2 texcoord1 : TEXCOORD1; 63 | }; 64 | 65 | struct v2f { 66 | float4 vertex : SV_POSITION; 67 | fixed4 color : COLOR; 68 | float2 texcoord0 : TEXCOORD0; 69 | float2 texcoord1 : TEXCOORD1; 70 | float4 mask : TEXCOORD2; 71 | }; 72 | 73 | uniform sampler2D _MainTex; 74 | uniform sampler2D _FaceTex; 75 | uniform float4 _FaceTex_ST; 76 | uniform fixed4 _FaceColor; 77 | 78 | uniform float _VertexOffsetX; 79 | uniform float _VertexOffsetY; 80 | uniform float4 _ClipRect; 81 | uniform float _MaskSoftnessX; 82 | uniform float _MaskSoftnessY; 83 | 84 | float2 UnpackUV(float uv) 85 | { 86 | float2 output; 87 | output.x = floor(uv / 4096); 88 | output.y = uv - 4096 * output.x; 89 | 90 | return output * 0.001953125; 91 | } 92 | 93 | v2f vert (appdata_t v) 94 | { 95 | float4 vert = v.vertex; 96 | vert.x += _VertexOffsetX; 97 | vert.y += _VertexOffsetY; 98 | 99 | vert.xy += (vert.w * 0.5) / _ScreenParams.xy; 100 | 101 | float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); 102 | 103 | fixed4 faceColor = v.color; 104 | faceColor *= _FaceColor; 105 | 106 | v2f OUT; 107 | OUT.vertex = vPosition; 108 | OUT.color = faceColor; 109 | OUT.texcoord0 = v.texcoord0; 110 | OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); 111 | float2 pixelSize = vPosition.w; 112 | pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); 113 | 114 | // Clamp _ClipRect to 16bit. 115 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 116 | OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); 117 | 118 | return OUT; 119 | } 120 | 121 | fixed4 frag (v2f IN) : SV_Target 122 | { 123 | fixed4 color = tex2D(_MainTex, IN.texcoord0) * tex2D(_FaceTex, IN.texcoord1) * IN.color; 124 | 125 | // Alternative implementation to UnityGet2DClipping with support for softness. 126 | #if UNITY_UI_CLIP_RECT 127 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 128 | color *= m.x * m.y; 129 | #endif 130 | 131 | #if UNITY_UI_ALPHACLIP 132 | clip(color.a - 0.001); 133 | #endif 134 | 135 | return color; 136 | } 137 | ENDCG 138 | } 139 | } 140 | 141 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 142 | } 143 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Mobile/Bitmap" { 2 | 3 | Properties { 4 | _MainTex ("Font Atlas", 2D) = "white" {} 5 | _Color ("Text Color", Color) = (1,1,1,1) 6 | _DiffusePower ("Diffuse Power", Range(1.0,4.0)) = 1.0 7 | 8 | _VertexOffsetX("Vertex OffsetX", float) = 0 9 | _VertexOffsetY("Vertex OffsetY", float) = 0 10 | _MaskSoftnessX("Mask SoftnessX", float) = 0 11 | _MaskSoftnessY("Mask SoftnessY", float) = 0 12 | 13 | _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 14 | 15 | _StencilComp("Stencil Comparison", Float) = 8 16 | _Stencil("Stencil ID", Float) = 0 17 | _StencilOp("Stencil Operation", Float) = 0 18 | _StencilWriteMask("Stencil Write Mask", Float) = 255 19 | _StencilReadMask("Stencil Read Mask", Float) = 255 20 | 21 | _ColorMask("Color Mask", Float) = 15 22 | } 23 | 24 | SubShader { 25 | 26 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 27 | 28 | Stencil 29 | { 30 | Ref[_Stencil] 31 | Comp[_StencilComp] 32 | Pass[_StencilOp] 33 | ReadMask[_StencilReadMask] 34 | WriteMask[_StencilWriteMask] 35 | } 36 | 37 | 38 | Lighting Off 39 | Cull Off 40 | ZTest [unity_GUIZTestMode] 41 | ZWrite Off 42 | Fog { Mode Off } 43 | Blend SrcAlpha OneMinusSrcAlpha 44 | ColorMask[_ColorMask] 45 | 46 | Pass { 47 | CGPROGRAM 48 | #pragma vertex vert 49 | #pragma fragment frag 50 | #pragma fragmentoption ARB_precision_hint_fastest 51 | 52 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 53 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 54 | 55 | 56 | #include "UnityCG.cginc" 57 | 58 | struct appdata_t { 59 | float4 vertex : POSITION; 60 | fixed4 color : COLOR; 61 | float2 texcoord0 : TEXCOORD0; 62 | float2 texcoord1 : TEXCOORD1; 63 | }; 64 | 65 | struct v2f { 66 | float4 vertex : POSITION; 67 | fixed4 color : COLOR; 68 | float2 texcoord0 : TEXCOORD0; 69 | float4 mask : TEXCOORD2; 70 | }; 71 | 72 | sampler2D _MainTex; 73 | fixed4 _Color; 74 | float _DiffusePower; 75 | 76 | uniform float _VertexOffsetX; 77 | uniform float _VertexOffsetY; 78 | uniform float4 _ClipRect; 79 | uniform float _MaskSoftnessX; 80 | uniform float _MaskSoftnessY; 81 | 82 | v2f vert (appdata_t v) 83 | { 84 | v2f OUT; 85 | float4 vert = v.vertex; 86 | vert.x += _VertexOffsetX; 87 | vert.y += _VertexOffsetY; 88 | 89 | vert.xy += (vert.w * 0.5) / _ScreenParams.xy; 90 | 91 | OUT.vertex = UnityPixelSnap(UnityObjectToClipPos(vert)); 92 | OUT.color = v.color; 93 | OUT.color *= _Color; 94 | OUT.color.rgb *= _DiffusePower; 95 | OUT.texcoord0 = v.texcoord0; 96 | 97 | float2 pixelSize = OUT.vertex.w; 98 | //pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); 99 | 100 | // Clamp _ClipRect to 16bit. 101 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 102 | OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); 103 | 104 | return OUT; 105 | } 106 | 107 | fixed4 frag (v2f IN) : COLOR 108 | { 109 | fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0).a); 110 | 111 | // Alternative implementation to UnityGet2DClipping with support for softness. 112 | #if UNITY_UI_CLIP_RECT 113 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 114 | color *= m.x * m.y; 115 | #endif 116 | 117 | #if UNITY_UI_ALPHACLIP 118 | clip(color.a - 0.001); 119 | #endif 120 | 121 | return color; 122 | } 123 | ENDCG 124 | } 125 | } 126 | 127 | SubShader { 128 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 129 | Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off } 130 | Blend SrcAlpha OneMinusSrcAlpha 131 | BindChannels { 132 | Bind "Color", color 133 | Bind "Vertex", vertex 134 | Bind "TexCoord", texcoord0 135 | } 136 | Pass { 137 | SetTexture [_MainTex] { 138 | constantColor [_Color] combine constant * primary, constant * texture 139 | } 140 | } 141 | } 142 | 143 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 144 | } 145 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc: -------------------------------------------------------------------------------- 1 | void VertShader(inout appdata_full v, out Input data) 2 | { 3 | v.vertex.x += _VertexOffsetX; 4 | v.vertex.y += _VertexOffsetY; 5 | 6 | UNITY_INITIALIZE_OUTPUT(Input, data); 7 | 8 | float bold = step(v.texcoord1.y, 0); 9 | 10 | // Generate normal for backface 11 | float3 view = ObjSpaceViewDir(v.vertex); 12 | v.normal *= sign(dot(v.normal, view)); 13 | 14 | #if USE_DERIVATIVE 15 | data.param.y = 1; 16 | #else 17 | float4 vert = v.vertex; 18 | float4 vPosition = UnityObjectToClipPos(vert); 19 | float2 pixelSize = vPosition.w; 20 | 21 | pixelSize /= float2(_ScaleX, _ScaleY) * mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy); 22 | float scale = rsqrt(dot(pixelSize, pixelSize)); 23 | scale *= abs(v.texcoord1.y) * _GradientScale * 1.5; 24 | scale = lerp(scale * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(v.normal.xyz), normalize(WorldSpaceViewDir(vert))))); 25 | data.param.y = scale; 26 | #endif 27 | 28 | //float opacity = v.color.a; 29 | 30 | data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; // 31 | 32 | v.texcoord1.xy = UnpackUV(v.texcoord1.x); 33 | data.viewDirEnv = mul((float3x3)_EnvMatrix, WorldSpaceViewDir(v.vertex)); 34 | } 35 | 36 | void PixShader(Input input, inout SurfaceOutput o) 37 | { 38 | 39 | #if USE_DERIVATIVE | BEVEL_ON 40 | float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0); 41 | 42 | float4 smp4x = { tex2D(_MainTex, input.uv_MainTex - delta.xz).a, 43 | tex2D(_MainTex, input.uv_MainTex + delta.xz).a, 44 | tex2D(_MainTex, input.uv_MainTex - delta.zy).a, 45 | tex2D(_MainTex, input.uv_MainTex + delta.zy).a }; 46 | #endif 47 | 48 | #if USE_DERIVATIVE 49 | // Screen space scaling reciprocal with anisotropic correction 50 | float2 edgeNormal = Normalize(float2(smp4x.x - smp4x.y, smp4x.z - smp4x.w)); 51 | float2 res = float2(_TextureWidth * input.param.y, _TextureHeight); 52 | float2 tdx = ddx(input.uv_MainTex)*res; 53 | float2 tdy = ddy(input.uv_MainTex)*res; 54 | float lx = length(tdx); 55 | float ly = length(tdy); 56 | float s = sqrt(min(lx, ly) / max(lx, ly)); 57 | s = lerp(1, s, abs(dot(normalize(tdx + tdy), edgeNormal))); 58 | float scale = rsqrt(abs(tdx.x * tdy.y - tdx.y * tdy.x)) * (_GradientScale * 2) * s; 59 | #else 60 | float scale = input.param.y; 61 | #endif 62 | 63 | // Signed distance 64 | float c = tex2D(_MainTex, input.uv_MainTex).a; 65 | float sd = (.5 - c - input.param.x) * scale + .5; 66 | float outline = _OutlineWidth*_ScaleRatioA * scale; 67 | float softness = _OutlineSoftness*_ScaleRatioA * scale; 68 | 69 | // Color & Alpha 70 | float4 faceColor = _FaceColor; 71 | float4 outlineColor = _OutlineColor; 72 | faceColor *= input.color; 73 | outlineColor.a *= input.color.a; 74 | faceColor *= tex2D(_FaceTex, float2(input.uv2_FaceTex.x + _FaceUVSpeedX * _Time.y, input.uv2_FaceTex.y + _FaceUVSpeedY * _Time.y)); 75 | outlineColor *= tex2D(_OutlineTex, float2(input.uv2_OutlineTex.x + _OutlineUVSpeedX * _Time.y, input.uv2_OutlineTex.y + _OutlineUVSpeedY * _Time.y)); 76 | faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); 77 | faceColor.rgb /= max(faceColor.a, 0.0001); 78 | 79 | 80 | #if BEVEL_ON 81 | // Face Normal 82 | float3 n = GetSurfaceNormal(smp4x, input.param.x); 83 | 84 | // Bumpmap 85 | float3 bump = UnpackNormal(tex2D(_BumpMap, input.uv2_FaceTex.xy)).xyz; 86 | bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); 87 | bump = lerp(float3(0, 0, 1), bump, faceColor.a); 88 | n = normalize(n - bump); 89 | 90 | // Cubemap reflection 91 | fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDirEnv, mul((float3x3)unity_ObjectToWorld, n))); 92 | float3 emission = reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; 93 | #else 94 | float3 n = float3(0, 0, -1); 95 | float3 emission = float3(0, 0, 0); 96 | #endif 97 | 98 | 99 | 100 | #if GLOW_ON 101 | float4 glowColor = GetGlowColor(sd, scale); 102 | glowColor.a *= input.color.a; 103 | emission += glowColor.rgb*glowColor.a; 104 | faceColor = BlendARGB(glowColor, faceColor); 105 | faceColor.rgb /= max(faceColor.a, 0.0001); 106 | #endif 107 | 108 | // Set Standard output structure 109 | o.Albedo = faceColor.rgb; 110 | o.Normal = -n; 111 | o.Emission = emission; 112 | o.Specular = lerp(_FaceShininess, _OutlineShininess, saturate(sd + outline * 0.5)); 113 | o.Gloss = 1; 114 | o.Alpha = faceColor.a; 115 | } 116 | -------------------------------------------------------------------------------- /Assets/TextTyper/README.md: -------------------------------------------------------------------------------- 1 | Unity-TextTyper 2 | ========================= 3 | 4 | TextTyper is a text typing effect component for Unity. TextTyper prints out characters one by one to a uGUI Text component. Adapted by RedBlueGames from synchrok's GitHub project (https://github.com/synchrok/TypeText). 5 | 6 | It's easy to find other examples of Text printing components, but TextTyper provides two major differences: 7 | * Correct wrapping as characters are printed 8 | * Support for Rich Text Tags 9 | 10 | **Note this verison of TextTyper requires TextMeshPro, which can be installed for free from the Package Manager in Unity 2018, or the Asset Store in older versions. If you want the version that is compatible with Unity's uGUI Text component, [this branch](https://github.com/redbluegames/unity-text-typer/tree/ugui-text-typer) or download [this release](https://github.com/redbluegames/unity-text-typer/releases/tag/v1.2).** 11 | 12 | How To Use 13 | -------- 14 | To start TextTyping all you need to do is add the `TextTyper` component to a unity Text widget: 15 | 16 | 1. Create a GameObject with a Unity UI Text Widget, as normal. 17 | 2. Add a TextTyper component to the GameObject. 18 | 3. Call the TextTyper component's public functions ```TypeText``` and ```Skip``` to print the desired text with the specified delay. We call these from a 3rd component we call `Talker`. 19 | 20 | You can optionally subscribe to the `PrintCompleted` and `CharacterPrinted` [UnityEvents](https://docs.unity3d.com/ScriptReference/Events.UnityEvent.AddListener.html) to add additional feedback like sounds and paging widgets. 21 | 22 | Features 23 | -------- 24 | - **Define Text Speed Per Character**: ```Mayday! S.O.S.``` 25 | - **Support for uGUI Rich Text Tags**: ```,,,,...``` 26 | - **Additional delay for punctuation** 27 | - **Skip to end** 28 | - **OnComplete Callback** 29 | - **OnCharacterPrinted Callback (for audio)** 30 | 31 | Changelog on UPM branch 32 | -------- 33 | 34 | ### 2.3.0 35 | - Add `PrintAmount` to the config to support printing any number of characters each time. 36 | 37 | ### 2.2.0 38 | - The fields named `PunctuationCharacters` inside `TextTyper` and `TextTyperConfig` have been renamed to `Punctuations`. Their type has been changed to `List` 39 | - `TextSymbol` class has been moved out of `TextTagParser` 40 | - The constructors of `TextSymbol` has been changed into `Initialize(...)` methods 41 | - `TextTagParser` is now a static class 42 | - The signature of `TextTagParser.CreateSymbolListFromText(...)` has been changed. It now requires a `List` parameter to reduce allocation 43 | - `TextTagParser` now uses a pool of `TextSymbol` to reduce allocation 44 | - Add `Pause()` and `Resume(...)` methods to `TextTyper` 45 | 46 | ### 2.1.3 47 | - Add `TextTyperConfig` field to `TextTyper` to allow overriding default settings: `PrintDelay`, `PunctuationDelayMultiplier`, `PunctuationCharacters` 48 | - `TextTyper.TypeText(...)` can now receive an instance of `TextTyperConfig` as an alternated config. It's only valid until the next invocation of `TypeText(...)` 49 | 50 | ### 2.1.2 51 | - `TextTyper` now requires `TMP_Text` instead of `TextMeshProUGUI` 52 | 53 | Screenshots 54 | -------- 55 | ![TypeText Screenshot GIF](https://github.com/redbluegames/unity-text-typer/blob/master/README-Images/ss_chat_watermarked.gif) 56 | Image of TextTyper in Sparklite (© RedBlueGames 2016) 57 | 58 | The Code 59 | -------- 60 | The core of our text typer is a coroutine that’s triggered via the TypeText method. The coroutine has the following steps: 61 | Check next character to see if it’s the start of a Rich Text tag 62 | - If It’s a tag, parse it and apply it. Right now “applying” a tag just means modifying the print delay, but other tags could be added. Add it to a list of tags that need to be closed (because we have not yet reached the corresponding closing tag in our string). Move to next character and repeat 63 | - If it’s not a tag, print it 64 | - Wait for the print delay 65 | - Check if we are complete 66 | 67 | The tool also uses RichTextTag.cs, a class that’s used to help with parsing. 68 | There are a few details I left out, but this should give you enough to start reading through the code if you want to know more. 69 | 70 | How to Help 71 | ------- 72 | The easiest way to help with the project is to just to use it! As you use it, you can submit bugs and feature requests through GitHub issues. 73 | 74 | Contributors 75 | ------- 76 | **Issue Resporters** 77 | - JonathanGorr 78 | 79 | License and Credits 80 | ------- 81 | - **TypeText** is under MIT license. See the [LICENSE](LICENSE) file for more info. 82 | - Typing sound effect (UITextDisplay.wav) provided by @kevinrmabie. Free for others to use, no attribution necessary. 83 | -------------------------------------------------------------------------------- /Assets/TextTyper/TextTagParser.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// "Utility class to assist with parsing HTML-style tags in strings 7 | /// 8 | public static class TextTagParser 9 | { 10 | /// 11 | /// Define custom tags here. These should also be added to the CustomTagTypes List below 12 | /// 13 | public struct CustomTags 14 | { 15 | public const string Delay = "delay"; 16 | public const string Speed = "speed"; 17 | public const string Anim = "anim"; 18 | public const string Animation = "animation"; 19 | } 20 | 21 | private static readonly string[] UnityTags = new string[] 22 | { 23 | "b", 24 | "i", 25 | "s", 26 | "u", 27 | "br", 28 | "nobr", 29 | "size", 30 | "color", 31 | "style", 32 | "width", 33 | "align", 34 | "alpha", 35 | "cspace", 36 | "font", 37 | "indent", 38 | "line-height", 39 | "line-indent", 40 | "link", 41 | "lowercase", 42 | "uppercase", 43 | "smallcaps", 44 | "margin", 45 | "mark", 46 | "mspace", 47 | "noparse", 48 | "page", 49 | "pos", 50 | "space", 51 | "sprite", 52 | "sup", 53 | "sub", 54 | "voffset", 55 | "gradient" 56 | }; 57 | 58 | private static readonly string[] CustomTagTypes = new string[] 59 | { 60 | CustomTags.Delay, 61 | CustomTags.Speed, 62 | CustomTags.Anim, 63 | CustomTags.Animation, 64 | }; 65 | 66 | private static readonly Queue SymbolPool = new Queue(); 67 | 68 | private static TextSymbol GetSymbol() 69 | { 70 | if (SymbolPool.Count > 0) 71 | return SymbolPool.Dequeue(); 72 | 73 | return new TextSymbol(); 74 | } 75 | 76 | private static void Pool(IEnumerable symbols) 77 | { 78 | foreach (var symbol in symbols) 79 | { 80 | SymbolPool.Enqueue(symbol); 81 | } 82 | } 83 | 84 | public static void CreateSymbolListFromText(string text, List symbolList) 85 | { 86 | Pool(symbolList); 87 | symbolList.Clear(); 88 | 89 | var parsedCharacters = 0; 90 | 91 | while (parsedCharacters < text.Length) 92 | { 93 | TextSymbol symbol; 94 | 95 | // Check for tags 96 | var remainingText = text.Substring(parsedCharacters, text.Length - parsedCharacters); 97 | 98 | if (RichTextTag.StringStartsWithTag(remainingText)) 99 | { 100 | var tag = RichTextTag.ParseNext(remainingText); 101 | symbol = GetSymbol().Initialize(tag); 102 | } 103 | else 104 | { 105 | symbol = GetSymbol().Initialize(remainingText.Substring(0, 1)); 106 | } 107 | 108 | parsedCharacters += symbol.Length; 109 | symbolList.Add(symbol); 110 | } 111 | } 112 | 113 | public static string RemoveAllTags(string textWithTags) 114 | { 115 | string textWithoutTags = textWithTags; 116 | textWithoutTags = RemoveUnityTags(textWithoutTags); 117 | textWithoutTags = RemoveCustomTags(textWithoutTags); 118 | 119 | return textWithoutTags; 120 | } 121 | 122 | public static string RemoveCustomTags(string textWithTags) 123 | { 124 | return RemoveTags(textWithTags, CustomTagTypes); 125 | } 126 | 127 | public static string RemoveUnityTags(string textWithTags) 128 | { 129 | return RemoveTags(textWithTags, UnityTags); 130 | } 131 | 132 | private static string RemoveTags(string textWithTags, params string[] tags) 133 | { 134 | string textWithoutTags = textWithTags; 135 | foreach (var tag in tags) 136 | { 137 | textWithoutTags = RichTextTag.RemoveTagsFromString(textWithoutTags, tag); 138 | } 139 | 140 | return textWithoutTags; 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Sprites/EmojiOne.json: -------------------------------------------------------------------------------- 1 | {"frames": [ 2 | 3 | { 4 | "filename": "1f60a.png", 5 | "frame": {"x":0,"y":0,"w":128,"h":128}, 6 | "rotated": false, 7 | "trimmed": false, 8 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 9 | "sourceSize": {"w":128,"h":128}, 10 | "pivot": {"x":0.5,"y":0.5} 11 | }, 12 | { 13 | "filename": "1f60b.png", 14 | "frame": {"x":128,"y":0,"w":128,"h":128}, 15 | "rotated": false, 16 | "trimmed": false, 17 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 18 | "sourceSize": {"w":128,"h":128}, 19 | "pivot": {"x":0.5,"y":0.5} 20 | }, 21 | { 22 | "filename": "1f60d.png", 23 | "frame": {"x":256,"y":0,"w":128,"h":128}, 24 | "rotated": false, 25 | "trimmed": false, 26 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 27 | "sourceSize": {"w":128,"h":128}, 28 | "pivot": {"x":0.5,"y":0.5} 29 | }, 30 | { 31 | "filename": "1f60e.png", 32 | "frame": {"x":384,"y":0,"w":128,"h":128}, 33 | "rotated": false, 34 | "trimmed": false, 35 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 36 | "sourceSize": {"w":128,"h":128}, 37 | "pivot": {"x":0.5,"y":0.5} 38 | }, 39 | { 40 | "filename": "1f600.png", 41 | "frame": {"x":0,"y":128,"w":128,"h":128}, 42 | "rotated": false, 43 | "trimmed": false, 44 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 45 | "sourceSize": {"w":128,"h":128}, 46 | "pivot": {"x":0.5,"y":0.5} 47 | }, 48 | { 49 | "filename": "1f601.png", 50 | "frame": {"x":128,"y":128,"w":128,"h":128}, 51 | "rotated": false, 52 | "trimmed": false, 53 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 54 | "sourceSize": {"w":128,"h":128}, 55 | "pivot": {"x":0.5,"y":0.5} 56 | }, 57 | { 58 | "filename": "1f602.png", 59 | "frame": {"x":256,"y":128,"w":128,"h":128}, 60 | "rotated": false, 61 | "trimmed": false, 62 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 63 | "sourceSize": {"w":128,"h":128}, 64 | "pivot": {"x":0.5,"y":0.5} 65 | }, 66 | { 67 | "filename": "1f603.png", 68 | "frame": {"x":384,"y":128,"w":128,"h":128}, 69 | "rotated": false, 70 | "trimmed": false, 71 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 72 | "sourceSize": {"w":128,"h":128}, 73 | "pivot": {"x":0.5,"y":0.5} 74 | }, 75 | { 76 | "filename": "1f604.png", 77 | "frame": {"x":0,"y":256,"w":128,"h":128}, 78 | "rotated": false, 79 | "trimmed": false, 80 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 81 | "sourceSize": {"w":128,"h":128}, 82 | "pivot": {"x":0.5,"y":0.5} 83 | }, 84 | { 85 | "filename": "1f605.png", 86 | "frame": {"x":128,"y":256,"w":128,"h":128}, 87 | "rotated": false, 88 | "trimmed": false, 89 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 90 | "sourceSize": {"w":128,"h":128}, 91 | "pivot": {"x":0.5,"y":0.5} 92 | }, 93 | { 94 | "filename": "1f606.png", 95 | "frame": {"x":256,"y":256,"w":128,"h":128}, 96 | "rotated": false, 97 | "trimmed": false, 98 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 99 | "sourceSize": {"w":128,"h":128}, 100 | "pivot": {"x":0.5,"y":0.5} 101 | }, 102 | { 103 | "filename": "1f609.png", 104 | "frame": {"x":384,"y":256,"w":128,"h":128}, 105 | "rotated": false, 106 | "trimmed": false, 107 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 108 | "sourceSize": {"w":128,"h":128}, 109 | "pivot": {"x":0.5,"y":0.5} 110 | }, 111 | { 112 | "filename": "1f618.png", 113 | "frame": {"x":0,"y":384,"w":128,"h":128}, 114 | "rotated": false, 115 | "trimmed": false, 116 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 117 | "sourceSize": {"w":128,"h":128}, 118 | "pivot": {"x":0.5,"y":0.5} 119 | }, 120 | { 121 | "filename": "1f923.png", 122 | "frame": {"x":128,"y":384,"w":128,"h":128}, 123 | "rotated": false, 124 | "trimmed": false, 125 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 126 | "sourceSize": {"w":128,"h":128}, 127 | "pivot": {"x":0.5,"y":0.5} 128 | }, 129 | { 130 | "filename": "263a.png", 131 | "frame": {"x":256,"y":384,"w":128,"h":128}, 132 | "rotated": false, 133 | "trimmed": false, 134 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 135 | "sourceSize": {"w":128,"h":128}, 136 | "pivot": {"x":0.5,"y":0.5} 137 | }, 138 | { 139 | "filename": "2639.png", 140 | "frame": {"x":384,"y":384,"w":128,"h":128}, 141 | "rotated": false, 142 | "trimmed": false, 143 | "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, 144 | "sourceSize": {"w":128,"h":128}, 145 | "pivot": {"x":0.5,"y":0.5} 146 | }], 147 | "meta": { 148 | "app": "http://www.codeandweb.com/texturepacker", 149 | "version": "1.0", 150 | "image": "EmojiOne.png", 151 | "format": "RGBA8888", 152 | "size": {"w":512,"h":512}, 153 | "scale": "1", 154 | "smartupdate": "$TexturePacker:SmartUpdate:196a26a2e149d875b91ffc8fa3581e76:fc928c7e275404b7e0649307410475cb:424723c3774975ddb2053fd5c4b85f6e$" 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Distance Field (Surface)" { 2 | 3 | Properties { 4 | _FaceTex ("Fill Texture", 2D) = "white" {} 5 | _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 6 | _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 7 | _FaceColor ("Fill Color", Color) = (1,1,1,1) 8 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 9 | 10 | _OutlineColor ("Outline Color", Color) = (0,0,0,1) 11 | _OutlineTex ("Outline Texture", 2D) = "white" {} 12 | _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 13 | _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 14 | _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 15 | _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 16 | 17 | _Bevel ("Bevel", Range(0,1)) = 0.5 18 | _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 19 | _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 20 | _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 21 | _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 22 | 23 | _BumpMap ("Normalmap", 2D) = "bump" {} 24 | _BumpOutline ("Bump Outline", Range(0,1)) = 0.5 25 | _BumpFace ("Bump Face", Range(0,1)) = 0.5 26 | 27 | _ReflectFaceColor ("Face Color", Color) = (0,0,0,1) 28 | _ReflectOutlineColor ("Outline Color", Color) = (0,0,0,1) 29 | _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } 30 | _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) 31 | _SpecColor ("Specular Color", Color) = (0,0,0,1) 32 | 33 | _FaceShininess ("Face Shininess", Range(0,1)) = 0 34 | _OutlineShininess ("Outline Shininess", Range(0,1)) = 0 35 | 36 | _GlowColor ("Color", Color) = (0, 1, 0, 0.5) 37 | _GlowOffset ("Offset", Range(-1,1)) = 0 38 | _GlowInner ("Inner", Range(0,1)) = 0.05 39 | _GlowOuter ("Outer", Range(0,1)) = 0.05 40 | _GlowPower ("Falloff", Range(1, 0)) = 0.75 41 | 42 | _WeightNormal ("Weight Normal", float) = 0 43 | _WeightBold ("Weight Bold", float) = 0.5 44 | 45 | // Should not be directly exposed to the user 46 | _ShaderFlags ("Flags", float) = 0 47 | _ScaleRatioA ("Scale RatioA", float) = 1 48 | _ScaleRatioB ("Scale RatioB", float) = 1 49 | _ScaleRatioC ("Scale RatioC", float) = 1 50 | 51 | _MainTex ("Font Atlas", 2D) = "white" {} 52 | _TextureWidth ("Texture Width", float) = 512 53 | _TextureHeight ("Texture Height", float) = 512 54 | _GradientScale ("Gradient Scale", float) = 5.0 55 | _ScaleX ("Scale X", float) = 1.0 56 | _ScaleY ("Scale Y", float) = 1.0 57 | _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 58 | 59 | _VertexOffsetX ("Vertex OffsetX", float) = 0 60 | _VertexOffsetY ("Vertex OffsetY", float) = 0 61 | //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) 62 | //_MaskSoftness ("Mask Softness", float) = 0 63 | } 64 | 65 | SubShader { 66 | 67 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 68 | 69 | LOD 300 70 | Cull [_CullMode] 71 | 72 | CGPROGRAM 73 | #pragma surface PixShader BlinnPhong alpha:blend vertex:VertShader nolightmap nodirlightmap 74 | #pragma target 3.0 75 | #pragma shader_feature __ GLOW_ON 76 | #pragma glsl 77 | 78 | #include "TMPro_Properties.cginc" 79 | #include "TMPro.cginc" 80 | 81 | half _FaceShininess; 82 | half _OutlineShininess; 83 | 84 | struct Input 85 | { 86 | fixed4 color : COLOR; 87 | float2 uv_MainTex; 88 | float2 uv2_FaceTex; 89 | float2 uv2_OutlineTex; 90 | float2 param; // Weight, Scale 91 | float3 viewDirEnv; 92 | }; 93 | 94 | 95 | #define BEVEL_ON 1 96 | #include "TMPro_Surface.cginc" 97 | 98 | ENDCG 99 | 100 | // Pass to render object as a shadow caster 101 | Pass 102 | { 103 | Name "Caster" 104 | Tags { "LightMode" = "ShadowCaster" } 105 | Offset 1, 1 106 | 107 | Fog {Mode Off} 108 | ZWrite On 109 | ZTest LEqual 110 | Cull Off 111 | 112 | CGPROGRAM 113 | #pragma vertex vert 114 | #pragma fragment frag 115 | #pragma multi_compile_shadowcaster 116 | #include "UnityCG.cginc" 117 | 118 | struct v2f { 119 | V2F_SHADOW_CASTER; 120 | float2 uv : TEXCOORD1; 121 | float2 uv2 : TEXCOORD3; 122 | float alphaClip : TEXCOORD2; 123 | }; 124 | 125 | uniform float4 _MainTex_ST; 126 | uniform float4 _OutlineTex_ST; 127 | float _OutlineWidth; 128 | float _FaceDilate; 129 | float _ScaleRatioA; 130 | 131 | v2f vert( appdata_base v ) 132 | { 133 | v2f o; 134 | TRANSFER_SHADOW_CASTER(o) 135 | o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); 136 | o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); 137 | o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; 138 | return o; 139 | } 140 | 141 | uniform sampler2D _MainTex; 142 | 143 | float4 frag(v2f i) : COLOR 144 | { 145 | fixed4 texcol = tex2D(_MainTex, i.uv).a; 146 | clip(texcol.a - i.alphaClip); 147 | SHADOW_CASTER_FRAGMENT(i) 148 | } 149 | ENDCG 150 | } 151 | } 152 | 153 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 154 | } 155 | 156 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: ab2114bdc8544297b417dfefe9f1e410, type: 3} 12 | m_Name: Default Style Sheet 13 | m_EditorClassIdentifier: 14 | m_StyleList: 15 | - m_Name: H1 16 | m_HashCode: 2425 17 | m_OpeningDefinition: <#40ff80>* 18 | m_ClosingDefinition: '*' 19 | m_OpeningTagArray: 3c00000073000000690000007a000000650000003d00000032000000650000006d0000003e0000003c000000620000003e0000003c000000230000003400000030000000660000006600000038000000300000003e0000002a000000 20 | m_ClosingTagArray: 2a0000003c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 21 | - m_Name: Quote 22 | m_HashCode: 92254330 23 | m_OpeningDefinition: 24 | m_ClosingDefinition: 25 | m_OpeningTagArray: 3c000000690000003e0000003c00000073000000690000007a000000650000003d0000003700000035000000250000003e0000003c0000006d000000610000007200000067000000690000006e0000003d0000003100000030000000250000003e000000 26 | m_ClosingTagArray: 3c0000002f000000690000003e0000003c0000002f00000073000000690000007a000000650000003e0000003c0000002f00000077000000690000006400000074000000680000003e0000003c0000002f0000006d000000610000007200000067000000690000006e0000003e000000 27 | - m_Name: Link 28 | m_HashCode: 2687968 29 | m_OpeningDefinition: <#40a0ff> 30 | m_ClosingDefinition: 31 | m_OpeningTagArray: 3c000000750000003e0000003c000000230000003400000030000000610000003000000066000000660000003e0000003c0000006c000000690000006e0000006b0000003d0000002200000049000000440000005f0000003000000031000000220000003e000000 32 | m_ClosingTagArray: 3c0000002f000000750000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f0000006c000000690000006e0000006b0000003e000000 33 | - m_Name: Title 34 | m_HashCode: 98732960 35 | m_OpeningDefinition: 36 | m_ClosingDefinition: 37 | m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000003200000035000000250000003e0000003c000000620000003e0000003c000000610000006c00000069000000670000006e0000003d00000063000000650000006e0000007400000065000000720000003e000000 38 | m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000610000006c00000069000000670000006e0000003e000000 39 | - m_Name: H2 40 | m_HashCode: 2426 41 | m_OpeningDefinition: <#4080FF> 42 | m_ClosingDefinition: 43 | m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000002e00000035000000650000006d0000003e0000003c000000620000003e0000003c000000230000003400000030000000380000003000000046000000460000003e000000 44 | m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 45 | - m_Name: H3 46 | m_HashCode: 2427 47 | m_OpeningDefinition: <#FF8040> 48 | m_ClosingDefinition: 49 | m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000002e0000003100000037000000650000006d0000003e0000003c000000620000003e0000003c000000230000004600000046000000380000003000000034000000300000003e000000 50 | m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 51 | - m_Name: C1 52 | m_HashCode: 2194 53 | m_OpeningDefinition: 54 | m_ClosingDefinition: 55 | m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000006600000066000000660000006600000034000000300000003e000000 56 | m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e000000 57 | - m_Name: C2 58 | m_HashCode: 2193 59 | m_OpeningDefinition: 60 | m_ClosingDefinition: 61 | m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000006600000066000000340000003000000046000000460000003e0000003c00000073000000690000007a000000650000003d000000310000003200000035000000250000003e000000 62 | m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f00000073000000690000007a000000650000003e000000 63 | - m_Name: C3 64 | m_HashCode: 2192 65 | m_OpeningDefinition: 66 | m_ClosingDefinition: 67 | m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000003800000030000000410000003000000046000000460000003e0000003c000000620000003e000000 68 | m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f000000620000003e000000 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Unity-TextTyper 2 | ========================= 3 | 4 | TextTyper is a text typing effect component for Unity. TextTyper prints out characters one by one to a uGUI Text component. Adapted by RedBlueGames from synchrok's GitHub project (https://github.com/synchrok/TypeText). 5 | 6 | It's easy to find other examples of Text printing components, but TextTyper provides two major differences: 7 | * Correct wrapping as characters are printed 8 | * Support for Rich Text Tags 9 | 10 | **Note this verison of TextTyper requires TextMeshPro, which can be installed for free from the Package Manager in Unity 2018, or the Asset Store in older versions. If you want the version that is compatible with Unity's uGUI Text component, [this branch](https://github.com/redbluegames/unity-text-typer/tree/ugui-text-typer) or download [this release](https://github.com/redbluegames/unity-text-typer/releases/tag/v1.2).** 11 | 12 | How To Use 13 | -------- 14 | To start TextTyping all you need to do is add the `TextTyper` component to a unity Text widget: 15 | 16 | 1. Create a GameObject with a Unity UI Text Widget, as normal. 17 | 2. Add a TextTyper component to the GameObject. 18 | 3. Call the TextTyper component's public functions ```TypeText``` and ```Skip``` to print the desired text with the specified delay. We call these from a 3rd component we call `Talker`. 19 | 20 | You can optionally subscribe to the `PrintCompleted` and `CharacterPrinted` [UnityEvents](https://docs.unity3d.com/ScriptReference/Events.UnityEvent.AddListener.html) to add additional feedback like sounds and paging widgets. 21 | 22 | Features 23 | -------- 24 | - **Define Text Speed Per Character**: ```Mayday! S.O.S.``` 25 | - **Support for uGUI Rich Text Tags**: ```,,,,...``` 26 | - **Additional delay for punctuation** 27 | - **Skip to end** 28 | - **OnComplete Callback** 29 | - **OnCharacterPrinted Callback (for audio)** 30 | 31 | Changelog on UPM branch 32 | -------- 33 | 34 | ### 3.1.0 35 | - Re-implement commits from upstream 36 | - Implement pools to reduce GC calls 37 | - `RedBlueGames.TextTyper.Examples.dll` is now excluded from the build by default 38 | - To include it in the build, just add `ENABLE_TEXTTYPER_EXAMPLES` into `Project Settings > Player > Scripting Define Symbols` 39 | 40 | ### 3.0.0 41 | - Re-implmenet commits from upstream 42 | - Fix an issue that prevents speed typer to work correctly when PrintAmount is greater than the text length 43 | 44 | ### 2.3.0 45 | - Add `PrintAmount` to the config to support printing any number of characters each time. 46 | 47 | ### 2.2.0 48 | - The fields named `PunctuationCharacters` inside `TextTyper` and `TextTyperConfig` have been renamed to `Punctuations`. Their type has been changed to `List` 49 | - `TextSymbol` class has been moved out of `TextTagParser` 50 | - The constructors of `TextSymbol` has been changed into `Initialize(...)` methods 51 | - `TextTagParser` is now a static class 52 | - The signature of `TextTagParser.CreateSymbolListFromText(...)` has been changed. It now requires a `List` parameter to reduce allocation 53 | - `TextTagParser` now uses a pool of `TextSymbol` to reduce allocation 54 | - Add `Pause()` and `Resume(...)` methods to `TextTyper` 55 | 56 | ### 2.1.3 57 | - Add `TextTyperConfig` field to `TextTyper` to allow overriding default settings: `PrintDelay`, `PunctuationDelayMultiplier`, `PunctuationCharacters` 58 | - `TextTyper.TypeText(...)` can now receive an instance of `TextTyperConfig` as an alternated config. It's only valid until the next invocation of `TypeText(...)` 59 | 60 | ### 2.1.2 61 | - `TextTyper` now requires `TMP_Text` instead of `TextMeshProUGUI` 62 | 63 | Screenshots 64 | -------- 65 | ![TypeText Screenshot GIF](https://github.com/redbluegames/unity-text-typer/blob/master/README-Images/ss_chat_watermarked.gif) 66 | Image of TextTyper in Sparklite (© RedBlueGames 2016) 67 | 68 | The Code 69 | -------- 70 | The core of our text typer is a coroutine that’s triggered via the TypeText method. The coroutine has the following steps: 71 | Check next character to see if it’s the start of a Rich Text tag 72 | - If It’s a tag, parse it and apply it. Right now “applying” a tag just means modifying the print delay, but other tags could be added. Add it to a list of tags that need to be closed (because we have not yet reached the corresponding closing tag in our string). Move to next character and repeat 73 | - If it’s not a tag, print it 74 | - Wait for the print delay 75 | - Check if we are complete 76 | 77 | The tool also uses RichTextTag.cs, a class that’s used to help with parsing. 78 | There are a few details I left out, but this should give you enough to start reading through the code if you want to know more. 79 | 80 | How to Help 81 | ------- 82 | The easiest way to help with the project is to just to use it! As you use it, you can submit bugs and feature requests through GitHub issues. 83 | 84 | Contributors 85 | ------- 86 | **Issue Resporters** 87 | - JonathanGorr 88 | 89 | License and Credits 90 | ------- 91 | - **TypeText** is under MIT license. See the [LICENSE](LICENSE) file for more info. 92 | - Typing sound effect (UITextDisplay.wav) provided by @kevinrmabie. Free for others to use, no attribution necessary. 93 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 3 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 0 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | BlackBerry: 2 168 | FlashPlayer: 3 169 | GLES Emulation: 3 170 | PS3: 3 171 | PS4: 3 172 | PSM: 3 173 | PSP2: 3 174 | Samsung TV: 2 175 | Standalone: 3 176 | Tizen: 2 177 | WP8: 3 178 | Web: 3 179 | Windows Store Apps: 3 180 | XBOX360: 3 181 | XboxOne: 3 182 | iPhone: 2 183 | -------------------------------------------------------------------------------- /Assets/TextTyper/Examples/TextTyperTester.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using UnityEngine; 4 | using System.Collections.Generic; 5 | using UnityEngine.UI; 6 | 7 | /// 8 | /// Class that tests TextTyper and shows how to interface with it. 9 | /// 10 | public class TextTyperTester : MonoBehaviour 11 | { 12 | [SerializeField] 13 | private AudioClip printSoundEffect = null; 14 | 15 | [Header("UI References")] 16 | 17 | [SerializeField] 18 | private Button printNextButton = null; 19 | 20 | [SerializeField] 21 | private Button printNoSkipButton = null; 22 | 23 | private readonly Queue dialogueLines = new Queue(); 24 | 25 | [SerializeField] 26 | [Tooltip("The text typer element to test typing with")] 27 | private TextTyper testTextTyper = null; 28 | 29 | [SerializeField] 30 | private TextTyperConfig speedTyperConfig = null; 31 | 32 | private bool canSpeedUp; 33 | 34 | public void Start() 35 | { 36 | this.testTextTyper.PrintCompleted.AddListener(this.HandlePrintCompleted); 37 | this.testTextTyper.CharacterPrinted.AddListener(this.HandleCharacterPrinted); 38 | 39 | this.printNextButton.onClick.AddListener(this.HandlePrintNextClicked); 40 | this.printNoSkipButton.onClick.AddListener(this.HandlePrintNoSkipClicked); 41 | 42 | this.dialogueLines.Enqueue("Hello! My name is... NPC. Got it, bub?"); 43 | this.dialogueLines.Enqueue("You can use uGUI text tag and color tag like this."); 44 | this.dialogueLines.Enqueue("..."); 45 | this.dialogueLines.Enqueue("bold text test bold text test"); 46 | this.dialogueLines.Enqueue("Sprites!Isn't that neat?"); 47 | this.dialogueLines.Enqueue("You can size 40 and size 20"); 48 | this.dialogueLines.Enqueue("You can color tag like this."); 49 | this.dialogueLines.Enqueue("Sample Shake Animations: Light Rotation, Light Position, Full Shake\nSample Curve Animations: Slow Sine, Bounce Bounce, Crazy Flip"); 50 | 51 | ShowScript(); 52 | } 53 | 54 | public void Update() 55 | { 56 | if (Input.GetKeyDown(KeyCode.Space)) 57 | { 58 | var tag = RichTextTag.ParseNext("blahbooblue"); 67 | LogTag(tag); 68 | } 69 | 70 | if (Input.GetKey(KeyCode.LeftControl)) 71 | { 72 | SpeedUp(); 73 | } 74 | else 75 | { 76 | StopSpeedUp(); 77 | } 78 | } 79 | 80 | private void HandlePrintNextClicked() 81 | { 82 | if (this.testTextTyper.IsSkippable() && this.testTextTyper.IsTyping) 83 | { 84 | this.testTextTyper.Skip(); 85 | } 86 | else 87 | { 88 | ShowScript(); 89 | } 90 | } 91 | 92 | private void HandlePrintNoSkipClicked() 93 | { 94 | ShowScript(); 95 | } 96 | 97 | private void SpeedUp() 98 | { 99 | if (this.canSpeedUp) 100 | return; 101 | 102 | if (this.testTextTyper.IsTyping) 103 | { 104 | this.testTextTyper.Pause(); 105 | this.testTextTyper.Resume(this.speedTyperConfig); 106 | } 107 | else 108 | { 109 | ShowScript(this.speedTyperConfig); 110 | } 111 | 112 | this.canSpeedUp = true; 113 | } 114 | 115 | private void StopSpeedUp() 116 | { 117 | if (!this.canSpeedUp) 118 | return; 119 | 120 | if (this.testTextTyper.IsTyping) 121 | { 122 | this.testTextTyper.Pause(); 123 | this.testTextTyper.Resume(); 124 | } 125 | 126 | this.canSpeedUp = false; 127 | } 128 | 129 | private void ShowScript(TextTyperConfig config = null) 130 | { 131 | if (this.dialogueLines.Count <= 0) 132 | { 133 | return; 134 | } 135 | 136 | this.testTextTyper.TypeText(this.dialogueLines.Dequeue(), config); 137 | } 138 | 139 | private void LogTag(RichTextTag tag) 140 | { 141 | if (tag != null) 142 | { 143 | Debug.Log("Tag: " + tag.ToString()); 144 | } 145 | } 146 | 147 | private void HandleCharacterPrinted(string printedCharacter) 148 | { 149 | // Do not play a sound for whitespace 150 | if (printedCharacter == " " || printedCharacter == "\n") 151 | { 152 | return; 153 | } 154 | 155 | var audioSource = this.GetComponent(); 156 | if (audioSource == null) 157 | { 158 | audioSource = this.gameObject.AddComponent(); 159 | } 160 | 161 | audioSource.clip = this.printSoundEffect; 162 | audioSource.Play(); 163 | } 164 | 165 | private void HandlePrintCompleted() 166 | { 167 | this.canSpeedUp = false; 168 | Debug.Log("TypeText Complete"); 169 | } 170 | } 171 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Remove the line below if you want to inherit .editorconfig settings from higher directories 2 | root = true 3 | 4 | # C# files 5 | [*.cs] 6 | 7 | #### Core EditorConfig Options #### 8 | 9 | # Indentation and spacing 10 | indent_size = 4 11 | indent_style = space 12 | 13 | # New line preferences 14 | end_of_line = lf 15 | insert_final_newline = false 16 | 17 | #### .NET Coding Conventions #### 18 | 19 | # this. and Me. preferences 20 | dotnet_style_qualification_for_event = true:suggestion 21 | dotnet_style_qualification_for_field = true:suggestion 22 | dotnet_style_qualification_for_method = false:silent 23 | dotnet_style_qualification_for_property = true:suggestion 24 | 25 | # Language keywords vs BCL types preferences 26 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 27 | dotnet_style_predefined_type_for_member_access = true:suggestion 28 | 29 | # Parentheses preferences 30 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent 31 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent 32 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent 33 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent 34 | 35 | # Modifier preferences 36 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion 37 | 38 | # Expression-level preferences 39 | csharp_style_deconstructed_variable_declaration = true:suggestion 40 | csharp_style_inlined_variable_declaration = true:suggestion 41 | csharp_style_throw_expression = true:suggestion 42 | csharp_prefer_simple_default_expression = true:suggestion 43 | dotnet_style_coalesce_expression = true:suggestion 44 | dotnet_style_collection_initializer = true:suggestion 45 | dotnet_style_explicit_tuple_names = true:suggestion 46 | dotnet_style_null_propagation = true:suggestion 47 | dotnet_style_object_initializer = true:suggestion 48 | dotnet_style_prefer_auto_properties = true:silent 49 | dotnet_style_prefer_compound_assignment = true:suggestion 50 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent 51 | dotnet_style_prefer_conditional_expression_over_return = true:silent 52 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 53 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 54 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion 55 | 56 | # Field preferences 57 | dotnet_style_readonly_field = true:suggestion 58 | 59 | # Parameter preferences 60 | dotnet_code_quality_unused_parameters = all:suggestion 61 | 62 | #### C# Coding Conventions #### 63 | 64 | # var preferences 65 | csharp_style_var_elsewhere = false:silent 66 | csharp_style_var_for_built_in_types = true:suggestion 67 | csharp_style_var_when_type_is_apparent = true:suggestion 68 | 69 | # Expression-bodied members 70 | csharp_style_expression_bodied_accessors = true:silent 71 | csharp_style_expression_bodied_constructors = false:silent 72 | csharp_style_expression_bodied_indexers = true:silent 73 | csharp_style_expression_bodied_lambdas = true:silent 74 | csharp_style_expression_bodied_local_functions = false:silent 75 | csharp_style_expression_bodied_methods = false:silent 76 | csharp_style_expression_bodied_operators = false:silent 77 | csharp_style_expression_bodied_properties = true:silent 78 | 79 | # Pattern matching preferences 80 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 81 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 82 | 83 | # Null-checking preferences 84 | csharp_style_conditional_delegate_call = true:suggestion 85 | 86 | # Modifier preferences 87 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async 88 | 89 | # Code-block preferences 90 | csharp_prefer_braces = true:silent 91 | 92 | # Expression-level preferences 93 | csharp_prefer_simple_default_expression = true:suggestion 94 | csharp_style_pattern_local_over_anonymous_function = true:suggestion 95 | csharp_style_prefer_index_operator = true:suggestion 96 | csharp_style_prefer_range_operator = true:suggestion 97 | csharp_style_unused_value_assignment_preference = discard_variable:suggestion 98 | csharp_style_unused_value_expression_statement_preference = discard_variable:silent 99 | 100 | #### C# Formatting Rules #### 101 | 102 | # New line preferences 103 | csharp_new_line_before_catch = true 104 | csharp_new_line_before_else = true 105 | csharp_new_line_before_finally = true 106 | csharp_new_line_before_members_in_anonymous_types = true 107 | csharp_new_line_before_members_in_object_initializers = true 108 | csharp_new_line_before_open_brace = accessors,anonymous_methods,anonymous_types,control_blocks,methods,properties,types 109 | csharp_new_line_between_query_expression_clauses = true 110 | 111 | # Indentation preferences 112 | csharp_indent_block_contents = true 113 | csharp_indent_braces = false 114 | csharp_indent_case_contents = true 115 | csharp_indent_case_contents_when_block = false 116 | csharp_indent_labels = one_less_than_current 117 | csharp_indent_switch_labels = true 118 | 119 | # Space preferences 120 | csharp_space_after_cast = false 121 | csharp_space_after_colon_in_inheritance_clause = true 122 | csharp_space_after_comma = true 123 | csharp_space_after_dot = false 124 | csharp_space_after_keywords_in_control_flow_statements = true 125 | csharp_space_after_semicolon_in_for_statement = true 126 | csharp_space_around_binary_operators = before_and_after 127 | csharp_space_around_declaration_statements = false 128 | csharp_space_before_colon_in_inheritance_clause = true 129 | csharp_space_before_comma = false 130 | csharp_space_before_dot = false 131 | csharp_space_before_open_square_brackets = false 132 | csharp_space_before_semicolon_in_for_statement = false 133 | csharp_space_between_empty_square_brackets = false 134 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 135 | csharp_space_between_method_call_name_and_opening_parenthesis = false 136 | csharp_space_between_method_call_parameter_list_parentheses = false 137 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 138 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 139 | csharp_space_between_method_declaration_parameter_list_parentheses = false 140 | csharp_space_between_parentheses = false 141 | csharp_space_between_square_brackets = false 142 | 143 | # Wrapping preferences 144 | csharp_preserve_single_line_blocks = true 145 | csharp_preserve_single_line_statements = true 146 | 147 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left cmd 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader: -------------------------------------------------------------------------------- 1 | // Simplified SDF shader: 2 | // - No Shading Option (bevel / bump / env map) 3 | // - No Glow Option 4 | // - Softness is applied on both side of the outline 5 | 6 | Shader "TextMeshPro/Mobile/Distance Field Overlay" { 7 | 8 | Properties { 9 | _FaceColor ("Face Color", Color) = (1,1,1,1) 10 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 11 | 12 | _OutlineColor ("Outline Color", Color) = (0,0,0,1) 13 | _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 14 | _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 15 | 16 | _UnderlayColor ("Border Color", Color) = (0,0,0,.5) 17 | _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 18 | _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 19 | _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 20 | _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 21 | 22 | _WeightNormal ("Weight Normal", float) = 0 23 | _WeightBold ("Weight Bold", float) = .5 24 | 25 | _ShaderFlags ("Flags", float) = 0 26 | _ScaleRatioA ("Scale RatioA", float) = 1 27 | _ScaleRatioB ("Scale RatioB", float) = 1 28 | _ScaleRatioC ("Scale RatioC", float) = 1 29 | 30 | _MainTex ("Font Atlas", 2D) = "white" {} 31 | _TextureWidth ("Texture Width", float) = 512 32 | _TextureHeight ("Texture Height", float) = 512 33 | _GradientScale ("Gradient Scale", float) = 5 34 | _ScaleX ("Scale X", float) = 1 35 | _ScaleY ("Scale Y", float) = 1 36 | _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 37 | 38 | _VertexOffsetX ("Vertex OffsetX", float) = 0 39 | _VertexOffsetY ("Vertex OffsetY", float) = 0 40 | 41 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 42 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 43 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 44 | 45 | _StencilComp ("Stencil Comparison", Float) = 8 46 | _Stencil ("Stencil ID", Float) = 0 47 | _StencilOp ("Stencil Operation", Float) = 0 48 | _StencilWriteMask ("Stencil Write Mask", Float) = 255 49 | _StencilReadMask ("Stencil Read Mask", Float) = 255 50 | 51 | _ColorMask ("Color Mask", Float) = 15 52 | } 53 | 54 | SubShader { 55 | Tags 56 | { 57 | "Queue"="Overlay" 58 | "IgnoreProjector"="True" 59 | "RenderType"="Transparent" 60 | } 61 | 62 | 63 | Stencil 64 | { 65 | Ref [_Stencil] 66 | Comp [_StencilComp] 67 | Pass [_StencilOp] 68 | ReadMask [_StencilReadMask] 69 | WriteMask [_StencilWriteMask] 70 | } 71 | 72 | Cull [_CullMode] 73 | ZWrite Off 74 | Lighting Off 75 | Fog { Mode Off } 76 | ZTest Always 77 | Blend One OneMinusSrcAlpha 78 | ColorMask [_ColorMask] 79 | 80 | Pass { 81 | CGPROGRAM 82 | #pragma vertex VertShader 83 | #pragma fragment PixShader 84 | #pragma shader_feature __ OUTLINE_ON 85 | #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER 86 | 87 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 88 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 89 | 90 | #include "UnityCG.cginc" 91 | #include "UnityUI.cginc" 92 | #include "TMPro_Properties.cginc" 93 | 94 | struct vertex_t { 95 | float4 vertex : POSITION; 96 | float3 normal : NORMAL; 97 | fixed4 color : COLOR; 98 | float2 texcoord0 : TEXCOORD0; 99 | float2 texcoord1 : TEXCOORD1; 100 | }; 101 | 102 | struct pixel_t { 103 | float4 vertex : SV_POSITION; 104 | fixed4 faceColor : COLOR; 105 | fixed4 outlineColor : COLOR1; 106 | float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV 107 | half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) 108 | half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) 109 | #if (UNDERLAY_ON | UNDERLAY_INNER) 110 | float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved 111 | half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) 112 | #endif 113 | }; 114 | 115 | 116 | pixel_t VertShader(vertex_t input) 117 | { 118 | float bold = step(input.texcoord1.y, 0); 119 | 120 | float4 vert = input.vertex; 121 | vert.x += _VertexOffsetX; 122 | vert.y += _VertexOffsetY; 123 | float4 vPosition = UnityObjectToClipPos(vert); 124 | 125 | float2 pixelSize = vPosition.w; 126 | pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); 127 | 128 | float scale = rsqrt(dot(pixelSize, pixelSize)); 129 | scale *= abs(input.texcoord1.y) * _GradientScale * 1.5; 130 | if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); 131 | 132 | float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; 133 | weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; 134 | 135 | float layerScale = scale; 136 | 137 | scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); 138 | float bias = (0.5 - weight) * scale - 0.5; 139 | float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; 140 | 141 | float opacity = input.color.a; 142 | #if (UNDERLAY_ON | UNDERLAY_INNER) 143 | opacity = 1.0; 144 | #endif 145 | 146 | fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; 147 | faceColor.rgb *= faceColor.a; 148 | 149 | fixed4 outlineColor = _OutlineColor; 150 | outlineColor.a *= opacity; 151 | outlineColor.rgb *= outlineColor.a; 152 | outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); 153 | 154 | #if (UNDERLAY_ON | UNDERLAY_INNER) 155 | 156 | layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); 157 | float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); 158 | 159 | float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; 160 | float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; 161 | float2 layerOffset = float2(x, y); 162 | #endif 163 | 164 | // Generate UV for the Masking Texture 165 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 166 | float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); 167 | 168 | // Structure for pixel shader 169 | pixel_t output = { 170 | vPosition, 171 | faceColor, 172 | outlineColor, 173 | float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), 174 | half4(scale, bias - outline, bias + outline, bias), 175 | half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), 176 | #if (UNDERLAY_ON | UNDERLAY_INNER) 177 | float4(input.texcoord0 + layerOffset, input.color.a, 0), 178 | half2(layerScale, layerBias), 179 | #endif 180 | }; 181 | 182 | return output; 183 | } 184 | 185 | 186 | // PIXEL SHADER 187 | fixed4 PixShader(pixel_t input) : SV_Target 188 | { 189 | half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; 190 | half4 c = input.faceColor * saturate(d - input.param.w); 191 | 192 | #ifdef OUTLINE_ON 193 | c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); 194 | c *= saturate(d - input.param.y); 195 | #endif 196 | 197 | #if UNDERLAY_ON 198 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 199 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); 200 | #endif 201 | 202 | #if UNDERLAY_INNER 203 | half sd = saturate(d - input.param.z); 204 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 205 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); 206 | #endif 207 | 208 | // Alternative implementation to UnityGet2DClipping with support for softness. 209 | #if UNITY_UI_CLIP_RECT 210 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); 211 | c *= m.x * m.y; 212 | #endif 213 | 214 | #if (UNDERLAY_ON | UNDERLAY_INNER) 215 | c *= input.texcoord1.z; 216 | #endif 217 | 218 | #if UNITY_UI_ALPHACLIP 219 | clip(c.a - 0.001); 220 | #endif 221 | 222 | return c; 223 | } 224 | ENDCG 225 | } 226 | } 227 | 228 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 229 | } 230 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader: -------------------------------------------------------------------------------- 1 | // Simplified SDF shader: 2 | // - No Shading Option (bevel / bump / env map) 3 | // - No Glow Option 4 | // - Softness is applied on both side of the outline 5 | 6 | Shader "TextMeshPro/Mobile/Distance Field" { 7 | 8 | Properties { 9 | _FaceColor ("Face Color", Color) = (1,1,1,1) 10 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 11 | 12 | _OutlineColor ("Outline Color", Color) = (0,0,0,1) 13 | _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 14 | _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 15 | 16 | _UnderlayColor ("Border Color", Color) = (0,0,0,.5) 17 | _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 18 | _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 19 | _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 20 | _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 21 | 22 | _WeightNormal ("Weight Normal", float) = 0 23 | _WeightBold ("Weight Bold", float) = .5 24 | 25 | _ShaderFlags ("Flags", float) = 0 26 | _ScaleRatioA ("Scale RatioA", float) = 1 27 | _ScaleRatioB ("Scale RatioB", float) = 1 28 | _ScaleRatioC ("Scale RatioC", float) = 1 29 | 30 | _MainTex ("Font Atlas", 2D) = "white" {} 31 | _TextureWidth ("Texture Width", float) = 512 32 | _TextureHeight ("Texture Height", float) = 512 33 | _GradientScale ("Gradient Scale", float) = 5 34 | _ScaleX ("Scale X", float) = 1 35 | _ScaleY ("Scale Y", float) = 1 36 | _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 37 | 38 | _VertexOffsetX ("Vertex OffsetX", float) = 0 39 | _VertexOffsetY ("Vertex OffsetY", float) = 0 40 | 41 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 42 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 43 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 44 | 45 | _StencilComp ("Stencil Comparison", Float) = 8 46 | _Stencil ("Stencil ID", Float) = 0 47 | _StencilOp ("Stencil Operation", Float) = 0 48 | _StencilWriteMask ("Stencil Write Mask", Float) = 255 49 | _StencilReadMask ("Stencil Read Mask", Float) = 255 50 | 51 | _ColorMask ("Color Mask", Float) = 15 52 | } 53 | 54 | SubShader { 55 | Tags 56 | { 57 | "Queue"="Transparent" 58 | "IgnoreProjector"="True" 59 | "RenderType"="Transparent" 60 | } 61 | 62 | 63 | Stencil 64 | { 65 | Ref [_Stencil] 66 | Comp [_StencilComp] 67 | Pass [_StencilOp] 68 | ReadMask [_StencilReadMask] 69 | WriteMask [_StencilWriteMask] 70 | } 71 | 72 | Cull [_CullMode] 73 | ZWrite Off 74 | Lighting Off 75 | Fog { Mode Off } 76 | ZTest [unity_GUIZTestMode] 77 | Blend One OneMinusSrcAlpha 78 | ColorMask [_ColorMask] 79 | 80 | Pass { 81 | CGPROGRAM 82 | #pragma vertex VertShader 83 | #pragma fragment PixShader 84 | #pragma shader_feature __ OUTLINE_ON 85 | #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER 86 | 87 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 88 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 89 | 90 | #include "UnityCG.cginc" 91 | #include "UnityUI.cginc" 92 | #include "TMPro_Properties.cginc" 93 | 94 | struct vertex_t { 95 | float4 vertex : POSITION; 96 | float3 normal : NORMAL; 97 | fixed4 color : COLOR; 98 | float2 texcoord0 : TEXCOORD0; 99 | float2 texcoord1 : TEXCOORD1; 100 | }; 101 | 102 | struct pixel_t { 103 | float4 vertex : SV_POSITION; 104 | fixed4 faceColor : COLOR; 105 | fixed4 outlineColor : COLOR1; 106 | float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV 107 | half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) 108 | half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) 109 | #if (UNDERLAY_ON | UNDERLAY_INNER) 110 | float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved 111 | half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) 112 | #endif 113 | }; 114 | 115 | 116 | pixel_t VertShader(vertex_t input) 117 | { 118 | float bold = step(input.texcoord1.y, 0); 119 | 120 | float4 vert = input.vertex; 121 | vert.x += _VertexOffsetX; 122 | vert.y += _VertexOffsetY; 123 | float4 vPosition = UnityObjectToClipPos(vert); 124 | 125 | float2 pixelSize = vPosition.w; 126 | pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); 127 | 128 | float scale = rsqrt(dot(pixelSize, pixelSize)); 129 | scale *= abs(input.texcoord1.y) * _GradientScale * 1.5; 130 | if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); 131 | 132 | float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; 133 | weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; 134 | 135 | float layerScale = scale; 136 | 137 | scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); 138 | float bias = (0.5 - weight) * scale - 0.5; 139 | float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; 140 | 141 | float opacity = input.color.a; 142 | #if (UNDERLAY_ON | UNDERLAY_INNER) 143 | opacity = 1.0; 144 | #endif 145 | 146 | fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; 147 | faceColor.rgb *= faceColor.a; 148 | 149 | fixed4 outlineColor = _OutlineColor; 150 | outlineColor.a *= opacity; 151 | outlineColor.rgb *= outlineColor.a; 152 | outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); 153 | 154 | #if (UNDERLAY_ON | UNDERLAY_INNER) 155 | 156 | layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); 157 | float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); 158 | 159 | float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; 160 | float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; 161 | float2 layerOffset = float2(x, y); 162 | #endif 163 | 164 | // Generate UV for the Masking Texture 165 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 166 | float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); 167 | 168 | // Structure for pixel shader 169 | pixel_t output = { 170 | vPosition, 171 | faceColor, 172 | outlineColor, 173 | float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), 174 | half4(scale, bias - outline, bias + outline, bias), 175 | half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), 176 | #if (UNDERLAY_ON | UNDERLAY_INNER) 177 | float4(input.texcoord0 + layerOffset, input.color.a, 0), 178 | half2(layerScale, layerBias), 179 | #endif 180 | }; 181 | 182 | return output; 183 | } 184 | 185 | 186 | // PIXEL SHADER 187 | fixed4 PixShader(pixel_t input) : SV_Target 188 | { 189 | half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; 190 | half4 c = input.faceColor * saturate(d - input.param.w); 191 | 192 | #ifdef OUTLINE_ON 193 | c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); 194 | c *= saturate(d - input.param.y); 195 | #endif 196 | 197 | #if UNDERLAY_ON 198 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 199 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); 200 | #endif 201 | 202 | #if UNDERLAY_INNER 203 | half sd = saturate(d - input.param.z); 204 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 205 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); 206 | #endif 207 | 208 | // Alternative implementation to UnityGet2DClipping with support for softness. 209 | #if UNITY_UI_CLIP_RECT 210 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); 211 | c *= m.x * m.y; 212 | #endif 213 | 214 | #if (UNDERLAY_ON | UNDERLAY_INNER) 215 | c *= input.texcoord1.z; 216 | #endif 217 | 218 | #if UNITY_UI_ALPHACLIP 219 | clip(c.a - 0.001); 220 | #endif 221 | 222 | return c; 223 | } 224 | ENDCG 225 | } 226 | } 227 | 228 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 229 | } 230 | -------------------------------------------------------------------------------- /Assets/TextTyper/RichTextTag.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | /// 4 | /// RichTextTags help parse text that contains HTML style tags, used by Unity's RichText text components. 5 | /// 6 | public class RichTextTag 7 | { 8 | public static readonly RichTextTag ClearColorTag = new RichTextTag(""); 9 | 10 | private const char OpeningNodeDelimeter = '<'; 11 | private const char CloseNodeDelimeter = '>'; 12 | private const char EndTagDelimeter = '/'; 13 | private const char ParameterDelimeter = '='; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// Tag text. 19 | public RichTextTag(string tagText) 20 | { 21 | this.TagText = tagText; 22 | } 23 | 24 | /// 25 | /// Gets the full tag text including markers. 26 | /// 27 | /// The tag full text. 28 | public string TagText { get; private set; } 29 | 30 | /// 31 | /// Gets the text for this tag if it's used as a closing tag. Closing tags are unchanged. 32 | /// 33 | /// The closing tag text. 34 | public string ClosingTagText 35 | { 36 | get 37 | { 38 | return this.IsClosingTag ? this.TagText : string.Format("", this.TagType); 39 | } 40 | } 41 | 42 | /// 43 | /// Gets the TagType, the body of the tag as a string 44 | /// 45 | /// The type of the tag. 46 | public string TagType 47 | { 48 | get 49 | { 50 | // Strip start and end tags 51 | var tagType = this.TagText.Substring(1, this.TagText.Length - 2); 52 | tagType = tagType.TrimStart(EndTagDelimeter); 53 | 54 | // Strip Parameter 55 | var tagEndDelimeters = new char[] { ' ', ParameterDelimeter }; 56 | var delimeterIndex = tagType.IndexOfAny(tagEndDelimeters); 57 | var tagEndIndex = delimeterIndex > 0 ? delimeterIndex : tagType.Length; 58 | tagType = tagType.Substring(0, tagEndIndex); 59 | 60 | return tagType; 61 | } 62 | } 63 | 64 | /// 65 | /// Gets the parameter as a string. Ex: For tag Color=#FF00FFFF the parameter would be #FF00FFFF. 66 | /// 67 | /// The parameter. 68 | public string Parameter 69 | { 70 | get 71 | { 72 | var parameterDelimeterIndex = this.TagText.IndexOf(ParameterDelimeter); 73 | if (parameterDelimeterIndex < 0) 74 | { 75 | return string.Empty; 76 | } 77 | 78 | // Subtract two, one for the delimeter and one for the closing character 79 | var parameterLength = this.TagText.Length - parameterDelimeterIndex - 2; 80 | var parameter = this.TagText.Substring(parameterDelimeterIndex + 1, parameterLength); 81 | 82 | // Kill optional enclosing quotes 83 | if (parameter.Length > 0) 84 | { 85 | if (parameter[0] == '\"' && parameter[parameter.Length - 1] == '\"') 86 | { 87 | parameter = parameter.Substring(1, parameter.Length - 2); 88 | } 89 | } 90 | 91 | return parameter; 92 | } 93 | } 94 | 95 | /// 96 | /// Gets a value indicating whether this instance is an opening tag. 97 | /// 98 | /// true if this instance is an opening tag; otherwise, false. 99 | public bool IsOpeningTag 100 | { 101 | get 102 | { 103 | return !this.IsClosingTag; 104 | } 105 | } 106 | 107 | /// 108 | /// Gets a value indicating whether this instance is a closing tag. 109 | /// 110 | /// true if this instance is a closing tag; otherwise, false. 111 | public bool IsClosingTag 112 | { 113 | get 114 | { 115 | return this.TagText.Length > 2 && this.TagText[1] == EndTagDelimeter; 116 | } 117 | } 118 | 119 | /// 120 | /// Gets the length of the tag. Shorcut for the length of the full TagText. 121 | /// 122 | /// The text length. 123 | public int Length 124 | { 125 | get 126 | { 127 | return this.TagText.Length; 128 | } 129 | } 130 | 131 | /// 132 | /// Checks if the specified String starts with a tag. 133 | /// 134 | /// true, if the first character begins a tag false otherwise. 135 | /// Text to check for tags. 136 | public static bool StringStartsWithTag(string text) 137 | { 138 | return text.StartsWith(RichTextTag.OpeningNodeDelimeter.ToString()); 139 | } 140 | 141 | /// 142 | /// Parses the text for the next RichTextTag. 143 | /// 144 | /// The next RichTextTag in the sequence. Null if the sequence contains no RichTextTag 145 | /// Text to parse. 146 | public static RichTextTag ParseNext(string text) 147 | { 148 | // Trim up to the first delimeter 149 | var openingDelimeterIndex = text.IndexOf(RichTextTag.OpeningNodeDelimeter); 150 | 151 | // No opening delimeter found. Might want to throw. 152 | if (openingDelimeterIndex < 0) 153 | { 154 | return null; 155 | } 156 | 157 | var closingDelimeterIndex = text.IndexOf(RichTextTag.CloseNodeDelimeter); 158 | 159 | // No closingDelimeter found. Might want to throw. 160 | if (closingDelimeterIndex < 0) 161 | { 162 | return null; 163 | } 164 | 165 | var tagText = text.Substring(openingDelimeterIndex, closingDelimeterIndex - openingDelimeterIndex + 1); 166 | return new RichTextTag(tagText); 167 | } 168 | 169 | /// 170 | /// Removes all copies of the tag of the specified type from the text string. 171 | /// 172 | /// The text string without any tag of the specified type. 173 | /// Text to remove Tags from. 174 | /// Tag type to remove. 175 | public static string RemoveTagsFromString(string text, string tagType) 176 | { 177 | var bodyWithoutTags = text; 178 | for (int i = 0; i < text.Length; ++i) 179 | { 180 | var remainingText = text.Substring(i, text.Length - i); 181 | if (StringStartsWithTag(remainingText)) 182 | { 183 | var parsedTag = ParseNext(remainingText); 184 | if (parsedTag.TagType == tagType) 185 | { 186 | bodyWithoutTags = bodyWithoutTags.Replace(parsedTag.TagText, string.Empty); 187 | } 188 | 189 | i += parsedTag.Length - 1; 190 | } 191 | } 192 | 193 | return bodyWithoutTags; 194 | } 195 | 196 | /// 197 | /// Returns a that represents the current . 198 | /// 199 | /// A that represents the current . 200 | public override string ToString() 201 | { 202 | return this.TagText; 203 | } 204 | } 205 | } -------------------------------------------------------------------------------- /Assets/Editor/RBPackageExporter.cs: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | 3 | Copyright (c) 2016 Edward Rowe, RedBlueGames 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | */ 23 | 24 | using System.Collections; 25 | using System.Collections.Generic; 26 | using UnityEditor; 27 | using UnityEngine; 28 | 29 | /// 30 | /// Tool that helps us export RedBlueTools for use in other projects, as well as for the public 31 | /// 32 | public class RBPackageExporter : UnityEditor.EditorWindow 33 | { 34 | private static string companyPath = "Assets/RedBlueGames"; 35 | private static string packageExtension = ".unitypackage"; 36 | private static string testPackageSuffix = "WithTests"; 37 | private List redBlueAssets; 38 | 39 | private bool includeTests; 40 | 41 | [MenuItem("Assets/RBPackage Exporter")] 42 | private static void ExportRBScriptsWithTests() 43 | { 44 | EditorWindow.GetWindow(false, "RBPackage Exporter", true); 45 | } 46 | 47 | private static List GetTestDirectories(string[] directories) 48 | { 49 | var testDirectories = new List(); 50 | foreach (var directory in directories) 51 | { 52 | if (IsDirectoryAChildOfAnyOfThese(directory, testDirectories)) 53 | { 54 | testDirectories.Add(directory); 55 | continue; 56 | } 57 | 58 | if (IsTestDirectory(directory)) 59 | { 60 | testDirectories.Add(directory); 61 | } 62 | } 63 | 64 | return testDirectories; 65 | } 66 | 67 | private static bool IsDirectoryAChildOfAnyOfThese(string path, List possibleParentDirectories) 68 | { 69 | foreach (var possibleParentDirectory in possibleParentDirectories) 70 | { 71 | if (path.Contains(possibleParentDirectory)) 72 | { 73 | return true; 74 | } 75 | } 76 | 77 | return false; 78 | } 79 | 80 | private static bool IsTestDirectory(string path) 81 | { 82 | return System.IO.Path.GetFileName(path) == "Tests"; 83 | } 84 | 85 | private void OnEnable() 86 | { 87 | this.redBlueAssets = new List(); 88 | this.FindAssetsInCompanyFolder(); 89 | } 90 | 91 | private void FindAssetsInCompanyFolder() 92 | { 93 | foreach (var subdirectory in System.IO.Directory.GetDirectories(companyPath)) 94 | { 95 | var splitSubdirectory = subdirectory.Split(System.IO.Path.DirectorySeparatorChar); 96 | string folderName = splitSubdirectory[splitSubdirectory.Length - 1]; 97 | this.redBlueAssets.Add(new RBAsset() 98 | { 99 | AssetName = folderName, 100 | IsSelected = false 101 | }); 102 | } 103 | } 104 | 105 | private void OnGUI() 106 | { 107 | EditorGUILayout.HelpBox( 108 | "This tool Allows quick export of specific RedBlueGames custom assets. It also allows optional export of Tests folders.", 109 | MessageType.None); 110 | EditorGUILayout.LabelField("Asset Packages to export:", EditorStyles.boldLabel); 111 | EditorGUILayout.BeginVertical(); 112 | for (int i = 0; i < this.redBlueAssets.Count; i++) 113 | { 114 | this.redBlueAssets[i].IsSelected = EditorGUILayout.Toggle( 115 | this.redBlueAssets[i].AssetName, 116 | this.redBlueAssets[i].IsSelected); 117 | } 118 | 119 | EditorGUILayout.EndVertical(); 120 | 121 | // Check if any assets are selected. 122 | bool atLeastOnePackageSelected = false; 123 | foreach (var assetPackage in this.redBlueAssets) 124 | { 125 | if (assetPackage.IsSelected) 126 | { 127 | atLeastOnePackageSelected = true; 128 | break; 129 | } 130 | } 131 | 132 | EditorGUILayout.Separator(); 133 | this.includeTests = EditorGUILayout.Toggle("Include Tests", this.includeTests); 134 | 135 | EditorGUI.BeginDisabledGroup(!atLeastOnePackageSelected); 136 | if (GUILayout.Button("Export")) 137 | { 138 | this.ExportAllPackages(this.includeTests); 139 | } 140 | 141 | EditorGUI.EndDisabledGroup(); 142 | 143 | if (!atLeastOnePackageSelected) 144 | { 145 | EditorGUILayout.HelpBox( 146 | "No packages selected to export. Select at least one asset Package.", 147 | MessageType.Warning); 148 | } 149 | } 150 | 151 | private void ExportAllPackages(bool includeTests) 152 | { 153 | foreach (var asset in this.redBlueAssets) 154 | { 155 | if (asset.IsSelected) 156 | { 157 | this.ExportRBScripts(asset, includeTests); 158 | } 159 | } 160 | } 161 | 162 | private void ExportRBScripts(RBAsset assetToExport, bool includeTests) 163 | { 164 | var subDirectories = System.IO.Directory.GetDirectories(companyPath, "*", System.IO.SearchOption.AllDirectories); 165 | var directoriesToExport = new List(subDirectories); 166 | 167 | var testDirectories = GetTestDirectories(subDirectories); 168 | if (!includeTests) 169 | { 170 | foreach (var testDirectory in testDirectories) 171 | { 172 | directoriesToExport.Remove(testDirectory); 173 | } 174 | } 175 | 176 | // Do not export the other packages 177 | foreach (var asset in this.redBlueAssets) 178 | { 179 | if (assetToExport.AssetName != asset.AssetName) 180 | { 181 | string assetPath = companyPath + System.IO.Path.DirectorySeparatorChar + asset.AssetName; 182 | directoriesToExport.Remove(assetPath); 183 | 184 | var subdirectoriesOfAsset = System.IO.Directory.GetDirectories(assetPath, "*", System.IO.SearchOption.AllDirectories); 185 | foreach (var subdirectory in subdirectoriesOfAsset) 186 | { 187 | directoriesToExport.Remove(subdirectory); 188 | } 189 | } 190 | } 191 | 192 | var allAssetPaths = new List(); 193 | foreach (var directory in directoriesToExport) 194 | { 195 | var filesInDirectory = System.IO.Directory.GetFiles(directory); 196 | allAssetPaths.AddRange(filesInDirectory); 197 | } 198 | 199 | if (allAssetPaths.Count == 0) 200 | { 201 | Debug.Log("No assets to export. Will not export asset package: " + assetToExport.AssetName); 202 | return; 203 | } 204 | 205 | string filename = string.Concat(assetToExport.AssetName, includeTests ? testPackageSuffix : string.Empty, packageExtension); 206 | AssetDatabase.ExportPackage( 207 | allAssetPaths.ToArray(), 208 | filename, 209 | ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Interactive); 210 | } 211 | 212 | private class RBAsset 213 | { 214 | public string AssetName { get; set; } 215 | 216 | public bool IsSelected { get; set; } 217 | } 218 | } -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader: -------------------------------------------------------------------------------- 1 | // Simplified SDF shader: 2 | // - No Shading Option (bevel / bump / env map) 3 | // - No Glow Option 4 | // - Softness is applied on both side of the outline 5 | 6 | Shader "TextMeshPro/Mobile/Distance Field - Masking" { 7 | 8 | Properties { 9 | _FaceColor ("Face Color", Color) = (1,1,1,1) 10 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 11 | 12 | _OutlineColor ("Outline Color", Color) = (0,0,0,1) 13 | _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 14 | _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 15 | 16 | _UnderlayColor ("Border Color", Color) = (0,0,0,.5) 17 | _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 18 | _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 19 | _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 20 | _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 21 | 22 | _WeightNormal ("Weight Normal", float) = 0 23 | _WeightBold ("Weight Bold", float) = .5 24 | 25 | _ShaderFlags ("Flags", float) = 0 26 | _ScaleRatioA ("Scale RatioA", float) = 1 27 | _ScaleRatioB ("Scale RatioB", float) = 1 28 | _ScaleRatioC ("Scale RatioC", float) = 1 29 | 30 | _MainTex ("Font Atlas", 2D) = "white" {} 31 | _TextureWidth ("Texture Width", float) = 512 32 | _TextureHeight ("Texture Height", float) = 512 33 | _GradientScale ("Gradient Scale", float) = 5 34 | _ScaleX ("Scale X", float) = 1 35 | _ScaleY ("Scale Y", float) = 1 36 | _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 37 | 38 | _VertexOffsetX ("Vertex OffsetX", float) = 0 39 | _VertexOffsetY ("Vertex OffsetY", float) = 0 40 | 41 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 42 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 43 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 44 | _MaskTex ("Mask Texture", 2D) = "white" {} 45 | _MaskInverse ("Inverse", float) = 0 46 | _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) 47 | _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 48 | _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 49 | 50 | _StencilComp ("Stencil Comparison", Float) = 8 51 | _Stencil ("Stencil ID", Float) = 0 52 | _StencilOp ("Stencil Operation", Float) = 0 53 | _StencilWriteMask ("Stencil Write Mask", Float) = 255 54 | _StencilReadMask ("Stencil Read Mask", Float) = 255 55 | 56 | _ColorMask ("Color Mask", Float) = 15 57 | } 58 | 59 | SubShader { 60 | Tags 61 | { 62 | "Queue"="Transparent" 63 | "IgnoreProjector"="True" 64 | "RenderType"="Transparent" 65 | } 66 | 67 | 68 | Stencil 69 | { 70 | Ref [_Stencil] 71 | Comp [_StencilComp] 72 | Pass [_StencilOp] 73 | ReadMask [_StencilReadMask] 74 | WriteMask [_StencilWriteMask] 75 | } 76 | 77 | Cull [_CullMode] 78 | ZWrite Off 79 | Lighting Off 80 | Fog { Mode Off } 81 | ZTest [unity_GUIZTestMode] 82 | Blend One OneMinusSrcAlpha 83 | ColorMask [_ColorMask] 84 | 85 | Pass { 86 | CGPROGRAM 87 | #pragma vertex VertShader 88 | #pragma fragment PixShader 89 | #pragma shader_feature __ OUTLINE_ON 90 | #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER 91 | 92 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 93 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 94 | 95 | 96 | #include "UnityCG.cginc" 97 | #include "UnityUI.cginc" 98 | #include "TMPro_Properties.cginc" 99 | 100 | struct vertex_t { 101 | float4 vertex : POSITION; 102 | float3 normal : NORMAL; 103 | fixed4 color : COLOR; 104 | float2 texcoord0 : TEXCOORD0; 105 | float2 texcoord1 : TEXCOORD1; 106 | }; 107 | 108 | struct pixel_t { 109 | float4 vertex : SV_POSITION; 110 | fixed4 faceColor : COLOR; 111 | fixed4 outlineColor : COLOR1; 112 | float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV 113 | half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) 114 | half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) 115 | #if (UNDERLAY_ON | UNDERLAY_INNER) 116 | float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved 117 | half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) 118 | #endif 119 | }; 120 | 121 | float _MaskWipeControl; 122 | float _MaskEdgeSoftness; 123 | fixed4 _MaskEdgeColor; 124 | bool _MaskInverse; 125 | 126 | pixel_t VertShader(vertex_t input) 127 | { 128 | float bold = step(input.texcoord1.y, 0); 129 | 130 | float4 vert = input.vertex; 131 | vert.x += _VertexOffsetX; 132 | vert.y += _VertexOffsetY; 133 | float4 vPosition = UnityObjectToClipPos(vert); 134 | 135 | float2 pixelSize = vPosition.w; 136 | pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); 137 | 138 | float scale = rsqrt(dot(pixelSize, pixelSize)); 139 | scale *= abs(input.texcoord1.y) * _GradientScale * 1.5; 140 | if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); 141 | 142 | float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; 143 | weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; 144 | 145 | float layerScale = scale; 146 | 147 | scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); 148 | float bias = (0.5 - weight) * scale - 0.5; 149 | float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; 150 | 151 | float opacity = input.color.a; 152 | #if (UNDERLAY_ON | UNDERLAY_INNER) 153 | opacity = 1.0; 154 | #endif 155 | 156 | fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; 157 | faceColor.rgb *= faceColor.a; 158 | 159 | fixed4 outlineColor = _OutlineColor; 160 | outlineColor.a *= opacity; 161 | outlineColor.rgb *= outlineColor.a; 162 | outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); 163 | 164 | #if (UNDERLAY_ON | UNDERLAY_INNER) 165 | 166 | layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); 167 | float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); 168 | 169 | float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; 170 | float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; 171 | float2 layerOffset = float2(x, y); 172 | #endif 173 | 174 | // Generate UV for the Masking Texture 175 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 176 | float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); 177 | 178 | // Structure for pixel shader 179 | pixel_t output = { 180 | vPosition, 181 | faceColor, 182 | outlineColor, 183 | float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), 184 | half4(scale, bias - outline, bias + outline, bias), 185 | half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), 186 | #if (UNDERLAY_ON | UNDERLAY_INNER) 187 | float4(input.texcoord0 + layerOffset, input.color.a, 0), 188 | half2(layerScale, layerBias), 189 | #endif 190 | }; 191 | 192 | return output; 193 | } 194 | 195 | 196 | // PIXEL SHADER 197 | fixed4 PixShader(pixel_t input) : SV_Target 198 | { 199 | half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; 200 | half4 c = input.faceColor * saturate(d - input.param.w); 201 | 202 | #ifdef OUTLINE_ON 203 | c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); 204 | c *= saturate(d - input.param.y); 205 | #endif 206 | 207 | #if UNDERLAY_ON 208 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 209 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); 210 | #endif 211 | 212 | #if UNDERLAY_INNER 213 | half sd = saturate(d - input.param.z); 214 | d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; 215 | c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); 216 | #endif 217 | 218 | // Alternative implementation to UnityGet2DClipping with support for softness. 219 | #if UNITY_UI_CLIP_RECT 220 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); 221 | c *= m.x * m.y; 222 | #endif 223 | 224 | float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a); 225 | float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl; 226 | a = saturate(t / _MaskEdgeSoftness); 227 | c.rgb = lerp(_MaskEdgeColor.rgb*c.a, c.rgb, a); 228 | c *= a; 229 | 230 | #if (UNDERLAY_ON | UNDERLAY_INNER) 231 | c *= input.texcoord1.z; 232 | #endif 233 | 234 | #if UNITY_UI_ALPHACLIP 235 | clip(c.a - 0.001); 236 | #endif 237 | 238 | return c; 239 | } 240 | ENDCG 241 | } 242 | } 243 | 244 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 245 | } 246 | -------------------------------------------------------------------------------- /Assets/TextTyper/Animation/TextAnimation.cs: -------------------------------------------------------------------------------- 1 | namespace RedBlueGames.Tools.TextTyper 2 | { 3 | using TMPro; 4 | using UnityEngine; 5 | 6 | [RequireComponent(typeof(TextMeshProUGUI))] 7 | public abstract class TextAnimation : MonoBehaviour 8 | { 9 | [Tooltip("0-based index of the first printable character that should be animated")] 10 | [SerializeField] 11 | private int firstCharToAnimate = 0; 12 | 13 | [Tooltip("0-based index of the last printable character that should be animated")] 14 | [SerializeField] 15 | private int lastCharToAnimate = 0; 16 | 17 | [Tooltip("If true, animation will begin playing immediately on Awake")] 18 | [SerializeField] 19 | private bool playOnAwake = false; 20 | 21 | /// 22 | /// Determines how often Animate() will be called 23 | /// 24 | private const float frameRate = 15f; 25 | private static readonly float timeBetweenAnimates = 1f / frameRate; 26 | 27 | private float lastAnimateTime; 28 | private TextMeshProUGUI textComponent; 29 | private TMP_TextInfo textInfo; 30 | private TMP_MeshInfo[] cachedMeshInfo; 31 | 32 | public bool UseUnscaledTime { get; set; } 33 | 34 | protected int FirstCharToAnimate 35 | { 36 | get 37 | { 38 | return this.firstCharToAnimate; 39 | } 40 | } 41 | protected int LastCharToAnimate 42 | { 43 | get 44 | { 45 | return this.lastCharToAnimate; 46 | } 47 | } 48 | 49 | private TextMeshProUGUI TextComponent 50 | { 51 | get 52 | { 53 | if (this.textComponent == null) 54 | { 55 | this.textComponent = this.GetComponent(); 56 | } 57 | 58 | return this.textComponent; 59 | } 60 | } 61 | 62 | protected float TimeForTimeScale 63 | { 64 | get 65 | { 66 | return this.UseUnscaledTime ? Time.realtimeSinceStartup : Time.time; 67 | } 68 | } 69 | 70 | /// 71 | /// Set the range of characters that should be animated by this Component 72 | /// 73 | /// 0-based index of the first printable character that should be animated 74 | /// 0-based index of the last printable character that should be animated 75 | public void SetCharsToAnimate(int firstChar, int lastChar) 76 | { 77 | this.firstCharToAnimate = firstChar; 78 | this.lastCharToAnimate = lastChar; 79 | } 80 | 81 | /// 82 | /// Cache the vertex data of the text object b/c the animation transform is applied to the original position of the characters. 83 | /// 84 | public void CacheTextMeshInfo() 85 | { 86 | this.textInfo = this.TextComponent.textInfo; 87 | this.cachedMeshInfo = this.textInfo.CopyMeshInfoVertexData(); 88 | } 89 | 90 | protected virtual void Awake() 91 | { 92 | this.enabled = this.playOnAwake; 93 | } 94 | 95 | protected virtual void Start() 96 | { 97 | this.TextComponent.ForceMeshUpdate(); 98 | this.lastAnimateTime = float.MinValue; 99 | } 100 | 101 | protected virtual void OnEnable() 102 | { 103 | TMPro_EventManager.TEXT_CHANGED_EVENT.Add(OnTMProChanged); 104 | } 105 | 106 | protected virtual void OnDisable() 107 | { 108 | TMPro_EventManager.TEXT_CHANGED_EVENT.Remove(OnTMProChanged); 109 | 110 | // Reset to baseline/standard text mesh 111 | this.TextComponent.ForceMeshUpdate(); 112 | } 113 | 114 | protected virtual void Update() 115 | { 116 | if (this.TimeForTimeScale > this.lastAnimateTime + timeBetweenAnimates) 117 | { 118 | this.AnimateAllChars(); 119 | } 120 | } 121 | 122 | /// 123 | /// Derived classes must implement how individual characters are animated 124 | /// 125 | /// Index of character being animated 126 | /// X/Y translation vector 127 | /// 2D rotation angle 128 | /// Uniform scale 129 | protected abstract void Animate(int characterIndex, out Vector2 translation, out float rotation, out float scale); 130 | 131 | /// 132 | /// Get the vertices of the TMPro mesh, request translation/rotation/scale info from Animate(), 133 | /// then, transform the vertices and apply them back to the mesh 134 | /// 135 | public void AnimateAllChars() 136 | { 137 | this.lastAnimateTime = this.TimeForTimeScale; 138 | 139 | int characterCount = this.textInfo.characterCount; 140 | 141 | // If no characters do nothing 142 | if (characterCount == 0) 143 | { 144 | return; 145 | } 146 | 147 | for (int i = 0; i < characterCount; i++) 148 | { 149 | // Skip characters that aren't specified to animate 150 | if (i < this.firstCharToAnimate || i > this.lastCharToAnimate) 151 | { 152 | continue; 153 | } 154 | 155 | TMP_CharacterInfo charInfo = textInfo.characterInfo[i]; 156 | 157 | // Skip characters that are not visible and thus have no geometry to manipulate. 158 | if (!charInfo.isVisible) 159 | { 160 | continue; 161 | } 162 | 163 | // Get the index of the material used by the current character. 164 | int materialIndex = charInfo.materialReferenceIndex; 165 | 166 | // Get the index of the first vertex used by this text element. 167 | int vertexIndex = charInfo.vertexIndex; 168 | 169 | // Get the cached vertices of the mesh used by this text element (character or sprite). 170 | Vector3[] sourceVertices = cachedMeshInfo[materialIndex].vertices; 171 | 172 | // NOTE: Alternate calculation - Determine the center point of each character at the baseline. 173 | //Vector2 charMidBasline = new Vector2((sourceVertices[vertexIndex + 0].x + sourceVertices[vertexIndex + 2].x) / 2, charInfo.baseLine); 174 | // Determine the center point of each character. 175 | Vector2 charMidBasline = (sourceVertices[vertexIndex + 0] + sourceVertices[vertexIndex + 2]) / 2; 176 | 177 | // Need to translate all 4 vertices of each quad to align with middle of character / baseline. 178 | // This is needed so the matrix TRS is applied at the origin for each character. 179 | Vector3 offset = charMidBasline; 180 | 181 | Vector3[] destinationVertices = textInfo.meshInfo[materialIndex].vertices; 182 | 183 | // Apply offset from center 184 | destinationVertices[vertexIndex + 0] = sourceVertices[vertexIndex + 0] - offset; 185 | destinationVertices[vertexIndex + 1] = sourceVertices[vertexIndex + 1] - offset; 186 | destinationVertices[vertexIndex + 2] = sourceVertices[vertexIndex + 2] - offset; 187 | destinationVertices[vertexIndex + 3] = sourceVertices[vertexIndex + 3] - offset; 188 | 189 | Vector2 translation; 190 | float rotation, scale; 191 | 192 | // This is where the derived class sets translation/rotation/scale 193 | this.Animate(i, out translation, out rotation, out scale); 194 | Matrix4x4 matrix = Matrix4x4.TRS(translation, Quaternion.Euler(0f, 0f, rotation), scale * Vector3.one); 195 | 196 | // Apply the derived class transformation 197 | destinationVertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(destinationVertices[vertexIndex + 0]); 198 | destinationVertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(destinationVertices[vertexIndex + 1]); 199 | destinationVertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(destinationVertices[vertexIndex + 2]); 200 | destinationVertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(destinationVertices[vertexIndex + 3]); 201 | 202 | // Remove offset from center 203 | destinationVertices[vertexIndex + 0] += offset; 204 | destinationVertices[vertexIndex + 1] += offset; 205 | destinationVertices[vertexIndex + 2] += offset; 206 | destinationVertices[vertexIndex + 3] += offset; 207 | } 208 | 209 | this.ApplyChangesToMesh(); 210 | } 211 | 212 | /// 213 | /// Apply the modified vertices (calculated by Animate) to the mesh 214 | /// 215 | private void ApplyChangesToMesh() 216 | { 217 | for (int i = 0; i < this.textInfo.meshInfo.Length; i++) 218 | { 219 | this.textInfo.meshInfo[i].mesh.vertices = this.textInfo.meshInfo[i].vertices; 220 | this.TextComponent.UpdateGeometry(this.textInfo.meshInfo[i].mesh, i); 221 | } 222 | } 223 | 224 | /// 225 | /// This event is fired whenever the TMPro mesh is updated 226 | /// For example, if the text string changes or MaxVisibleCharacters changes 227 | /// 228 | private void OnTMProChanged(Object obj) 229 | { 230 | if (obj == this.TextComponent) 231 | { 232 | this.CacheTextMeshInfo(); 233 | } 234 | } 235 | } 236 | } --------------------------------------------------------------------------------