From 5b799893b5d9dabd5efbb6fe97b72f944214d783 Mon Sep 17 00:00:00 2001 From: TongZiGang <754383023@qq.com> Date: Fri, 25 Jul 2025 13:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BB=A3=E7=A0=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameLogic/UI/UILogic/UIComponentBase.cs | 4 ++-- .../Scripts/GameTools/UI/UIComponentExport.cs | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/UnityGame/Assets/Scripts/GameLogic/UI/UILogic/UIComponentBase.cs b/UnityGame/Assets/Scripts/GameLogic/UI/UILogic/UIComponentBase.cs index 8e89db4..fecab6c 100644 --- a/UnityGame/Assets/Scripts/GameLogic/UI/UILogic/UIComponentBase.cs +++ b/UnityGame/Assets/Scripts/GameLogic/UI/UILogic/UIComponentBase.cs @@ -14,7 +14,7 @@ namespace CreatGame.UI /// /// 导出脚本 /// - protected UIViewExport m_ViewExport; + protected UIComponentExport m_ViewExport; /// /// 是否加载完成 /// @@ -22,7 +22,7 @@ namespace CreatGame.UI public virtual void PreLoad(GameObject obj) { m_ComponentObject = obj; - m_ViewExport = obj.GetComponent(); + m_ViewExport = obj.GetComponent(); IsPreLoad = true; } } diff --git a/UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs b/UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs index 2fd2689..7319bd3 100644 --- a/UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs +++ b/UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs @@ -13,7 +13,26 @@ namespace CreatGame.UI public GameObject prefab; public string selectedComponentName; // 存储选择的组件类型名 } - + /// + /// + /// public List entries = new List(); + /// + /// + /// + /// + /// + public GameObject GetGameObject(string name) + { + for (int i = 0; i < entries.Count; i++) + { + if (entries[i].key == name) + { + return entries[i].prefab; + } + } + + return null; + } } } \ No newline at end of file