Example #1
0
 public void Save(ComponentSerializable serializable)
 {
     serializable.Name             = Name;
     serializable.Description      = Description;
     serializable.DisplayCategory  = DisplayCategory;
     serializable.Availability     = Availability;
     serializable.ComponentStatsId = Stats.Value;
     serializable.Faction          = Faction.Value;
     serializable.Level            = Level.Value;
     serializable.Icon             = Icon;
     serializable.Color            = Helpers.ColorToString(Color);
     serializable.Layout           = Layout.Data;
     serializable.CellType         = CellType;
     serializable.DeviceId         = Device.Value;
     serializable.WeaponId         = Weapon.Value;
     serializable.AmmunitionId     = Ammunition.Value;
     serializable.AmmunitionId     = AmmunitionObsolete.Value;
     serializable.WeaponSlotType   = WeaponSlotType;
     serializable.DroneBayId       = DroneBay.Value;
     serializable.DroneId          = Drone.Value;
     serializable.Restrictions     = Restrictions.Serialize();
     if (PossibleModifications == null || PossibleModifications.Length == 0)
     {
         serializable.PossibleModifications = null;
     }
     else
     {
         serializable.PossibleModifications = PossibleModifications.Select(wrapper => wrapper.Item.Value).ToArray();
     }
     OnDataSerialized(ref serializable);
 }
Example #2
0
        public ComponentSerializable Serialize()
        {
            var serializable = new ComponentSerializable();

            serializable.Id                    = ItemId.Id;
            serializable.FileName              = ItemId.Name;
            serializable.ItemType              = (int)ItemType.Component;
            serializable.Name                  = Name;
            serializable.Description           = Description;
            serializable.DisplayCategory       = DisplayCategory;
            serializable.Availability          = Availability;
            serializable.ComponentStatsId      = ComponentStatsId.Id;
            serializable.Faction               = Faction.Id;
            serializable.Level                 = Level.Value;
            serializable.Icon                  = Icon.ToString();
            serializable.Color                 = Utils.ColorUtils.ColorToString(Color);
            serializable.Layout                = Layout.Data;
            serializable.CellType              = CellType;
            serializable.DeviceId              = DeviceId.Id;
            serializable.WeaponId              = WeaponId.Id;
            serializable.AmmunitionId          = AmmunitionId.Id;
            serializable.AmmunitionObsoleteId  = AmmunitionObsoleteId.Id;
            serializable.WeaponSlotType        = WeaponSlotType;
            serializable.DroneBayId            = DroneBayId.Id;
            serializable.DroneId               = DroneId.Id;
            serializable.PossibleModifications = PossibleModifications?.Select(item => item.Item.Id).ToArray();
            return(serializable);
        }