public override void OnSelect(BaseEventData eventData) { base.OnSelect(eventData); //Debug.Log("a"); transform.localScale = scala * scaleMultiplier; AudioButton.sSelect(); }
public void OnSelect(BaseEventData eventData) { if (EventSystem.current && EventSystem.current.currentSelectedGameObject != gameObject) { AudioButton.sSelect(); } }
/// <summary> /// Swap 2 audio button /// </summary> /// <param name="leftButton"></param> /// <param name="rightButton"></param> private void Swap(AudioButton leftButton, AudioButton rightButton) { /*Vector3 temp = leftButton.transform.position; leftButton.transform.position = rightButton.transform.position; rightButton.transform.position = temp;*/ StartCoroutine(CR_SwapTranslation(leftButton, rightButton)); }
// Use this for initialization void Awake() { descriptionObject = GetComponentInChildren<LeaveParent>().gameObject; descriptionCanvas = GetComponentInChildren<CanvasGroup>(); audioButton = GetComponentInChildren<AudioButton>(); buttons = descriptionObject.GetComponentsInChildren<IInteractiveItem>(); Gazable = true; }
private bool PlayAudio(AudioButton audBtn) { if ((!AllAtOnce && !audioSource.isPlaying) || AllAtOnce) { audBtn.Click(); audioSource.PlayOneShot(audBtn.audioClip); return(true); } return(false); }
void Awake() { if (singleton) { return; } transform.SetParent(null, false); AudioListener.pause = false; singleton = this; audioSource.ignoreListenerPause = true; }
public void Submit() { if (!submit) { return; } onSubmit.Invoke(); if (!useSelectAudio) { AudioButton.sConfirm(); } else { AudioButton.sSelect(); } }
public OptionsState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content) { var buttonTexture = _content.Load <Texture2D>("Components/Button"); var buttonFont = _content.Load <SpriteFont>("Components/Font"); var backgroundTexture = _content.Load <Texture2D>("Components/Background"); var background = new MenuBackground(backgroundTexture) { Position = new Vector2(0, 0) }; musicVolumeButton = new AudioButton(buttonTexture, buttonFont, _game.GetMusicVolume()) { Position = new Vector2(550, 340), Text = "Music volume: ", OnClick = ApplyMusicVolume, }; soundVolumeButton = new AudioButton(buttonTexture, buttonFont, _game.GetSoundVolume()) { Position = new Vector2(550, 400), Text = "Sounds volume: ", OnClick = ApplySoundVolume, }; var backButton = new Button(buttonTexture, buttonFont) { Position = new Vector2(550, 600), Text = "Back", }; backButton.OnClick += BackButton_Click; navigationMenu = new NavigationMenu(new List <Component> { musicVolumeButton, soundVolumeButton, backButton, }); _components = new List <Component>() { background, navigationMenu, }; }
private bool PlayAudioWithRandomAudioChance(AudioButton audBtn, AudioClip randomAudio, int randNum, int randThreshold) { if ((!AllAtOnce && !audioSource.isPlaying) || AllAtOnce) { audBtn.Click(); if (Random.Range(0, randNum) >= randThreshold) { audioSource.PlayOneShot(randomAudio); RandomAudioPlayedOnce = true; } else { audioSource.PlayOneShot(audBtn.audioClip); } return(true); } return(false); }
void ReleaseDesignerOutlets() { if (AudioButton != null) { AudioButton.Dispose(); AudioButton = null; } if (flashButton != null) { flashButton.Dispose(); flashButton = null; } if (GalleryButton != null) { GalleryButton.Dispose(); GalleryButton = null; } if (liveCameraStreamView != null) { liveCameraStreamView.Dispose(); liveCameraStreamView = null; } if (SwitchCameraButton != null) { SwitchCameraButton.Dispose(); SwitchCameraButton = null; } if (TakePhotoButton != null) { TakePhotoButton.Dispose(); TakePhotoButton = null; } }
public void OnMove(AxisEventData eventData) { if (!move) { return; } if (verticalMove && eventData.moveVector.x != 0) { return; } if (!verticalMove && eventData.moveVector.y != 0) { return; } if (!useSelectAudio) { AudioButton.sConfirm(); } else { AudioButton.sSelect(); } }
/// <summary> /// On audio button clicked /// </summary> /// <param name="audioButton">Audio button clicked</param> public void OnButtonClicked(AudioButton audioButton) { if (m_AudioTimeManager != null) { bool demoOn; if (m_AudioTimeManager.IsInputValid(audioButton, m_Timer, out demoOn)) { if (!demoOn) { // Success OnSuccess(); } } else { if (!demoOn) { // Fail OnFail(audioButton); } } } }
/// <summary> /// On input failed /// </summary> private void OnFail(AudioButton audioButton) { Debug.LogWarning("FAIL"); // Inc nb fail m_CurrentNbFail++; // Apply fail if (m_CurrentNbFail >= m_NbFailToDecOffset) { ApplyFailImpact(); } // Reset nb success m_CurrentNbSuccess = 0; // Effect audioButton.FailEffect(); }
private IEnumerator CR_SwapTranslation(AudioButton leftButton, AudioButton rightButton) { float t = 0; Vector3 oldLeft = leftButton.transform.position; Vector3 oldRight = rightButton.transform.position; while (t < m_SwapTranslationDuration) { t += Time.deltaTime; leftButton.transform.position = Vector3.Lerp(oldLeft, oldRight, t / m_SwapTranslationDuration); rightButton.transform.position = Vector3.Lerp(oldRight, oldLeft, t / m_SwapTranslationDuration); yield return null; } }
void ReleaseDesignerOutlets() { if (JoinContainerView != null) { JoinContainerView.Dispose(); JoinContainerView = null; } if (ChatView != null) { ChatView.Dispose(); ChatView = null; } if (OverlayView != null) { OverlayView.Dispose(); OverlayView = null; } if (JoinButton != null) { JoinButton.Dispose(); JoinButton = null; } if (RoomTextField != null) { RoomTextField.Dispose(); RoomTextField = null; } if (AudioButton != null) { AudioButton.Dispose(); AudioButton = null; } if (ButtonContainerView != null) { ButtonContainerView.Dispose(); ButtonContainerView = null; } if (ButtonContainerViewLeftConstraint != null) { ButtonContainerViewLeftConstraint.Dispose(); ButtonContainerViewLeftConstraint = null; } if (FooterView != null) { FooterView.Dispose(); FooterView = null; } if (FooterViewBottomConstraint != null) { FooterViewBottomConstraint.Dispose(); FooterViewBottomConstraint = null; } if (HangupButton != null) { HangupButton.Dispose(); HangupButton = null; } if (LocalView != null) { LocalView.Dispose(); LocalView = null; } if (LocalViewBottomConstraint != null) { LocalViewBottomConstraint.Dispose(); LocalViewBottomConstraint = null; } if (LocalViewHeightConstraint != null) { LocalViewHeightConstraint.Dispose(); LocalViewHeightConstraint = null; } if (LocalViewRightConstraint != null) { LocalViewRightConstraint.Dispose(); LocalViewRightConstraint = null; } if (LocalViewWidthConstraint != null) { LocalViewWidthConstraint.Dispose(); LocalViewWidthConstraint = null; } if (RemoteView != null) { RemoteView.Dispose(); RemoteView = null; } if (RemoteViewBottomConstraint != null) { RemoteViewBottomConstraint.Dispose(); RemoteViewBottomConstraint = null; } if (RemoteViewLeftConstraint != null) { RemoteViewLeftConstraint.Dispose(); RemoteViewLeftConstraint = null; } if (RemoteViewRightConstraint != null) { RemoteViewRightConstraint.Dispose(); RemoteViewRightConstraint = null; } if (RemoteViewTopConstraint != null) { RemoteViewTopConstraint.Dispose(); RemoteViewTopConstraint = null; } if (UrlLabel != null) { UrlLabel.Dispose(); UrlLabel = null; } if (VideoButton != null) { VideoButton.Dispose(); VideoButton = null; } }
/// <summary> /// Check if input is valid, based on button ID comaprison and touch time comparison /// </summary> /// <param name="audioButton"></param> /// <param name="time"></param> /// <returns></returns> public bool IsInputValid(AudioButton audioButton, float time, out bool demoOn) { demoOn = false; for (int i = 0; i < m_AudioInputSettings.Count; i++) { // Check not completed if (!m_AudioInputSettings[i].IsCompleted) { // Check demo off demoOn = m_AudioInputSettings[i].isDemoOn; if (!demoOn) { // Check button ID if (m_AudioInputSettings[i].buttonIDList.Contains(audioButton.GetAudioButtonID())) { // Check time if (time >= m_AudioInputSettings[i].minTouchTime && time <= m_AudioInputSettings[i].maxTouchTime) { m_AudioInputSettings[i].IsCompleted = true; return true; } } } } } return false; }
void Awake() { AudioListener.pause = false; singleton = this; audioSource.ignoreListenerPause = true; }