public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); serializer.DataField(ref _useSound, "useSound", "/Audio/Items/eatfood.ogg"); serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5)); serializer.DataField(ref _trashPrototype, "trash", null); serializer.DataReadWriteFunction( "utensils", new List <UtensilType>(), types => types.ForEach(type => _utensilsNeeded |= type), () => { var types = new List <UtensilType>(); foreach (var type in (UtensilType[])Enum.GetValues(typeof(UtensilType))) { if ((_utensilsNeeded & type) != 0) { types.Add(type); } } return(types); }); }
public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); serializer.DataField(ref _useSound, "useSound", "/Audio/Items/eatfood.ogg"); serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5)); serializer.DataField(ref _trashPrototype, "trash", null); if (serializer.Reading) { var utensils = serializer.ReadDataField("utensils", new List <UtensilType>()); foreach (var utensil in utensils) { _utensilsNeeded |= utensil; Dirty(); } } }
public Utensils(UtensilType type) { this.Type = type; this.Content = new List<Vegetable>(); }