feat: added select/deselect sfx
This commit is contained in:
parent
3f3e480c0a
commit
a276096476
2 changed files with 34 additions and 2 deletions
|
@ -611,6 +611,20 @@ MonoBehaviour:
|
|||
musicToggle: {fileID: 557112855}
|
||||
sfxToggle: {fileID: 1000034091}
|
||||
alwaysOnTopToggle: {fileID: 2076377159}
|
||||
selectSound:
|
||||
Guid:
|
||||
Data1: -1649360020
|
||||
Data2: 1242044891
|
||||
Data3: -1143008872
|
||||
Data4: 1904821661
|
||||
Path: event:/SFX_select
|
||||
deselectSound:
|
||||
Guid:
|
||||
Data1: 927500576
|
||||
Data2: 1297093792
|
||||
Data3: -1073879417
|
||||
Data4: 659817285
|
||||
Path: event:/SFX_back
|
||||
--- !u!1 &379057220
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -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