Files
CreatGame/UnityGame/Assets/Scripts/GameLogic/UI/UIViewBase.cs

56 lines
1.4 KiB
C#
Raw Normal View History

2025-07-16 18:10:09 +08:00
using UnityEngine;
namespace CreatGame.UI
2025-07-15 15:33:35 +08:00
{
public class UIViewBase
{
2025-07-16 13:36:21 +08:00
/// <summary>
/// 预制件的路径
/// </summary>
public virtual string PrefabPath { get; set; }
/// <summary>
2025-07-16 18:10:09 +08:00
/// 窗口预制件
/// </summary>
protected GameObject m_ViewObject;
/// <summary>
/// 导出脚本
/// </summary>
protected UIExportTool m_ExportTool;
/// <summary>
2025-07-16 13:36:21 +08:00
/// 加载窗口的时候需要预先加载的东西
/// </summary>
2025-07-16 18:10:09 +08:00
public virtual void PreLoad(GameObject viewObject)
2025-07-16 13:36:21 +08:00
{
2025-07-16 18:10:09 +08:00
m_ViewObject = viewObject;
m_ExportTool = viewObject.GetComponent<UIExportTool>();
2025-07-16 13:36:21 +08:00
}
/// <summary>
/// 初始化界面
/// </summary>
public virtual void InitView()
{
}
/// <summary>
/// 关闭窗口的时候的调用
/// </summary>
public virtual void CloseView()
{
}
2025-07-16 18:10:09 +08:00
protected GameObject GetGameObject(string name)
{
for (int i = 0; i < m_ExportTool.entries.Count; i++)
{
if (m_ExportTool.entries[i].key == name)
{
return m_ExportTool.entries[i].prefab;
}
}
return null;
}
2025-07-15 15:33:35 +08:00
}
}