界面组件导出工具
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CreatGame.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用的导出预制件的基类
|
||||
/// </summary>
|
||||
public class UIComponentBase : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba52eedd767b46ae90e720030c75503f
|
||||
timeCreated: 1752945611
|
||||
@@ -16,7 +16,7 @@ namespace CreatGame.UI
|
||||
/// <summary>
|
||||
/// 导出脚本
|
||||
/// </summary>
|
||||
protected UIExportTool m_ExportTool;
|
||||
protected UIViewExport MViewExport;
|
||||
/// <summary>
|
||||
/// 是否加载完成
|
||||
/// </summary>
|
||||
@@ -27,7 +27,7 @@ namespace CreatGame.UI
|
||||
public virtual void PreLoad(GameObject viewObject)
|
||||
{
|
||||
m_ViewObject = viewObject;
|
||||
m_ExportTool = viewObject.GetComponent<UIExportTool>();
|
||||
MViewExport = viewObject.GetComponent<UIViewExport>();
|
||||
IsPreLoad = true;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -47,11 +47,11 @@ namespace CreatGame.UI
|
||||
|
||||
protected GameObject GetGameObject(string name)
|
||||
{
|
||||
for (int i = 0; i < m_ExportTool.entries.Count; i++)
|
||||
for (int i = 0; i < MViewExport.entries.Count; i++)
|
||||
{
|
||||
if (m_ExportTool.entries[i].key == name)
|
||||
if (MViewExport.entries[i].key == name)
|
||||
{
|
||||
return m_ExportTool.entries[i].prefab;
|
||||
return MViewExport.entries[i].prefab;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs
Normal file
19
UnityGame/Assets/Scripts/GameTools/UI/UIComponentExport.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CreatGame.UI
|
||||
{
|
||||
public class UIComponentExport : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class UIEntry
|
||||
{
|
||||
public string key;
|
||||
public GameObject prefab;
|
||||
public string selectedComponentName; // 存储选择的组件类型名
|
||||
}
|
||||
|
||||
public List<UIEntry> entries = new List<UIEntry>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d94101161a144f17b4b80530abe93975
|
||||
timeCreated: 1752945103
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIExportTool : MonoBehaviour
|
||||
public class UIViewExport : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class UIEntry
|
||||
Reference in New Issue
Block a user