Example #1
0
    public void EnableHud()
    {
        _TransformSettingHud.gameObject.SetActive(true);

        if (PlayerData.IsRemoveAds)
        {
            _RestorePurchaseBtn.interactable = false;
        }
        else
        {
            _RestorePurchaseBtn.interactable = true;
        }

        #if UNITY_ANDROID
        _RestorePurchaseBtn.interactable = false;
        #endif

        RefreshMusicUI(false);
        RefreshSoundUI(false);
        RefreshBatterySaver(false);
        RefreshNotificationUI(false);

        _IconLanguage.sprite = _LanguageIcon.GetIcon(LanguageEnums.GetLanguageId(PlayerData.DefaultLanguage));

        RefreshLanguage();
    }
Example #2
0
    public void InitButton()
    {
        _ListLanguages = new List <Button> ();

        var support_language = ApplicationLanguage.Instance.GetSupportLanguage();

        for (int i = 0; i < support_language.Count; i++)
        {
            var prefab = Instantiate(_TransformButtonLanguage.gameObject, _GroupButtonLanguage);

            var item = prefab.GetComponent <Button> ();

            if (item == null)
            {
                continue;
            }

            string language_code = support_language[i].languageCode;
            int    instanceId    = item.GetInstanceID();

            item.image.sprite = _LanguageIcon.GetIcon(LanguageEnums.GetLanguageId(language_code));

            item.onClick.AddListener(() =>
            {
                ApplicationLanguage.Instance.ChangeLanguage(language_code);
                ApplicationLanguage.Instance.PlayAudioSound(AudioEnums.SoundId.TapOnButton);

                Instance.InstanceId = instanceId;
                Instance.RefreshItem();
                Instance.RefreshLanguage();
            });

            _ListLanguages.Add(item);

            if (string.CompareOrdinal(PlayerData.DefaultLanguage, language_code) == 0)
            {
                InstanceId = instanceId;
            }
        }

        _TransformButtonLanguage.gameObject.SetActive(false);

        RefreshItem();
    }