本文整理汇总了C#中UnityEditorInternal.ReorderableList.DoLayoutList方法的典型用法代码示例。如果您正苦于以下问题:C# ReorderableList.DoLayoutList方法的具体用法?C# ReorderableList.DoLayoutList怎么用?C# ReorderableList.DoLayoutList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditorInternal.ReorderableList
的用法示例。
在下文中一共展示了ReorderableList.DoLayoutList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInspectorGUI
public override void OnInspectorGUI()
{
// base.OnInspectorGUI();
serializedObject.Update();
list = new ReorderableList(
serializedObject,
serializedObject.FindProperty("waves"),
true, true, true, true);
list.drawElementCallback = DrawListElementCallbackDelegate;
list.DoLayoutList();
serializedObject.ApplyModifiedProperties();
}
示例2: OnInspectorGUI
public override void OnInspectorGUI()
{
//base.OnInspectorGUI();
var properties = target.GetType().GetProperties();
serializedObject.Update();
SerializedProperty iterator = serializedObject.GetIterator();
for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
{
EditorGUI.BeginChangeCheck();
if (iterator.isArray && iterator.propertyType != SerializedPropertyType.String)
{
var list = new ReorderableList(iterator.serializedObject, iterator,true,true,true,true);
list.drawHeaderCallback += rect => GUI.Label(rect, iterator.displayName);
list.drawElementCallback += (rect, index, active, focused) =>
{
rect.height = 16;
rect.y += 2;
EditorGUI.PropertyField(rect,
list.serializedProperty.GetArrayElementAtIndex(index),
GUIContent.none);
};
list.DoLayoutList();
// list.DoList(EditorGUILayout.);
}
else
{
EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]);
}
if (EditorGUI.EndChangeCheck())
{
var propertyName = iterator.name.ToLower().Substring(1);
var propertyInfo = properties.FirstOrDefault(p => p.Name.ToLower() == propertyName);
if (propertyInfo != null)
{
if (propertyInfo.PropertyType == typeof (int))
{
propertyInfo.SetValue(target, iterator.intValue,null);
}
if (propertyInfo.PropertyType == typeof(AnimationCurve))
{
propertyInfo.SetValue(target, iterator.animationCurveValue, null);
}
if (propertyInfo.PropertyType == typeof(Color))
{
propertyInfo.SetValue(target, iterator.colorValue, null);
}
if (propertyInfo.PropertyType == typeof(Quaternion))
{
propertyInfo.SetValue(target, iterator.quaternionValue, null);
}
if (propertyInfo.PropertyType == typeof(float))
{
propertyInfo.SetValue(target, iterator.floatValue, null);
}
if (propertyInfo.PropertyType == typeof(bool))
{
propertyInfo.SetValue(target, iterator.boolValue, null);
}
if (propertyInfo.PropertyType == typeof(Bounds))
{
propertyInfo.SetValue(target, iterator.boundsValue, null);
}
if (propertyInfo.PropertyType == typeof(string))
{
propertyInfo.SetValue(target, iterator.stringValue, null);
}
if (propertyInfo.PropertyType == typeof(Vector2))
{
propertyInfo.SetValue(target, iterator.vector2Value, null);
}
if (propertyInfo.PropertyType == typeof(Vector3))
{
propertyInfo.SetValue(target, iterator.vector3Value, null);
}
if (propertyInfo.PropertyType == typeof(Vector4))
{
propertyInfo.SetValue(target, iterator.vector4Value, null);
}
if (typeof(Enum).IsAssignableFrom(propertyInfo.PropertyType))
{
propertyInfo.SetValue(target, Enum.GetValues(propertyInfo.PropertyType).GetValue(iterator.enumValueIndex), null);
}
}
}
}
serializedObject.ApplyModifiedProperties();
if (InvertApplication.Container != null)
{
InvertApplication.SignalEvent<IDrawUnityInspector>(_ => _.DrawInspector(target));
}
}