Ejemplo n.º 1
0
        public override void OnGUILayout()
        {
            EGUILayout.DrawBoxHeader(Label, GUILayout.ExpandWidth(true));
            if (operater == null)
            {
                operater                 = ItemDrawer.Value as Operater;
                listDrawer               = new ArrayDrawer(operater.rules);
                listDrawer.Header        = "Operation Rules";
                listDrawer.IsShowBox     = true;
                listDrawer.IsShowInherit = false;

                listDrawer.CreateNewItem = () =>
                {
                    ShowMenuToCreateOperationRule((rule) =>
                    {
                        operater.rules.Add(rule);
                        listDrawer.Refresh();
                    });
                };
                listDrawer.ClearAllItem = () =>
                {
                    operater.rules.Clear();
                    listDrawer.Refresh();
                };
                listDrawer.DeleteItemAt = (index) =>
                {
                    operater.rules.RemoveAt(index);
                    listDrawer.Refresh();
                };
            }
            EGUI.BeginIndent();
            {
                operater.enable = EditorGUILayout.Toggle("enable", operater.enable);
                listDrawer.OnGUILayout();
            }
            EGUI.EndIndent();
        }
Ejemplo n.º 2
0
        public override void OnGUILayout()
        {
            EGUILayout.DrawBoxHeader(Label, GUILayout.ExpandWidth(true));
            if (matcher == null)
            {
                matcher                  = ItemDrawer.Value as Matcher;
                listDrawer               = new ArrayDrawer(matcher.filters);
                listDrawer.Header        = "Filters";
                listDrawer.IsShowBox     = true;
                listDrawer.IsShowInherit = false;

                listDrawer.CreateNewItem = () =>
                {
                    ShowMenuToCreateMatchFilter((filter) =>
                    {
                        matcher.filters.Add(filter);
                        listDrawer.Refresh();
                    });
                };
                listDrawer.ClearAllItem = () =>
                {
                    matcher.filters.Clear();
                    listDrawer.Refresh();
                };
                listDrawer.DeleteItemAt = (index) =>
                {
                    matcher.filters.RemoveAt(index);
                    listDrawer.Refresh();
                };
            }
            EGUI.BeginIndent();
            {
                matcher.enable = EditorGUILayout.Toggle("enable", matcher.enable);
                listDrawer.OnGUILayout();
            }
            EGUI.EndIndent();
        }