public void Save(CharacterSerializable serializable) { serializable.Name = Name; serializable.AvatarIcon = AvatarIcon; serializable.Faction = Faction.Value; serializable.Inventory = Inventory.Value; serializable.Fleet = Fleet.Value; serializable.Relations = Relations.Value; serializable.IsUnique = IsUnique; OnDataSerialized(ref serializable); }
private CharacterData(CharacterSerializable serializable, Database database) { ItemId = new ItemId <CharacterData>(serializable.Id, serializable.FileName); Name = serializable.Name; AvatarIcon = new SpriteId(serializable.AvatarIcon); Faction = database.GetFactionId(serializable.Faction); Inventory = database.GetLootId(serializable.Inventory); Fleet = database.GetFleetId(serializable.Fleet); Relations = new NumericValue <int>(serializable.Relations, 0, 100); IsUnique = serializable.IsUnique; }
public Character(CharacterSerializable serializable, Database database) { Id = new ItemId <Character>(serializable.Id, serializable.FileName); Name = serializable.Name; AvatarIcon = serializable.AvatarIcon; Faction = database.GetFactionId(serializable.Faction); Inventory = database.GetLootId(serializable.Inventory); Fleet = database.GetFleetId(serializable.Fleet); Relations = new NumericValue <int>(serializable.Relations, -100, 100); IsUnique = serializable.IsUnique; OnDataDeserialized(serializable, database); }
private Character(CharacterSerializable serializable, Database.Loader loader) { Id = new ItemId <Character>(serializable.Id); loader.AddCharacter(serializable.Id, this); Name = serializable.Name; AvatarIcon = new SpriteId(serializable.AvatarIcon, SpriteId.Type.AvatarIcon); Faction = loader.GetFaction(new ItemId <Faction>(serializable.Faction)); Inventory = loader.GetLoot(new ItemId <LootModel>(serializable.Inventory)); Fleet = loader.GetFleet(new ItemId <Fleet>(serializable.Fleet)); Relations = UnityEngine.Mathf.Clamp(serializable.Relations, -100, 100); IsUnique = serializable.IsUnique; OnDataDeserialized(serializable, loader); }
public CharacterSerializable Serialize() { var serializable = new CharacterSerializable(); serializable.Id = ItemId.Id; serializable.FileName = ItemId.Name; serializable.ItemType = (int)ItemType.Character; serializable.Name = Name; serializable.AvatarIcon = AvatarIcon.ToString(); serializable.Faction = Faction.Id; serializable.Inventory = Inventory.Id; serializable.Fleet = Fleet.Id; serializable.Relations = Relations.Value; serializable.IsUnique = IsUnique; return(serializable); }
public static CharacterData Deserialize(CharacterSerializable serializable, Database database) { return(new CharacterData(serializable, database)); }
partial void OnDataSerialized(ref CharacterSerializable serializable);
partial void OnDataDeserialized(CharacterSerializable serializable, Database database);
public static Character Create(CharacterSerializable serializable, Database.Loader loader) { return(new Character(serializable, loader)); }
partial void OnDataDeserialized(CharacterSerializable serializable, Database.Loader loader);