private void Start() { isPress = 0; pressDown = 0; pressUp = 0; currentVolume = 0; source = GetComponent <AudioSource>(); maxVol = source.volume; rec = GetComponent <RectTransform>(); volume[0] = () => { }; volume[1] = () => { pressUp = Input.mousePosition.x; float offset = pressUp - pressDown; float delta = 1.2f; float futurePos = rec.localPosition.x + offset * delta; if (futurePos >= min && futurePos <= max) { rec.localPosition += new Vector3(offset * delta, 0, 0); } pressDown = pressUp; }; rec.localPosition = new Vector3(max, rec.localPosition.y, rec.localPosition.z); if (PlayerPrefs.HasKey("Volume")) { float vol = PlayerPrefs.GetFloat("Volume"); TapToExit.SetupVolume(vol); Conecting.Volume = vol; float range = max - min; float soundVolume = range * vol; rec.localPosition = new Vector3(min + soundVolume, rec.localPosition.y, rec.localPosition.z); } else { TapToExit.SetupVolume(1); PlayerPrefs.SetFloat("Volume", 1); Conecting.Volume = 1; } if (PlayerPrefs.HasKey("Music")) { Conecting.Music = PlayerPrefs.GetInt("Music"); StartCoroutine(CheckBoxMusic.box[Conecting.Music]()); if (PlayerPrefs.GetInt("Music") == 1) { check.SetActive(true); line.SetActive(true); } // Так должно быть(без else) } else { Conecting.Music = 1; check.SetActive(true); line.SetActive(true); PlayerPrefs.SetInt("Music", 1); } }
public void GoToNewScene() { frame.SetActive(true); TapToExit.SetDefaultValue(); TapToSettings.SetDefaultValue(); LoadToPlayingScene.progress(number); }
private void OnMouseDown() { TapToExit.PlayClip(); Conecting.Language = 1 - Conecting.Language; GetComponent <Image>().sprite = lang[Conecting.Language]; PlayerPrefs.SetInt("Language", Conecting.Language); SetLanguage(); }
private void OnMouseDown() { TapToExit.PlayClip(); check.SetActive(true); line.SetActive(true); // Так должно быть Conecting.Music = 1 - Conecting.Music; PlayerPrefs.SetInt("Music", Conecting.Music); StartCoroutine(box[Conecting.Music]()); }
IEnumerator ActivateVol() { while (!TapToExit.IsInicialised || !TapToSettings.IsInicialised) { yield return(null); } MessageSystemMainScreen.ActivateVolume(); TapToSettings.ActivateVolume(); TapToExit.ActivateVolume(); }
private void OnMouseUp() { currentVolume = (rec.transform.localPosition.x - min) / (max - min); Conecting.Volume = currentVolume; TapToExit.SetupVolume(currentVolume); TapToSettings.SetupVolume(currentVolume); MessageSystemMainScreen.SetupVolume(currentVolume); PlayerPrefs.SetFloat("Volume", currentVolume); PlayClip(); isPress = 0; }
IEnumerator DisactiveVol() { while (!TapToExit.IsInicialised || !TapToSettings.IsInicialised) { yield return(null); } MessageSystemMainScreen.DisactiveVolume(); TapToExit.DisactiveVolume(); TapToSettings.DisactiveVolume(); check.SetActive(false); line.SetActive(false); }
private void OnMouseDown() { TapToExit.PlayClip(); if (name == "Swipe") { Conecting.Management = 0; } else { Conecting.Management = 1; } GetComponent <Image>().sprite = press[Conecting.Management]; if (PlayerPrefs.HasKey("Management")) { buttons[Conecting.Management].GetComponent <Image>().sprite = defaultSprite; } PlayerPrefs.SetInt("Management", Conecting.Management); }
private void OnMouseDown() { TapToExit.PlayClip(); transform.localScale = new Vector3(newSize, newSize, 1); }
private void OnMouseUp() { transform.localScale = new Vector3(1, 1, 1); MessageSystemMainScreen.CloseExitPanel(); TapToExit.PlayClip(); }
private void OnMouseDown() { TapToExit.PlayClip(); transform.localScale = new Vector3(changeScale, changeScale, changeScale); }
private void OnMouseUp() { TapToExit.PlayClip(); transform.localScale = new Vector3(1, 1, 1); Application.Quit(); }