PJ/Assets/scripts/Localisation.cs

47 lines
1.2 KiB
C#
Executable file

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class Localisation : MonoBehaviour
{
public int LanguageID;
public Sprite[] Image;
public int Type;
private TMP_Text textLine;
private Text TextN;
public string[] text;
private void Start()
{
LanguageID = PlayerPrefs.GetInt("LanguageID");
switch (Type)
{
case 0:
textLine = GetComponent<TMP_Text>();
textLine.text = "" + text[LanguageID];
break;
case 1:
SpriteRenderer S = GetComponent<SpriteRenderer>();
S.sprite = Image[LanguageID];
break;
case 2:
TextN = GetComponent<Text>();
TextN.text = "" + text[LanguageID];
break;
case 3:
Image I = GetComponent<Image>();
I.sprite = Image[LanguageID];
break;
}
}
public void ForSettings()
{
LanguageID = PlayerPrefs.GetInt("LanguageID");
textLine.text = "" + text[LanguageID];
}
}