aboutsummaryrefslogtreecommitdiff
path: root/Assets/Packages/Lean/Localization/Scripts/LeanSource.cs
blob: 748024503e64d24cf8aad00e55c885d1426f3cc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;
using System.Collections.Generic;

namespace Lean.Localization
{
	/// <summary>This is the interface used for all translation sources. When a translation source is built, it will populate the LeanLocalization class with its translation data.</summary>
	public abstract class LeanSource : MonoBehaviour
	{
		public static LinkedList<LeanSource> Instances = new LinkedList<LeanSource>();

		[System.NonSerialized]
		private LinkedListNode<LeanSource> node;

		public abstract void Compile(string primaryLanguage, string secondaryLanguage);

		protected virtual void OnEnable()
		{
			node = Instances.AddLast(this);

			LeanLocalization.DelayUpdateTranslations();
		}

		protected virtual void OnDisable()
		{
			Instances.Remove(node);

			LeanLocalization.DelayUpdateTranslations();
		}
	}
}