/// <summary> /// Play a pre-loaded sound /// </summary> /// <param name="sound"></param> public void PlaySound(UISound sound) { if (sound != null) { Bass.BASS_ChannelPlay(sound.ThisChannel, false); } }
private IEnumerator PlaySound(UISound sound) { yield return(new WaitForSeconds(sound.Delay)); MasterAudio.PlaySoundAndForget(sound.SoundGroupName); CompleteTask(); }
public override bool OnClick(TouchEvent touch, UISound uiSound) { if (m_main.Check(m_alphabet)) { RootTransform.Find("Button").gameObject.SetActive(false); } return(true); }
// Update is called once per frame private void Update() { timer -= Time.deltaTime; if (timer <= 0) { string countdownText = ""; int countdownFontSize = 60; countdown--; switch (countdown) { case 4: countdownText = "READY"; countdownFontSize = 80; UISound.Play(countdown1); break; case 3: countdownText = "STEADY"; countdownFontSize = 100; UISound.Play(countdown1); break; case 2: countdownText = "GET SET"; countdownFontSize = 120; UISound.Play(countdown1); break; case 1: countdownText = "GO FAST"; countdownFontSize = 160; UISound.Play(countdown2); if (OnCountdownFinished != null) { OnCountdownFinished(this, new System.EventArgs()); } break; case 0: Destroy(gameObject); break; } countdownLabel.text = countdownText; targetFontSize = countdownFontSize; timer = 1f; if (countdown == 1) { timer = 2f; } } currentFontSize = Mathf.Lerp(currentFontSize, targetFontSize, Time.deltaTime * 10); countdownLabel.fontSize = (int)currentFontSize; }
public static void Play(AudioClip clip, float volume = 1f) { if (Object.op_Equality((Object)clip, (Object)null)) { return; } UISound.GetAudioSource().set_volume((float)((double)volume * (double)Audio.master * 0.400000005960464)); UISound.GetAudioSource().PlayOneShot(clip); }
public static void Play(AudioClip clip, float volume = 1f) { if (clip == null) { return; } UISound.GetAudioSource().volume = volume * Audio.master * 0.4f; UISound.GetAudioSource().PlayOneShot(clip); }
private void TargetPlayer_Respawned(object sender, EventArgs e) { UISound.Play(respawnSound); checkpointTimeField.text = "Respawn lap time penalty"; checkpointTimeField.GetComponent <ToggleCanvasGroup>().ShowTemporarily(2f); checkpointTimeDiffField.color = Color.red; checkpointTimeDiffField.text = "+" + Utils.GetTimeString(TimeSpan.FromSeconds(5)); checkpointTimeDiffField.GetComponent <ToggleCanvasGroup>().ShowTemporarily(2f); }
public override bool OnClick(TouchEvent touch, UISound uiSound) { switch (touch.Listener.name) { case "HowToPlay": { IsScheduleUpdate = false; UIController.Instance.AddFront(new UIMiniGameHowToPlay()); return(true); } } return(false); }
void Start() { if (instance == null) { instance = this; UiSoundPlayer.Instance.PlayMusic(musicSource, 2.0f); DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public void Play(UiClipNames name) { UISound sound = System.Array.Find(_sounds, s => s.ClipName == name); if (sound != null) { sound.AudioSource.Play(); } else { Debug.LogError("Wrong name of the clip - " + name); } }
public override bool OnClick(TouchEvent touch, UISound uiSound) { switch (touch.Listener.name) { case "HowToPlay": { UIController.Instance.AddFront(new UIMiniGameHowToPlay()); return(true); } case "Panel": { UIController.Instance.Replace(new UIBase[] { new UIMiniGameMain() }); return(true); } } return(false); }
public override bool OnClick(TouchEvent touch, UISound uiSound) { switch (touch.Listener.name) { case "Title": { UIController.Instance.Replace(new UIBase[] { new UIMiniGameTitle() }, new EnumUIGroup[] { EnumUIGroup.Dialog }); return(true); } case "Retry": { UIController.Instance.Dispatch("retry", null); UIController.Instance.Remove(this); return(true); } } return(false); }
private void TargetPlayer_NextCheckpointPassed(object sender, NextCheckpointPassArgs e) { UISound.Play(checkpointSound); checkpointTimeField.text = Utils.GetTimeString(e.CurrentLapTime); checkpointTimeField.GetComponent <ToggleCanvasGroup>().ShowTemporarily(2f); if (TargetPlayer.LapRecordsEnabled) { CharacterTier tier = ActiveData.Characters[targetPlayer.Character].tier; string sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; int stage = ActiveData.Stages.Where(a => a.sceneName == sceneName).First().id; float time = (float)e.CurrentLapTime.TotalSeconds; RaceRecord bestRecord = ActiveData.RaceRecords .Where(a => a.Tier == tier && a.Stage == stage && a.GameVersion == GameVersion.AS_FLOAT && a.WasTesting == GameVersion.IS_TESTING) .OrderBy(a => a.Time) .FirstOrDefault(); if (bestRecord != null) { float diff = time - bestRecord.CheckpointTimes[e.IndexOfPreviousCheckpoint]; bool faster = diff < 0; TimeSpan diffSpan = TimeSpan.FromSeconds(Mathf.Abs(diff)); checkpointTimeDiffField.text = (faster ? "-" : "+") + Utils.GetTimeString(diffSpan); checkpointTimeDiffField.color = faster ? Color.blue : Color.red; checkpointTimeDiffField.GetComponent <ToggleCanvasGroup>().ShowTemporarily(2f); if (e.IndexOfPreviousCheckpoint == StageReferences.Active.checkpoints.Length - 1 && faster) { checkpointTimeDiffField.text = "New lap record!"; } } else { if (e.IndexOfPreviousCheckpoint == StageReferences.Active.checkpoints.Length - 1) { checkpointTimeDiffField.text = "Lap record set!"; checkpointTimeDiffField.color = Color.blue; checkpointTimeDiffField.GetComponent <ToggleCanvasGroup>().ShowTemporarily(2f); } } } }
public void playSound2D(string theSoundName) { for (int i = 0; i < _allPlayableSound.Count; i++) { if (_allPlayableSound[i].name == theSoundName) { GameObject sound = new GameObject("UI Sound"); sound.transform.position = Vector3.zero; UISound sp = sound.AddComponent <UISound>(); sp.transform.parent = _soundsParent.transform; sp.Init(); sp.Play(_allPlayableSound[i].clip, _allPlayableSound[i].loop); return; } } Debug.LogError("Could not find sound " + theSoundName + " to play it 2D"); }
public void UiSpeaker(UISound type) { if (type == UISound.Button) { center.PlayOneShot(uiSoundButtonDown, effectVolume); } if (type == UISound.Purchase) { center.PlayOneShot(uiSoundBuyPlane, effectVolume); } if (type == UISound.ChangePlane) { center.PlayOneShot(uiSoundChangePlane, effectVolume); } if (type == UISound.PurchaseFail) { center.PlayOneShot(uiSoundPurchaseFail, effectVolume); } if (type == UISound.OverHeat) { warningSpeaker.PlayOneShot(uiSoundOverHeat, effectVolume); } }
static void AddAudioSource(Button compomnt, AudioClip audioClip, StringBuilder sb) { var imgGo = compomnt.gameObject; Button btn = compomnt; UISound uiSound = imgGo.GetComponent <UISound>(); if (uiSound == null) { uiSound = imgGo.AddComponent <UISound>(); sb.AppendLine(compomnt.name); } uiSound.Clip = audioClip; AudioSource audio = imgGo.GetComponent <AudioSource>(); // if (audio == null) { // audio = imgGo.AddComponent<AudioSource>(); // sb.AppendLine(compomnt.name); // } if (audio.clip == null) { //audio.clip = audioClip; audio.playOnAwake = false; } else if (audio.playOnAwake) { audio.playOnAwake = false; } // UnityEngine.UI.Button.ButtonClickedEvent btClickEvent = btn.onClick; // int PersCount = btClickEvent.GetPersistentEventCount(); // if (PersCount == 0) { // UnityEventTools.AddPersistentListener(btClickEvent); // } // UnityEventTools.RegisterPersistentListener(btClickEvent, 0, audio.Play); EditorUtility.SetDirty(imgGo); }
public void UIPlay(UISound sound, float p_volume = 1f) { AudioClip clip = collection.GetUISoud(sound.ToString()); ui_audio_source.PlayOneShot(clip, p_volume * TotalVolume * UIVolume); }
private void Update() { timer -= Time.deltaTime; if (timer <= 0) { string countdownText = ""; int countdownFontSize = 60; countdown--; switch (countdown) { case 4: countdownText = "READY"; if (blue) { countdownText = "I'M"; } countdownFontSize = 80; UISound.Play(countdown1); break; case 3: countdownText = "STEADY"; if (blue) { countdownText = "BLUE"; } countdownFontSize = 100; UISound.Play(countdown1); break; case 2: countdownText = "GET SET"; if (blue) { countdownText = "DA BA DEE"; } countdownFontSize = 120; UISound.Play(countdown1); break; case 1: countdownText = "GO FAST"; if (blue) { countdownText = "DA BA DYE"; } countdownFontSize = 160; UISound.Play(countdown2); if (OnCountdownFinished != null) { OnCountdownFinished(this, new System.EventArgs()); } if (esport) { esport.StartTheShit(); } else if (green) { green.StartTheShit(); } else if (blue) { blue.StartTheShit(); } else if (red) { red.StartTheShit(); } break; case 0: Destroy(gameObject); break; } countdownLabel.text = countdownText; targetFontSize = countdownFontSize; timer = 1f; if (countdown == 1) { timer = 2f; } } currentFontSize = Mathf.Lerp(currentFontSize, targetFontSize, Time.deltaTime * 10); countdownLabel.fontSize = (int)currentFontSize; }
private void btn_Blue_Click() { img_Colors.GetComponent <Image>().color = Color.blue; UISound.GetComponent <AudioSource>().PlayOneShot(Resources.Load <AudioClip>("Sounds/UI/Spacey Click_Minimal UI Sounds")); }
internal static void PlaySound(UISound guidePopup) { throw new NotImplementedException(); }
void Awake () { Instance = this; }