LanguigeManager.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using ICTS.Localization;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class LanguigeManager : MonoBehaviour
  6. {
  7. public ScreenBase ScrrenLanguage;
  8. // Use this for initialization
  9. public LoadingBackgroundSpermsManager LoadingBackgroundSpermsManager;
  10. public Loader Loader;
  11. void Start()
  12. {
  13. //PlayerPrefs.DeleteAll();
  14. //PlayerPrefs.Save();
  15. var l = PlayerPrefs.GetString("LanguageSelect");
  16. Debug.Log(l);
  17. if (string.IsNullOrEmpty(l))
  18. {
  19. ScrrenLanguage.Show();
  20. LoadingBackgroundSpermsManager.enabled = false;
  21. Loader.enabled = false;
  22. return;
  23. }
  24. if (l == "Denmark")
  25. {
  26. if (Localization.instance != null)
  27. {
  28. Localization.instance.currentLanguage = "Denmark";
  29. }
  30. }
  31. else
  32. {
  33. if (Localization.instance != null)
  34. {
  35. Localization.instance.currentLanguage = "Icelandic";
  36. }
  37. }
  38. ScrrenLanguage.Hide();
  39. LoadingBackgroundSpermsManager.enabled = true;
  40. Loader.enabled = true;
  41. }
  42. void OnDenmark () {
  43. ScrrenLanguage.Hide();
  44. if (Localization.instance != null)
  45. {
  46. Localization.instance.currentLanguage = "Denmark";
  47. }
  48. LoadingBackgroundSpermsManager.enabled = true;
  49. Loader.enabled = true;
  50. PlayerPrefs.SetString("LanguageSelect", "Denmark");
  51. PlayerPrefs.Save();
  52. }
  53. void OnIcelandic () {
  54. ScrrenLanguage.Hide();
  55. if (Localization.instance != null)
  56. {
  57. Localization.instance.currentLanguage = "Icelandic";
  58. }
  59. LoadingBackgroundSpermsManager.enabled = true;
  60. Loader.enabled = true;
  61. PlayerPrefs.SetString("LanguageSelect", "Icelandic");
  62. PlayerPrefs.Save();
  63. }
  64. }