UGUI代码导出工具

This commit is contained in:
2025-07-16 18:22:32 +08:00
parent 76507e5929
commit a6f442044a
5 changed files with 10 additions and 7 deletions

View File

@@ -16,12 +16,7 @@ MonoBehaviour:
m_Data: m_Data:
m_SerializedData: [] m_SerializedData: []
m_GUID: e54335de04e226844af6d4f43cee569c m_GUID: e54335de04e226844af6d4f43cee569c
m_SerializeEntries: m_SerializeEntries: []
- m_GUID: df19a62afc91680458a47c27783266c1
m_Address: UI/MainView
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0 m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: bee6bc9b5cc8353408a831cc694fcc59, type: 2} m_Settings: {fileID: 11400000, guid: bee6bc9b5cc8353408a831cc694fcc59, type: 2}
m_SchemaSet: m_SchemaSet:

View File

@@ -16,7 +16,12 @@ MonoBehaviour:
m_Data: m_Data:
m_SerializedData: [] m_SerializedData: []
m_GUID: 225bd79756fccf14b86d3deb4a2750b7 m_GUID: 225bd79756fccf14b86d3deb4a2750b7
m_SerializeEntries: [] m_SerializeEntries:
- m_GUID: df19a62afc91680458a47c27783266c1
m_Address: Prefabs/UI/MainView
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0 m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: bee6bc9b5cc8353408a831cc694fcc59, type: 2} m_Settings: {fileID: 11400000, guid: bee6bc9b5cc8353408a831cc694fcc59, type: 2}
m_SchemaSet: m_SchemaSet:

View File

@@ -133,6 +133,7 @@ public class UIExportToolEditor : Editor
sb.AppendLine("{"); sb.AppendLine("{");
sb.AppendLine($" public class {className} : UIViewBase"); sb.AppendLine($" public class {className} : UIViewBase");
sb.AppendLine(" {"); sb.AppendLine(" {");
sb.AppendLine($" public override string PrefabPath => \"Prefabs/UI/{target.GameObject().name}\";");
// 字段定义 // 字段定义

View File

@@ -5,6 +5,7 @@ namespace CreatGame.UI
{ {
public class UIMainView : UIViewBase public class UIMainView : UIViewBase
{ {
public override string PrefabPath => "Prefabs/UI/MainView";
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@@ -25,6 +25,7 @@ namespace CreatGame.UI
public UIViewBase OpenView<T>(UILayer layer) where T : UIViewBase , new() public UIViewBase OpenView<T>(UILayer layer) where T : UIViewBase , new()
{ {
var view = new T(); var view = new T();
//加载预制件
view.InitView(); view.InitView();
return view; return view;