public object CaptureState() { var dto = new TravelManagerDto(); dto.BiomeQueue = _biomeQueue; dto.CurrentBiome = CurrentBiome; dto.CurrentDayOfTravel = CurrentDayOfTravel; dto.DaysTilNextBiome = _daysTilNextBiome; dto.TravelDaysTilDestination = TravelDaysToDestination; dto.Party = Party.CaptureState(); dto.Inventory = (Inventory.InventorySlotRecord[])Inventory.GetPartyInventory().CaptureState(); return(dto); }
public void RestoreState(object state) { if (state == null) { return; } TravelManagerDto dto = (TravelManagerDto)state; _biomeQueue = dto.BiomeQueue; CurrentBiome = dto.CurrentBiome; CurrentDayOfTravel = dto.CurrentDayOfTravel; _daysTilNextBiome = dto.DaysTilNextBiome; TravelDaysToDestination = dto.TravelDaysTilDestination; Inventory.GetPartyInventory().RestoreState(dto.Inventory); Party = new Party(); Party.RestoreState(dto.Party); }