Files
zeling_v2/Assets/_Game/Scripts/UI/MainMenu/MainMenuConfigSO.cs
2026-06-06 09:00:11 +08:00

57 lines
2.0 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.MainMenu
{
/// <summary>主菜单项动作类型。常用动作内置;任意自定义走事件频道。</summary>
public enum MainMenuAction
{
NewGame, // 打开存档槽(新游戏语境)
Continue, // 打开存档槽(继续语境)
OpenSettings, // 打开设置子面板
OpenCredits, // 打开制作团队子面板
LoadScene, // 直接发起场景加载(用 sceneKey
Quit, // 退出游戏
RaiseEvent, // 触发 eventChannel万能扩展
}
/// <summary>
/// 主菜单数据驱动表(策划编辑)。按顺序列出主菜单项;
/// <see cref="DataDrivenMainMenuController"/> 据此生成按钮并派发动作。
/// 策划可增删 / 重排 / 改标签图标 / 改动作,无需改代码。
///
/// 派发边界:动作类型固定(含 RaiseEvent 万能扩展);
/// 子面板 / 场景 / 存档流的编排在控制器,配置表不引用场景对象。
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/UI/Main Menu Config", fileName = "UI_MainMenuConfig")]
public class MainMenuConfigSO : ScriptableObject
{
[Serializable]
public struct Item
{
[Tooltip("按钮标签本地化 KeyUI 表)。")]
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;
}
}