aboutsummaryrefslogtreecommitdiff
path: root/Assets/Packages/Lean/Localization/Scripts/Behaviours
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Packages/Lean/Localization/Scripts/Behaviours')
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs47
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs.meta8
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs48
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs.meta8
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs55
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs.meta12
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs47
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs.meta8
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs48
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs.meta8
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs48
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs.meta12
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs46
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs.meta13
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs46
-rw-r--r--Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs.meta13
16 files changed, 0 insertions, 467 deletions
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs
deleted file mode 100644
index 7b45595..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using UnityEngine;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update an AudioSource component with localized text, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(AudioSource))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedAudioSource")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized AudioSource")]
- public class LeanLocalizedAudioSource : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this clip will be used")]
- public AudioClip FallbackAudioClip;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the AudioSource component attached to this GameObject
- var audioSource = GetComponent<AudioSource>();
-
- // Use translation?
- if (translation != null && translation.Data is AudioClip)
- {
- audioSource.clip = (AudioClip)translation.Data;
- }
- // Use fallback?
- else
- {
- audioSource.clip = FallbackAudioClip;
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackAudioClip?
- if (FallbackAudioClip == null)
- {
- // Get the AudioSource component attached to this GameObject
- var audioSource = GetComponent<AudioSource>();
-
- // Copy current sprite to fallback
- FallbackAudioClip = audioSource.clip;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs.meta
deleted file mode 100644
index 479d2ca..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedAudioSource.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 4bbcd1203ed53d54e9a127af382c0181
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs
deleted file mode 100644
index 664ec95..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update an Image component with a localized sprite, or use a fallback if none is found</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(Image))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedImage")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized Image")]
- public class LeanLocalizedImage : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this sprite will be used")]
- public Sprite FallbackSprite;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the Image component attached to this GameObject
- var image = GetComponent<Image>();
-
- // Use translation?
- if (translation != null && translation.Data is Sprite)
- {
- image.sprite = (Sprite)translation.Data;
- }
- // Use fallback?
- else
- {
- image.sprite = FallbackSprite;
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackSprite?
- if (FallbackSprite == null)
- {
- // Get the SpriteRenderer component attached to this GameObject
- var spriteRenderer = GetComponent<Image>();
-
- // Copy current sprite to fallback
- FallbackSprite = spriteRenderer.sprite;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs.meta
deleted file mode 100644
index b7be84d..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedImage.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 5b28f7e33d1e3e0408d7ff2c8a92a650
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs
deleted file mode 100644
index 701e538..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using UnityEngine;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a Renderer component's sharedMaterial with a localized material, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(Renderer))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedRenderer")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized Renderer")]
- public class LeanLocalizedRenderer : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this material will be used")]
- public Material FallbackMaterial;
-
- [Tooltip("The material index you want to replace.")]
- public int Index;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the Renderer component attached to this GameObject
- var renderer = GetComponent<Renderer>();
-
- // Get the shared materials of this component
- var sharedMaterials = renderer.sharedMaterials;
-
- // Use translation?
- if (translation != null && translation.Data is Material)
- {
- sharedMaterials[Index] = (Material)translation.Data;
- }
- // Use fallback?
- else
- {
- sharedMaterials[Index] = FallbackMaterial;
- }
-
- renderer.sharedMaterials = sharedMaterials;
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackFont?
- if (FallbackMaterial == null)
- {
- // Get the Renderer component attached to this GameObject
- var renderer = GetComponent<Renderer>();
-
- // Copy current material to fallback
- FallbackMaterial = renderer.sharedMaterials[Index];
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs.meta
deleted file mode 100644
index 4fcb5ed..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedRenderer.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: b42c83c3c333a7e4a8e498fec50ce1fb
-timeCreated: 1478133615
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs
deleted file mode 100644
index e1170b0..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using UnityEngine;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a SpriteRenderer component with a localized sprite, or use a fallback if none is found</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(SpriteRenderer))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedSpriteRenderer")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized SpriteRenderer")]
- public class LeanLocalizedSpriteRenderer : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this sprite will be used")]
- public Sprite FallbackSprite;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the SpriteRenderer component attached to this GameObject
- var spriteRenderer = GetComponent<SpriteRenderer>();
-
- // Use translation?
- if (translation != null && translation.Data is Sprite)
- {
- spriteRenderer.sprite = (Sprite)translation.Data;
- }
- // Use fallback?
- else
- {
- spriteRenderer.sprite = FallbackSprite;
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackSprite?
- if (FallbackSprite == null)
- {
- // Get the SpriteRenderer component attached to this GameObject
- var spriteRenderer = GetComponent<SpriteRenderer>();
-
- // Copy current sprite to fallback
- FallbackSprite = spriteRenderer.sprite;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs.meta
deleted file mode 100644
index 84485b2..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedSpriteRenderer.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 84f599809c9879044b69f17af8c248c6
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs
deleted file mode 100644
index df63743..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a UI.Text component with localized text, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(Text))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedText")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized Text")]
- public class LeanLocalizedText : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this text will be used")]
- public string FallbackText;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the Text component attached to this GameObject
- var text = GetComponent<Text>();
-
- // Use translation?
- if (translation != null && translation.Data is string)
- {
- text.text = LeanTranslation.FormatText((string)translation.Data, text.text, this);
- }
- // Use fallback?
- else
- {
- text.text = LeanTranslation.FormatText(FallbackText, text.text, this);
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackText?
- if (string.IsNullOrEmpty(FallbackText) == true)
- {
- // Get the Text component attached to this GameObject
- var text = GetComponent<Text>();
-
- // Copy current text to fallback
- FallbackText = text.text;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs.meta
deleted file mode 100644
index 8b76311..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedText.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 7ee4021ce59f313499a5cab041f02aba
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs
deleted file mode 100644
index 6730956..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a Text component's Font with a localized font, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(Text))]
- [HelpURL(LeanLocalization.HelpUrlPrefix + "LeanLocalizedTextFont")]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized TextFont")]
- public class LeanLocalizedTextFont : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this font will be used")]
- public Font FallbackFont;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the Text component attached to this GameObject
- var text = GetComponent<Text>();
-
- // Use translation?
- if (translation != null && translation.Data is Font)
- {
- text.font = (Font)translation.Data;
- }
- // Use fallback?
- else
- {
- text.font = FallbackFont;
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackFont?
- if (FallbackFont == null)
- {
- // Get the Text component attached to this GameObject
- var text = GetComponent<Text>();
-
- // Copy current font to fallback
- FallbackFont = text.font;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs.meta
deleted file mode 100644
index 5b0ceea..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextFont.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: fce53ba05f9c84246b062afd12f4619f
-timeCreated: 1478133615
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs
deleted file mode 100644
index c9fcbc6..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using UnityEngine;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a TMPro.TextMeshProUGUI component with localized text, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(TextMesh))]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized TextMesh")]
- public class LeanLocalizedTextMesh : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this text will be used")]
- public string FallbackText;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the TextMeshProUGUI component attached to this GameObject
- var text = GetComponent<TextMesh>();
-
- // Use translation?
- if (translation != null && translation.Data is string)
- {
- text.text = LeanTranslation.FormatText((string)translation.Data, text.text, this);
- }
- // Use fallback?
- else
- {
- text.text = LeanTranslation.FormatText(FallbackText, text.text, this);
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackText?
- if (string.IsNullOrEmpty(FallbackText) == true)
- {
- // Get the TextMeshProUGUI component attached to this GameObject
- var text = GetComponent<TextMesh>();
-
- // Copy current text to fallback
- FallbackText = text.text;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs.meta
deleted file mode 100644
index 6af3498..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMesh.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: 365897690d9e7c54f9fd65401bffb0d3
-timeCreated: 1561293177
-licenseType: Store
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs
deleted file mode 100644
index a0046a7..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using UnityEngine;
-
-namespace Lean.Localization
-{
- /// <summary>This component will update a TextMesh component's Font with a localized font, or use a fallback if none is found.</summary>
- [ExecuteInEditMode]
- [DisallowMultipleComponent]
- [RequireComponent(typeof(TextMesh))]
- [AddComponentMenu(LeanLocalization.ComponentPathPrefix + "Localized TextMesh Font")]
- public class LeanLocalizedTextMeshFont : LeanLocalizedBehaviour
- {
- [Tooltip("If PhraseName couldn't be found, this font asset will be used")]
- public Font FallbackFont;
-
- // This gets called every time the translation needs updating
- public override void UpdateTranslation(LeanTranslation translation)
- {
- // Get the TextMesh component attached to this GameObject
- var text = GetComponent<TextMesh>();
-
- // Use translation?
- if (translation != null && translation.Data is Font)
- {
- text.font = (Font)translation.Data;
- }
- // Use fallback?
- else
- {
- text.font = FallbackFont;
- }
- }
-
- protected virtual void Awake()
- {
- // Should we set FallbackFont?
- if (FallbackFont == null)
- {
- // Get the TextMesh component attached to this GameObject
- var text = GetComponent<TextMesh>();
-
- // Copy current text to fallback
- FallbackFont = text.font;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs.meta b/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs.meta
deleted file mode 100644
index d8c179f..0000000
--- a/Assets/Packages/Lean/Localization/Scripts/Behaviours/LeanLocalizedTextMeshFont.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: 3904cf0d2d9103140ab648dbbee38d3f
-timeCreated: 1561293177
-licenseType: Store
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant: