- 新增 TerminalUIAudio 事件通知与 TerminalUIAudioBehaviour 组件 - TerminalButton/TerminalMenuItemView/SelectItem/SliderItem 接入悬停与点击音效 - AudioManager 监听 TerminalUIEvent 播放 menu_hover/menu_click - 新增 PauseMenu 环境音状态及恢复逻辑 - 新增 MainMenuStage FMOD 参数控制 - BaseButton 调用基类 DoStateTransition 保证状态事件正确触发 - 为 TerminalChapterPanel Prefab 添加 TerminalUIAudioBehaviour
58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class BaseButton : Button
|
|
{
|
|
public SelectionType CurSelectionState => TransStateToType(currentSelectionState);
|
|
|
|
public UnityEvent<SelectionType, bool> onStateTransition = new();
|
|
|
|
protected override void DoStateTransition(SelectionState state, bool instant)
|
|
{
|
|
if (!gameObject.activeInHierarchy)
|
|
return;
|
|
|
|
base.DoStateTransition(state, instant);
|
|
onStateTransition?.Invoke(TransStateToType(state), instant);
|
|
}
|
|
|
|
protected static SelectionType TransStateToType(SelectionState state)
|
|
{
|
|
return Enum.Parse<SelectionType>(state.ToString());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 因为作用域问题把枚举转出来用
|
|
/// </summary>
|
|
public enum SelectionType
|
|
{
|
|
/// <summary>
|
|
/// The UI object can be selected.
|
|
/// </summary>
|
|
Normal,
|
|
|
|
/// <summary>
|
|
/// The UI object is highlighted.
|
|
/// </summary>
|
|
Highlighted,
|
|
|
|
/// <summary>
|
|
/// The UI object is pressed.
|
|
/// </summary>
|
|
Pressed,
|
|
|
|
/// <summary>
|
|
/// The UI object is selected
|
|
/// </summary>
|
|
Selected,
|
|
|
|
/// <summary>
|
|
/// The UI object cannot be selected.
|
|
/// </summary>
|
|
Disabled
|
|
}
|
|
} |