TouhouLS/TouhouStation/Assets/RealCode/Menu/ButtonS/ButtonSwitchLanguages.cs

23 lines
698 B
C#
Raw Normal View History

2020-08-22 05:29:00 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonSwitchLanguages : ButtonOnClick {
private void Awake() {
Localization.SelectedLanguage = (LocalizationLanguage)PlayerPrefs.GetInt("lang", 0);
}
public override void OnClick() {
Localization.SelectedLanguage = Localization.SelectedLanguage == LocalizationLanguage.English ? LocalizationLanguage.Japanese : LocalizationLanguage.English;
PlayerPrefs.SetInt("lang", (int)Localization.SelectedLanguage);
Localization.RebuildKeyDictionary();
var injector = FindObjectsOfType<LocalizationButtonInjector>();
foreach(var i in injector){
i.UpdateText();
}
}
}