当前位置: 首页>>代码示例>>C#>>正文


C# ReorderableList.DoLayoutList方法代码示例

本文整理汇总了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();
    }
开发者ID:ColonelBlack94,项目名称:ToolDev_GPD415,代码行数:17,代码来源:LevelEditor.cs

示例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));
        }
        
    }
开发者ID:InvertGames,项目名称:uFrame.ECS.Templates,代码行数:97,代码来源:ComponentEditor.cs


注:本文中的UnityEditorInternal.ReorderableList.DoLayoutList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。