/
crypt
/
SnowBallRefactoring
Обзор
Документация
Войти
/
crypt
/
SnowBallRefactoring
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Scripts/vibrate.cs
53 строки
2 KB
crypt
Мой первый проект. Старт рефакторинга.
21 июл 2026, 18:23
21 июл 2026, 18:23
bef234c
Код
Авторство
О чём код?
using UnityEngine; using System.Collections; using UnityEngine.UI; public class vibrate : MonoBehaviour { public Sprite rus_on, rus_off, eng_on, eng_off; int isVibrate; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (PlayerPrefs.GetInt("langID") == 1 && PlayerPrefs.GetInt("isVibrate") == 1) gameObject.GetComponent<Image>().sprite = rus_on; if (PlayerPrefs.GetInt("langID") == 1 && PlayerPrefs.GetInt("isVibrate") == 2) gameObject.GetComponent<Image>().sprite = rus_off; if (PlayerPrefs.GetInt("langID") == 2 && PlayerPrefs.GetInt("isVibrate") == 2) gameObject.GetComponent<Image>().sprite = eng_off; if (PlayerPrefs.GetInt("langID") == 2 && PlayerPrefs.GetInt("isVibrate") == 1) gameObject.GetComponent<Image>().sprite = eng_on; } //1-on,2-off public void SwitchVibro() { isVibrate++; if (isVibrate > 2) isVibrate = 1; if (isVibrate< 1) isVibrate = 1; PlayerPrefs.SetInt("isVibrate", isVibrate); if (PlayerPrefs.GetInt("langID") == 1 && PlayerPrefs.GetInt("isVibrate") == 1) gameObject.GetComponent<Image>().sprite = rus_on; if (PlayerPrefs.GetInt("langID") == 1 && PlayerPrefs.GetInt("isVibrate") == 2) gameObject.GetComponent<Image>().sprite = rus_off; if (PlayerPrefs.GetInt("langID") == 2 && PlayerPrefs.GetInt("isVibrate") == 2) gameObject.GetComponent<Image>().sprite = eng_off; if (PlayerPrefs.GetInt("langID") == 2 && PlayerPrefs.GetInt("isVibrate") == 1) gameObject.GetComponent<Image>().sprite = eng_on; } }