public CustomPropertiesEditor(CustomPropertySchema schema, CustomProperties properties, CustomPropertyAppliesTo showPropertiesThatApplyTo)
        {
            InitializeComponent();
            _properties = properties;
            _schema = schema;
            _showPropertiesThatApplyTo = showPropertiesThatApplyTo;

            propertyGrid.SelectedObject = new CustomPropertyBag(schema, _properties, _showPropertiesThatApplyTo);
        }
Example #2
0
 public InventoryItem()
 {
     _startWithItem = false;
     _name = string.Empty;
     _description = string.Empty;
     _image = 0;
     _cursorImage = 0;
     _hotspotX = 0;
     _hotspotY = 0;
     _properties = new CustomProperties();
 }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            CustomProperties properties = (CustomProperties)value;

            if (CustomPropertiesGUI != null)
            {
                CustomPropertiesGUI(properties, context.Instance);

                if (context.Instance is IChangeNotification)
                {
                    ((IChangeNotification)context.Instance).ItemModified();
                }
            }

            return(properties);
        }
Example #4
0
 public Character()
 {
     _properties = new CustomProperties();
 }
Example #5
0
 public void CustomPropertiesEditor(CustomProperties properties, CustomPropertyAppliesTo showPropertiesOfType)
 {
     AGS.Editor.CustomPropertiesEditor editor = new CustomPropertiesEditor(_agsEditor.CurrentGame.PropertySchema, properties, showPropertiesOfType);
     editor.ShowDialog();
     editor.Dispose();
 }
Example #6
0
        private void ShowPropertiesEditorFromPropertyGrid(CustomProperties props, object objectThatHasProperties)
        {
            CustomPropertyAppliesTo propertyTypes;
            if (objectThatHasProperties is Character)
            {
                propertyTypes = CustomPropertyAppliesTo.Characters;
            }
            else if (objectThatHasProperties is RoomHotspot)
            {
                propertyTypes = CustomPropertyAppliesTo.Hotspots;
            }
            else if (objectThatHasProperties is InventoryItem)
            {
                propertyTypes = CustomPropertyAppliesTo.InventoryItems;
            }
            else if (objectThatHasProperties is RoomObject)
            {
                propertyTypes = CustomPropertyAppliesTo.Objects;
            }
            else if (objectThatHasProperties is Room)
            {
                propertyTypes = CustomPropertyAppliesTo.Rooms;
            }
            else
            {
                throw new AGSEditorException("Object not recognised to contain properties: " + objectThatHasProperties.ToString());
            }

            Factory.GUIController.CustomPropertiesEditor(props, propertyTypes);
        }
 public CustomPropertyDescriptor(CustomPropertySchemaItem schemaItem, CustomProperties properties)
     : base(schemaItem.Name, new Attribute[] { new DescriptionAttribute(schemaItem.Description), new DefaultValueAttribute(schemaItem.GetTypedDefaultValue()) })
 {
     _properties = properties;
     _schemaItem = schemaItem;
 }
Example #8
0
 private static void CompileCustomProperties(CustomProperties convertFrom, CompiledCustomProperties compileInto)
 {
     compileInto.Reset();
     foreach (string key in convertFrom.PropertyValues.Keys)
     {
         compileInto.AddProperty(convertFrom.PropertyValues[key].Name, convertFrom.PropertyValues[key].Value);
     }
 }
Example #9
0
 public static void Write(BinaryWriter writer, CustomProperties properties)
 {
     writer.Write(NativeConstants.CustomPropertyVersion.Current);
     writer.Write(properties.PropertyValues.Count);
     foreach (KeyValuePair<string, CustomProperty> pair in properties.PropertyValues)
     {
         FilePutString(pair.Value.Name, writer);
         FilePutString(pair.Value.Value, writer);
     }
 }
Example #10
0
 public CustomPropertyBag(CustomPropertySchema schema, CustomProperties properties, CustomPropertyAppliesTo showPropertiesThatApplyTo)
 {
     _properties = properties;
     _schema = schema;
     _showPropertiesThatApplyTo = showPropertiesThatApplyTo;
 }
Example #11
0
 public Character()
 {
     _properties = new CustomProperties();
 }