public override StratusRuntimeInspectorDrawer GetDrawer(StratusSerializedField field)
        {
            StratusRuntimeInspectorDrawer drawer = null;

            switch (field.fieldType)
            {
            case StratusSerializedFieldType.Boolean:
                drawer = valueNavigationDrawer;
                break;

            case StratusSerializedFieldType.Integer:
                drawer = numericDrawer;
                break;

            case StratusSerializedFieldType.Float:
                drawer = numericDrawer;
                break;

            case StratusSerializedFieldType.String:
                break;

            case StratusSerializedFieldType.Enum:
                drawer = dropdownDrawer;
                break;

            case StratusSerializedFieldType.Vector2:
                break;

            case StratusSerializedFieldType.Vector3:
                break;

            case StratusSerializedFieldType.Vector4:
                break;

            case StratusSerializedFieldType.LayerMask:
                break;

            case StratusSerializedFieldType.Color:
                break;

            case StratusSerializedFieldType.Rect:
                break;

            case StratusSerializedFieldType.ObjectReference:
                break;

            case StratusSerializedFieldType.Generic:
                break;

            case StratusSerializedFieldType.Unsupported:
                break;

            default:
                break;
            }

            return(drawer);
        }
Пример #2
0
        private void GenerateDrawer(StratusSerializedField field, StratusRuntimeInspectorFieldBehaviour parent)
        {
            StratusRuntimeInspectorFieldBehaviour current = Instantiate(settings.fieldBehaviour, layoutGroup.transform, false);

            current.SetParent(this);
            serializedFieldObjects.Add(current);

            // Set the drawer (if available)
            // The drawer selected can change depending on attributes specified for the field
            StratusRuntimeInspectorDrawer drawer       = null;
            StratusRuntimeInspectorDrawer drawerPrefab = settings.GetDrawer(field);

            if (drawerPrefab != null)
            {
                drawer = Instantiate(drawerPrefab);
            }

            StratusRuntimeInspectorFieldSettings fieldBehaviourSettings = new StratusRuntimeInspectorFieldSettings();

            fieldBehaviourSettings.field       = field;
            fieldBehaviourSettings.drawer      = drawer;
            fieldBehaviourSettings.parent      = parent;
            fieldBehaviourSettings.drawerWidth = drawerWidth;
            fieldBehaviourSettings.style       = this.style;
            current.Set(fieldBehaviourSettings);

            // Offset by depth somehow?
            int depth = parent != null ? parent.depth : 0;

            if (parent != null)
            {
            }

            // Get the drawer
            if (field.hasChildren)
            {
                foreach (var child in field.children)
                {
                    GenerateDrawer(child, current);
                }
            }
        }