Esempio n. 1
0
 public void Pause()
 {
     ButtonClickSound.playSound();
     Pausemenu.SetActive(true);
     PauseButton.SetActive(false);
     Time.timeScale = 0;
 }
Esempio n. 2
0
        private void AddButtonClickSound(GameObject candidate)
        {
            ButtonClickSound buttonClickSound = candidate.AddComponent <ButtonClickSound>();

            AssignClickSound(buttonClickSound);
            EditorUtility.SetDirty(candidate);
        }
Esempio n. 3
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (buttonText != null)
     {
         buttonText.color = Color.gray;
     }
     ButtonClickSound.Play();
 }
Esempio n. 4
0
        private void DrawButtonSettings(GameObject candidate)
        {
            GUILayout.BeginHorizontal();

            MarkSelectedCandidate(candidate);

            ButtonClickSound clickSound = candidate.GetComponent <ButtonClickSound>();

            if (clickSound == null)
            {
                GUILayout.Label("No any click sound!", EditorStyles.whiteLabel, GUILayout.Width(225));

                if (GUILayout.Button(new GUIContent("Add", "Add 'ButtonClickSound' component to button."), GUILayout.Width(50)))
                {
                    AddButtonClickSound(candidate);
                    SelectButton(candidate);
                }
            }
            else
            {
                clickSound.ClickSound = EditorGUILayout.ObjectField(clickSound.ClickSound, typeof(AudioClip), false, GUILayout.Width(200)) as AudioClip;
                if (GUILayout.Button(new GUIContent("X", "Remove 'ButtonClickSound' component from button."), GUILayout.Width(20)))
                {
                    DestroyImmediate(clickSound);
                    SelectButton(candidate);
                }

                bool hasErrors = clickSound.AudioSource == null || clickSound.ClickSound == null;
                if (hasErrors)
                {
                    if (GUILayout.Button("Fix", GUILayout.Width(50)))
                    {
                        if (clickSound.AudioSource == null)
                        {
                            clickSound.AudioSource = _audioSource;
                        }

                        if (clickSound.ClickSound == null)
                        {
                            clickSound.ClickSound = _clickSound;
                        }

                        EditorUtility.SetDirty(clickSound);
                    }
                }
                else
                {
                    if (GUILayout.Button(new GUIContent("Play", "Test assigned AudioClip."), GUILayout.Width(50)))
                    {
                        clickSound.AudioSource.PlayOneShot(clickSound.ClickSound);
                        SelectButton(candidate);
                    }
                }
            }

            GUILayout.EndHorizontal();
        }
 void Awake()
 {
     if (buttonClickSound == null)
     {
         DontDestroyOnLoad(gameObject);
         buttonClickSound = this;
     }
     else if (buttonClickSound != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 6
0
        public bool LeftClick(MouseState mouseState)
        {
            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                ButtonClickSound.Play(0.5f);
                ButtonClickSound.Wait = true;
            }
            else if (mouseState.LeftButton == ButtonState.Released)
            {
                ButtonClickSound.Wait = false;
            }

            return(ButtonClickSound.Wait);
        }
Esempio n. 7
0
        private void DrawBottomPanel()
        {
            GUILayout.BeginHorizontal("Box");

            DrawAuthorLink();

            GUILayout.Label("Version 1.2");

            GUILayout.FlexibleSpace();

            EditorGUI.BeginDisabledGroup(_clickSound == null);

            if (GUILayout.Button("Add click sound to ALL"))
            {
                foreach (GameObject candidate in All)
                {
                    ButtonClickSound buttonClickSound = candidate.GetComponent <ButtonClickSound>();
                    if (buttonClickSound == null)
                    {
                        AddButtonClickSound(candidate);
                    }
                    else
                    {
                        AssignClickSound(buttonClickSound);
                    }
                }
            }

            EditorGUI.EndDisabledGroup();

            if (GUILayout.Button("Clear ALL"))
            {
                foreach (GameObject candidate in All)
                {
                    ButtonClickSound buttonClickSound = candidate.GetComponent <ButtonClickSound>();
                    if (buttonClickSound != null)
                    {
                        DestroyImmediate(buttonClickSound);
                        EditorUtility.SetDirty(candidate);
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 8
0
        private void DrawButtonSettingsNotificationLine(GameObject candidate)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(135f);
            ButtonClickSound clickSound = candidate.GetComponent <ButtonClickSound>();

            if (clickSound != null)
            {
                if (clickSound.AudioSource == null)
                {
                    DrawTip("Audio Source is not assigned!");
                }
                else if (clickSound.ClickSound == null)
                {
                    DrawTip("Click Sound is not assigned!");
                }
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 9
0
        private List <GameObject> GetFilteredCandidates()
        {
            List <GameObject> candidates = _candidates[_candidatesTypeFilter];

            if (_selectedClickSoundFilter == AllClickSoundFilter)
            {
                return(candidates);
            }

            List <GameObject> filteredCandidates = new List <GameObject>();

            foreach (GameObject candidate in candidates)
            {
                ButtonClickSound clickSound       = candidate.GetComponent <ButtonClickSound>();
                bool             isNotAssigned    = (clickSound == null || clickSound.ClickSound == null) && _selectedClickSoundFilter == NotAssignedClickSoundFilter;
                bool             isSoundNameEqual = clickSound != null && clickSound.ClickSound != null && clickSound.ClickSound.name == _selectedClickSoundFilter;
                if (isNotAssigned || isSoundNameEqual)
                {
                    filteredCandidates.Add(candidate);
                }
            }
            return(filteredCandidates);
        }
Esempio n. 10
0
 private void Btn_Options_Click(object sender, RoutedEventArgs e)
 {
     ButtonClickSound.Play();
     this.NavigationService.Navigate(new Option());
 }
Esempio n. 11
0
 private void Btn_New_How_To_Play_Click(object sender, RoutedEventArgs e)
 {
     ButtonClickSound.Play();
     this.NavigationService.Navigate(new HowToPlay());
 }
Esempio n. 12
0
 private void Ranking_Click(object sender, RoutedEventArgs e)
 {
     ButtonClickSound.Play();
     this.NavigationService.Navigate(new Ranking());
 }
Esempio n. 13
0
 private void New_game_Click(object sender, RoutedEventArgs e)
 {
     ButtonClickSound.Play();
     this.NavigationService.Navigate(new NewGame());
 }
Esempio n. 14
0
 private void Exit_Click(object sender, RoutedEventArgs e)
 {
     ButtonClickSound.Play();
     Application.Current.Shutdown();
 }
Esempio n. 15
0
        private AudioClip GetFirstClickSound(ButtonClickSound[] clickSounds)
        {
            ButtonClickSound buttonClickSound = clickSounds.FirstOrDefault(_ => _.ClickSound != null);

            return(buttonClickSound == null ? null : buttonClickSound.ClickSound);
        }
Esempio n. 16
0
        private AudioSource GetFirstAudioSource(ButtonClickSound[] clickSounds)
        {
            ButtonClickSound buttonClickSound = clickSounds.FirstOrDefault(_ => _.AudioSource != null);

            return(buttonClickSound == null ? null : buttonClickSound.AudioSource);
        }
Esempio n. 17
0
 public void MainMenu()
 {
     ButtonClickSound.playSound();
     SceneManager.LoadScene("Menu");
     Time.timeScale = 1;
 }
Esempio n. 18
0
 private void AssignClickSound(ButtonClickSound buttonClickSound)
 {
     buttonClickSound.AudioSource = _audioSource;
     buttonClickSound.ClickSound  = _clickSound;
     EditorUtility.SetDirty(buttonClickSound);
 }
Esempio n. 19
0
 public void QuitGame()
 {
     ButtonClickSound.playSound();
     Application.Quit();
 }
Esempio n. 20
0
 public void Restart()
 {
     ButtonClickSound.playSound();
     SceneManager.LoadScene("Game");
 }
Esempio n. 21
0
 public void Play()
 {
     ButtonClickSound.playSound();
     SceneManager.LoadScene("Game");
     Time.timeScale = 1;
 }