Merge remote-tracking branch 'gitea/thr_dev/dev2'
This commit is contained in:
@@ -70,6 +70,15 @@ namespace XericUIEditor.XTable
|
||||
EditorGUILayout.PropertyField(m_RowHeightsProp, new GUIContent("行高"), true);
|
||||
if (m_ColWidthsProp != null)
|
||||
EditorGUILayout.PropertyField(m_ColWidthsProp, new GUIContent("列宽"), true);
|
||||
|
||||
// 冻结行列
|
||||
var freezeRowProp = serializedObject.FindProperty("m_FreezeRowCount");
|
||||
var freezeColProp = serializedObject.FindProperty("m_FreezeColCount");
|
||||
if (freezeRowProp != null)
|
||||
EditorGUILayout.PropertyField(freezeRowProp, new GUIContent("冻结行数"));
|
||||
if (freezeColProp != null)
|
||||
EditorGUILayout.PropertyField(freezeColProp, new GUIContent("冻结列数"));
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
@@ -168,6 +177,44 @@ namespace XericUIEditor.XTable
|
||||
if (GUILayout.Button("手动刷新视图", GUILayout.Height(22)))
|
||||
EditorApplication.delayCall += () => m_Table.RefreshView();
|
||||
|
||||
// ── 预制体配置 ──
|
||||
EditorGUILayout.Space(4);
|
||||
EditorGUILayout.LabelField("单元格预制体配置", EditorStyles.boldLabel);
|
||||
int selRow = m_Table.SelectedRow;
|
||||
int selCol = m_Table.SelectedCol;
|
||||
if (selRow < 0 || selCol < 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("请先在 Scene View 中点击选中一个单元格", MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
var data = m_Table.TableData?.GetCell(selRow, selCol);
|
||||
GameObject currentPrefab = data?.Prefab;
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField("目标单元格", $"({selRow}, {selCol})");
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
GameObject newPrefab = (GameObject)EditorGUILayout.ObjectField(
|
||||
"预制体", currentPrefab, typeof(GameObject), false);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("应用预制体", GUILayout.Height(22)))
|
||||
{
|
||||
Undo.RecordObject(m_Table, "Set Cell Prefab");
|
||||
m_Table.SetCellPrefab(selRow, selCol, newPrefab);
|
||||
EditorUtility.SetDirty(m_Table);
|
||||
Repaint();
|
||||
}
|
||||
if (GUILayout.Button("清除预制体", GUILayout.Height(22)))
|
||||
{
|
||||
Undo.RecordObject(m_Table, "Clear Cell Prefab");
|
||||
m_Table.ClearCellPrefab(selRow, selCol);
|
||||
EditorUtility.SetDirty(m_Table);
|
||||
Repaint();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user