public void Initialize(EditorControl editorControl) { this.editorControl = editorControl; // Create custom property editor types. typeEditors["sprite"] = new ResourcePropertyEditor <Sprite>(); typeEditors["animation"] = new ResourcePropertyEditor <Animation>(); typeEditors["collision_model"] = new ResourcePropertyEditor <CollisionModel>(); typeEditors["song"] = new ResourcePropertyEditor <Song>(); typeEditors["sound"] = new ResourcePropertyEditor <Sound>(); typeEditors["zone"] = new ResourcePropertyEditor <Zone>(); typeEditors["reward"] = new RewardPropertyEditor(editorControl.RewardManager); typeEditors["text_message"] = new TextMessagePropertyEditor(); typeEditors["script"] = new ScriptPropertyEditor(); typeEditors["sprite_index"] = new SpriteIndexComboBox(); typeEditors["direction"] = new DirectionPropertyEditor(); typeEditors["angle"] = null; typeEditors["enum"] = new EnumComboBox(); typeEditors["enum_flags"] = null; typeEditors["dungeon"] = new DungeonPropertyEditor(); typeEditors["level"] = new LevelPropertyEditor(); // Initialize the property editors. foreach (CustomPropertyEditor editor in typeEditors.Values.Where(e => e != null)) { editor.Initialize(this); } }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public PropertyGridControl(EditorControl editorControl, PropertyGrid propertyGrid) { this.editorControl = editorControl; this.propertyGrid = propertyGrid; propertiesContainer = new PropertiesContainer(null); propertyGrid.SelectedObject = propertiesContainer; // Create property editor types. typeEditors = new Dictionary <string, CustomPropertyEditor>(); typeEditors["sprite"] = new ResourcePropertyEditor <Sprite>(); typeEditors["animation"] = new ResourcePropertyEditor <Animation>(); typeEditors["collision_model"] = new ResourcePropertyEditor <CollisionModel>(); typeEditors["song"] = new ResourcePropertyEditor <Song>(); typeEditors["sound"] = new ResourcePropertyEditor <Sound>(); typeEditors["zone"] = new ResourcePropertyEditor <Zone>(); typeEditors["reward"] = new RewardPropertyEditor(editorControl.RewardManager); typeEditors["text_message"] = new TextMessagePropertyEditor(); typeEditors["script"] = new ScriptPropertyEditor(); typeEditors["sprite_index"] = new SpriteIndexComboBox(); typeEditors["direction"] = new DirectionPropertyEditor(); typeEditors["angle"] = null; typeEditors["enum"] = new EnumComboBox(); typeEditors["enum_flags"] = null; typeEditors["dungeon"] = new DungeonPropertyEditor(); typeEditors["level"] = new LevelPropertyEditor(); /* * // Initialize property type editors. * foreach (KeyValuePair<string, CustomPropertyEditor> entry in typeEditors) { * if (entry.Value != null) * entry.Value.Initialize(this); * }*/ }