feat: added select/deselect sfx
This commit is contained in:
parent
3f3e480c0a
commit
a276096476
2 changed files with 34 additions and 2 deletions
|
@ -25,6 +25,10 @@ namespace View.UI {
|
|||
[SerializeField] private Toggle sfxToggle;
|
||||
[SerializeField] private Toggle alwaysOnTopToggle;
|
||||
|
||||
[Space]
|
||||
[SerializeField] private EventReference selectSound;
|
||||
[SerializeField] private EventReference deselectSound;
|
||||
|
||||
private Bus _musicBus;
|
||||
private Bus _sfxBus;
|
||||
|
||||
|
@ -41,13 +45,25 @@ namespace View.UI {
|
|||
}
|
||||
|
||||
private void AlwaysOnTopStateChange(bool state) {
|
||||
PlayToggleSound(state);
|
||||
AppWindowUtility.AlwaysOnTop = state;
|
||||
}
|
||||
|
||||
private void SFXStateChange(bool state) => _sfxBus.setMute(!state);
|
||||
private void MusicStateChange(bool state) => _musicBus.setMute(!state);
|
||||
private void SFXStateChange(bool state) {
|
||||
PlayToggleSound(state);
|
||||
_sfxBus.setMute(!state);
|
||||
}
|
||||
|
||||
private void MusicStateChange(bool state) {
|
||||
PlayToggleSound(state);
|
||||
_musicBus.setMute(!state);
|
||||
}
|
||||
|
||||
private void PlayToggleSound(bool state) => RuntimeManager.PlayOneShot(state ? selectSound : deselectSound);
|
||||
|
||||
private void OpenSettings() {
|
||||
PlayToggleSound(true);
|
||||
|
||||
mainUIGroup.interactable = mainUIGroup.blocksRaycasts = false;
|
||||
mainUIGroup.DOFade(0f, transitionDuration);
|
||||
|
||||
|
@ -56,6 +72,8 @@ namespace View.UI {
|
|||
}
|
||||
|
||||
private void CloseSettings() {
|
||||
PlayToggleSound(false);
|
||||
|
||||
settingsUIGroup.interactable = settingsUIGroup.blocksRaycasts = false;
|
||||
settingsUIGroup.DOFade(0f, transitionDuration);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue