Add subtitle UI for voice playback
This commit is contained in:
@@ -635,6 +635,11 @@ namespace BriarQueen.UI.Menus
|
||||
group.blocksRaycasts = inputEnabled;
|
||||
}
|
||||
|
||||
public bool CanSuspendFor(WindowType incomingWindowType)
|
||||
{
|
||||
return incomingWindowType == WindowType.SettingsWindow;
|
||||
}
|
||||
|
||||
public async UniTask SuspendForOverlay()
|
||||
{
|
||||
if (_mainMenuGroup == null)
|
||||
|
||||
@@ -79,18 +79,25 @@ namespace BriarQueen.UI.Menus
|
||||
|
||||
public bool IsModal => true;
|
||||
public WindowType WindowType => WindowType.PauseMenuWindow;
|
||||
|
||||
private void TryRegisterRaycaster()
|
||||
{
|
||||
if (_raycasterRegistered)
|
||||
return;
|
||||
public UIPauseBehavior PauseBehavior => UIPauseBehavior.TreatAsBackRequest;
|
||||
|
||||
public bool CanSuspendFor(WindowType incomingWindowType)
|
||||
{
|
||||
return incomingWindowType == WindowType.SettingsWindow;
|
||||
}
|
||||
|
||||
private void EnsureExclusiveRaycaster()
|
||||
{
|
||||
if (_interactManager == null || _graphicRaycaster == null)
|
||||
return;
|
||||
|
||||
_interactManager.AddUIRaycaster(_graphicRaycaster);
|
||||
if (!_raycasterRegistered)
|
||||
{
|
||||
_interactManager.AddUIRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = true;
|
||||
}
|
||||
|
||||
_interactManager.SetExclusiveRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = true;
|
||||
}
|
||||
|
||||
private void TryUnregisterRaycaster()
|
||||
@@ -102,7 +109,7 @@ namespace BriarQueen.UI.Menus
|
||||
return;
|
||||
|
||||
_interactManager.RemoveUIRaycaster(_graphicRaycaster);
|
||||
_interactManager.ClearExclusiveRaycaster();
|
||||
_interactManager.ReleaseExclusiveRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = false;
|
||||
}
|
||||
|
||||
@@ -149,7 +156,7 @@ namespace BriarQueen.UI.Menus
|
||||
SetLevelName();
|
||||
|
||||
gameObject.SetActive(true);
|
||||
TryRegisterRaycaster();
|
||||
EnsureExclusiveRaycaster();
|
||||
|
||||
_canvasGroup.blocksRaycasts = false;
|
||||
_canvasGroup.interactable = false;
|
||||
@@ -233,6 +240,7 @@ namespace BriarQueen.UI.Menus
|
||||
public async UniTask ResumeFromOverlay()
|
||||
{
|
||||
StopAndResetCancellation();
|
||||
EnsureExclusiveRaycaster();
|
||||
|
||||
_buttonsGroup.blocksRaycasts = true;
|
||||
_buttonsGroup.interactable = true;
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace BriarQueen.UI.Menus
|
||||
// ── IUIWindow ─────────────────────────────────────────────────
|
||||
public bool IsModal => true;
|
||||
public WindowType WindowType => WindowType.SettingsWindow;
|
||||
public UIPauseBehavior PauseBehavior => UIPauseBehavior.TreatAsBackRequest;
|
||||
|
||||
// ── Unity lifecycle ───────────────────────────────────────────
|
||||
private void Awake()
|
||||
@@ -155,9 +156,9 @@ namespace BriarQueen.UI.Menus
|
||||
if (_backButton != null) _backButton.onClick.AddListener(OnBackClicked);
|
||||
|
||||
// Individual buttons drive panel switching via SelectionRequested
|
||||
if (_gameCategoryButton != null) _gameCategoryButton.SelectionRequested += _ => SwitchCategory(Category.Game);
|
||||
if (_visualCategoryButton != null) _visualCategoryButton.SelectionRequested += _ => SwitchCategory(Category.Visual);
|
||||
if (_audioCategoryButton != null) _audioCategoryButton.SelectionRequested += _ => SwitchCategory(Category.Audio);
|
||||
if (_gameCategoryButton != null) _gameCategoryButton.SelectionRequested += OnGameCategorySelected;
|
||||
if (_visualCategoryButton != null) _visualCategoryButton.SelectionRequested += OnVisualCategorySelected;
|
||||
if (_audioCategoryButton != null) _audioCategoryButton.SelectionRequested += OnAudioCategorySelected;
|
||||
|
||||
HookSlider(_masterVolumeSlider, _masterVolumeText, v => _draftAudio.MasterVolume = v);
|
||||
HookSlider(_musicVolumeSlider, _musicVolumeText, v => _draftAudio.MusicVolume = v);
|
||||
@@ -210,9 +211,9 @@ namespace BriarQueen.UI.Menus
|
||||
if (_applyButton != null) _applyButton.onClick.RemoveListener(OnApplyClicked);
|
||||
if (_backButton != null) _backButton.onClick.RemoveListener(OnBackClicked);
|
||||
|
||||
if (_gameCategoryButton != null) _gameCategoryButton.SelectionRequested -= _ => SwitchCategory(Category.Game);
|
||||
if (_visualCategoryButton != null) _visualCategoryButton.SelectionRequested -= _ => SwitchCategory(Category.Visual);
|
||||
if (_audioCategoryButton != null) _audioCategoryButton.SelectionRequested -= _ => SwitchCategory(Category.Audio);
|
||||
if (_gameCategoryButton != null) _gameCategoryButton.SelectionRequested -= OnGameCategorySelected;
|
||||
if (_visualCategoryButton != null) _visualCategoryButton.SelectionRequested -= OnVisualCategorySelected;
|
||||
if (_audioCategoryButton != null) _audioCategoryButton.SelectionRequested -= OnAudioCategorySelected;
|
||||
|
||||
if (_popupDisplayDurationSlider != null)
|
||||
_popupDisplayDurationSlider.onValueChanged.RemoveListener(OnPopupDisplayDurationChanged);
|
||||
@@ -246,7 +247,7 @@ namespace BriarQueen.UI.Menus
|
||||
StopAndResetCancellation();
|
||||
|
||||
gameObject.SetActive(true);
|
||||
TryRegisterRaycaster();
|
||||
EnsureExclusiveRaycaster();
|
||||
|
||||
_canvasGroup.alpha = 1f;
|
||||
_canvasGroup.blocksRaycasts = false;
|
||||
@@ -368,6 +369,21 @@ namespace BriarQueen.UI.Menus
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnGameCategorySelected(AnimatedSelectionButton _)
|
||||
{
|
||||
SwitchCategory(Category.Game);
|
||||
}
|
||||
|
||||
private void OnVisualCategorySelected(AnimatedSelectionButton _)
|
||||
{
|
||||
SwitchCategory(Category.Visual);
|
||||
}
|
||||
|
||||
private void OnAudioCategorySelected(AnimatedSelectionButton _)
|
||||
{
|
||||
SwitchCategory(Category.Audio);
|
||||
}
|
||||
|
||||
// ── Category switching ────────────────────────────────────────
|
||||
|
||||
private void SwitchCategory(Category category)
|
||||
@@ -909,17 +925,18 @@ namespace BriarQueen.UI.Menus
|
||||
};
|
||||
}
|
||||
|
||||
private void TryRegisterRaycaster()
|
||||
private void EnsureExclusiveRaycaster()
|
||||
{
|
||||
if (_raycasterRegistered)
|
||||
return;
|
||||
|
||||
if (_interactManager == null || _graphicRaycaster == null)
|
||||
return;
|
||||
|
||||
_interactManager.AddUIRaycaster(_graphicRaycaster);
|
||||
if (!_raycasterRegistered)
|
||||
{
|
||||
_interactManager.AddUIRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = true;
|
||||
}
|
||||
|
||||
_interactManager.SetExclusiveRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = true;
|
||||
}
|
||||
|
||||
private void TryUnregisterRaycaster()
|
||||
@@ -931,7 +948,7 @@ namespace BriarQueen.UI.Menus
|
||||
return;
|
||||
|
||||
_interactManager.RemoveUIRaycaster(_graphicRaycaster);
|
||||
_interactManager.ClearExclusiveRaycaster();
|
||||
_interactManager.ReleaseExclusiveRaycaster(_graphicRaycaster);
|
||||
_raycasterRegistered = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user