组件导出代码

This commit is contained in:
2025-07-25 00:10:54 +08:00
parent 288bf3129c
commit 5580b43743
2 changed files with 36 additions and 2 deletions

View File

@@ -7,6 +7,40 @@ namespace CreatGame.UI
/// </summary>
public class UIComponentBase : MonoBehaviour
{
/// <summary>
/// 窗口预制件
/// </summary>
protected GameObject m_ComponentObject;
/// <summary>
/// 导出脚本
/// </summary>
protected UIViewExport m_ViewExport;
/// <summary>
/// 是否加载完成
/// </summary>
public bool IsPreLoad = false;
public virtual void PreLoad(GameObject obj)
{
m_ComponentObject = obj;
m_ViewExport = obj.GetComponent<UIViewExport>();
IsPreLoad = true;
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
protected GameObject GetGameObject(string name)
{
for (int i = 0; i < m_ViewExport.entries.Count; i++)
{
if (m_ViewExport.entries[i].key == name)
{
return m_ViewExport.entries[i].prefab;
}
}
return null;
}
}
}