├── .gitignore ├── Assets ├── Editor.meta ├── Editor │ ├── LocalizationEditorUserData.asset │ ├── LocalizationEditorUserData.asset.meta │ ├── LocalizationSetting.asset │ └── LocalizationSetting.asset.meta ├── Example.meta ├── Example │ ├── ActorTest.cs │ ├── ActorTest.cs.meta │ ├── Extend.meta │ ├── Extend │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── LocalizationAssets_GameObjectEditor.cs │ │ │ ├── LocalizationAssets_GameObjectEditor.cs.meta │ │ │ ├── LocalizationAssets_SpriteEditor.cs │ │ │ ├── LocalizationAssets_SpriteEditor.cs.meta │ │ │ ├── LocalizationAssets_StringEditor.cs │ │ │ └── LocalizationAssets_StringEditor.cs.meta │ │ ├── LocalizationAssets_GameObject.cs │ │ ├── LocalizationAssets_GameObject.cs.meta │ │ ├── LocalizationAssets_Sprite.cs │ │ ├── LocalizationAssets_Sprite.cs.meta │ │ ├── LocalizationAssets_String.cs │ │ └── LocalizationAssets_String.cs.meta │ ├── LocalizationGame.cs │ ├── LocalizationGame.cs.meta │ ├── New Localization Data.asset │ ├── New Localization Data.asset.meta │ ├── New Localization Data.csv │ ├── New Localization Data.csv.meta │ ├── New Localization Data_bad.csv │ ├── New Localization Data_bad.csv.meta │ ├── New Scene.unity │ ├── New Scene.unity.meta │ ├── a9af3c3abfad1ac740e95a00f577a8a6.jpg │ ├── a9af3c3abfad1ac740e95a00f577a8a6.jpg.meta │ ├── c9f24d0f094dd7c27f326c43df25fcf0.jpg │ ├── c9f24d0f094dd7c27f326c43df25fcf0.jpg.meta │ ├── cn.prefab │ ├── cn.prefab.meta │ ├── en.prefab │ └── en.prefab.meta ├── Exend.meta ├── Exend │ ├── Editor.meta │ ├── Editor │ │ ├── LocalizationTMP_TextEditor.cs │ │ └── LocalizationTMP_TextEditor.cs.meta │ ├── LocalizationTMP_Text.cs │ └── LocalizationTMP_Text.cs.meta ├── Resources.meta ├── Resources │ ├── BillingMode.json │ └── BillingMode.json.meta ├── TextMesh Pro.meta ├── TextMesh Pro │ ├── Documentation.meta │ ├── Documentation │ │ ├── TextMesh Pro User Guide 2016.pdf │ │ └── TextMesh Pro User Guide 2016.pdf.meta │ ├── Fonts.meta │ ├── Fonts │ │ ├── LiberationSans - OFL.txt │ │ ├── LiberationSans - OFL.txt.meta │ │ ├── LiberationSans.ttf │ │ └── LiberationSans.ttf.meta │ ├── Resources.meta │ ├── Resources │ │ ├── Fonts & Materials.meta │ │ ├── Fonts & Materials │ │ │ ├── LiberationSans SDF - Drop Shadow.mat │ │ │ ├── LiberationSans SDF - Drop Shadow.mat.meta │ │ │ ├── LiberationSans SDF - Fallback.asset │ │ │ ├── LiberationSans SDF - Fallback.asset.meta │ │ │ ├── LiberationSans SDF - Outline.mat │ │ │ ├── LiberationSans SDF - Outline.mat.meta │ │ │ ├── LiberationSans SDF.asset │ │ │ └── LiberationSans SDF.asset.meta │ │ ├── LineBreaking Following Characters.txt │ │ ├── LineBreaking Following Characters.txt.meta │ │ ├── LineBreaking Leading Characters.txt │ │ ├── LineBreaking Leading Characters.txt.meta │ │ ├── Sprite Assets.meta │ │ ├── Sprite Assets │ │ │ ├── EmojiOne.asset │ │ │ └── EmojiOne.asset.meta │ │ ├── Style Sheets.meta │ │ ├── Style Sheets │ │ │ ├── Default Style Sheet.asset │ │ │ └── Default Style Sheet.asset.meta │ │ ├── TMP Settings.asset │ │ └── TMP Settings.asset.meta │ ├── Shaders.meta │ ├── Shaders │ │ ├── TMP_Bitmap-Custom-Atlas.shader │ │ ├── TMP_Bitmap-Custom-Atlas.shader.meta │ │ ├── TMP_Bitmap-Mobile.shader │ │ ├── TMP_Bitmap-Mobile.shader.meta │ │ ├── TMP_Bitmap.shader │ │ ├── TMP_Bitmap.shader.meta │ │ ├── TMP_SDF Overlay.shader │ │ ├── TMP_SDF Overlay.shader.meta │ │ ├── TMP_SDF SSD.shader │ │ ├── TMP_SDF SSD.shader.meta │ │ ├── TMP_SDF-Mobile Masking.shader │ │ ├── TMP_SDF-Mobile Masking.shader.meta │ │ ├── TMP_SDF-Mobile Overlay.shader │ │ ├── TMP_SDF-Mobile Overlay.shader.meta │ │ ├── TMP_SDF-Mobile SSD.shader │ │ ├── TMP_SDF-Mobile SSD.shader.meta │ │ ├── TMP_SDF-Mobile.shader │ │ ├── TMP_SDF-Mobile.shader.meta │ │ ├── TMP_SDF-Surface-Mobile.shader │ │ ├── TMP_SDF-Surface-Mobile.shader.meta │ │ ├── TMP_SDF-Surface.shader │ │ ├── TMP_SDF-Surface.shader.meta │ │ ├── TMP_SDF.shader │ │ ├── TMP_SDF.shader.meta │ │ ├── TMP_Sprite.shader │ │ ├── TMP_Sprite.shader.meta │ │ ├── TMPro.cginc │ │ ├── TMPro.cginc.meta │ │ ├── TMPro_Mobile.cginc │ │ ├── TMPro_Mobile.cginc.meta │ │ ├── TMPro_Properties.cginc │ │ ├── TMPro_Properties.cginc.meta │ │ ├── TMPro_Surface.cginc │ │ └── TMPro_Surface.cginc.meta │ ├── Sprites.meta │ └── Sprites │ │ ├── EmojiOne Attribution.txt │ │ ├── EmojiOne Attribution.txt.meta │ │ ├── EmojiOne.json │ │ ├── EmojiOne.json.meta │ │ ├── EmojiOne.png │ │ └── EmojiOne.png.meta ├── WooLocalization.meta └── WooLocalization │ ├── Editor.meta │ ├── Editor │ ├── Actor.meta │ ├── Actor │ │ ├── ILocalizationActorEditor.cs │ │ ├── ILocalizationActorEditor.cs.meta │ │ ├── LocalizationActorEditor.cs │ │ ├── LocalizationActorEditor.cs.meta │ │ ├── LocalizationMapActorEditor.cs │ │ ├── LocalizationMapActorEditor.cs.meta │ │ ├── ObjectActorEditor.cs │ │ ├── ObjectActorEditor.cs.meta │ │ ├── TextValueActor_BaseEditor.cs │ │ └── TextValueActor_BaseEditor.cs.meta │ ├── Component.meta │ ├── Component │ │ ├── LocalizationAssetsEditor.cs │ │ ├── LocalizationAssetsEditor.cs.meta │ │ ├── LocalizationBehaviorEditor.cs │ │ ├── LocalizationBehaviorEditor.cs.meta │ │ ├── LocalizationGraphicEditor.cs │ │ ├── LocalizationGraphicEditor.cs.meta │ │ ├── LocalizationImageEditor.cs │ │ ├── LocalizationImageEditor.cs.meta │ │ ├── LocalizationPrefabEditor.cs │ │ ├── LocalizationPrefabEditor.cs.meta │ │ ├── LocalizationTextEditor.cs │ │ └── LocalizationTextEditor.cs.meta │ ├── LocalizationActorEditorAttribute.cs │ ├── LocalizationActorEditorAttribute.cs.meta │ ├── LocalizationDataEditor.cs │ ├── LocalizationDataEditor.cs.meta │ ├── LocalizationEditor.cs │ ├── LocalizationEditor.cs.meta │ ├── LocalizationEditorHelper.cs │ ├── LocalizationEditorHelper.cs.meta │ ├── LocalizationEditorUserData.cs │ ├── LocalizationEditorUserData.cs.meta │ ├── LocalizationSetting.cs │ ├── LocalizationSetting.cs.meta │ ├── LocalizationWindow.cs │ ├── LocalizationWindow.cs.meta │ ├── WooLocalization.Editor.asmdef │ └── WooLocalization.Editor.asmdef.meta │ ├── Package Resources.meta │ ├── Package Resources │ ├── LocalizationTmp Extend.unitypackage │ └── LocalizationTmp Extend.unitypackage.meta │ ├── Runtime.meta │ ├── Runtime │ ├── Actor.meta │ ├── Actor │ │ ├── ILocalizationActor.cs │ │ ├── ILocalizationActor.cs.meta │ │ ├── IMapActorContext.cs │ │ ├── IMapActorContext.cs.meta │ │ ├── LocalizationActor.cs │ │ ├── LocalizationActor.cs.meta │ │ ├── LocalizationMapActor.cs │ │ ├── LocalizationMapActor.cs.meta │ │ ├── ObjectActor.cs │ │ ├── ObjectActor.cs.meta │ │ ├── TextValueActor_Base.cs │ │ └── TextValueActor_Base.cs.meta │ ├── Component.meta │ ├── Component │ │ ├── LocalizationAssets.cs │ │ ├── LocalizationAssets.cs.meta │ │ ├── LocalizationBehavior.cs │ │ ├── LocalizationBehavior.cs.meta │ │ ├── LocalizationGraphic.cs │ │ ├── LocalizationGraphic.cs.meta │ │ ├── LocalizationImage.cs │ │ ├── LocalizationImage.cs.meta │ │ ├── LocalizationPrefab.cs │ │ ├── LocalizationPrefab.cs.meta │ │ ├── LocalizationText.cs │ │ └── LocalizationText.cs.meta │ ├── ILocalizationContext.cs │ ├── ILocalizationContext.cs.meta │ ├── ILocalizationPrefRecorder.cs │ ├── ILocalizationPrefRecorder.cs.meta │ ├── Localization.cs │ ├── Localization.cs.meta │ ├── LocalizationData.cs │ ├── LocalizationData.cs.meta │ ├── LocalizationPref.cs │ ├── LocalizationPref.cs.meta │ ├── MixedRecorder.cs │ ├── MixedRecorder.cs.meta │ ├── SerializableDictionary.cs │ ├── SerializableDictionary.cs.meta │ ├── WooLocalization.asmdef │ └── WooLocalization.asmdef.meta │ ├── package.json │ └── package.json.meta ├── Packages ├── manifest.json └── packages-lock.json ├── README.md └── 制作src分支.bat /.gitignore: -------------------------------------------------------------------------------- 1 | *.csproj 2 | .vsconfig 3 | .vs 4 | Library/ 5 | .idea/ 6 | Logs/ 7 | obj/ 8 | Temp/ 9 | UserSettings/ 10 | *.sln 11 | ProjectSettings/ -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ba35e7e6c4ce214fb116e0f06d73117 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor/LocalizationEditorUserData.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: d1829bde1a3a029478e7a02a5ce5656a, type: 3} 13 | m_Name: LocalizationEditorUserData 14 | m_EditorClassIdentifier: 15 | _lastCSVPath: E:\Project\Unity\WooLocalization\Assets\Example 16 | _lastLocalizationDataPath: Assets 17 | -------------------------------------------------------------------------------- /Assets/Editor/LocalizationEditorUserData.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09cafbd4b1bdeb4429b1fa245fedca53 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor/LocalizationSetting.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: 02facdc7cf6749f47959bc9e742e80d8, type: 3} 13 | m_Name: LocalizationSetting 14 | m_EditorClassIdentifier: 15 | _localizationType: en 16 | _defaultData: Assets/Example/New Localization Data.asset 17 | _lineReg: '"' 18 | _fieldReg: \G(?:^|,)(?:"((?>[^"]*)(?>""[^"]*)*)"|([^",]*)) 19 | _quotesReg: '""' 20 | _youDaoAppId: 21 | _youDaoAppSecret: 22 | reflect: 23 | list: [] 24 | -------------------------------------------------------------------------------- /Assets/Editor/LocalizationSetting.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ccd12ae90dc23f4e91d78ef4b75c306 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 851d893850e230e468a7f3890026007a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example/ActorTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using WooLocalization; 5 | 6 | [UnityEditor.CustomEditor(typeof(ActorTest))] 7 | public class ActorTestEditor : WooLocalization.LocalizationBehaviorEditor 8 | { 9 | 10 | } 11 | [Flags] 12 | public enum FlagEnum 13 | { 14 | A = 2, B = 4, C = 8, D = 16 15 | } 16 | public enum TestEnum 17 | { 18 | A, B, C, D 19 | } 20 | public class ActorTest : WooLocalization.LocalizationBehavior 21 | { 22 | protected override List GetActors() 23 | { 24 | return new List() { 25 | _enum, _enum_flag, _string_private, _string,_go,_int,_float,_bool,_double,_long,_color,_v3,_v2,_v4,_v2i,_v3i,_rect,_recti,_bounds,_curve 26 | }; 27 | } 28 | private ObjectActor _string_private = new ObjectActor(true); 29 | public ObjectActor _enum_flag = new ObjectActor(true); 30 | 31 | 32 | public ObjectActor _enum = new ObjectActor(true); 33 | 34 | public ObjectActor _string = new ObjectActor(true); 35 | public ObjectActor _go = new ObjectActor(true); 36 | public ObjectActor _int = new ObjectActor(true); 37 | public ObjectActor _float = new ObjectActor(true); 38 | public ObjectActor _bool = new ObjectActor(true); 39 | public ObjectActor _double = new ObjectActor(true); 40 | public ObjectActor _long = new ObjectActor(true); 41 | public ObjectActor _color = new ObjectActor(true); 42 | public ObjectActor _v3 = new ObjectActor(true); 43 | public ObjectActor _v2 = new ObjectActor(true); 44 | public ObjectActor _v4 = new ObjectActor(true); 45 | public ObjectActor _v2i = new ObjectActor(true); 46 | public ObjectActor _v3i = new ObjectActor(true); 47 | public ObjectActor _rect = new ObjectActor(true); 48 | public ObjectActor _recti = new ObjectActor(true); 49 | public ObjectActor _bounds = new ObjectActor(true); 50 | public ObjectActor _curve = new ObjectActor(true); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Assets/Example/ActorTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9804e3d3023ba8742ac770377eb06849 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c20dc233d9d5314a811d7eeecc29980 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb6e9fe030dba05489ada91b8c2f683d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_GameObjectEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | [CustomEditor(typeof(LocalizationAssets_GameObject))] 13 | class LocalizationAssets_GameObjectEditor : LocalizationAssetsEditor 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_GameObjectEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9990b88005daec84285128077d3c6fb9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_SpriteEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | [CustomEditor(typeof(LocalizationAssets_Sprite))] 13 | class LocalizationAssets_SpriteEditor : LocalizationAssetsEditor 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_SpriteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c639f549622fba144977f3d19d0622d1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_StringEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | 9 | namespace WooLocalization 10 | { 11 | [CustomEditor(typeof(LocalizationAssets_String))] 12 | class LocalizationAssets_StringEditor : LocalizationAssetsEditor 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/Example/Extend/Editor/LocalizationAssets_StringEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d871db48e069f94482dd3a7cd6c69b7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_GameObject.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using UnityEngine; 9 | namespace WooLocalization 10 | { 11 | [UnityEngine.DisallowMultipleComponent] 12 | public class LocalizationAssets_GameObject : LocalizationAssets 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_GameObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80c2348fc5f16d14d80d55dfe72e0f26 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_Sprite.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | namespace WooLocalization 9 | { 10 | [UnityEngine.DisallowMultipleComponent] 11 | public class LocalizationAssets_Sprite : LocalizationAssets 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_Sprite.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15040f2d1428a734d95ca4cb77d169d5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_String.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | namespace WooLocalization 9 | { 10 | [UnityEngine.DisallowMultipleComponent] 11 | public class LocalizationAssets_String : LocalizationAssets 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/Example/Extend/LocalizationAssets_String.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1eec510d8455f6b4fa743a8154d174da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/LocalizationGame.cs: -------------------------------------------------------------------------------- 1 | using WooLocalization; 2 | using UnityEngine; 3 | 4 | public class LocalizationGame : MonoBehaviour, ILocalizationPrefRecorder 5 | { 6 | 7 | public TMPro.TextMeshProUGUI text; 8 | [ContextMenu("HH")] 9 | public void GG() 10 | { 11 | text.gameObject.AddComponent(); 12 | } 13 | 14 | public LocalizationData data; 15 | private void Start() 16 | { 17 | Localization.SetContext(data); 18 | Localization.SetRecorder(this); 19 | } 20 | 21 | private void OnGUI() 22 | { 23 | var types = Localization.GetLocalizationTypes(); 24 | var type = Localization.localizationType; 25 | var index = GUILayout.Toolbar(Mathf.Max(types.IndexOf(type), 0), types.ToArray(), new GUIStyle(GUI.skin.button) { fontSize = 40 }, GUILayout.Height(100), GUILayout.Width(300)); 26 | Localization.SetLocalizationType(types[index]); 27 | } 28 | 29 | LocalizationPref ILocalizationPrefRecorder.Read() 30 | { 31 | Debug.Log("Read"); 32 | 33 | return null; 34 | } 35 | 36 | void ILocalizationPrefRecorder.Write(LocalizationPref pref) 37 | { 38 | Debug.Log("Write"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Assets/Example/LocalizationGame.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 981cca6b95ac6d547a55a29ba8844528 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Example/New Localization Data.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: 6632ecebdeabf2a43a189d064c61ee43, type: 3} 13 | m_Name: New Localization Data 14 | m_EditorClassIdentifier: 15 | map: 16 | list: 17 | - Key: zh-Hans 18 | Value: 19 | list: 20 | - Key: Load_GameTip 21 | Value: "\u300A\u5065\u5EB7\u6E38\u620F\u5FE0\u544A\u300B\r\n\u62B5\u5236\u4E0D\u826F\u6E38\u620F\uFF0C\u62D2\u7EDD\u76D7\u7248\u6E38\u620F\u3002\r\n\u6CE8\u610F\u81EA\u6211\u4FDD\u62A4\uFF0C\u8C28\u9632\u53D7\u9A97\u4E0A\u5F53\u3002\r\n\u9002\u5EA6\u6E38\u620F\u76CA\u8111\uFF0C\u6C89\u8FF7\u6E38\u620F\u4F24\u8EAB\u3002\r\n\u5408\u7406\u5B89\u6392\u65F6\u95F4\uFF0C\u4EAB\u53D7\u5065\u5EB7\u751F\u6D3B\u3002" 22 | - Key: Load_UpdateText 23 | Value: "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u4E2D" 24 | - Key: Load_Tip_Title 25 | Value: "\u6E38\u620F\u66F4\u65B0" 26 | - Key: Load_Tip_Text 27 | Value: "\u5C06\u66F4\u65B0100MB\u7684\u6E38\u620F\u8D44\u6E90\r\n\r\n1.\u4FEE\u590D\u4E86\u5F00\u53D1\u8005\u592A\u5E05\u7684Bug\r\n2.\u8FD8\u662F\u4FEE\u590D\u4E86\u5F00\u53D1\u8005\u592A\u5E05\u7684Bug\r\n3.\u4FEE\u590D\u4E86\u5F00\u53D1\u8005\u592A\u53EF\u7231\u7684Bug\r\n4.\u8FD8\u662F\u4FEE\u590D\u4E86\u5F00\u53D1\u8005\u592A\u53EF\u7231\u7684Bug" 28 | - Key: Load_Tip_Button_Text 29 | Value: "\u5F00\u59CB\u66F4\u65B0" 30 | - Key: Load_UpdateText_1 31 | Value: "HotUpdate\u6A21\u5757\u52A0\u8F7D\u4E2D\u2026" 32 | - Key: Load_UpdateText_2 33 | Value: "\u6B63\u5728\u68C0\u67E5\u7248\u672C\u66F4\u65B0\u2026" 34 | - Key: Load_UpdateText_3 35 | Value: "\u66F4\u65B0\u63D0\u793A" 36 | - Key: Load_UpdateText_4 37 | Value: "\u53D1\u73B0\u65B0\u7248\u672C:V{0}\uFF0C\u8BF7\u524D\u5F80\u5E94\u7528\u5E02\u573A/\u5B98\u7F51\u4E0B\u8F7D" 38 | - Key: Load_UpdateText_5 39 | Value: "\u77E5\u9053\u4E86" 40 | - Key: Load_UpdateText_6 41 | Value: "\u8D44\u6E90\u66F4\u65B0" 42 | - Key: Load_DOWNLOAD_FORMAT 43 | Value: "\u5DF2\u4E0B\u8F7D:{0}% {1}MB/{2}MB" 44 | - Key: Load_UpdateText_7 45 | Value: "\u68C0\u6D4B\u5230\u6709\u65B0\u7248\u672C\u8D44\u6E90\uFF0C\u8D44\u6E90\u5927\u5C0F\uFF1A{0}MB\uFF0C\u6B63\u5728\u4E0B\u8F7D\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." 46 | - Key: Load_UpdateText_8 47 | Value: "\u4E0B\u8F7D\u51FA\u9519{0} \\r\\n {1}" 48 | - Key: Load_UpdateText_9 49 | Value: "\u68C0\u67E5\u5230\u670D\u52A1\u5668\u4E0A\u6709\u65B0\u7248\u672C\u8D44\u6E90" 50 | - Key: Load_UpdateText_10 51 | Value: "\u6682\u65F6\u6CA1\u6709\u53D1\u73B0\u66F4\u65B0" 52 | - Key: Load_UpdateText_11 53 | Value: "\u5F00\u59CB\u52A0\u8F7D\u6E38\u620F\u7EC4\u4EF6\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." 54 | - Key: Load_UpdateText_12 55 | Value: "\u52A0\u8F7D\u6210\u529F" 56 | - Key: en 57 | Value: 58 | list: 59 | - Key: Load_GameTip 60 | Value: 61 | - Key: Load_UpdateText 62 | Value: 63 | - Key: Load_Tip_Title 64 | Value: 65 | - Key: Load_Tip_Text 66 | Value: 67 | - Key: Load_Tip_Button_Text 68 | Value: 69 | - Key: Load_UpdateText_1 70 | Value: 71 | - Key: Load_UpdateText_2 72 | Value: 73 | - Key: Load_UpdateText_3 74 | Value: 75 | - Key: Load_UpdateText_4 76 | Value: 77 | - Key: Load_UpdateText_5 78 | Value: 79 | - Key: Load_UpdateText_6 80 | Value: 81 | - Key: Load_DOWNLOAD_FORMAT 82 | Value: 83 | - Key: Load_UpdateText_7 84 | Value: 85 | - Key: Load_UpdateText_8 86 | Value: 87 | - Key: Load_UpdateText_9 88 | Value: 89 | - Key: Load_UpdateText_10 90 | Value: 91 | - Key: Load_UpdateText_11 92 | Value: 93 | - Key: Load_UpdateText_12 94 | Value: 95 | keys: 96 | - Load_GameTip 97 | - Load_UpdateText 98 | - Load_Tip_Title 99 | - Load_Tip_Text 100 | - Load_Tip_Button_Text 101 | - Load_UpdateText_1 102 | - Load_UpdateText_2 103 | - Load_UpdateText_3 104 | - Load_UpdateText_4 105 | - Load_UpdateText_5 106 | - Load_UpdateText_6 107 | - Load_DOWNLOAD_FORMAT 108 | - Load_UpdateText_7 109 | - Load_UpdateText_8 110 | - Load_UpdateText_9 111 | - Load_UpdateText_10 112 | - Load_UpdateText_11 113 | - Load_UpdateText_12 114 | -------------------------------------------------------------------------------- /Assets/Example/New Localization Data.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0021bbf700fa9af4090b2907de57fd27 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Example/New Localization Data.csv: -------------------------------------------------------------------------------- 1 | Key,zh-Hans,zh-TW,en,ja 2 | "Load_GameTip","《健康游戏忠告》 3 | 抵制不良游戏,拒绝盗版游戏。 4 | 注意自我保护,谨防受骗上当。 5 | 适度游戏益脑,沉迷游戏伤身。 6 | 合理安排时间,享受健康生活。",,, 7 | "Load_UpdateText","正在检查更新中",,, 8 | "Load_Tip_Title","游戏更新",,, 9 | "Load_Tip_Text","将更新100MB的游戏资源 10 | 11 | 1.修复了开发者太帅的Bug 12 | 2.还是修复了开发者太帅的Bug 13 | 3.修复了开发者太可爱的Bug 14 | 4.还是修复了开发者太可爱的Bug",,, 15 | "Load_Tip_Button_Text","开始更新",,, 16 | "Load_UpdateText_1","HotUpdate模块加载中…",,, 17 | "Load_UpdateText_2","正在检查版本更新…",,, 18 | "Load_UpdateText_3","更新提示",,, 19 | "Load_UpdateText_4","发现新版本:V{0},请前往应用市场/官网下载",,, 20 | "Load_UpdateText_5","知道了",,, 21 | "Load_UpdateText_6","资源更新",,, 22 | "Load_DOWNLOAD_FORMAT","已下载:{0}% {1}MB/{2}MB",,, 23 | "Load_UpdateText_7","检测到有新版本资源,资源大小:{0}MB,正在下载中,请耐心等待...",,, 24 | "Load_UpdateText_8","下载出错{0} \r\n {1}",,, 25 | "Load_UpdateText_9","检查到服务器上有新版本资源",,, 26 | "Load_UpdateText_10","暂时没有发现更新",,, 27 | "Load_UpdateText_11","开始加载游戏组件,请耐心等待...",,, 28 | "Load_UpdateText_12","加载成功",,, 29 | -------------------------------------------------------------------------------- /Assets/Example/New Localization Data.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c67537724dea3c4baffcc96d27486a5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Example/New Localization Data_bad.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/Example/New Localization Data_bad.csv -------------------------------------------------------------------------------- /Assets/Example/New Localization Data_bad.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e68c13f7a1dbead47a50e58151abd52d 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Example/New Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eae0824b496271346b6ed22f28c68c7b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Example/a9af3c3abfad1ac740e95a00f577a8a6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/Example/a9af3c3abfad1ac740e95a00f577a8a6.jpg -------------------------------------------------------------------------------- /Assets/Example/a9af3c3abfad1ac740e95a00f577a8a6.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 666a83e6f84faa340982aa4a13a2e55c 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | ignoreMasterTextureLimit: 0 28 | grayScaleToAlpha: 0 29 | generateCubemap: 6 30 | cubemapConvolution: 0 31 | seamlessCubemap: 0 32 | textureFormat: 1 33 | maxTextureSize: 2048 34 | textureSettings: 35 | serializedVersion: 2 36 | filterMode: 1 37 | aniso: 1 38 | mipBias: 0 39 | wrapU: 1 40 | wrapV: 1 41 | wrapW: 0 42 | nPOTScale: 0 43 | lightmap: 0 44 | compressionQuality: 50 45 | spriteMode: 1 46 | spriteExtrude: 1 47 | spriteMeshType: 1 48 | alignment: 0 49 | spritePivot: {x: 0.5, y: 0.5} 50 | spritePixelsToUnits: 100 51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 52 | spriteGenerateFallbackPhysicsShape: 1 53 | alphaUsage: 1 54 | alphaIsTransparency: 1 55 | spriteTessellationDetail: -1 56 | textureType: 8 57 | textureShape: 1 58 | singleChannelComponent: 0 59 | flipbookRows: 1 60 | flipbookColumns: 1 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | ignorePngGamma: 0 65 | applyGammaDecoding: 0 66 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: WebGL 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Standalone 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | - serializedVersion: 3 105 | buildTarget: Android 106 | maxTextureSize: 2048 107 | resizeAlgorithm: 0 108 | textureFormat: -1 109 | textureCompression: 1 110 | compressionQuality: 50 111 | crunchedCompression: 0 112 | allowsAlphaSplitting: 0 113 | overridden: 0 114 | androidETC2FallbackOverride: 0 115 | forceMaximumCompressionQuality_BC6H_BC7: 0 116 | - serializedVersion: 3 117 | buildTarget: Server 118 | maxTextureSize: 2048 119 | resizeAlgorithm: 0 120 | textureFormat: -1 121 | textureCompression: 1 122 | compressionQuality: 50 123 | crunchedCompression: 0 124 | allowsAlphaSplitting: 0 125 | overridden: 0 126 | androidETC2FallbackOverride: 0 127 | forceMaximumCompressionQuality_BC6H_BC7: 0 128 | spriteSheet: 129 | serializedVersion: 2 130 | sprites: [] 131 | outline: [] 132 | physicsShape: [] 133 | bones: [] 134 | spriteID: 5e97eb03825dee720800000000000000 135 | internalID: 0 136 | vertices: [] 137 | indices: 138 | edges: [] 139 | weights: [] 140 | secondaryTextures: [] 141 | nameFileIdTable: {} 142 | spritePackingTag: 143 | pSDRemoveMatte: 0 144 | pSDShowRemoveMatteOption: 0 145 | userData: 146 | assetBundleName: 147 | assetBundleVariant: 148 | -------------------------------------------------------------------------------- /Assets/Example/c9f24d0f094dd7c27f326c43df25fcf0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/Example/c9f24d0f094dd7c27f326c43df25fcf0.jpg -------------------------------------------------------------------------------- /Assets/Example/c9f24d0f094dd7c27f326c43df25fcf0.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f49c06b3dfcb8747a2025c8cbb44f67 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | ignoreMasterTextureLimit: 0 28 | grayScaleToAlpha: 0 29 | generateCubemap: 6 30 | cubemapConvolution: 0 31 | seamlessCubemap: 0 32 | textureFormat: 1 33 | maxTextureSize: 2048 34 | textureSettings: 35 | serializedVersion: 2 36 | filterMode: 1 37 | aniso: 1 38 | mipBias: 0 39 | wrapU: 1 40 | wrapV: 1 41 | wrapW: 0 42 | nPOTScale: 0 43 | lightmap: 0 44 | compressionQuality: 50 45 | spriteMode: 1 46 | spriteExtrude: 1 47 | spriteMeshType: 1 48 | alignment: 0 49 | spritePivot: {x: 0.5, y: 0.5} 50 | spritePixelsToUnits: 100 51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 52 | spriteGenerateFallbackPhysicsShape: 1 53 | alphaUsage: 1 54 | alphaIsTransparency: 1 55 | spriteTessellationDetail: -1 56 | textureType: 8 57 | textureShape: 1 58 | singleChannelComponent: 0 59 | flipbookRows: 1 60 | flipbookColumns: 1 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | ignorePngGamma: 0 65 | applyGammaDecoding: 0 66 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: WebGL 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Standalone 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | - serializedVersion: 3 105 | buildTarget: Android 106 | maxTextureSize: 2048 107 | resizeAlgorithm: 0 108 | textureFormat: -1 109 | textureCompression: 1 110 | compressionQuality: 50 111 | crunchedCompression: 0 112 | allowsAlphaSplitting: 0 113 | overridden: 0 114 | androidETC2FallbackOverride: 0 115 | forceMaximumCompressionQuality_BC6H_BC7: 0 116 | - serializedVersion: 3 117 | buildTarget: Server 118 | maxTextureSize: 2048 119 | resizeAlgorithm: 0 120 | textureFormat: -1 121 | textureCompression: 1 122 | compressionQuality: 50 123 | crunchedCompression: 0 124 | allowsAlphaSplitting: 0 125 | overridden: 0 126 | androidETC2FallbackOverride: 0 127 | forceMaximumCompressionQuality_BC6H_BC7: 0 128 | spriteSheet: 129 | serializedVersion: 2 130 | sprites: [] 131 | outline: [] 132 | physicsShape: [] 133 | bones: [] 134 | spriteID: 5e97eb03825dee720800000000000000 135 | internalID: 0 136 | vertices: [] 137 | indices: 138 | edges: [] 139 | weights: [] 140 | secondaryTextures: [] 141 | nameFileIdTable: {} 142 | spritePackingTag: 143 | pSDRemoveMatte: 0 144 | pSDShowRemoveMatteOption: 0 145 | userData: 146 | assetBundleName: 147 | assetBundleVariant: 148 | -------------------------------------------------------------------------------- /Assets/Example/cn.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1650236985246834161 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1650236985246834160} 12 | - component: {fileID: 1650236985246834166} 13 | - component: {fileID: 1650236985246834167} 14 | m_Layer: 5 15 | m_Name: cn 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &1650236985246834160 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 1650236985246834161} 28 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_ConstrainProportionsScale: 0 32 | m_Children: [] 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 0, y: 0} 37 | m_AnchorMax: {x: 1, y: 1} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 0, y: 0} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!222 &1650236985246834166 42 | CanvasRenderer: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 1650236985246834161} 48 | m_CullTransparentMesh: 1 49 | --- !u!114 &1650236985246834167 50 | MonoBehaviour: 51 | m_ObjectHideFlags: 0 52 | m_CorrespondingSourceObject: {fileID: 0} 53 | m_PrefabInstance: {fileID: 0} 54 | m_PrefabAsset: {fileID: 0} 55 | m_GameObject: {fileID: 1650236985246834161} 56 | m_Enabled: 1 57 | m_EditorHideFlags: 0 58 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 59 | m_Name: 60 | m_EditorClassIdentifier: 61 | m_Material: {fileID: 0} 62 | m_Color: {r: 1, g: 0.15846807, b: 0, a: 1} 63 | m_RaycastTarget: 1 64 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 65 | m_Maskable: 1 66 | m_OnCullStateChanged: 67 | m_PersistentCalls: 68 | m_Calls: [] 69 | m_Sprite: {fileID: 0} 70 | m_Type: 0 71 | m_PreserveAspect: 0 72 | m_FillCenter: 1 73 | m_FillMethod: 4 74 | m_FillAmount: 1 75 | m_FillClockwise: 1 76 | m_FillOrigin: 0 77 | m_UseSpriteMesh: 0 78 | m_PixelsPerUnitMultiplier: 1 79 | -------------------------------------------------------------------------------- /Assets/Example/cn.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 955fa673c5767994abc2684c1d7e1498 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Example/en.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1650236985246834161 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1650236985246834160} 12 | - component: {fileID: 1650236985246834166} 13 | - component: {fileID: 1650236985246834167} 14 | m_Layer: 5 15 | m_Name: en 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &1650236985246834160 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 1650236985246834161} 28 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_ConstrainProportionsScale: 0 32 | m_Children: [] 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 0, y: 0} 37 | m_AnchorMax: {x: 1, y: 1} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 0, y: 0} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!222 &1650236985246834166 42 | CanvasRenderer: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 1650236985246834161} 48 | m_CullTransparentMesh: 1 49 | --- !u!114 &1650236985246834167 50 | MonoBehaviour: 51 | m_ObjectHideFlags: 0 52 | m_CorrespondingSourceObject: {fileID: 0} 53 | m_PrefabInstance: {fileID: 0} 54 | m_PrefabAsset: {fileID: 0} 55 | m_GameObject: {fileID: 1650236985246834161} 56 | m_Enabled: 1 57 | m_EditorHideFlags: 0 58 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 59 | m_Name: 60 | m_EditorClassIdentifier: 61 | m_Material: {fileID: 0} 62 | m_Color: {r: 0, g: 0.39058065, b: 1, a: 1} 63 | m_RaycastTarget: 1 64 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 65 | m_Maskable: 1 66 | m_OnCullStateChanged: 67 | m_PersistentCalls: 68 | m_Calls: [] 69 | m_Sprite: {fileID: 0} 70 | m_Type: 0 71 | m_PreserveAspect: 0 72 | m_FillCenter: 1 73 | m_FillMethod: 4 74 | m_FillAmount: 1 75 | m_FillClockwise: 1 76 | m_FillOrigin: 0 77 | m_UseSpriteMesh: 0 78 | m_PixelsPerUnitMultiplier: 1 79 | -------------------------------------------------------------------------------- /Assets/Example/en.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ce153d78190b444c8747ddf3f2ac1a9 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Exend.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d382db581d8d0948bae44046aa63f64 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Exend/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e78cccd5df9ebd4b98896adc53a999b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Exend/Editor/LocalizationTMP_TextEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | #if UNITY_EDITOR 8 | using UnityEditor; 9 | namespace WooLocalization 10 | { 11 | [CustomEditor(typeof(LocalizationTMP_Text))] 12 | class LocalizationTMP_TextEditor : LocalizationBehaviorEditor 13 | { 14 | 15 | [LocalizationActorEditorAttribute] 16 | class TMPTextActorEditor : TextValueActor_BaseEditor 17 | { 18 | 19 | } 20 | 21 | [LocalizationActorEditorAttribute] 22 | class TextFontActorEditor : LocalizationMapActorEditor 23 | { 24 | } 25 | 26 | [LocalizationActorEditorAttribute] 27 | class TMPFontSizeActorEditor : LocalizationMapActorEditor 28 | { 29 | } 30 | } 31 | } 32 | #endif -------------------------------------------------------------------------------- /Assets/Exend/Editor/LocalizationTMP_TextEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6757bcaa90f1654f9c752ca3d612341 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Exend/LocalizationTMP_Text.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | using TMPro; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | [UnityEngine.RequireComponent(typeof(TMPro.TMP_Text))] 14 | [DisallowMultipleComponent] 15 | public class LocalizationTMP_Text : LocalizationGraphic 16 | { 17 | [System.Serializable] 18 | public class TMPTextActor : TextValueActor_Base 19 | { 20 | public TMPTextActor(bool enable) : base(enable) { } 21 | protected override string GetComponentText() => this.behavior.graphicT.text; 22 | protected override void SetComponentText(string value) => this.behavior.graphicT.text = value; 23 | } 24 | [System.Serializable] 25 | public class TMPFontActor : LocalizationMapActor 26 | { 27 | public TMPFontActor(bool enable) : base(enable) 28 | { 29 | 30 | } 31 | 32 | protected override TMP_FontAsset GetDefault() => TMP_Settings.instance != null ? TMP_Settings.defaultFontAsset : null; 33 | 34 | protected override void Execute(string localizationType, LocalizationTMP_Text component) 35 | { 36 | component.graphicT.font = GetValue(localizationType); 37 | } 38 | } 39 | 40 | [System.Serializable] 41 | public class TMPFontSizeActor : LocalizationMapActor 42 | { 43 | public TMPFontSizeActor(bool enable) : base(enable) 44 | { 45 | } 46 | 47 | protected override float GetDefault() => 36; 48 | 49 | protected override void Execute(string localizationType, LocalizationTMP_Text component) 50 | { 51 | component.graphicT.fontSize = GetValue(localizationType); 52 | } 53 | } 54 | public TMPTextActor text = new TMPTextActor(true); 55 | public TMPFontActor font = new TMPFontActor(false); 56 | public TMPFontSizeActor fontSize = new TMPFontSizeActor(false); 57 | 58 | 59 | protected override List GetActors() 60 | { 61 | var _base = base.GetActors(); 62 | _base.Add(text); 63 | _base.Add(font); 64 | _base.Add(fontSize); 65 | 66 | return _base; 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/Exend/LocalizationTMP_Text.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46782399ded2e6940b7618d75f33b9d2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48507ba8c5c23ef4bb742621c7143877 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/BillingMode.json: -------------------------------------------------------------------------------- 1 | {"androidStore":"GooglePlay"} -------------------------------------------------------------------------------- /Assets/Resources/BillingMode.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8e243ab8113b134c91de379a771e968 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f54d1bd14bd3ca042bd867b519fee8cc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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/Documentation/TextMesh Pro User Guide 2016.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf -------------------------------------------------------------------------------- /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/Fonts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ab70aee4d56447429c680537fbf93ed 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt: -------------------------------------------------------------------------------- 1 | Digitized data copyright (c) 2010 Google Corporation 2 | with Reserved Font Arimo, Tinos and Cousine. 3 | Copyright (c) 2012 Red Hat, Inc. 4 | with Reserved Font Name Liberation. 5 | 6 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 7 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL 8 | 9 | ----------------------------------------------------------- 10 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 11 | ----------------------------------------------------------- 12 | 13 | PREAMBLE 14 | The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. 15 | 16 | The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. 17 | 18 | DEFINITIONS 19 | "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. 20 | 21 | "Reserved Font Name" refers to any names specified as such after the copyright statement(s). 22 | 23 | "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). 24 | 25 | "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. 26 | 27 | "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. 28 | 29 | PERMISSION & CONDITIONS 30 | Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 31 | 32 | 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 33 | 34 | 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 35 | 36 | 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 37 | 38 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 39 | 40 | 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. 41 | 42 | TERMINATION 43 | This license becomes null and void if any of the above conditions are not met. 44 | 45 | DISCLAIMER 46 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e59c59b81ab47f9b6ec5781fa725d2c 3 | timeCreated: 1484171296 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Fonts/LiberationSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/TextMesh Pro/Fonts/LiberationSans.ttf -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3265ab4bf004d28a9537516768c1c75 3 | timeCreated: 1484171297 4 | licenseType: Pro 5 | TrueTypeFontImporter: 6 | serializedVersion: 2 7 | fontSize: 16 8 | forceTextureCase: -2 9 | characterSpacing: 1 10 | characterPadding: 0 11 | includeFontData: 1 12 | use2xBehaviour: 0 13 | fontNames: [] 14 | fallbackFontReferences: [] 15 | customCharacters: 16 | fontRenderingMode: 0 17 | userData: 18 | assetBundleName: 19 | assetBundleVariant: 20 | -------------------------------------------------------------------------------- /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/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 - 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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: LiberationSans SDF - Drop Shadow 11 | m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} 12 | m_ShaderKeywords: OUTLINE_ON UNDERLAY_ON 13 | m_LightmapFlags: 5 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _Cube: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _FaceTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MainTex: 35 | m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee, 36 | type: 2} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _OutlineTex: 40 | m_Texture: {fileID: 0} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | m_Floats: 44 | - _Ambient: 0.5 45 | - _Bevel: 0.5 46 | - _BevelClamp: 0 47 | - _BevelOffset: 0 48 | - _BevelRoundness: 0 49 | - _BevelWidth: 0 50 | - _BumpFace: 0 51 | - _BumpOutline: 0 52 | - _ColorMask: 15 53 | - _Diffuse: 0.5 54 | - _DiffusePower: 1 55 | - _FaceDilate: 0.1 56 | - _FaceUVSpeedX: 0 57 | - _FaceUVSpeedY: 0 58 | - _GlowInner: 0.05 59 | - _GlowOffset: 0 60 | - _GlowOuter: 0.05 61 | - _GlowPower: 0.75 62 | - _GradientScale: 10 63 | - _LightAngle: 3.1416 64 | - _MaskSoftnessX: 0 65 | - _MaskSoftnessY: 0 66 | - _OutlineSoftness: 0 67 | - _OutlineUVSpeedX: 0 68 | - _OutlineUVSpeedY: 0 69 | - _OutlineWidth: 0.1 70 | - _PerspectiveFilter: 0.875 71 | - _Reflectivity: 10 72 | - _ScaleRatioA: 0.9 73 | - _ScaleRatioB: 0.73125 74 | - _ScaleRatioC: 0.64125 75 | - _ScaleX: 1 76 | - _ScaleY: 1 77 | - _ShaderFlags: 0 78 | - _Sharpness: 0 79 | - _SpecularPower: 2 80 | - _Stencil: 0 81 | - _StencilComp: 8 82 | - _StencilOp: 0 83 | - _StencilReadMask: 255 84 | - _StencilWriteMask: 255 85 | - _TextureHeight: 1024 86 | - _TextureWidth: 1024 87 | - _UnderlayDilate: 0 88 | - _UnderlayOffsetX: 0.5 89 | - _UnderlayOffsetY: -0.5 90 | - _UnderlaySoftness: 0.05 91 | - _VertexOffsetX: 0 92 | - _VertexOffsetY: 0 93 | - _WeightBold: 0.75 94 | - _WeightNormal: 0 95 | m_Colors: 96 | - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} 97 | - _Color: {r: 1, g: 1, b: 1, a: 1} 98 | - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} 99 | - _FaceColor: {r: 1, g: 1, b: 1, a: 1} 100 | - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} 101 | - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} 102 | - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} 103 | - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} 104 | - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} 105 | - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} 106 | - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} 107 | -------------------------------------------------------------------------------- /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/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e498d1c8094910479dc3e1b768306a4 3 | timeCreated: 1484171803 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: LiberationSans SDF - Outline 11 | m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} 12 | m_ShaderKeywords: OUTLINE_ON 13 | m_LightmapFlags: 5 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _Cube: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _FaceTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MainTex: 35 | m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee, 36 | type: 2} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _OutlineTex: 40 | m_Texture: {fileID: 0} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | m_Floats: 44 | - _Ambient: 0.5 45 | - _Bevel: 0.5 46 | - _BevelClamp: 0 47 | - _BevelOffset: 0 48 | - _BevelRoundness: 0 49 | - _BevelWidth: 0 50 | - _BumpFace: 0 51 | - _BumpOutline: 0 52 | - _ColorMask: 15 53 | - _Diffuse: 0.5 54 | - _FaceDilate: 0.1 55 | - _FaceUVSpeedX: 0 56 | - _FaceUVSpeedY: 0 57 | - _GlowInner: 0.05 58 | - _GlowOffset: 0 59 | - _GlowOuter: 0.05 60 | - _GlowPower: 0.75 61 | - _GradientScale: 10 62 | - _LightAngle: 3.1416 63 | - _MaskSoftnessX: 0 64 | - _MaskSoftnessY: 0 65 | - _OutlineSoftness: 0 66 | - _OutlineUVSpeedX: 0 67 | - _OutlineUVSpeedY: 0 68 | - _OutlineWidth: 0.1 69 | - _PerspectiveFilter: 0.875 70 | - _Reflectivity: 10 71 | - _ScaleRatioA: 0.9 72 | - _ScaleRatioB: 0.73125 73 | - _ScaleRatioC: 0.64125 74 | - _ScaleX: 1 75 | - _ScaleY: 1 76 | - _ShaderFlags: 0 77 | - _Sharpness: 0 78 | - _SpecularPower: 2 79 | - _Stencil: 0 80 | - _StencilComp: 8 81 | - _StencilOp: 0 82 | - _StencilReadMask: 255 83 | - _StencilWriteMask: 255 84 | - _TextureHeight: 1024 85 | - _TextureWidth: 1024 86 | - _UnderlayDilate: 0 87 | - _UnderlayOffsetX: 0 88 | - _UnderlayOffsetY: 0 89 | - _UnderlaySoftness: 0 90 | - _VertexOffsetX: 0 91 | - _VertexOffsetY: 0 92 | - _WeightBold: 0.75 93 | - _WeightNormal: 0 94 | m_Colors: 95 | - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} 96 | - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} 97 | - _FaceColor: {r: 1, g: 1, b: 1, a: 1} 98 | - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} 99 | - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} 100 | - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} 101 | - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} 102 | - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} 103 | - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} 104 | - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} 105 | -------------------------------------------------------------------------------- /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.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/LineBreaking Following Characters.txt: -------------------------------------------------------------------------------- 1 | )]}〕〉》」』】〙〗〟’”⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、%,.:;。!?]):;=}¢°"†‡℃〆%,. -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- 1 | ([{〔〈《「『【〘〖〝‘“⦅«$—…‥〳〴〵\[({£¥"々〇$¥₩ # -------------------------------------------------------------------------------- /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/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/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/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: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /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/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_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: 2705215ac5b84b70bacc50632be6e391, type: 3} 13 | m_Name: TMP Settings 14 | m_EditorClassIdentifier: 15 | m_enableWordWrapping: 1 16 | m_enableKerning: 1 17 | m_enableExtraPadding: 0 18 | m_enableTintAllSprites: 0 19 | m_enableParseEscapeCharacters: 1 20 | m_EnableRaycastTarget: 1 21 | m_GetFontFeaturesAtRuntime: 1 22 | m_missingGlyphCharacter: 0 23 | m_warningsDisabled: 0 24 | m_defaultFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} 25 | m_defaultFontAssetPath: Fonts & Materials/ 26 | m_defaultFontSize: 36 27 | m_defaultAutoSizeMinRatio: 0.5 28 | m_defaultAutoSizeMaxRatio: 2 29 | m_defaultTextMeshProTextContainerSize: {x: 20, y: 5} 30 | m_defaultTextMeshProUITextContainerSize: {x: 200, y: 50} 31 | m_autoSizeTextContainer: 0 32 | m_fallbackFontAssets: [] 33 | m_matchMaterialPreset: 1 34 | m_defaultSpriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45, 35 | type: 2} 36 | m_defaultSpriteAssetPath: Sprite Assets/ 37 | m_enableEmojiSupport: 1 38 | m_MissingCharacterSpriteUnicode: 0 39 | m_defaultColorGradientPresetsPath: Color Gradient Presets/ 40 | m_defaultStyleSheet: {fileID: 11400000, guid: f952c082cb03451daed3ee968ac6c63e, 41 | type: 2} 42 | m_StyleSheetsResourcePath: 43 | m_leadingCharacters: {fileID: 4900000, guid: d82c1b31c7e74239bff1220585707d2b, type: 3} 44 | m_followingCharacters: {fileID: 4900000, guid: fade42e8bc714b018fac513c043d323b, 45 | type: 3} 46 | m_UseModernHangulLineBreakingRules: 0 47 | -------------------------------------------------------------------------------- /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/TextMesh Pro/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9f693669af91aa45ad615fc681ed29f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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 | [HDR]_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 | _CullMode("Cull Mode", Float) = 0 23 | _ColorMask("Color Mask", Float) = 15 24 | } 25 | 26 | SubShader{ 27 | 28 | Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } 29 | 30 | Stencil 31 | { 32 | Ref[_Stencil] 33 | Comp[_StencilComp] 34 | Pass[_StencilOp] 35 | ReadMask[_StencilReadMask] 36 | WriteMask[_StencilWriteMask] 37 | } 38 | 39 | 40 | Lighting Off 41 | Cull [_CullMode] 42 | ZTest [unity_GUIZTestMode] 43 | ZWrite Off 44 | Fog { Mode Off } 45 | Blend SrcAlpha OneMinusSrcAlpha 46 | ColorMask[_ColorMask] 47 | 48 | Pass { 49 | CGPROGRAM 50 | #pragma vertex vert 51 | #pragma fragment frag 52 | 53 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 54 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 55 | 56 | 57 | #include "UnityCG.cginc" 58 | 59 | struct appdata_t { 60 | float4 vertex : POSITION; 61 | fixed4 color : COLOR; 62 | float2 texcoord0 : TEXCOORD0; 63 | float2 texcoord1 : TEXCOORD1; 64 | }; 65 | 66 | struct v2f { 67 | float4 vertex : SV_POSITION; 68 | fixed4 color : COLOR; 69 | float2 texcoord0 : TEXCOORD0; 70 | float2 texcoord1 : TEXCOORD1; 71 | float4 mask : TEXCOORD2; 72 | }; 73 | 74 | uniform sampler2D _MainTex; 75 | uniform sampler2D _FaceTex; 76 | uniform float4 _FaceTex_ST; 77 | uniform fixed4 _FaceColor; 78 | 79 | uniform float _VertexOffsetX; 80 | uniform float _VertexOffsetY; 81 | uniform float4 _ClipRect; 82 | uniform float _MaskSoftnessX; 83 | uniform float _MaskSoftnessY; 84 | 85 | float2 UnpackUV(float uv) 86 | { 87 | float2 output; 88 | output.x = floor(uv / 4096); 89 | output.y = uv - 4096 * output.x; 90 | 91 | return output * 0.001953125; 92 | } 93 | 94 | v2f vert (appdata_t v) 95 | { 96 | float4 vert = v.vertex; 97 | vert.x += _VertexOffsetX; 98 | vert.y += _VertexOffsetY; 99 | 100 | vert.xy += (vert.w * 0.5) / _ScreenParams.xy; 101 | 102 | float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); 103 | 104 | fixed4 faceColor = v.color; 105 | faceColor *= _FaceColor; 106 | 107 | v2f OUT; 108 | OUT.vertex = vPosition; 109 | OUT.color = faceColor; 110 | OUT.texcoord0 = v.texcoord0; 111 | OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); 112 | float2 pixelSize = vPosition.w; 113 | pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); 114 | 115 | // Clamp _ClipRect to 16bit. 116 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 117 | OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); 118 | 119 | return OUT; 120 | } 121 | 122 | fixed4 frag (v2f IN) : SV_Target 123 | { 124 | fixed4 color = tex2D(_MainTex, IN.texcoord0) * tex2D(_FaceTex, IN.texcoord1) * IN.color; 125 | 126 | // Alternative implementation to UnityGet2DClipping with support for softness. 127 | #if UNITY_UI_CLIP_RECT 128 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 129 | color *= m.x * m.y; 130 | #endif 131 | 132 | #if UNITY_UI_ALPHACLIP 133 | clip(color.a - 0.001); 134 | #endif 135 | 136 | return color; 137 | } 138 | ENDCG 139 | } 140 | } 141 | 142 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 143 | } 144 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48bb5f55d8670e349b6e614913f9d910 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Mobile/Bitmap" { 2 | 3 | Properties { 4 | _MainTex ("Font Atlas", 2D) = "white" {} 5 | [HDR]_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 | _CullMode("Cull Mode", Float) = 0 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 | #pragma fragmentoption ARB_precision_hint_fastest 52 | 53 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 54 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 55 | 56 | 57 | #include "UnityCG.cginc" 58 | 59 | struct appdata_t { 60 | float4 vertex : POSITION; 61 | fixed4 color : COLOR; 62 | float2 texcoord0 : TEXCOORD0; 63 | float2 texcoord1 : TEXCOORD1; 64 | }; 65 | 66 | struct v2f { 67 | float4 vertex : POSITION; 68 | fixed4 color : COLOR; 69 | float2 texcoord0 : TEXCOORD0; 70 | float4 mask : TEXCOORD2; 71 | }; 72 | 73 | sampler2D _MainTex; 74 | fixed4 _Color; 75 | float _DiffusePower; 76 | 77 | uniform float _VertexOffsetX; 78 | uniform float _VertexOffsetY; 79 | uniform float4 _ClipRect; 80 | uniform float _MaskSoftnessX; 81 | uniform float _MaskSoftnessY; 82 | 83 | v2f vert (appdata_t v) 84 | { 85 | v2f OUT; 86 | float4 vert = v.vertex; 87 | vert.x += _VertexOffsetX; 88 | vert.y += _VertexOffsetY; 89 | 90 | vert.xy += (vert.w * 0.5) / _ScreenParams.xy; 91 | 92 | OUT.vertex = UnityPixelSnap(UnityObjectToClipPos(vert)); 93 | OUT.color = v.color; 94 | OUT.color *= _Color; 95 | OUT.color.rgb *= _DiffusePower; 96 | OUT.texcoord0 = v.texcoord0; 97 | 98 | float2 pixelSize = OUT.vertex.w; 99 | //pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); 100 | 101 | // Clamp _ClipRect to 16bit. 102 | float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); 103 | OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); 104 | 105 | return OUT; 106 | } 107 | 108 | fixed4 frag (v2f IN) : COLOR 109 | { 110 | fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0).a); 111 | 112 | // Alternative implementation to UnityGet2DClipping with support for softness. 113 | #if UNITY_UI_CLIP_RECT 114 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 115 | color *= m.x * m.y; 116 | #endif 117 | 118 | #if UNITY_UI_ALPHACLIP 119 | clip(color.a - 0.001); 120 | #endif 121 | 122 | return color; 123 | } 124 | ENDCG 125 | } 126 | } 127 | 128 | SubShader { 129 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 130 | Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off } 131 | Blend SrcAlpha OneMinusSrcAlpha 132 | BindChannels { 133 | Bind "Color", color 134 | Bind "Vertex", vertex 135 | Bind "TexCoord", texcoord0 136 | } 137 | Pass { 138 | SetTexture [_MainTex] { 139 | constantColor [_Color] combine constant * primary, constant * texture 140 | } 141 | } 142 | } 143 | 144 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 145 | } 146 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e3b057af24249748ff873be7fafee47 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Bitmap" { 2 | 3 | Properties { 4 | _MainTex ("Font Atlas", 2D) = "white" {} 5 | _FaceTex ("Font Texture", 2D) = "white" {} 6 | [HDR]_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 | _CullMode("Cull Mode", Float) = 0 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); 124 | color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); 125 | 126 | // Alternative implementation to UnityGet2DClipping with support for softness. 127 | #if UNITY_UI_CLIP_RECT 128 | half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); 129 | color *= m.x * m.y; 130 | #endif 131 | 132 | #if UNITY_UI_ALPHACLIP 133 | clip(color.a - 0.001); 134 | #endif 135 | 136 | return color; 137 | } 138 | ENDCG 139 | } 140 | } 141 | 142 | CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" 143 | } 144 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 128e987d567d4e2c824d754223b3f3b0 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd89cf5b9246416f84610a006f916af7 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14eb328de4b8eb245bb7cea29e4ac00b 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc1ede39bf3643ee8e493720e4259791 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a02a7d8c237544f1962732b55a9aebf1 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.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 SSD" { 7 | 8 | Properties { 9 | [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) 10 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 11 | 12 | [HDR]_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 | [HDR]_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 | _Sharpness ("Sharpness", Range(-1,1)) = 0 38 | 39 | _VertexOffsetX ("Vertex OffsetX", float) = 0 40 | _VertexOffsetY ("Vertex OffsetY", float) = 0 41 | 42 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 43 | _MaskSoftnessX ("Mask SoftnessX", float) = 0 44 | _MaskSoftnessY ("Mask SoftnessY", float) = 0 45 | _MaskTex ("Mask Texture", 2D) = "white" {} 46 | _MaskInverse ("Inverse", float) = 0 47 | _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) 48 | _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 49 | _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 50 | 51 | _StencilComp ("Stencil Comparison", Float) = 8 52 | _Stencil ("Stencil ID", Float) = 0 53 | _StencilOp ("Stencil Operation", Float) = 0 54 | _StencilWriteMask ("Stencil Write Mask", Float) = 255 55 | _StencilReadMask ("Stencil Read Mask", Float) = 255 56 | 57 | _CullMode ("Cull Mode", Float) = 0 58 | _ColorMask ("Color Mask", Float) = 15 59 | } 60 | 61 | SubShader { 62 | Tags { 63 | "Queue"="Transparent" 64 | "IgnoreProjector"="True" 65 | "RenderType"="Transparent" 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 | #include "UnityCG.cginc" 96 | #include "UnityUI.cginc" 97 | #include "TMPro_Properties.cginc" 98 | 99 | #include "TMPro_Mobile.cginc" 100 | 101 | ENDCG 102 | } 103 | } 104 | 105 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 106 | } 107 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8d12adcee749c344b8117cf7c7eb912 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe393ace9b354375a9cb14cdbbc28be4 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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 | [HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) 11 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 12 | 13 | [HDR]_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 | [HDR]_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 | _Sharpness ("Sharpness", Range(-1,1)) = 0 41 | 42 | _VertexOffsetX ("Vertex OffsetX", float) = 0 43 | _VertexOffsetY ("Vertex OffsetY", float) = 0 44 | 45 | _CullMode ("Cull Mode", Float) = 0 46 | //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) 47 | //_MaskSoftness ("Mask Softness", float) = 0 48 | } 49 | 50 | SubShader { 51 | 52 | Tags { 53 | "Queue"="Transparent" 54 | "IgnoreProjector"="True" 55 | "RenderType"="Transparent" 56 | } 57 | 58 | LOD 300 59 | Cull [_CullMode] 60 | 61 | CGPROGRAM 62 | #pragma surface PixShader Lambert alpha:blend vertex:VertShader noforwardadd nolightmap nodirlightmap 63 | #pragma target 3.0 64 | #pragma shader_feature __ GLOW_ON 65 | 66 | #include "TMPro_Properties.cginc" 67 | #include "TMPro.cginc" 68 | 69 | half _FaceShininess; 70 | half _OutlineShininess; 71 | 72 | struct Input 73 | { 74 | fixed4 color : COLOR; 75 | float2 uv_MainTex; 76 | float2 uv2_FaceTex; 77 | float2 uv2_OutlineTex; 78 | float2 param; // Weight, Scale 79 | float3 viewDirEnv; 80 | }; 81 | 82 | #include "TMPro_Surface.cginc" 83 | 84 | ENDCG 85 | 86 | // Pass to render object as a shadow caster 87 | Pass 88 | { 89 | Name "Caster" 90 | Tags { "LightMode" = "ShadowCaster" } 91 | Offset 1, 1 92 | 93 | Fog {Mode Off} 94 | ZWrite On ZTest LEqual Cull Off 95 | 96 | CGPROGRAM 97 | #pragma vertex vert 98 | #pragma fragment frag 99 | #pragma multi_compile_shadowcaster 100 | #include "UnityCG.cginc" 101 | 102 | struct v2f { 103 | V2F_SHADOW_CASTER; 104 | float2 uv : TEXCOORD1; 105 | float2 uv2 : TEXCOORD3; 106 | float alphaClip : TEXCOORD2; 107 | }; 108 | 109 | uniform float4 _MainTex_ST; 110 | uniform float4 _OutlineTex_ST; 111 | float _OutlineWidth; 112 | float _FaceDilate; 113 | float _ScaleRatioA; 114 | 115 | v2f vert( appdata_base v ) 116 | { 117 | v2f o; 118 | TRANSFER_SHADOW_CASTER(o) 119 | o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); 120 | o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); 121 | o.alphaClip = o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; 122 | return o; 123 | } 124 | 125 | uniform sampler2D _MainTex; 126 | 127 | float4 frag(v2f i) : COLOR 128 | { 129 | fixed4 texcol = tex2D(_MainTex, i.uv).a; 130 | clip(texcol.a - i.alphaClip); 131 | SHADOW_CASTER_FRAGMENT(i) 132 | } 133 | ENDCG 134 | } 135 | } 136 | 137 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 138 | } 139 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85187c2149c549c5b33f0cdb02836b17 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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 | [HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) 8 | _FaceDilate ("Face Dilate", Range(-1,1)) = 0 9 | 10 | [HDR]_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 | [HDR]_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 | [HDR]_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 | _Sharpness ("Sharpness", Range(-1,1)) = 0 59 | 60 | _VertexOffsetX ("Vertex OffsetX", float) = 0 61 | _VertexOffsetY ("Vertex OffsetY", float) = 0 62 | 63 | _CullMode ("Cull Mode", Float) = 0 64 | //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) 65 | //_MaskSoftness ("Mask Softness", float) = 0 66 | } 67 | 68 | SubShader { 69 | 70 | Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } 71 | 72 | LOD 300 73 | Cull [_CullMode] 74 | 75 | CGPROGRAM 76 | #pragma surface PixShader BlinnPhong alpha:blend vertex:VertShader nolightmap nodirlightmap 77 | #pragma target 3.0 78 | #pragma shader_feature __ GLOW_ON 79 | #pragma glsl 80 | 81 | #include "TMPro_Properties.cginc" 82 | #include "TMPro.cginc" 83 | 84 | half _FaceShininess; 85 | half _OutlineShininess; 86 | 87 | struct Input 88 | { 89 | fixed4 color : COLOR; 90 | float2 uv_MainTex; 91 | float2 uv2_FaceTex; 92 | float2 uv2_OutlineTex; 93 | float2 param; // Weight, Scale 94 | float3 viewDirEnv; 95 | }; 96 | 97 | 98 | #define BEVEL_ON 1 99 | #include "TMPro_Surface.cginc" 100 | 101 | ENDCG 102 | 103 | // Pass to render object as a shadow caster 104 | Pass 105 | { 106 | Name "Caster" 107 | Tags { "LightMode" = "ShadowCaster" } 108 | Offset 1, 1 109 | 110 | Fog {Mode Off} 111 | ZWrite On 112 | ZTest LEqual 113 | Cull Off 114 | 115 | CGPROGRAM 116 | #pragma vertex vert 117 | #pragma fragment frag 118 | #pragma multi_compile_shadowcaster 119 | #include "UnityCG.cginc" 120 | 121 | struct v2f { 122 | V2F_SHADOW_CASTER; 123 | float2 uv : TEXCOORD1; 124 | float2 uv2 : TEXCOORD3; 125 | float alphaClip : TEXCOORD2; 126 | }; 127 | 128 | uniform float4 _MainTex_ST; 129 | uniform float4 _OutlineTex_ST; 130 | float _OutlineWidth; 131 | float _FaceDilate; 132 | float _ScaleRatioA; 133 | 134 | v2f vert( appdata_base v ) 135 | { 136 | v2f o; 137 | TRANSFER_SHADOW_CASTER(o) 138 | o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); 139 | o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); 140 | o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; 141 | return o; 142 | } 143 | 144 | uniform sampler2D _MainTex; 145 | 146 | float4 frag(v2f i) : COLOR 147 | { 148 | fixed4 texcol = tex2D(_MainTex, i.uv).a; 149 | clip(texcol.a - i.alphaClip); 150 | SHADOW_CASTER_FRAGMENT(i) 151 | } 152 | ENDCG 153 | } 154 | } 155 | 156 | CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" 157 | } 158 | 159 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7ada0af4f174f0694ca6a487b8f543d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_SDF.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68e6db2ebdc24f95958faec2be5558d6 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Sprite.shader: -------------------------------------------------------------------------------- 1 | Shader "TextMeshPro/Sprite" 2 | { 3 | Properties 4 | { 5 | [PerRendererData] _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 | _CullMode ("Cull Mode", Float) = 0 15 | _ColorMask ("Color Mask", Float) = 15 16 | _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) 17 | 18 | [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 19 | } 20 | 21 | SubShader 22 | { 23 | Tags 24 | { 25 | "Queue"="Transparent" 26 | "IgnoreProjector"="True" 27 | "RenderType"="Transparent" 28 | "PreviewType"="Plane" 29 | "CanUseSpriteAtlas"="True" 30 | } 31 | 32 | Stencil 33 | { 34 | Ref [_Stencil] 35 | Comp [_StencilComp] 36 | Pass [_StencilOp] 37 | ReadMask [_StencilReadMask] 38 | WriteMask [_StencilWriteMask] 39 | } 40 | 41 | Cull [_CullMode] 42 | Lighting Off 43 | ZWrite Off 44 | ZTest [unity_GUIZTestMode] 45 | Blend SrcAlpha OneMinusSrcAlpha 46 | ColorMask [_ColorMask] 47 | 48 | Pass 49 | { 50 | Name "Default" 51 | CGPROGRAM 52 | #pragma vertex vert 53 | #pragma fragment frag 54 | #pragma target 2.0 55 | 56 | #include "UnityCG.cginc" 57 | #include "UnityUI.cginc" 58 | 59 | #pragma multi_compile __ UNITY_UI_CLIP_RECT 60 | #pragma multi_compile __ UNITY_UI_ALPHACLIP 61 | 62 | struct appdata_t 63 | { 64 | float4 vertex : POSITION; 65 | float4 color : COLOR; 66 | float2 texcoord : TEXCOORD0; 67 | UNITY_VERTEX_INPUT_INSTANCE_ID 68 | }; 69 | 70 | struct v2f 71 | { 72 | float4 vertex : SV_POSITION; 73 | fixed4 color : COLOR; 74 | float2 texcoord : TEXCOORD0; 75 | float4 worldPosition : TEXCOORD1; 76 | UNITY_VERTEX_OUTPUT_STEREO 77 | }; 78 | 79 | sampler2D _MainTex; 80 | fixed4 _Color; 81 | fixed4 _TextureSampleAdd; 82 | float4 _ClipRect; 83 | float4 _MainTex_ST; 84 | 85 | v2f vert(appdata_t v) 86 | { 87 | v2f OUT; 88 | UNITY_SETUP_INSTANCE_ID(v); 89 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); 90 | OUT.worldPosition = v.vertex; 91 | OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); 92 | 93 | OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); 94 | 95 | OUT.color = v.color * _Color; 96 | return OUT; 97 | } 98 | 99 | fixed4 frag(v2f IN) : SV_Target 100 | { 101 | half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; 102 | 103 | #ifdef UNITY_UI_CLIP_RECT 104 | color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); 105 | #endif 106 | 107 | #ifdef UNITY_UI_ALPHACLIP 108 | clip (color.a - 0.001); 109 | #endif 110 | 111 | return color; 112 | } 113 | ENDCG 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMP_Sprite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf81c85f95fe47e1a27f6ae460cf182c 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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/TextMesh Pro/Shaders/TMPro.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 407bc68d299748449bbf7f48ee690f8d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c334973cef89a9840b0b0c507e0377ab 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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 | uniform float _Sharpness; 86 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3997e2241185407d80309a82f9148466 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/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 * (_Sharpness + 1); 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 | data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; // 29 | 30 | v.texcoord1.xy = UnpackUV(v.texcoord1.x); 31 | data.viewDirEnv = mul((float3x3)_EnvMatrix, WorldSpaceViewDir(v.vertex)); 32 | } 33 | 34 | void PixShader(Input input, inout SurfaceOutput o) 35 | { 36 | 37 | #if USE_DERIVATIVE 38 | float2 pixelSize = float2(ddx(input.uv_MainTex.y), ddy(input.uv_MainTex.y)); 39 | pixelSize *= _TextureWidth * .75; 40 | float scale = rsqrt(dot(pixelSize, pixelSize)) * _GradientScale * (_Sharpness + 1); 41 | #else 42 | float scale = input.param.y; 43 | #endif 44 | 45 | // Signed distance 46 | float c = tex2D(_MainTex, input.uv_MainTex).a; 47 | float sd = (.5 - c - input.param.x) * scale + .5; 48 | float outline = _OutlineWidth*_ScaleRatioA * scale; 49 | float softness = _OutlineSoftness*_ScaleRatioA * scale; 50 | 51 | // Color & Alpha 52 | float4 faceColor = _FaceColor; 53 | float4 outlineColor = _OutlineColor; 54 | faceColor *= input.color; 55 | outlineColor.a *= input.color.a; 56 | faceColor *= tex2D(_FaceTex, float2(input.uv2_FaceTex.x + _FaceUVSpeedX * _Time.y, input.uv2_FaceTex.y + _FaceUVSpeedY * _Time.y)); 57 | outlineColor *= tex2D(_OutlineTex, float2(input.uv2_OutlineTex.x + _OutlineUVSpeedX * _Time.y, input.uv2_OutlineTex.y + _OutlineUVSpeedY * _Time.y)); 58 | faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); 59 | faceColor.rgb /= max(faceColor.a, 0.0001); 60 | 61 | #if BEVEL_ON 62 | float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0); 63 | 64 | float4 smp4x = {tex2D(_MainTex, input.uv_MainTex - delta.xz).a, 65 | tex2D(_MainTex, input.uv_MainTex + delta.xz).a, 66 | tex2D(_MainTex, input.uv_MainTex - delta.zy).a, 67 | tex2D(_MainTex, input.uv_MainTex + delta.zy).a }; 68 | 69 | // Face Normal 70 | float3 n = GetSurfaceNormal(smp4x, input.param.x); 71 | 72 | // Bumpmap 73 | float3 bump = UnpackNormal(tex2D(_BumpMap, input.uv2_FaceTex.xy)).xyz; 74 | bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); 75 | bump = lerp(float3(0, 0, 1), bump, faceColor.a); 76 | n = normalize(n - bump); 77 | 78 | // Cubemap reflection 79 | fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDirEnv, mul((float3x3)unity_ObjectToWorld, n))); 80 | float3 emission = reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; 81 | #else 82 | float3 n = float3(0, 0, -1); 83 | float3 emission = float3(0, 0, 0); 84 | #endif 85 | 86 | #if GLOW_ON 87 | float4 glowColor = GetGlowColor(sd, scale); 88 | glowColor.a *= input.color.a; 89 | emission += glowColor.rgb*glowColor.a; 90 | faceColor = BlendARGB(glowColor, faceColor); 91 | faceColor.rgb /= max(faceColor.a, 0.0001); 92 | #endif 93 | 94 | // Set Standard output structure 95 | o.Albedo = faceColor.rgb; 96 | o.Normal = -n; 97 | o.Emission = emission; 98 | o.Specular = lerp(_FaceShininess, _OutlineShininess, saturate(sd + outline * 0.5)); 99 | o.Gloss = 1; 100 | o.Alpha = faceColor.a; 101 | } 102 | -------------------------------------------------------------------------------- /Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d930090c0cd643c7b55f19a38538c162 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /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/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/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/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/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/TextMesh Pro/Sprites/EmojiOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/TextMesh Pro/Sprites/EmojiOne.png -------------------------------------------------------------------------------- /Assets/WooLocalization.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4f498e04afb5c5439b58d3e53fe209f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66a7a071fd4fae04890f08b3e544eab0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4707b439ffc4d91468896cccfba17a2f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/ILocalizationActorEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | namespace WooLocalization 8 | { 9 | interface ILocalizationActorEditor 10 | { 11 | void OnGUI(string name, LocalizationBehavior component, object value); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/ILocalizationActorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d870d2934980dc44591662449b6b875e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/LocalizationActorEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | public abstract class LocalizationActorEditor : ILocalizationActorEditor where T : class, ILocalizationActor 13 | { 14 | void ILocalizationActorEditor.OnGUI(string name, LocalizationBehavior component, object value) 15 | { 16 | T context = value as T; 17 | var on = EditorGUILayout.Toggle(context.enable, EditorStyles.toolbarPopup); 18 | if (on != context.enable) 19 | { 20 | context.enable = on; 21 | SetDirty(component); 22 | 23 | } 24 | 25 | var rect = GUILayoutUtility.GetLastRect(); 26 | rect.x += 10; 27 | rect.width -= 10; 28 | GUI.Toggle(rect, on, name); 29 | if (context.enable) 30 | { 31 | GUILayout.BeginVertical(EditorStyles.helpBox); 32 | OnGUI(component, context); 33 | if (NeedExecute()) 34 | if (GUILayout.Button("Execute", GUILayout.Height(30))) 35 | { 36 | context.Execute(); 37 | SetDirty(component); 38 | } 39 | GUILayout.EndVertical(); 40 | } 41 | 42 | } 43 | protected virtual bool NeedExecute() 44 | { 45 | return true; 46 | } 47 | protected abstract void OnGUI(LocalizationBehavior component, T context); 48 | 49 | protected void SetDirty(LocalizationBehavior component) 50 | { 51 | EditorUtility.SetDirty(component); 52 | 53 | } 54 | 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/LocalizationActorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a6cb74823cfa524dada83b42b062f56 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/LocalizationMapActorEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using UnityEditor; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | public abstract class LocalizationMapActorEditor : LocalizationActorEditor 14 | where Actor : LocalizationMapActor 15 | where Behavior : LocalizationBehavior 16 | { 17 | protected override void OnGUI(LocalizationBehavior component, Actor context) 18 | { 19 | if (component.context == null) return; 20 | GUI.enabled = false; 21 | EditorGUILayout.EnumPopup(nameof(context.mode), context.mode); 22 | if (context.mode != LocalizationMapActor.Mode.Default) 23 | { 24 | EditorGUILayout.TextField(nameof(context.key), context.key); 25 | EditorGUILayout.TextField(nameof(context.CustomContextType), context.CustomContextType); 26 | } 27 | 28 | GUI.enabled = true; 29 | var keys = component.GetLocalizationTypes(); 30 | var map = context.map; 31 | for (int i = 0; keys.Count > i; i++) 32 | { 33 | var key = keys[i]; 34 | if (context.AddLocalizationTypeToMap(key)) 35 | { 36 | SetDirty(component); 37 | } 38 | } 39 | if (context.mode != LocalizationMapActor.Mode.Default) 40 | return; 41 | for (int i = 0; i < keys.Count; i++) 42 | { 43 | var lan = keys[i]; 44 | var src = map[lan]; 45 | 46 | var tmp = Draw(lan, src); 47 | bool change = false; 48 | if (src == null) 49 | { 50 | if (tmp != null) change = true; 51 | } 52 | else 53 | { 54 | if (tmp == null) change = true; 55 | else change = !src.Equals(tmp); 56 | } 57 | if (change) 58 | { 59 | map[lan] = tmp; 60 | SetDirty(component); 61 | } 62 | 63 | } 64 | } 65 | protected virtual Value Draw(string lan, Value value) 66 | { 67 | return LocalizationEditorHelper.DrawObject(lan, value); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/LocalizationMapActorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92c6388d91adb714bb523f1219269e3e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/ObjectActorEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | namespace WooLocalization 8 | { 9 | [LocalizationActorEditorAttribute] 10 | 11 | class ObjectActorEditor : LocalizationMapActorEditor, V, LocalizationBehavior> 12 | { 13 | protected override bool NeedExecute() 14 | { 15 | return false; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/ObjectActorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4191dd8969208fb40ba46d71e99511fc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Actor/TextValueActor_BaseEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e17704e33d9a3964e875dc568a939cc8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95b0aba7e2e2c4645af8183b7e50df36 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationAssetsEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Linq; 8 | using UnityEditor; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | public class LocalizationAssetsEditor : LocalizationBehaviorEditor> 14 | where V : LocalizationAssets 15 | 16 | { 17 | private string _name = ""; 18 | 19 | protected override void RemoveActor(ILocalizationActor actor) 20 | { 21 | comp.objects.Remove(actor as ObjectActor); 22 | } 23 | protected override void DrawInspectorGUI() 24 | { 25 | DrawContext(); 26 | GUILayout.BeginVertical(EditorStyles.helpBox); 27 | GUILayout.Label($"New ObjectActor<{typeof(T)}>"); 28 | GUILayout.Space(5); 29 | GUILayout.BeginHorizontal(); 30 | _name = EditorGUILayout.TextField("Name", _name); 31 | if (GUILayout.Button("+", GUILayout.Width(50))) 32 | { 33 | if (string.IsNullOrEmpty(_name)) 34 | { 35 | EditorWindow.focusedWindow.ShowNotification(new GUIContent("Name is Null")); 36 | return; 37 | } 38 | if (comp.objects.Any(x => (x as ILocalizationActor).name == _name)) 39 | { 40 | EditorWindow.focusedWindow.ShowNotification(new GUIContent("Same Name")); 41 | return; 42 | } 43 | comp.objects.Add(new ObjectActor(true).SetName(_name).SetCanRemove(true) as ObjectActor); 44 | EditorUtility.SetDirty(comp); 45 | AssetDatabase.SaveAssetIfDirty(comp); 46 | LoadFields(); 47 | 48 | } 49 | GUILayout.EndHorizontal(); 50 | GUILayout.Space(5); 51 | 52 | GUILayout.EndVertical(); 53 | DrawFields(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationAssetsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e89248cc0a0d6f47bd49845944e1a75 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationBehaviorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2c7f15e82491e44f994b5bafb577f80 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationGraphicEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | using static WooLocalization.LocalizationGraphic; 10 | 11 | namespace WooLocalization 12 | { 13 | [CustomEditor(typeof(LocalizationGraphic))] 14 | class LocalizationGraphicEditor : LocalizationBehaviorEditor 15 | { 16 | [LocalizationActorEditorAttribute] 17 | class GraphicColorActorEditor : LocalizationMapActorEditor 18 | { 19 | 20 | } 21 | [LocalizationActorEditorAttribute] 22 | class GraphicMaterialActorEditor : LocalizationMapActorEditor 23 | { 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationGraphicEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9a90e7a112a9964996844321c10aa12 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationImageEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | using static WooLocalization.LocalizationImage; 10 | 11 | namespace WooLocalization 12 | { 13 | [CustomEditor(typeof(LocalizationImage))] 14 | class LocalizationImageEditor : LocalizationBehaviorEditor 15 | { 16 | [LocalizationActorEditorAttribute] 17 | class ImageSpriteActorEditor : LocalizationMapActorEditor 18 | { 19 | 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationImageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b37c931d85b38348b75beb2d7223b9c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationPrefabEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | using static WooLocalization.LocalizationPrefab; 10 | 11 | namespace WooLocalization 12 | { 13 | 14 | [CustomEditor(typeof(LocalizationPrefab))] 15 | class LocalizationPrefabEditor : LocalizationBehaviorEditor 16 | { 17 | [LocalizationActorEditorAttribute] 18 | 19 | class PrefabActorEditor : LocalizationMapActorEditor 20 | { 21 | protected override bool NeedExecute() => false; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationPrefabEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e7718c480fd88848884dee77e3041d7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationTextEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | using static WooLocalization.LocalizationText; 10 | 11 | namespace WooLocalization 12 | { 13 | 14 | 15 | [CustomEditor(typeof(LocalizationText))] 16 | class LocalizationTextEditor : LocalizationBehaviorEditor 17 | { 18 | [LocalizationActorEditorAttribute] 19 | 20 | class TextFontActorEditor : LocalizationMapActorEditor 21 | { 22 | } 23 | [LocalizationActorEditorAttribute] 24 | class TextFontSizeActorEditor : LocalizationMapActorEditor 25 | { 26 | } 27 | [LocalizationActorEditorAttribute] 28 | class TextValueActorEditor : TextValueActor_BaseEditor 29 | { 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/Component/LocalizationTextEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 036f2ffbb03ad714d8f410e3818209cc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationActorEditorAttribute.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System; 8 | 9 | namespace WooLocalization 10 | { 11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 12 | public class LocalizationActorEditorAttribute : Attribute { } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationActorEditorAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7552117fcd9d3741ac1339793412c91 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationDataEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f6f611ec472f104196e4c76753222b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationEditor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 1.0 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-06-29 6 | *********************************************************************************/ 7 | 8 | using System.IO; 9 | using System.Linq; 10 | using UnityEditor; 11 | 12 | namespace WooLocalization 13 | { 14 | [UnityEditor.InitializeOnLoad] 15 | class LocalizationEditor 16 | { 17 | private const string ObjDir = "Assets/Editor"; 18 | 19 | private static string GetFilePath() 20 | { 21 | return AssetDatabase.GetAllAssetPaths().FirstOrDefault(x => x.Contains(nameof(WooLocalization)) 22 | && x.EndsWith($"{nameof(LocalizationEditor)}.cs")); 23 | } 24 | public static string pkgPath 25 | { 26 | get 27 | { 28 | string packagePath = Path.GetFullPath("Packages/com.woo.localization"); 29 | if (Directory.Exists(packagePath)) 30 | { 31 | return packagePath; 32 | } 33 | 34 | string path = GetFilePath(); 35 | var index = path.LastIndexOf("WooLocalization"); 36 | path = path.Substring(0, index + "WooLocalization".Length); 37 | return path; 38 | } 39 | } 40 | static LocalizationEditor() 41 | { 42 | if (!Directory.Exists(ObjDir)) 43 | Directory.CreateDirectory(ObjDir); 44 | Localization.SetRecorder(context); 45 | LocalizationBehavior.defaultContext = LocalizationSetting.defaultData; 46 | } 47 | internal static T LoadContext(string path) where T : UnityEngine.ScriptableObject 48 | { 49 | T _context; 50 | if (!System.IO.File.Exists(path)) 51 | { 52 | _context = LocalizationSetting.CreateInstance(); 53 | AssetDatabase.CreateAsset(_context, path); 54 | } 55 | else 56 | { 57 | _context = AssetDatabase.LoadAssetAtPath(path); 58 | } 59 | return _context; 60 | } 61 | internal static void SaveContext(T context) where T : UnityEngine.ScriptableObject 62 | { 63 | EditorUtility.SetDirty(context); 64 | AssetDatabase.SaveAssets(); 65 | AssetDatabase.Refresh(); 66 | } 67 | 68 | private static LocalizationSetting _context; 69 | internal static LocalizationSetting context 70 | { 71 | get 72 | { 73 | if (_context == null) 74 | { 75 | _context = LoadContext("Assets/Editor/LocalizationSetting.asset"); 76 | } 77 | return _context; 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65eeaacd0aa48424d907e4dc1d6e0b48 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationEditorHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf637db208e7fc0419b694a17495e7d6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationEditorUserData.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 1.0 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-06-29 6 | *********************************************************************************/ 7 | 8 | 9 | namespace WooLocalization 10 | { 11 | [System.Serializable] 12 | class LocalizationEditorUserData : UnityEngine.ScriptableObject 13 | { 14 | 15 | [UnityEngine.SerializeField] private string _lastCSVPath = "Assets"; 16 | [UnityEngine.SerializeField] private string _lastLocalizationDataPath = "Assets"; 17 | public static string lastCSVPath 18 | { 19 | get { return context._lastCSVPath; } 20 | set 21 | { 22 | if (context._lastCSVPath != value) 23 | { 24 | context._lastCSVPath = value; 25 | context.Save(); 26 | } 27 | 28 | } 29 | } 30 | public static string lastLocalizationDataPath 31 | { 32 | get { return context._lastLocalizationDataPath; } 33 | set 34 | { 35 | if (context._lastLocalizationDataPath != value) 36 | { 37 | context._lastLocalizationDataPath = value; 38 | context.Save(); 39 | } 40 | 41 | } 42 | } 43 | private void Save() 44 | { 45 | LocalizationEditor.SaveContext(this); 46 | } 47 | private static LocalizationEditorUserData _context; 48 | private static LocalizationEditorUserData context 49 | { 50 | get 51 | { 52 | if (_context == null) 53 | { 54 | _context = LocalizationEditor.LoadContext("Assets/Editor/LocalizationEditorUserData.asset"); 55 | } 56 | return _context; 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationEditorUserData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1829bde1a3a029478e7a02a5ce5656a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationSetting.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 1.0 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-06-29 6 | *********************************************************************************/ 7 | 8 | using UnityEditor; 9 | 10 | namespace WooLocalization 11 | { 12 | 13 | 14 | class LocalizationSetting : UnityEngine.ScriptableObject, ILocalizationPrefRecorder 15 | { 16 | 17 | 18 | private static LocalizationSetting context => LocalizationEditor.context; 19 | 20 | 21 | LocalizationPref ILocalizationPrefRecorder.Read() 22 | { 23 | return new LocalizationPref() 24 | { 25 | localizationType = localizationType, 26 | }; 27 | } 28 | 29 | void ILocalizationPrefRecorder.Write(LocalizationPref pref) 30 | { 31 | this._localizationType = pref.localizationType; 32 | Save(); 33 | } 34 | [UnityEngine.SerializeField] private string _localizationType = "CN"; 35 | [UnityEngine.SerializeField] private string _defaultData; 36 | [UnityEngine.SerializeField] private string _lineReg = "\""; 37 | [UnityEngine.SerializeField] private string _fieldReg = "\\G(?:^|,)(?:\"((?>[^\"]*)(?>\"\"[^\"]*)*)\"|([^\",]*))"; 38 | [UnityEngine.SerializeField] private string _quotesReg = "\"\""; 39 | [UnityEngine.SerializeField] private string _youDaoAppId = ""; 40 | [UnityEngine.SerializeField] private string _youDaoAppSecret = ""; 41 | 42 | [UnityEngine.SerializeField] private SerializableDictionary reflect = new SerializableDictionary(); 43 | 44 | 45 | private void Save() 46 | { 47 | LocalizationEditor.SaveContext(this); 48 | } 49 | 50 | public static string localizationType 51 | { 52 | get { return context._localizationType; } 53 | set 54 | { 55 | if (context._localizationType == value) return; 56 | context._localizationType = value; 57 | context.Save(); 58 | 59 | } 60 | } 61 | public static string lineReg 62 | { 63 | get { return context._lineReg; } 64 | set 65 | { 66 | if (context._lineReg == value) return; context._lineReg = value; 67 | context.Save(); 68 | } 69 | } 70 | public static string fieldReg 71 | { 72 | get { return context._fieldReg; } 73 | set 74 | { 75 | if (context._fieldReg == value) return; 76 | context._fieldReg = value; 77 | context.Save(); 78 | } 79 | } 80 | public static string quotesReg 81 | { 82 | get { return context._quotesReg; } 83 | set 84 | { 85 | if (context._quotesReg == value) return; 86 | context._quotesReg = value; 87 | context.Save(); 88 | } 89 | } 90 | public static string youDaoAppId 91 | { 92 | get { return context._youDaoAppId; } 93 | set 94 | { 95 | if (context._youDaoAppId == value) return; 96 | context._youDaoAppId = value; 97 | context.Save(); 98 | } 99 | } 100 | public static string youDaoAppSecret 101 | { 102 | get { return context._youDaoAppSecret; } 103 | set 104 | { 105 | if (context._youDaoAppSecret == value) return; 106 | context._youDaoAppSecret = value; 107 | context.Save(); 108 | } 109 | } 110 | 111 | private static LocalizationData __defaultData; 112 | public static LocalizationData defaultData 113 | { 114 | get 115 | { 116 | if (__defaultData == null) 117 | { 118 | __defaultData = AssetDatabase.LoadAssetAtPath(context._defaultData); 119 | } 120 | LocalizationBehavior.defaultContext = __defaultData; 121 | return __defaultData; 122 | } 123 | set 124 | { 125 | var path = AssetDatabase.GetAssetPath(value); 126 | if (context._defaultData == path) return; 127 | __defaultData = null; 128 | context._defaultData = path; 129 | 130 | context.Save(); 131 | LocalizationBehavior.defaultContext = __defaultData; 132 | 133 | } 134 | } 135 | 136 | 137 | public static string GetLocalizationTypeReflect(string src) 138 | { 139 | if (context.reflect.ContainsKey(src)) 140 | return context.reflect[src]; 141 | return src; 142 | } 143 | public static void SetLocalizationTypeReflect(string src, string dst) 144 | { 145 | if (context.reflect.ContainsKey(src)) 146 | context.reflect[src] = dst; 147 | else 148 | context.reflect.Add(src, dst); 149 | context.Save(); 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationSetting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02facdc7cf6749f47959bc9e742e80d8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationWindow.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 1.0 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-06-29 6 | *********************************************************************************/ 7 | using UnityEditor; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | 13 | class LocalizationWindow : EditorWindow 14 | { 15 | [MenuItem("Tools/Localization")] 16 | static void Open() 17 | { 18 | GetWindow(); 19 | } 20 | 21 | 22 | private void OnGUI() 23 | { 24 | EditorGUILayout.BeginVertical(EditorStyles.helpBox); 25 | EditorGUILayout.LabelField("CSV Regex"); 26 | LocalizationSetting.quotesReg = EditorGUILayout.TextField(nameof(LocalizationSetting.quotesReg), LocalizationSetting.quotesReg); 27 | LocalizationSetting.lineReg = EditorGUILayout.TextField(nameof(LocalizationSetting.lineReg), LocalizationSetting.lineReg); 28 | LocalizationSetting.fieldReg = EditorGUILayout.TextField(nameof(LocalizationSetting.fieldReg), LocalizationSetting.fieldReg); 29 | EditorGUILayout.EndVertical(); 30 | 31 | EditorGUILayout.BeginVertical(EditorStyles.helpBox); 32 | EditorGUILayout.LabelField("YouDao"); 33 | LocalizationSetting.youDaoAppId = EditorGUILayout.TextField(nameof(LocalizationSetting.youDaoAppId), LocalizationSetting.youDaoAppId); 34 | LocalizationSetting.youDaoAppSecret = EditorGUILayout.TextField(nameof(LocalizationSetting.youDaoAppSecret), LocalizationSetting.youDaoAppSecret); 35 | GUILayout.BeginHorizontal(); 36 | if (GUILayout.Button("Register")) 37 | { 38 | Application.OpenURL("https://ai.youdao.com/product-fanyi-text.s"); 39 | } 40 | if (GUILayout.Button("Code && Language")) 41 | { 42 | Application.OpenURL("https://ai.youdao.com/DOCSIRMA/html/trans/api/wbfy/index.html"); 43 | } 44 | 45 | GUILayout.EndHorizontal(); 46 | EditorGUILayout.EndVertical(); 47 | 48 | GUILayout.Space(10); 49 | GUILayout.BeginVertical(EditorStyles.helpBox); 50 | LocalizationSetting.defaultData = EditorGUILayout.ObjectField(nameof(LocalizationSetting.defaultData), LocalizationSetting.defaultData, typeof(LocalizationData), false) as LocalizationData; 51 | 52 | if (LocalizationSetting.defaultData) 53 | { 54 | var types = LocalizationSetting.defaultData.GetLocalizationTypes(); 55 | if (types.Count != 0) 56 | { 57 | var index = EditorGUILayout.Popup("LanguageType", types.IndexOf(LocalizationSetting.localizationType), types.ToArray()); 58 | Localization.SetLocalizationType(types[Mathf.Clamp(index, 0, types.Count)]); 59 | GUILayout.Label("Type Reflect", EditorStyles.boldLabel); 60 | for (var i = 0; i < types.Count; i++) 61 | { 62 | var type = types[i]; 63 | var src = LocalizationSetting.GetLocalizationTypeReflect(type); 64 | var tmp = EditorGUILayout.TextField(type, src); 65 | if (tmp != src) 66 | { 67 | LocalizationSetting.SetLocalizationTypeReflect(type, tmp); 68 | } 69 | } 70 | } 71 | 72 | 73 | } 74 | GUILayout.EndVertical(); 75 | GUILayout.Space(10); 76 | if (GUILayout.Button("Import TMP Extend")) 77 | { 78 | string path = $"{LocalizationEditor.pkgPath}/Package Resources/LocalizationTmp Extend.unitypackage"; 79 | AssetDatabase.ImportPackage(path, true); 80 | } 81 | } 82 | 83 | 84 | 85 | 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/LocalizationWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f65abd2a8933d7049b49fccb6a75d24f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/WooLocalization.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WooLocalization.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:3e443f0166b6d594db81ef692aaf6deb" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Assets/WooLocalization/Editor/WooLocalization.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e82d23f7cbf3644e9ab33f9c4641de8 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Package Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68b78e395dd5e2c40aa4574df2b4f919 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Package Resources/LocalizationTmp Extend.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OnClick9927/WooLocalization/6947da1d85c0ef17b2a755337c2ed2a9c8b97d20/Assets/WooLocalization/Package Resources/LocalizationTmp Extend.unitypackage -------------------------------------------------------------------------------- /Assets/WooLocalization/Package Resources/LocalizationTmp Extend.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c61d699ef85fd3c4ab3a7a124a8e5659 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e97c0dacb369644a8f63e6d83500b1c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 348f3ca94c313d045a58f88c2662587d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/ILocalizationActor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | namespace WooLocalization 9 | { 10 | public interface ILocalizationActor 11 | { 12 | bool canRemove { get; } 13 | string name { get; } 14 | bool enable { get; set; } 15 | void Execute(string localizationType, LocalizationBehavior component); 16 | void Execute(); 17 | void SetBehavior(LocalizationBehavior behavior); 18 | 19 | void OnAddComponent(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/ILocalizationActor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6eea6f67052efe34fbb95c5994069696 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/IMapActorContext.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | namespace WooLocalization 8 | { 9 | public interface IMapActorContext 10 | { 11 | Value GetValue(string localizationType, string key); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/IMapActorContext.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db0d9eb6ba91b2a488babe893e595b45 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/LocalizationActor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | public abstract class LocalizationActor : ILocalizationActor where T : LocalizationBehavior 13 | { 14 | [UnityEngine.SerializeField] private bool _enable = true; 15 | [UnityEngine.SerializeField] private string _name = string.Empty; 16 | [UnityEngine.SerializeField] private bool _canRemove = false; 17 | 18 | [System.NonSerialized] private string _localizationType; 19 | bool ILocalizationActor.enable 20 | { 21 | get => _enable; set 22 | { 23 | if (value != _enable) 24 | { 25 | _enable = value; 26 | if (value) 27 | { 28 | ((ILocalizationActor)this).Execute(); 29 | } 30 | } 31 | 32 | } 33 | } 34 | protected LocalizationActor(bool enable) 35 | { 36 | this._enable = enable; 37 | } 38 | protected T behavior { get; private set; } 39 | 40 | string ILocalizationActor.name => _name; 41 | 42 | public bool canRemove => _canRemove; 43 | 44 | public LocalizationActor SetCanRemove(bool canRemove) 45 | { 46 | _canRemove = canRemove; 47 | return this; 48 | } 49 | public LocalizationActor SetName(string name) 50 | { 51 | _name = name; 52 | return this; 53 | } 54 | void ILocalizationActor.Execute() 55 | { 56 | (this as ILocalizationActor).Execute(this.behavior.GetLocalizationType(), this.behavior); 57 | } 58 | void ILocalizationActor.SetBehavior(LocalizationBehavior behavior) 59 | { 60 | this.behavior = behavior as T; 61 | 62 | 63 | } 64 | protected virtual bool NeedExecute(string localizationType) 65 | { 66 | if (!((ILocalizationActor)this).enable) return false; 67 | #if UNITY_EDITOR 68 | if (Application.isPlaying) 69 | if (_localizationType == localizationType) 70 | return false; 71 | 72 | #else 73 | if (_localizationType == localizationType) return false; 74 | #endif 75 | return true; 76 | } 77 | void ILocalizationActor.Execute(string localizationType, LocalizationBehavior component) 78 | { 79 | if (!NeedExecute(localizationType)) return; 80 | _localizationType = localizationType; 81 | T behavior = component as T; 82 | if (behavior == null) return; 83 | BeforeExecute(localizationType); 84 | Execute(localizationType, behavior); 85 | } 86 | protected virtual void OnAddComponent() 87 | { 88 | 89 | } 90 | protected abstract void Execute(string localizationType, T component); 91 | protected virtual void BeforeExecute(string localizationType) { } 92 | 93 | void ILocalizationActor.OnAddComponent() => OnAddComponent(); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/LocalizationActor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fed3fbab93269b343b2b1658637daf3e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/LocalizationMapActor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using UnityEngine; 8 | 9 | namespace WooLocalization 10 | { 11 | 12 | public abstract class LocalizationMapActor : LocalizationActor where Behavior : LocalizationBehavior 13 | { 14 | [System.Serializable] 15 | public class MapContext : IMapActorContext 16 | { 17 | internal SerializableDictionary map => actor.map; 18 | internal LocalizationMapActor actor; 19 | public Value GetValue(string localizationType, string key) 20 | { 21 | Value v; 22 | map.TryGetValue(localizationType, out v); 23 | return v; 24 | } 25 | 26 | internal bool AddLocalizationTypeToMap(string localizationType, Value _default) 27 | { 28 | Value value; 29 | if (!map.TryGetValue(localizationType, out value)) 30 | { 31 | map.Add(localizationType, _default); 32 | return true; 33 | } 34 | return false; 35 | } 36 | } 37 | public enum Mode 38 | { 39 | Default, Custom 40 | } 41 | public SerializableDictionary map = new SerializableDictionary(); 42 | public Mode mode { get; private set; } 43 | public string key { get; private set; } 44 | 45 | 46 | [SerializeField] private MapContext context = new MapContext(); 47 | private IMapActorContext customContext; 48 | public string CustomContextType { get; private set; } 49 | public void SetCustomContext(IMapActorContext context, string key) 50 | { 51 | customContext = context; 52 | if (context != null) 53 | { 54 | CustomContextType = context.GetType().Name; 55 | mode = Mode.Custom; 56 | this.key = key; 57 | } 58 | } 59 | protected LocalizationMapActor(bool enable) : base(enable) 60 | { 61 | context.actor = this; 62 | } 63 | protected override void OnAddComponent() 64 | { 65 | context.actor = this; 66 | base.OnAddComponent(); 67 | } 68 | public bool AddLocalizationTypeToMap(string localizationType) 69 | { 70 | #if UNITY_EDITOR 71 | if (Application.isPlaying) 72 | return false; 73 | return context.AddLocalizationTypeToMap(localizationType, GetDefault()); 74 | #endif 75 | return false; 76 | } 77 | protected sealed override void BeforeExecute(string localizationType) 78 | { 79 | #if UNITY_EDITOR 80 | if (!Application.isPlaying) 81 | AddLocalizationTypeToMap(localizationType); 82 | #endif 83 | } 84 | protected virtual Value GetDefault() => default; 85 | public Value GetValue() 86 | { 87 | return GetValue(Localization.GetLocalizationType()); 88 | } 89 | public Value GetValue(string localizationType) 90 | { 91 | if (mode == Mode.Custom) 92 | return customContext.GetValue(localizationType, key); 93 | return context.GetValue(localizationType, key); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/LocalizationMapActor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58880bc08d632de4e98a2027a92447a4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/ObjectActor.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | namespace WooLocalization 9 | { 10 | [System.Serializable] 11 | public class ObjectActor : LocalizationMapActor 12 | { 13 | public ObjectActor(bool enable) : base(enable) 14 | { 15 | } 16 | protected override void Execute(string localizationType, LocalizationBehavior component) 17 | { 18 | 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/ObjectActor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fc9004296bbd514ab24af32db0ac707 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/TextValueActor_Base.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System; 8 | using System.Text.RegularExpressions; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | public abstract class TextValueActor_Base : LocalizationActor where T : LocalizationBehavior 14 | { 15 | public string key; 16 | private string _lastKey; 17 | public string[] formatArgs = new string[0]; 18 | 19 | public TextValueActor_Base(bool enable) : base(enable) 20 | { 21 | 22 | } 23 | protected abstract string GetComponentText(); 24 | protected abstract void SetComponentText(string value); 25 | 26 | protected sealed override void OnAddComponent() 27 | { 28 | if (string.IsNullOrEmpty(key)) 29 | { 30 | 31 | var txt = GetComponentText(); 32 | if (!string.IsNullOrEmpty(txt)) 33 | { 34 | var key = this.behavior.FindKey(Localization.localizationType, txt); 35 | if (!string.IsNullOrEmpty(key)) 36 | SetKey(key); 37 | } 38 | } 39 | } 40 | private static Regex regex = new Regex("^{[0-9]*}$"); 41 | 42 | public string GetTargetText(LocalizationBehavior component, out Exception err) 43 | { 44 | err = null; 45 | var format = component.GetLocalization(key); 46 | if (regex.Match(format) == null) return format; 47 | try 48 | { 49 | return string.Format(format, formatArgs); 50 | } 51 | catch (Exception ex) 52 | { 53 | err = ex; 54 | return format; 55 | } 56 | } 57 | protected sealed override void Execute(string localizationType, T component) 58 | { 59 | _lastKey = key; 60 | Exception err; 61 | SetComponentText(GetTargetText(component, out err)); 62 | if (err != null) 63 | throw err; 64 | } 65 | public void SetKey(string key) 66 | { 67 | this.key = key; 68 | ((ILocalizationActor)this).enable = true; 69 | ((ILocalizationActor)this).Execute(); 70 | } 71 | protected sealed override bool NeedExecute(string localizationType) 72 | { 73 | var _base = base.NeedExecute(localizationType); 74 | bool self = _lastKey != this.key; 75 | #if UNITY_EDITOR 76 | if (!Application.isPlaying) 77 | self = true; 78 | #endif 79 | return self || _base; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Actor/TextValueActor_Base.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 531732069b1ba1944a90e90d4fe255f5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cca2d0026e332584f8a70f73611b250f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationAssets.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using System.Collections.Generic; 9 | namespace WooLocalization 10 | { 11 | 12 | public class LocalizationAssets : LocalizationBehavior,IMapActorContext 13 | { 14 | 15 | public List> objects = new List>(); 16 | private Dictionary> objectMap = new Dictionary>(); 17 | public T GetObject(string localizationType, string key) 18 | { 19 | if (!objectMap.ContainsKey(key)) return default; 20 | var actor = objectMap[key]; 21 | return actor.GetValue(localizationType); 22 | } 23 | public T GetObject(string key) 24 | { 25 | if (!objectMap.ContainsKey(key)) return default; 26 | var actor = objectMap[key]; 27 | return actor.GetValue(); 28 | } 29 | public T GetValue(string localizationType, string key) => GetObject(localizationType, key); 30 | 31 | protected override void Awake() 32 | { 33 | base.Awake(); 34 | for (int i = 0; i < objects.Count; i++) 35 | { 36 | var obj = objects[i]; 37 | objectMap.Add((obj as ILocalizationActor).name, obj); 38 | } 39 | } 40 | protected override List GetActors() 41 | { 42 | var list = new List(); 43 | list.AddRange(objects); 44 | 45 | return list; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationAssets.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c9833c99b08f0446b7942e15a878515 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationBehavior.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | namespace WooLocalization 13 | { 14 | 15 | [ExecuteAlways] 16 | public abstract class LocalizationBehavior : MonoBehaviour, ILocalizationEventActor 17 | { 18 | [SerializeField] 19 | private LocalizationData _context; 20 | public LocalizationData context { get { return _context; } set { _context = value; } } 21 | 22 | public static LocalizationData defaultContext; 23 | public List GetLocalizationTypes() 24 | { 25 | if (_context == null) 26 | return Localization.GetLocalizationTypes(); 27 | return Localization.GetLocalizationTypes(_context); 28 | } 29 | public List GetLocalizationKeys() 30 | { 31 | if (_context == null) 32 | return Localization.GetLocalizationKeys(); 33 | return Localization.GetLocalizationKeys(_context); 34 | } 35 | public string GetLocalization(string key) 36 | { 37 | if (_context == null) 38 | return Localization.GetLocalization(key); 39 | return Localization.GetLocalization(_context, key); 40 | } 41 | public string GetLocalization(string type, string key) 42 | { 43 | if (_context == null) 44 | return Localization.GetLocalization(type, key); 45 | return Localization.GetLocalization(_context, type, key); 46 | } 47 | public string GetLocalizationType() 48 | { 49 | return Localization.GetLocalizationType(); 50 | } 51 | 52 | protected List actors { get; private set; } 53 | 54 | public void EnableAll(bool enable) 55 | { 56 | for (int i = 0; i < actors.Count; i++) 57 | { 58 | actors[i].enable = enable; 59 | } 60 | } 61 | 62 | public string FindKey(string type, string value) 63 | { 64 | if (_context != null) 65 | { 66 | var key = _context.FindKey(type, value); 67 | return key; 68 | } 69 | return string.Empty; 70 | } 71 | 72 | public List LoadActors() 73 | { 74 | actors = GetActors(); 75 | 76 | for (int i = 0; i < actors.Count; i++) 77 | { 78 | var actor = actors[i]; 79 | actor.SetBehavior(this); 80 | } 81 | #if UNITY_EDITOR 82 | OnAddComponent(); 83 | #endif 84 | return actors; 85 | } 86 | 87 | private void OnAddComponent() 88 | { 89 | for (int i = 0; i < actors.Count; i++) 90 | { 91 | var actor = actors[i]; 92 | actor.OnAddComponent(); 93 | } 94 | } 95 | 96 | protected virtual void Awake() 97 | { 98 | #if UNITY_EDITOR 99 | if (_context == null) 100 | _context = defaultContext; 101 | #endif 102 | LoadActors(); 103 | } 104 | 105 | 106 | 107 | 108 | protected void OnDisable() 109 | { 110 | Localization.RemoveHandler(this); 111 | } 112 | protected void OnEnable() 113 | { 114 | Localization.AddHandler(this); 115 | Execute(); 116 | } 117 | 118 | protected abstract List GetActors(); 119 | 120 | public void AddActor(ILocalizationActor actor) 121 | { 122 | if (actors.Contains(actor)) return; 123 | actors.Add(actor); 124 | actor.SetBehavior(this); 125 | actor.Execute(Localization.GetLocalizationType(), this); 126 | } 127 | public void RemoveActor(ILocalizationActor actor) 128 | { 129 | actors.Remove(actor); 130 | } 131 | void ILocalizationEventActor.OnLocalizationChange() 132 | { 133 | Execute(); 134 | } 135 | private void Execute() 136 | { 137 | #if UNITY_EDITOR 138 | if (!Application.isPlaying) 139 | { 140 | LoadActors(); 141 | } 142 | #endif 143 | var _type = Localization.GetLocalizationType(); 144 | for (int i = 0; i < actors.Count; i++) 145 | actors[i].Execute(_type, this); 146 | } 147 | 148 | 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationBehavior.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d8d5d31bba6a55438fd414b442e3f03 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationGraphic.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | namespace WooLocalization 13 | { 14 | [UnityEngine.RequireComponent(typeof(UnityEngine.UI.Graphic))] 15 | [DisallowMultipleComponent] 16 | public class LocalizationGraphic : LocalizationBehavior 17 | { 18 | [System.Serializable] 19 | public class GraphicColorActor : LocalizationMapActor 20 | { 21 | public GraphicColorActor(bool enable) : base(enable) 22 | { 23 | } 24 | 25 | 26 | 27 | protected override void Execute(string localizationType, LocalizationGraphic component) 28 | { 29 | component.graphic.color = GetValue(localizationType); 30 | 31 | } 32 | } 33 | [System.Serializable] 34 | public class GraphicMaterialActor : LocalizationMapActor 35 | { 36 | public SerializableDictionary materials = new SerializableDictionary(); 37 | 38 | public GraphicMaterialActor(bool enable) : base(enable) 39 | { 40 | } 41 | 42 | protected override void Execute(string localizationType, LocalizationGraphic component) 43 | { 44 | component.graphic.material = GetValue(localizationType); 45 | 46 | } 47 | 48 | protected override Material GetDefault() => UnityEngine.UI.Graphic.defaultGraphicMaterial; 49 | } 50 | [NonSerialized] private Graphic _graphic; 51 | public Graphic graphic 52 | { 53 | get 54 | { 55 | if (_graphic == null) 56 | { 57 | _graphic = GetComponent(); 58 | } 59 | return _graphic; 60 | } 61 | } 62 | public GraphicColorActor color = new GraphicColorActor(false); 63 | public GraphicMaterialActor material = new GraphicMaterialActor(false); 64 | 65 | 66 | protected override List GetActors() 67 | { 68 | return new List() { 69 | color,material, 70 | }; 71 | } 72 | } 73 | 74 | public class LocalizationGraphic : LocalizationGraphic where T : Graphic 75 | { 76 | [NonSerialized] private T _graphic; 77 | public T graphicT 78 | { 79 | 80 | get 81 | { 82 | 83 | if (_graphic == null) 84 | { 85 | _graphic = graphic as T; 86 | } 87 | return _graphic; 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationGraphic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3df24e1aa799f49419b7b549dfc13813 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationImage.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | [UnityEngine.RequireComponent(typeof(UnityEngine.UI.Image))] 13 | [DisallowMultipleComponent] 14 | public class LocalizationImage : LocalizationGraphic 15 | { 16 | 17 | [System.Serializable] 18 | public class ImageSpriteActor : LocalizationMapActor 19 | { 20 | public ImageSpriteActor(bool enable) : base(enable) 21 | { 22 | } 23 | 24 | 25 | 26 | protected override void Execute(string localizationType, LocalizationImage component) 27 | { 28 | component.graphicT.sprite = GetValue(localizationType); 29 | } 30 | } 31 | public ImageSpriteActor sprite = new ImageSpriteActor(true); 32 | 33 | protected override List GetActors() 34 | { 35 | var _base = base.GetActors(); 36 | _base.Add(sprite); 37 | return _base; 38 | 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b22d7c0c6904f474482df62e724ef632 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationPrefab.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | [DisallowMultipleComponent] 14 | public class LocalizationPrefab : LocalizationBehavior 15 | { 16 | [System.Serializable] 17 | 18 | public class PrefabActor : LocalizationMapActor 19 | { 20 | private GameObject ins; 21 | 22 | public PrefabActor(bool enable) : base(enable) 23 | { 24 | } 25 | 26 | protected override void Execute(string localizationType, LocalizationBehavior component) 27 | { 28 | #if UNITY_EDITOR 29 | if (!Application.isPlaying) return; 30 | 31 | var root = component.transform.root.GetChild(0).gameObject; 32 | 33 | if (UnityEditor.SceneManagement.EditorSceneManager.IsPreviewSceneObject(component)) return; 34 | #endif 35 | var prefab = GetValue(localizationType); 36 | if (prefab != null) 37 | { 38 | if (ins != null) 39 | { 40 | GameObject.Destroy(ins); 41 | ins = null; 42 | } 43 | 44 | ins = GameObject.Instantiate(prefab, component.transform); 45 | } 46 | 47 | } 48 | 49 | public void Create() 50 | { 51 | ((ILocalizationActor)this).enable = true; 52 | ((ILocalizationActor)this).Execute(); 53 | } 54 | 55 | 56 | } 57 | public PrefabActor prefab = new PrefabActor(true); 58 | protected override List GetActors() 59 | { 60 | return new List() { 61 | prefab 62 | }; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationPrefab.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9c789697b478d544a78bc3d664a6397 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationText.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | 10 | namespace WooLocalization 11 | { 12 | 13 | 14 | [UnityEngine.RequireComponent(typeof(UnityEngine.UI.Text))] 15 | [DisallowMultipleComponent] 16 | 17 | public class LocalizationText : LocalizationGraphic 18 | { 19 | [System.Serializable] 20 | public class TextFontActor : LocalizationMapActor 21 | { 22 | public TextFontActor(bool enable) : base(enable) 23 | { 24 | } 25 | 26 | protected override Font GetDefault() 27 | { 28 | #if UNITY_2023_1_OR_NEWER 29 | return Resources.GetBuiltinResource("LegacyRuntime.ttf"); 30 | #else 31 | return Resources.GetBuiltinResource("Arial.ttf"); 32 | #endif 33 | } 34 | 35 | protected override void Execute(string localizationType, LocalizationText component) 36 | { 37 | component.graphicT.font = GetValue(localizationType); 38 | } 39 | } 40 | [System.Serializable] 41 | public class TextValueActor : TextValueActor_Base 42 | { 43 | public TextValueActor(bool enable) : base(enable) { } 44 | protected override string GetComponentText() => this.behavior.graphicT.text; 45 | protected override void SetComponentText(string value) => this.behavior.graphicT.text = value; 46 | } 47 | [System.Serializable] 48 | public class TextFontSizeActor : LocalizationMapActor 49 | { 50 | public TextFontSizeActor(bool enable) : base(enable) 51 | { 52 | } 53 | 54 | protected override int GetDefault() => 14; 55 | 56 | protected override void Execute(string localizationType, LocalizationText component) 57 | { 58 | component.graphicT.fontSize = GetValue(localizationType); 59 | 60 | } 61 | } 62 | public TextValueActor text = new TextValueActor(true); 63 | public TextFontActor font = new TextFontActor(false); 64 | public TextFontSizeActor fontSize = new TextFontSizeActor(false); 65 | protected override List GetActors() 66 | { 67 | var _base = base.GetActors(); 68 | _base.Add(text); 69 | _base.Add(font); 70 | _base.Add(fontSize); 71 | return _base; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Component/LocalizationText.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d22fe7808e7abb948b1fd59db1a8e40a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/ILocalizationContext.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | namespace WooLocalization 9 | { 10 | public interface ILocalizationContext 11 | { 12 | string GetLocalization(string localizationType, string key); 13 | List GetLocalizationKeys(); 14 | List GetLocalizationTypes(); 15 | 16 | void Merge(ILocalizationContext context); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/ILocalizationContext.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82cd6c5d1026c614c92645228fed0102 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/ILocalizationPrefRecorder.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | namespace WooLocalization 8 | { 9 | public interface ILocalizationPrefRecorder 10 | { 11 | LocalizationPref Read(); 12 | void Write(LocalizationPref pref); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/ILocalizationPrefRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf0272fcb4f7cf34d91a9ac6e01c64e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Localization.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System; 8 | using System.Collections.Generic; 9 | namespace WooLocalization 10 | { 11 | public interface ILocalizationEventActor 12 | { 13 | void OnLocalizationChange(); 14 | } 15 | public static class Localization 16 | { 17 | public static string localizationType => pref.localizationType; 18 | public static ILocalizationContext context; 19 | private static LocalizationPref pref; 20 | private static ILocalizationPrefRecorder recorder = new MixedRecorder(); 21 | private static List handlers = new List(); 22 | 23 | public static void AddHandler(ILocalizationEventActor handler) => handlers.Add(handler); 24 | public static void RemoveHandler(ILocalizationEventActor handler) => handlers.Remove(handler); 25 | public static void SetRecorder(ILocalizationPrefRecorder recorder) 26 | { 27 | (Localization.recorder as MixedRecorder).Add(recorder); 28 | pref = Localization.recorder.Read(); 29 | } 30 | 31 | public static void SetDefaultLocalizationType(string type) 32 | { 33 | if (string.IsNullOrEmpty(localizationType)) 34 | SetLocalizationType(type); 35 | } 36 | public static void SetContext(ILocalizationContext context) => Localization.context = context; 37 | public static void MergeContext(ILocalizationContext context) 38 | { 39 | if (Localization.context == null) 40 | SetContext(context); 41 | else 42 | Localization.context.Merge(context); 43 | } 44 | public static void SetLocalizationType(string type) 45 | { 46 | if (localizationType == type) return; 47 | pref.localizationType = type; 48 | recorder.Write(pref); 49 | for (int i = 0; i < handlers.Count; i++) 50 | { 51 | var handler = handlers[i]; 52 | if (handler == null) continue; 53 | handler.OnLocalizationChange(); 54 | } 55 | } 56 | public static string GetLocalizationType() => pref.localizationType; 57 | 58 | 59 | public static List GetLocalizationTypes(ILocalizationContext context) 60 | { 61 | if (context == null) 62 | return null; 63 | return context.GetLocalizationTypes(); 64 | } 65 | public static List GetLocalizationKeys(ILocalizationContext context) 66 | { 67 | if (context == null) return null; 68 | return context.GetLocalizationKeys(); 69 | } 70 | 71 | public static List GetLocalizationTypes() => GetLocalizationTypes(context); 72 | public static List GetLocalizationKeys() => GetLocalizationKeys(context); 73 | 74 | public static string GetLocalization(ILocalizationContext context, string type, string key) 75 | { 76 | if (string.IsNullOrEmpty(key)) return string.Empty; 77 | if (context == null) return string.Empty; 78 | var restult = context.GetLocalization(type, key); 79 | if (string.IsNullOrEmpty(restult)) 80 | return key; 81 | return restult; 82 | } 83 | public static string GetLocalization(ILocalizationContext context, string key) => GetLocalization(context, localizationType, key); 84 | public static string GetLocalization(string type, string key) => GetLocalization(context, type, key); 85 | public static string GetLocalization(string key) => GetLocalization(context, key); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/Localization.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d684114ad288044abf1ff84b2790038 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/LocalizationData.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using UnityEngine; 10 | 11 | namespace WooLocalization 12 | { 13 | [CreateAssetMenu] 14 | public class LocalizationData : ScriptableObject, ILocalizationContext 15 | { 16 | [UnityEngine.SerializeField] 17 | private SerializableDictionary> map 18 | = new SerializableDictionary>(); 19 | 20 | 21 | [UnityEngine.SerializeField] 22 | private List keys = new List(); 23 | 24 | public string GetLocalization(string localizationType, string key) 25 | { 26 | if (!map.ContainsKey(localizationType)) return string.Empty; 27 | if (!map[localizationType].ContainsKey(key)) return string.Empty; 28 | return map[localizationType][key]; 29 | 30 | } 31 | 32 | public List GetLocalizationTypes() 33 | { 34 | return map.Keys.ToList(); 35 | } 36 | 37 | public List GetLocalizationKeys() 38 | { 39 | return keys; 40 | } 41 | public void Merge(ILocalizationContext context) 42 | { 43 | var types = context.GetLocalizationTypes(); 44 | var keys = context.GetLocalizationKeys(); 45 | for (var i = 0; i < types.Count; i++) 46 | { 47 | var type = types[i]; 48 | for (var j = 0; j < keys.Count; j++) 49 | { 50 | var key = keys[j]; 51 | var value = context.GetLocalization(type, key); 52 | Add(type, key, value); 53 | } 54 | } 55 | } 56 | public void Clear() 57 | { 58 | map.Clear(); 59 | keys.Clear(); 60 | } 61 | public void ClearLan(string lan) 62 | { 63 | if (map.ContainsKey(lan)) 64 | map.Remove(lan); 65 | 66 | if (map.Count == 0) 67 | Clear(); 68 | } 69 | public void Add(string lan, string key, string value) 70 | { 71 | SerializableDictionary dic = Add(lan); 72 | dic[key] = value; 73 | if (!keys.Contains(key)) { keys.Add(key); } 74 | } 75 | 76 | public SerializableDictionary Add(string lan) 77 | { 78 | SerializableDictionary dic; 79 | if (!map.TryGetValue(lan, out dic)) 80 | { 81 | dic = new SerializableDictionary(); 82 | map.Add(lan, dic); 83 | } 84 | return dic; 85 | } 86 | 87 | 88 | 89 | public void ClearKeys(IList list) 90 | { 91 | var lanTypes = this.GetLocalizationTypes(); 92 | for (int i = list.Count - 1; i >= 0; i--) 93 | { 94 | var key = list[i]; 95 | 96 | for (int j = 0; j < lanTypes.Count; j++) 97 | { 98 | var type = lanTypes[j]; 99 | map[type].Remove(key); 100 | } 101 | 102 | keys.Remove(key); 103 | } 104 | } 105 | 106 | 107 | public string FindKey(string localizationType, string val) 108 | { 109 | if (map.TryGetValue(localizationType, out var key_value)) 110 | { 111 | foreach (var item in key_value) 112 | { 113 | if (item.Value == val) 114 | { 115 | return item.Key; 116 | } 117 | } 118 | } 119 | return string.Empty; 120 | } 121 | 122 | 123 | } 124 | } 125 | 126 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/LocalizationData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6632ecebdeabf2a43a189d064c61ee43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/LocalizationPref.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | namespace WooLocalization 8 | { 9 | [System.Serializable] 10 | public class LocalizationPref 11 | { 12 | public string localizationType; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/LocalizationPref.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8538d580cbf2011448436ff57a9f9679 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/MixedRecorder.cs: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *Author: OnClick 3 | *Version: 0.1 4 | *UnityVersion: 2021.3.33f1c1 5 | *Date: 2024-04-25 6 | *********************************************************************************/ 7 | using System.Collections.Generic; 8 | 9 | namespace WooLocalization 10 | { 11 | class MixedRecorder : ILocalizationPrefRecorder 12 | { 13 | private List recorders = new List(); 14 | public void Add(ILocalizationPrefRecorder recorder) 15 | { 16 | if (recorders.Contains(recorder)) return; 17 | recorders.Add(recorder); 18 | } 19 | LocalizationPref ILocalizationPrefRecorder.Read() 20 | { 21 | return recorders[0].Read(); 22 | } 23 | 24 | void ILocalizationPrefRecorder.Write(LocalizationPref pref) 25 | { 26 | for (int i = 0; i < recorders.Count; i++) 27 | { 28 | recorders[i].Write(pref); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/MixedRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5627b0b1f92bc7040af87972cac068fe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/SerializableDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02ed99728b022b343bd62aa75b928b71 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/WooLocalization.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WooLocalization" 3 | } 4 | -------------------------------------------------------------------------------- /Assets/WooLocalization/Runtime/WooLocalization.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e443f0166b6d594db81ef692aaf6deb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WooLocalization/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.woo.localization", 3 | "displayName": "WooLocalization", 4 | "version": "1.0.20", 5 | "unity": "2019.4", 6 | "description": "localization", 7 | "type": "library", 8 | "author": { 9 | "name": "woo", 10 | "email": "2809399366@qq.com", 11 | "url": "https://github.com/OnClick9927" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/WooLocalization/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac24b084e29eefa4f909d4de0e537146 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ide.visualstudio": "2.0.22", 4 | "com.unity.ide.vscode": "1.2.5", 5 | "com.unity.textmeshpro": "3.0.6", 6 | "com.unity.ugui": "1.0.0", 7 | "com.unity.modules.ai": "1.0.0", 8 | "com.unity.modules.androidjni": "1.0.0", 9 | "com.unity.modules.animation": "1.0.0", 10 | "com.unity.modules.assetbundle": "1.0.0", 11 | "com.unity.modules.audio": "1.0.0", 12 | "com.unity.modules.cloth": "1.0.0", 13 | "com.unity.modules.director": "1.0.0", 14 | "com.unity.modules.imageconversion": "1.0.0", 15 | "com.unity.modules.imgui": "1.0.0", 16 | "com.unity.modules.jsonserialize": "1.0.0", 17 | "com.unity.modules.particlesystem": "1.0.0", 18 | "com.unity.modules.physics": "1.0.0", 19 | "com.unity.modules.physics2d": "1.0.0", 20 | "com.unity.modules.screencapture": "1.0.0", 21 | "com.unity.modules.terrain": "1.0.0", 22 | "com.unity.modules.terrainphysics": "1.0.0", 23 | "com.unity.modules.tilemap": "1.0.0", 24 | "com.unity.modules.ui": "1.0.0", 25 | "com.unity.modules.uielements": "1.0.0", 26 | "com.unity.modules.umbra": "1.0.0", 27 | "com.unity.modules.unityanalytics": "1.0.0", 28 | "com.unity.modules.unitywebrequest": "1.0.0", 29 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 30 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 31 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 32 | "com.unity.modules.unitywebrequestwww": "1.0.0", 33 | "com.unity.modules.vehicles": "1.0.0", 34 | "com.unity.modules.video": "1.0.0", 35 | "com.unity.modules.vr": "1.0.0", 36 | "com.unity.modules.wind": "1.0.0", 37 | "com.unity.modules.xr": "1.0.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## upm 添加包地址 https://github.com/OnClick9927/WooLocalization.git#upm 2 | ## upm 添加包地址 https://gitee.com/OnClick9927/WooLocalization.git#upm 3 | 4 | [![Stargazers over time](https://starchart.cc/OnClick9927/WooLocalization.svg?variant=adaptive)](https://starchart.cc/OnClick9927/WooLocalization) 5 | 6 | # WooLocalization [Doc](https://onclick9927.github.io/2024/10/26/Doc/WooLocalization/1-WooLocalization-%E7%AE%80%E4%BB%8B) 7 | 8 | * 支持 文本/图片/特效/预制体/继承自UnityEngine.Object 本地化 9 | * 提供本地化组件(支持挖孔的文本,支持多种属性变化) 10 | * 支持一键翻译 11 | * 支持无限多语言类型 12 | * 支持扩展自定义本地化 13 | * 支持导入导出自定义本地化文件 14 | * 支持编辑器增加/检查/删除/修改 本地化 Key/语言 15 | * 支持编辑器下预览语言切换 16 | 17 | var value = Localization.GetLocalization(key) 18 | 19 | ![image](https://github.com/user-attachments/assets/2a20e84d-f32f-4b68-bd78-adf5e1f05114) 20 | {07D30E9E-D075-415C-B34A-FF629DC95346} 21 | 22 | ![image](https://github.com/user-attachments/assets/77d0f733-740d-4176-8144-6739b9b9d29f) 23 | ![image](https://github.com/user-attachments/assets/9b552a48-22c4-40bb-8028-6e3b0eb14e6b) 24 | 25 | 26 | 27 | ![image](https://github.com/user-attachments/assets/f836a65d-7010-4d31-9789-d7da55368254) 28 | ![image](https://github.com/user-attachments/assets/71a722bd-4ce7-41d5-a68c-d5d16d263bbb) 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /制作src分支.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set b="version" 3 | set version ="1" 4 | REM 获取版本号 5 | for /f "tokens=1,2* delims=:," %%a in (Assets/WooLocalization/package.json) do ( 6 | echo %%a| findstr %b% >nul && ( 7 | set version= %%b 8 | ) || ( 9 | @REM echo %%a nnn %b% 10 | ) 11 | ) 12 | 13 | 14 | set version=%version: =% 15 | echo on 16 | git subtree split --prefix=Assets/WooLocalization --branch upm 17 | git push origin upm:upm 18 | git tag %version% upm 19 | git push origin upm --tags 20 | pause --------------------------------------------------------------------------------