Files
zeling_v2/Assets/_Game/Scripts/UI/Menus/PauseMenuConfigSO.cs
2026-06-07 11:49:55 +08:00

49 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using UnityEngine;
using BaseGames.Core.Events;
namespace BaseGames.UI
{
/// <summary>暂停菜单项动作类型。常用动作内置;任意自定义走事件频道。</summary>
public enum PauseMenuAction
{
Resume, // 继续游戏(关闭暂停面板)
OpenSettings, // 打开设置面板
ReturnToMainMenu, // 返回主菜单(场景加载)
Quit, // 退出游戏
RaiseEvent, // 触发 eventChannel万能扩展
}
/// <summary>
/// 暂停菜单数据驱动表(策划编辑)。按顺序列出暂停菜单项;
/// <see cref="DataDrivenPauseMenuController"/> 据此生成按钮并派发动作。
/// 策划可增删 / 重排 / 改标签图标 / 改动作,无需改代码。样式改 UI_PauseScreen / UI_MainMenu_Button 预制件。
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/UI/Pause Menu Config", fileName = "UI_PauseMenuConfig")]
public class PauseMenuConfigSO : ScriptableObject
{
[Serializable]
public struct Item
{
[Tooltip("按钮标签本地化 KeyUI 表)。")]
public string labelKey;
[Tooltip("按钮图标(可空)。")]
public Sprite icon;
[Tooltip("点击动作。")]
public PauseMenuAction action;
[Tooltip("ReturnToMainMenu 的目标场景 Addressable Key留空用默认主菜单。")]
public string sceneKey;
[Tooltip("RaiseEvent 动作触发的事件频道。")]
public VoidEventChannelSO eventChannel;
}
[SerializeField] private Item[] _items;
public Item[] Items => _items;
}
}