From 06d7b0dc75fc7d348ed23a8aee7eed8a99d8ffb5 Mon Sep 17 00:00:00 2001 From: "JSD\\13999" <1399945104@qq.com> Date: Mon, 18 May 2026 12:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20P0=20UI=20Attribute=20?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/requirements/p0-requirements-set.md | 14 +++++--------- docs/requirements/p0-uimanager.md | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/requirements/p0-requirements-set.md b/docs/requirements/p0-requirements-set.md index 0f74efa..9f616a5 100644 --- a/docs/requirements/p0-requirements-set.md +++ b/docs/requirements/p0-requirements-set.md @@ -510,15 +510,10 @@ public sealed class UIPanelAttribute : Attribute public string Path { get; } public PanelStrategy? OverrideStrategy { get; } - public UIPanelAttribute( - string layer, - string path = null, - PanelStrategy? overrideStrategy = null) - { - Layer = layer; - Path = path; - OverrideStrategy = overrideStrategy; - } + public UIPanelAttribute(string layer); + public UIPanelAttribute(string layer, string path); + public UIPanelAttribute(string layer, PanelStrategy overrideStrategy); + public UIPanelAttribute(string layer, string path, PanelStrategy overrideStrategy); } ``` @@ -549,6 +544,7 @@ public abstract class UIPanelBase : MonoBehaviour - Panel 必须声明 `UIPanelAttribute`。 - Attribute 未指定 path 时,按命名约定推导资源路径。 +- C# Attribute 构造参数不支持 `Nullable`,因此 `OverrideStrategy` 属性保持 nullable,但构造函数通过重载表达“未指定”和“指定覆盖策略”。 - 同层级采用 LIFO 栈。 - 关闭非栈顶 Panel 抛异常。 - Destroy 策略关闭时释放资源 handle。 diff --git a/docs/requirements/p0-uimanager.md b/docs/requirements/p0-uimanager.md index e82f446..b58ff8c 100644 --- a/docs/requirements/p0-uimanager.md +++ b/docs/requirements/p0-uimanager.md @@ -44,15 +44,10 @@ public sealed class UIPanelAttribute : Attribute public string Path { get; } public PanelStrategy? OverrideStrategy { get; } - public UIPanelAttribute( - string layer, - string path = null, - PanelStrategy? overrideStrategy = null) - { - Layer = layer; - Path = path; - OverrideStrategy = overrideStrategy; - } + public UIPanelAttribute(string layer); + public UIPanelAttribute(string layer, string path); + public UIPanelAttribute(string layer, PanelStrategy overrideStrategy); + public UIPanelAttribute(string layer, string path, PanelStrategy overrideStrategy); } ``` @@ -61,6 +56,7 @@ public sealed class UIPanelAttribute : Attribute - `Layer` 必填。 - `Path` 可选;未填时按命名约定推导。 - `OverrideStrategy` 可选,优先于层级默认策略。 +- 说明:C# Attribute 构造参数不支持 `Nullable`,因此 `OverrideStrategy` 属性保持 nullable,但通过重载表达“未指定”和“指定覆盖策略”。 ## Panel 基类