导出代码更新
This commit is contained in:
@@ -135,7 +135,7 @@ public class UIComponentExportEditor : Editor
|
|||||||
SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(i);
|
SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(i);
|
||||||
var filedName = element.FindPropertyRelative("key").stringValue;
|
var filedName = element.FindPropertyRelative("key").stringValue;
|
||||||
var typeName = element.FindPropertyRelative("selectedComponentName").stringValue;
|
var typeName = element.FindPropertyRelative("selectedComponentName").stringValue;
|
||||||
sb.AppendLine($" {filedName} = GetGameObject(nameof({filedName})).GetComponent<{typeName}>();");
|
sb.AppendLine($" {filedName} = m_ViewExport.GetGameObject(nameof({filedName})).GetComponent<{typeName}>();");
|
||||||
}
|
}
|
||||||
sb.AppendLine(" }");
|
sb.AppendLine(" }");
|
||||||
sb.AppendLine(" }");
|
sb.AppendLine(" }");
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class UIViewExportEditor : Editor
|
|||||||
SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(i);
|
SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(i);
|
||||||
var filedName = element.FindPropertyRelative("key").stringValue;
|
var filedName = element.FindPropertyRelative("key").stringValue;
|
||||||
var typeName = element.FindPropertyRelative("selectedComponentName").stringValue;
|
var typeName = element.FindPropertyRelative("selectedComponentName").stringValue;
|
||||||
sb.AppendLine($" {filedName} = GetGameObject(nameof({filedName})).GetComponent<{typeName}>();");
|
sb.AppendLine($" {filedName} = m_ViewExport.GetGameObject(nameof({filedName})).GetComponent<{typeName}>();");
|
||||||
}
|
}
|
||||||
sb.AppendLine(" }");
|
sb.AppendLine(" }");
|
||||||
sb.AppendLine(" }");
|
sb.AppendLine(" }");
|
||||||
|
|||||||
@@ -25,22 +25,5 @@ namespace CreatGame.UI
|
|||||||
m_ViewExport = obj.GetComponent<UIViewExport>();
|
m_ViewExport = obj.GetComponent<UIViewExport>();
|
||||||
IsPreLoad = true;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,18 +45,5 @@ namespace CreatGame.UI
|
|||||||
DisposeGameObjectCache();
|
DisposeGameObjectCache();
|
||||||
GameObject.Destroy(m_ViewObject);
|
GameObject.Destroy(m_ViewObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,17 @@ public class UIViewExport : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<UIEntry> entries = new List<UIEntry>();
|
public List<UIEntry> entries = new List<UIEntry>();
|
||||||
|
|
||||||
|
public GameObject GetGameObject(string name)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < entries.Count; i++)
|
||||||
|
{
|
||||||
|
if (entries[i].key == name)
|
||||||
|
{
|
||||||
|
return entries[i].prefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user