本文整理汇总了C#中UnityEditor.SerializedProperty.GetEndProperty方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.GetEndProperty方法的具体用法?C# SerializedProperty.GetEndProperty怎么用?C# SerializedProperty.GetEndProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.GetEndProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHeight
public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
{
float num = 0f;
if (this.m_DecoratorDrawers != null)
{
foreach (DecoratorDrawer current in this.m_DecoratorDrawers)
{
num += current.GetHeight();
}
}
if (this.propertyDrawer != null)
{
num += this.propertyDrawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName));
}
else
{
if (!includeChildren)
{
num += EditorGUI.GetSinglePropertyHeight(property, label);
}
else
{
property = property.Copy();
SerializedProperty endProperty = property.GetEndProperty();
num += EditorGUI.GetSinglePropertyHeight(property, label);
bool enterChildren = property.isExpanded && EditorGUI.HasVisibleChildFields(property);
while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty))
{
num += ScriptAttributeUtility.GetHandler(property).GetHeight(property, EditorGUIUtility.TempContent(property.displayName), true);
enterChildren = false;
num += 2f;
}
}
}
return num;
}
示例2: DrawControl
public override object DrawControl(Rect position, SerializedProperty property, GUIContent label, object value)
{
var attr = (GroupAttribute)attribute;
if (fieldInfo.FieldType.IsClass &&
!typeof(Object).IsAssignableFrom(fieldInfo.FieldType) &&
!typeof(IList).IsAssignableFrom(fieldInfo.FieldType)) {
if (attr.drawFoldout) {
EditorGUI.PropertyField(position, property, label, true);
} else {
property.isExpanded = true;
SerializedProperty endProperty = property.GetEndProperty();
property.NextVisible(true);
while (!SerializedProperty.EqualContents(property, endProperty)) {
position.height = EditorGUI.GetPropertyHeight(property);
EditorGUI.PropertyField(position, property, true);
position.y += position.height + EditorGUIUtility.standardVerticalSpacing;
property.NextVisible(false);
}
}
return value;
} else {
throw new InvalidCastException(String.Format(
"Field '{0}' of type '{1}' must be a class not derived from UnityEngine.Object to be used with the Inspector.Group attribute.",
fieldInfo.Name, fieldInfo.FieldType));
}
}
示例3: GetPropertyHeight
public static float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
//PropertyDrawer drawer = PropertyDrawer.GetDrawer(property);
//if (drawer != null)
//{
// return drawer.GetPropertyHeight(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName));
//}
property = property.Copy();
SerializedProperty endProperty = property.GetEndProperty();
float height = EditorGUIEx.GetSinglePropertyHeight(property, label);
bool enterChildren = property.isExpanded && EditorGUIEx.HasVisibleChildFields(property);
while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty))
{
//drawer = PropertyDrawer.GetDrawer(property);
//if (drawer != null)
//{
// height += drawer.GetPropertyHeight(property.Copy(), EditorGUIUtility.TempContent(property.displayName));
// enterChildren = false;
//}
//else
{
height += EditorGUIEx.GetSinglePropertyHeight(property);
enterChildren = (property.isExpanded && EditorGUIEx.HasVisibleChildFields(property));
}
}
return height;
}
示例4: DrawSerializedProperty
private bool DrawSerializedProperty (SerializedProperty _property)
{
if (_property == null)
return false;
// Draw header
bool _isSelected = UnityEditorUtility.DrawPropertyHeader(_property);
// Draw immediate childrens
if (_property.hasVisibleChildren && _property.isExpanded)
{
SerializedProperty _propertyCopy = _property.Copy();
SerializedProperty _endProperty = _property.GetEndProperty();
// Move to immediate child property
_propertyCopy.NextVisible(true);
GUILayout.Space(-4f);
GUILayout.BeginHorizontal("HelpBox");
{
GUILayout.Space(8f);
GUILayout.BeginVertical();
{
do
{
if (SerializedProperty.EqualContents(_propertyCopy, _endProperty))
break;
// Lets make all properties expanded
_propertyCopy.isExpanded = true;
EditorGUILayout.PropertyField(_propertyCopy, true);
}while (_propertyCopy.NextVisible(false));
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
return _isSelected;
}
示例5: GetHeight
public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
{
float num1 = 0.0f;
if (this.m_DecoratorDrawers != null && !this.isCurrentlyNested)
{
using (List<DecoratorDrawer>.Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator())
{
while (enumerator.MoveNext())
{
DecoratorDrawer current = enumerator.Current;
num1 += current.GetHeight();
}
}
}
float num2;
if (this.propertyDrawer != null)
num2 = num1 + this.propertyDrawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName));
else if (!includeChildren)
{
num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label);
}
else
{
property = property.Copy();
SerializedProperty endProperty = property.GetEndProperty();
num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label);
bool enterChildren = property.isExpanded && EditorGUI.HasVisibleChildFields(property);
while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty))
{
float num3 = num2 + ScriptAttributeUtility.GetHandler(property).GetHeight(property, EditorGUIUtility.TempContent(property.displayName), true);
enterChildren = false;
num2 = num3 + 2f;
}
}
return num2;
}