Пример #1
0
        public void DrawBefore(CyberAttribute atr)
        {
            HelpBoxWhenAttribute helpBoxWhen = atr as HelpBoxWhenAttribute;

            if (TheEditor.CheckEquals(CyberEdit.Current.GetPropByName(helpBoxWhen.SerializedProperty), helpBoxWhen.Value, helpBoxWhen.Equaler))
            {
                TheEditor.HelpBox(helpBoxWhen.Text, helpBoxWhen.MessageType
                                  , new GUIStyle()
                {
                    fixedHeight = helpBoxWhen.Height, fixedWidth = helpBoxWhen.Width
                });
            }
        }
Пример #2
0
        public void DrawGroup(IGrouping <string, MemberInfo> groupToDraw, string[] usedFolder)
        {
            FieldInfo          first     = groupToDraw.First() as FieldInfo;
            SerializedProperty firstProp = CyberEdit.Current.GetPropByName(first.Name);

            bool           any  = (TheEditor.DrawBeforeGroup <CustomBackgrounGroupDrawer>(groupToDraw.Key)) != null;
            BackgroundMode mode = any ? BackgroundMode.None :(BackgroundMode.Box);

            TheEditor.BeginVertical(mode);
            CyberEdit.Current.DrawProperty(first);
            Rect rect = EditorGUILayout.GetControlRect(false, 0);

            rect = new Rect(rect.x, rect.y - 20, rect.width, 20);

            bool[] good =
                (from item in groupToDraw.Skip(1)
                 let attribute = item.GetCustomAttribute <ExtendetFoldoutGroupAttribute>()
                                 select TheEditor.CheckEquals(firstProp, attribute.Value, attribute.Equaler)).ToArray();

            if (good.Contains(true))
            {
                bool isFoldout = firstProp.isExpanded = EditorGUI.Foldout(rect, firstProp.isExpanded, new string(' ', 100), true);

                if (isFoldout)
                {
                    EditorGUI.indentLevel++;
                    foreach (MemberInfo item in groupToDraw.Skip(1))
                    {
                        ExtendetFoldoutGroupAttribute currentElementAttribute = item.GetCustomAttribute <ExtendetFoldoutGroupAttribute>();
                        if (TheEditor.CheckEquals(firstProp, currentElementAttribute.Value, currentElementAttribute.Equaler))
                        {
                            CyberEdit.Current.DrawMember(item);
                        }
                    }
                    EditorGUI.indentLevel--;
                }

                TheEditor.DrawAfteGroup <CustomBackgrounGroupDrawer>(groupToDraw.Key);
            }
            TheEditor.EndVertical(mode);
        }
Пример #3
0
        public void DrawBefore(CyberAttribute cyberAttribute)
        {
            var attr = (cyberAttribute as DisableWhenAttribute);

            GUI.enabled = !TheEditor.CheckEquals(attr);
        }
Пример #4
0
        public void DrawBefore(CyberAttribute atr)
        {
            var fatr = (atr as EnableWhenAttribute);

            GUI.enabled = TheEditor.CheckEquals(fatr);
        }
Пример #5
0
        public bool CanDraw(CyberAttribute cyberAttrribute)
        {
            HideWhenAttribute attr = cyberAttrribute as HideWhenAttribute;

            return(!TheEditor.CheckEquals(attr));
        }
Пример #6
0
        public bool CanDraw(CyberAttribute cyberAttrribute)
        {
            ShowWhenAttribute atr = cyberAttrribute as ShowWhenAttribute;

            return(TheEditor.CheckEquals(atr));
        }
Пример #7
0
        public bool CanDraw(CyberAttrribute cyberAttrribute)
        {
            ShowWhenAttribute atr = cyberAttrribute as ShowWhenAttribute;

            return(TheEditor.CheckEquals(CyberEdit.Current.CurrentProp.serializedObject.FindProperty(atr.Prop), atr.Value, atr.Equaler));
        }
Пример #8
0
        public void DrawBefore(CyberAttrribute atr)
        {
            var fatr = (atr as EnableWhenAttribute);

            GUI.enabled = TheEditor.CheckEquals(CyberEdit.Current.SerializedObject.FindProperty(fatr.Prop), fatr.Value, fatr.Equaler);
        }