Пример #1
0
        protected override void OnGUI(Rect position, GUIContent label)
        {
            Init();

            BeginBlock(metadata, position, GUIContent.none);

            CreateRects(position, label);

            if (nest.hasOptionalOverride)
            {
                nest.isOverridden = GUI.Toggle(toggleRect, nest.isOverridden, GUIContent.none);
            }

            HUMEditor.Disabled(!nest.isOverridden && nest.hasOptionalOverride, () =>
            {
                GUI.Label(labelRect, label);

                GUI.Box(backgroundRect, GUIContent.none, new GUIStyle(EditorStyles.helpBox));
                if (nest.isSpecial)
                {
                    GUI.DrawTexture(iconRect, Images.special_16);
                }

                EditorGUI.BeginDisabledGroup(nest.hasOptionalOverride);
                LudiqGUI.Inspector(metadata["returnType"], typeRect, GUIContent.none);
                EditorGUI.EndDisabledGroup();

                EditButton(editRect);
            });

            if (EndBlock(metadata))
            {
                metadata.RecordUndo();
            }
        }
Пример #2
0
        public static void MethodOverride(Metadata method, GUIContent label)
        {
            var _method = ((Method)method.value);
            HUMEditor.Horizontal(() =>
            {
                HUMEditor.Horizontal().Box(HUMEditorColor.DefaultEditorBackground.Darken(0.075f), Styles.borderColor, new RectOffset(2, 2, 2, 2), new RectOffset(1, 1, 1, 1), () =>
                   {
                       if (_method.entry.declaration.isMagic)
                       {
                           GUILayout.Box(GUIContent.none,
                               new GUIStyle()
                               {
                                   normal = new GUIStyleState()
                                   {
                                       background = Images.special_16
                                   }
                               },
                               GUILayout.Width(16), GUILayout.Height(16));
                       }

                       EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(100));
                       var lastRect = GUILayoutUtility.GetLastRect();

                       HUMEditor.Disabled(_method.entry.declaration.isAbstract, () =>
                       {
                           HUMEditor.Disabled(_method.entry.declaration.hasOptionalOverride, () =>
                           {
                               LudiqGUI.Inspector(method["entry"]["declaration"]["type"], new Rect(lastRect.x, lastRect.y, 80, 20), GUIContent.none);
                           });

                           LudiqGUI.Inspector(method["entry"]["declaration"]["isOverridden"], new Rect(lastRect.x + lastRect.width - 16, lastRect.y, 20, 20), GUIContent.none);

                           GUILayout.Label(label);
                       });

                       HUMEditor.Disabled(_method.entry.declaration.hasOptionalOverride && !_method.entry.declaration.isOverridden, () =>
                       {
                           if (GUILayout.Button("Edit", GUILayout.Width(42)))
                           {
                               GraphWindow.OpenActive(GraphReference.New(_method, true));
                           }
                       });
                   });
            });
        }