Настройки
This commit is contained in:
1 parent
4a547f1348
commit
79d03528f6
34 files changed
+17027
-62
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Door;
|
||||
using Code.UI.Panels.Etc;
|
||||
|
||||
@@ -36,7 +37,7 @@ namespace Code.UI.Panels
|
||||
settingButton.OnPointerExitEvent = CloseDoor;
|
||||
exitButton.OnPointerExitEvent = CloseDoor;
|
||||
|
||||
_cinematicDoorOpening = new(mainMenuUIVariables.MainMenuDoor, mainMenuUIVariables.DoorLight);
|
||||
_cinematicDoorOpening = new(mainMenuUIVariables.MainMenuDoor, mainMenuUIVariables.DoorLight);
|
||||
}
|
||||
|
||||
private void OpenStart() => _cinematicDoorOpening.PreOpen(0);
|
||||
@@ -45,6 +46,6 @@ namespace Code.UI.Panels
|
||||
|
||||
private void OpenExit() => _cinematicDoorOpening.PreOpen(2);
|
||||
|
||||
private void CloseDoor() => _cinematicDoorOpening.Close();
|
||||
private void CloseDoor() => _cinematicDoorOpening.Close();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Code.Audio;
|
||||
using Reflex.Attributes;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using AudioType = Code.Audio.AudioType;
|
||||
|
||||
@@ -12,17 +13,64 @@ namespace Code.UI
|
||||
{
|
||||
[SerializeField] private Slider master;
|
||||
[SerializeField] private Slider sfx;
|
||||
[SerializeField] private Slider dispatcher;
|
||||
[SerializeField] private Slider creatures;
|
||||
[SerializeField] private Slider menuMusic;
|
||||
[SerializeField] private Slider gameplayMusic;
|
||||
|
||||
[Inject] IAudioService _audioService;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
{
|
||||
master.SetValueWithoutNotify(_audioService.GetSetting(AudioType.Master));
|
||||
master.onValueChanged.AddListener(OnMasterUpdate);
|
||||
|
||||
sfx.value = _audioService.GetSetting(AudioType.SFX);
|
||||
sfx.onValueChanged.AddListener(OnSFXUpdate);
|
||||
|
||||
dispatcher.value = _audioService.GetSetting(AudioType.DispatcherSounds);
|
||||
dispatcher.onValueChanged.AddListener(OnDispatcherUpdate);
|
||||
|
||||
creatures.value = _audioService.GetSetting(AudioType.Creatures);
|
||||
creatures.onValueChanged.AddListener(OnEnemiesUpdate);
|
||||
|
||||
menuMusic.value = _audioService.GetSetting(AudioType.MenuMusic);
|
||||
menuMusic.onValueChanged.AddListener(OnMenuMusicUpdate);
|
||||
|
||||
gameplayMusic.value = _audioService.GetSetting(AudioType.GameplayMusic);
|
||||
gameplayMusic.onValueChanged.AddListener(OnGameplayUpdate);
|
||||
}
|
||||
|
||||
private void OnMasterUpdate(float value) => _audioService.ChangeSetting(AudioType.Master, value);
|
||||
private void OnSFXUpdate(float value) => _audioService.ChangeSetting(AudioType.SFX, value);
|
||||
private void OnMasterUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.Master, value);
|
||||
// _audioService.PlayTestClip(AudioType.Master); XDXDXDXD TODO Убрать или придумать что-нибудь
|
||||
}
|
||||
private void OnSFXUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.SFX, value);
|
||||
_audioService.PlayTestClip(AudioType.SFX);
|
||||
}
|
||||
private void OnDispatcherUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.DispatcherSounds, value);
|
||||
_audioService.PlayTestClip(AudioType.DispatcherSounds);
|
||||
}
|
||||
private void OnEnemiesUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.Creatures, value);
|
||||
_audioService.PlayTestClip(AudioType.Creatures);
|
||||
}
|
||||
private void OnMenuMusicUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.MenuMusic, value);
|
||||
_audioService.PlayTestClip(AudioType.MenuMusic);
|
||||
}
|
||||
private void OnGameplayUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.GameplayMusic, value);
|
||||
_audioService.PlayTestClip(AudioType.GameplayMusic);
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user