using System;
using UnityEngine;
using BaseGames.Core.Events;
namespace BaseGames.UI.MainMenu
{
/// 主菜单项动作类型。常用动作内置;任意自定义走事件频道。
public enum MainMenuAction
{
NewGame, // 打开存档槽(新游戏语境)
Continue, // 打开存档槽(继续语境)
OpenSettings, // 打开设置子面板
OpenCredits, // 打开制作团队子面板
LoadScene, // 直接发起场景加载(用 sceneKey)
Quit, // 退出游戏
RaiseEvent, // 触发 eventChannel(万能扩展)
}
///
/// 主菜单数据驱动表(策划编辑)。按顺序列出主菜单项;
/// 据此生成按钮并派发动作。
/// 策划可增删 / 重排 / 改标签图标 / 改动作,无需改代码。
///
/// 派发边界:动作类型固定(含 RaiseEvent 万能扩展);
/// 子面板 / 场景 / 存档流的编排在控制器,配置表不引用场景对象。
///
[CreateAssetMenu(menuName = "BaseGames/UI/Main Menu Config", fileName = "UI_MainMenuConfig")]
public class MainMenuConfigSO : ScriptableObject
{
[Serializable]
public struct Item
{
[Tooltip("按钮标签本地化 Key(UI 表)。")]
public string labelKey;
[Tooltip("按钮图标(可空)。")]
public Sprite icon;
[Tooltip("点击动作。")]
public MainMenuAction action;
[Tooltip("勾选则需要存在有效存档才可用(如\"继续\";无存档时按钮置灰)。")]
public bool requiresSave;
[Tooltip("LoadScene 动作的目标场景 Addressable Key。")]
public string sceneKey;
[Tooltip("RaiseEvent 动作触发的事件频道。")]
public VoidEventChannelSO eventChannel;
}
[SerializeField] private Item[] _items;
public Item[] Items => _items;
}
}