Beispiel #1
0
        public GObjectEditor(object obj) : base(0, 0, 0x13d, 0x188)
        {
            Gumps.Focus   = this;
            this.m_Object = obj;
            base.m_NonRestrictivePicking = true;
            base.Text = "Option Editor";
            PropertyInfo[] properties = obj.GetType().GetProperties();
            Hashtable      c          = new Hashtable();

            for (int i = 0; i < properties.Length; i++)
            {
                PropertyInfo        mi         = properties[i];
                OptionableAttribute optionable = this.GetAttribute(mi, typeof(OptionableAttribute)) as OptionableAttribute;
                if (optionable != null)
                {
                    ArrayList list = (ArrayList)c[optionable.Category];
                    if (list == null)
                    {
                        c[optionable.Category] = list = new ArrayList();
                    }
                    list.Add(new ObjectEditorEntry(mi, obj, optionable, this.GetAttribute(mi, typeof(OptionRangeAttribute)), this.GetAttribute(mi, typeof(OptionHueAttribute))));
                }
            }
            ArrayList list2 = new ArrayList(c);

            list2.Sort(new CategorySorter());
            ArrayList panels = new ArrayList();

            foreach (DictionaryEntry entry in list2)
            {
                string         key     = (string)entry.Key;
                ArrayList      entries = (ArrayList)entry.Value;
                GCategoryPanel panel   = new GCategoryPanel(obj, key, entries);
                panels.Add(panel);
            }
            GEditorPanel toAdd = new GEditorPanel(panels, 360);

            this.m_Panel = toAdd;
            toAdd.X     += 2;
            toAdd.Y     += 3;
            base.Client.m_NonRestrictivePicking = true;
            base.Client.Children.Add(toAdd);
            this.Center();
        }
Beispiel #2
0
        public void Layout()
        {
            int num   = 5;
            int num2  = 0;
            int width = 0;
            int num4  = 0;

            if (this.m_Scroller != null)
            {
                num2 = -this.m_Scroller.Value;
            }
            for (int i = 0; i < this.m_Panels.Length; i++)
            {
                GCategoryPanel toAdd = this.m_Panels[i];
                toAdd.X = 5;
                toAdd.Y = num + num2;
                if (this.m_Scroller == null)
                {
                    base.m_Children.Add(toAdd);
                }
                if (toAdd.Width > width)
                {
                    width = toAdd.Width;
                }
                if ((num + toAdd.Height) > num4)
                {
                    num4 = num + toAdd.Height;
                }
                num += toAdd.Height - 1;
            }
            width     += 0x1a;
            this.Width = width;
            if (this.m_Scroller == null)
            {
                this.m_Scroller         = new GEditorScroller(this);
                this.m_Scroller.X       = width - 0x10;
                this.m_Scroller.Y       = 0;
                this.m_Scroller.Height  = this.Height;
                this.m_Scroller.Width   = 0x10;
                this.m_Scroller.Maximum = (num4 - this.Height) + 5;
                base.m_Children.Insert(0, this.m_Scroller);
            }
        }
Beispiel #3
0
 public GObjectEditor(object obj)
     : base(0, 0, 0x13d, 0x188)
 {
     Gumps.Focus = this;
     this.m_Object = obj;
     base.m_NonRestrictivePicking = true;
     base.Text = "Option Editor";
     PropertyInfo[] properties = obj.GetType().GetProperties();
     Hashtable c = new Hashtable();
     for (int i = 0; i < properties.Length; i++)
     {
         PropertyInfo mi = properties[i];
         OptionableAttribute optionable = this.GetAttribute(mi, typeof(OptionableAttribute)) as OptionableAttribute;
         if (optionable != null)
         {
             ArrayList list = (ArrayList) c[optionable.Category];
             if (list == null)
             {
                 c[optionable.Category] = list = new ArrayList();
             }
             list.Add(new ObjectEditorEntry(mi, obj, optionable, this.GetAttribute(mi, typeof(OptionRangeAttribute)), this.GetAttribute(mi, typeof(OptionHueAttribute))));
         }
     }
     ArrayList list2 = new ArrayList(c);
     list2.Sort(new CategorySorter());
     ArrayList panels = new ArrayList();
     foreach (DictionaryEntry entry in list2)
     {
         string key = (string) entry.Key;
         ArrayList entries = (ArrayList) entry.Value;
         GCategoryPanel panel = new GCategoryPanel(obj, key, entries);
         panels.Add(panel);
     }
     GEditorPanel toAdd = new GEditorPanel(panels, 360);
     this.m_Panel = toAdd;
     toAdd.X += 2;
     toAdd.Y += 3;
     base.Client.m_NonRestrictivePicking = true;
     base.Client.Children.Add(toAdd);
     this.Center();
 }