diff options
| author | Andrew Lee <alee14498@gmail.com> | 2019-11-03 18:31:04 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@gmail.com> | 2019-11-03 18:31:04 -0500 |
| commit | e8dd5d4fd406e6e6b710cbe85309f6870bccc37a (patch) | |
| tree | db0e99cfdbefb1625d66d07631f43565ae8ff41f /Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs | |
| parent | 20b14c9a89821e6592bf25bed9329a5abe20495c (diff) | |
| download | Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.tar.gz Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.tar.bz2 Unicity-e8dd5d4fd406e6e6b710cbe85309f6870bccc37a.zip | |
Remove everything
Diffstat (limited to 'Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs')
| -rw-r--r-- | Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs b/Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs deleted file mode 100644 index 4163464..0000000 --- a/Assets/Packages/Lean/Localization/Scripts/LeanLocalizedBehaviour.cs +++ /dev/null @@ -1,121 +0,0 @@ -using UnityEngine; -using UnityEngine.Serialization; -using System.Collections.Generic; -using Lean.Common; -#if UNITY_EDITOR -using UnityEditor; - -namespace Lean.Localization -{ - [CanEditMultipleObjects] - [CustomEditor(typeof(LeanLocalizedBehaviour), true)] - public class LeanLocalizedBehaviour_Inspector : LeanInspector<LeanLocalizedBehaviour> - { - } -} -#endif - -namespace Lean.Localization -{ - /// <summary>This component simplifies the updating process, extend it if you want to cause a specific object to get localized</summary> - public abstract class LeanLocalizedBehaviour : MonoBehaviour - { - [Tooltip("The name of the phrase we want to use for this localized component")] - [SerializeField] - [LeanTranslationName] - [FormerlySerializedAs("phraseName")] - [FormerlySerializedAs("translationTitle")] - private string translationName; - - [System.NonSerialized] - private HashSet<LeanToken> tokens; - - /// <summary>This is the name of the translation this script uses.</summary> - public string TranslationName - { - set - { - if (translationName != value) - { - translationName = value; - - UpdateLocalization(); - } - } - - get - { - return translationName; - } - } - - public void Register(LeanToken token) - { - if (token != null) - { - if (tokens == null) - { - tokens = new HashSet<LeanToken>(); - } - - tokens.Add(token); - } - } - - public void Unregister(LeanToken token) - { - if (tokens != null) - { - tokens.Remove(token); - } - } - - public void UnregisterAll() - { - if (tokens != null) - { - foreach (var token in tokens) - { - token.Unregister(this); - } - - tokens.Clear(); - } - } - - // This gets called every time the translation needs updating - // NOTE: translation may be null if it can't be found - public abstract void UpdateTranslation(LeanTranslation translation); - - /// <summary>If you call this then this component will update using the translation for the specified phrase.</summary> - [ContextMenu("Update Localization")] - public void UpdateLocalization() - { - UpdateTranslation(LeanLocalization.GetTranslation(translationName)); - } - - protected virtual void OnEnable() - { - LeanLocalization.OnLocalizationChanged += UpdateLocalization; - - UpdateLocalization(); - } - - protected virtual void OnDisable() - { - LeanLocalization.OnLocalizationChanged -= UpdateLocalization; - - UnregisterAll(); - } - -#if UNITY_EDITOR - protected virtual void OnValidate() - { - if (isActiveAndEnabled == true) - { - UpdateLocalization(); - } - } -#endif - } -}
\ No newline at end of file |
