PKHeX/PKHeX.Core/Editing/Saves/SlotView/SlotDaycare.cs
Kurt f60926d200 Add slotview stuff
future implementation
2019-01-12 20:53:50 -08:00

39 lines
No EOL
1.2 KiB
C#

using System.Collections.Generic;
namespace PKHeX.Core
{
public class SlotDaycare : SlotView
{
private readonly List<StorageSlotOffset> Slots = new List<StorageSlotOffset>();
public SlotDaycare(SaveFile sav, bool locked)
: base(sav, (int) 2, locked)
{
ReloadDaycareSlots();
}
private void ReloadDaycareSlots()
{
var s1 = SAV.GetDaycareSlotOffset(CurrentDaycare, 0);
if (s1 < 0)
return;
Slots.Add(new StorageSlotOffset { IsPartyFormat = false, Offset = s1, Type = StorageSlotType.Daycare });
var s2 = SAV.GetDaycareSlotOffset(CurrentDaycare, 1);
if (s2 < 0)
return;
Slots.Add(new StorageSlotOffset { IsPartyFormat = false, Offset = s2, Type = StorageSlotType.Daycare });
Capacity = Slots.Count;
}
public int CurrentDaycare { get; private set; }
public bool CanSwitch => SAV.HasTwoDaycares;
public void SwitchCurrent()
{
CurrentDaycare ^= 1;
ReloadDaycareSlots();
}
protected override int GetOffset(int index) => Slots[index].Offset;
}
}