public void LoadComboBoxObjComboEntries(ObjectComboList objComboList)
        {
            myObjectCombos = objComboList;

            // Remove old property settings
            foreach (var ps in AdvPropertyGrid1.PropertySettings.ToArray())
            {
                if (ps.PropertyName == nameof(Managed3DObject.ObjectCombo) || ps.PropertyName == nameof(Managed3DObject.ObjectComboID))
                {
                    AdvPropertyGrid1.PropertySettings.Remove(ps);
                }
            }

            // Set property settings for ObjectCombo
            AdvPropertyGrid1.PropertySettings.Add(new PropertySettings(nameof(Managed3DObject.ObjectCombo))
            {
                Visible = false
            });

            // Set property settings for ObjectComboIndex
            var propSet = new PropertySettings(nameof(Managed3DObject.ObjectComboID));
            var items   = objComboList.Select(n => new ComboItem {
                Text = n.Name, Tag = n.ID.ID
            }).ToArray();
            var editor = new ComboBoxPropertyEditor(items);

            editor.DropDownWidth = 300;
            editor.SelectedType  = SelectedTypes.SelectedComboItem;
            propSet.ValueEditor  = editor;
            AdvPropertyGrid1.PropertySettings.Add(propSet);
        }
        public AdvPropGrid_ObjectPropertiesHelper(AdvPropertyGrid advPropGrid, ObjectComboList objComboList, BehaviorInfoList behaviors, string behaviorPropName, string bParamPropName)
        {
            CbEditorBParam1       = null;
            CbEditorBParam2       = null;
            CbEditorBParam3       = null;
            CbEditorBParam4       = null;
            CbEditorBehavAddr     = null;
            AdvPropertyGrid1      = advPropGrid;
            myObjectCombos        = objComboList;
            myBehaviors           = behaviors;
            this.behaviorPropName = behaviorPropName;
            this.bParamPropName   = bParamPropName;
            General.LoadBehaviorInfosIfEmpty();
            General.LoadObjectCombosIfEmpty();
            LoadComboBoxObjComboEntries(objComboList);

            // Add B. Param Editors to Property Grid
            var bpeditor = new ContentSelectorEditor();

            bpeditor.EditorCreated  += ContentSelectorEditor_EditorCreated;
            bpeditor.EditorCreating += ContentSelectorEditor_EditorCreating;
            var bp1PropSet = new PropertySettings(bParamPropName + Conversions.ToString(1));
            var bp2PropSet = new PropertySettings(bParamPropName + Conversions.ToString(2));
            var bp3PropSet = new PropertySettings(bParamPropName + Conversions.ToString(3));
            var bp4PropSet = new PropertySettings(bParamPropName + Conversions.ToString(4));

            bp1PropSet.ValueEditor = bpeditor;
            bp2PropSet.ValueEditor = bpeditor;
            bp3PropSet.ValueEditor = bpeditor;
            bp4PropSet.ValueEditor = bpeditor;
            AdvPropertyGrid1.PropertySettings.Add(bp1PropSet);
            AdvPropertyGrid1.PropertySettings.Add(bp2PropSet);
            AdvPropertyGrid1.PropertySettings.Add(bp3PropSet);
            AdvPropertyGrid1.PropertySettings.Add(bp4PropSet);

            // Add Behavior Address Editor to Property Grid
            var behavaddreditor = new ContentSelectorEditor();

            behavaddreditor.EditorCreating += ContentSelectorEditor_EditorCreating;
            behavaddreditor.EditorCreated  += ContentSelectorEditor_EditorCreated;
            var behavaddrPropSet = new PropertySettings(behaviorPropName);

            behavaddrPropSet.ValueEditor = behavaddreditor;
            AdvPropertyGrid1.PropertySettings.Add(behavaddrPropSet);

            // Add Position/Rotation Editors (NumberInputEditor for Increment/Decrement)
            foreach (string l in new[] { "X", "Y", "Z" })
            {
                foreach (string e in new[] { "Position", "Rotation" })
                {
                    var xyzeditor = new PropertyIntegerEditorX()
                    {
                        ShowUpDownButton = true, MinValue = short.MinValue, MaxValue = short.MaxValue
                    };
                    var xyzPropSet = new PropertySettings(e + l);
                    xyzPropSet.ValueEditor = xyzeditor;
                    AdvPropertyGrid1.PropertySettings.Add(xyzPropSet);
                }
            }
        }
Пример #3
0
 public InformationListDialog(EditModes editMode, ObjectComboList avaiableCombos, BehaviorInfoList avaiableBehaviors)
 {
     this.avaiableCombos    = avaiableCombos;
     this.avaiableBehaviors = avaiableBehaviors;
     InitializeComponent();
     SetUpPropertyGrid();
     this.editMode = editMode;
     General.LoadObjectCombosIfEmpty();
     General.LoadBehaviorInfosIfEmpty();
     SetUI();
     TextBoxX_Search.Select();
     base.UpdateAmbientColors();
 }