コード例 #1
0
ファイル: Field.cs プロジェクト: fuqunaga/RapidGUI
        static object DoField(object obj, Type type, string label, GUIStyle style, FieldFunc fieldFunc, LabelRightFunc labelRightFunc, GUILayoutOption[] options)
        {
            using (new GUILayout.VerticalScope(style, options))
            {
                GUILayout.BeginHorizontal();

                obj = PrefixLabelDraggable(label, obj, type, out var isLong);

                if (isLong || labelRightFunc != null)
                {
                    if (labelRightFunc != null)
                    {
                        obj = labelRightFunc(obj, type);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(PrefixLabelSetting.width + GUI.skin.label.margin.horizontal);
                }

                obj = fieldFunc(obj, type);

                GUILayout.EndHorizontal();
            }

            return(obj);
        }
コード例 #2
0
ファイル: Field.cs プロジェクト: fuqunaga/RapidGUI
        static FieldFunc DispatchFieldFunc(Type type)
        {
            if (!fieldFuncTable.TryGetValue(type, out var func))
            {
                if (type.IsEnum)
                {
                    func = new FieldFunc((obj, t) => EnumField(obj));
                }
                else if (TypeUtility.IsList(type))
                {
                    func = ListField;
                }
                else if (TypeUtility.IsRecursive(type))
                {
                    func = new FieldFunc((obj, t) => RecursiveField(obj));
                }
                else
                {
                    func = StandardField;
                }

                fieldFuncTable[type] = func;
            }

            return(func);
        }
コード例 #3
0
        static object DoField(object obj, Type type, string label, GUIStyle style, FieldFunc fieldFunc, GUILayoutOption[] options)
        {
            using (new GUILayout.VerticalScope(style, options))
                using (new GUILayout.HorizontalScope())
                {
                    obj = PrefixLabelDraggable(label, obj, type);
                    obj = fieldFunc(obj, type);
                }

            return(obj);
        }