Example #1
0
        /// <summary>
        /// Sets data to a slot.
        /// </summary>
        /// <param name="slot">Slot to be set to.</param>
        /// <param name="pkm">Data to set.</param>
        /// <returns>Operation succeeded or not via enum value.</returns>
        public SlotTouchResult Set(ISlotInfo slot, PKM pkm)
        {
            if (!slot.CanWriteTo(SAV))
            {
                return(SlotTouchResult.FailWrite);
            }

            WriteSlot(slot, pkm);
            NotifySlotChanged(slot, SlotTouchType.Set, pkm);

            return(SlotTouchResult.Success);
        }
Example #2
0
        /// <summary>
        /// Deletes a slot.
        /// </summary>
        /// <param name="slot">Slot to be deleted.</param>
        /// <returns>Operation succeeded or not via enum value.</returns>
        public SlotTouchResult Delete(ISlotInfo slot)
        {
            if (!slot.CanWriteTo(SAV))
            {
                return(SlotTouchResult.FailDelete);
            }

            var pk = DeleteSlot(slot);

            NotifySlotChanged(slot, SlotTouchType.Delete, pk);

            return(SlotTouchResult.Success);
        }
Example #3
0
        /// <summary>
        /// Swaps two slots.
        /// </summary>
        /// <param name="source">Source slot to be switched with <see cref="dest"/>.</param>
        /// <param name="dest">Destination slot to be switched with <see cref="source"/>.</param>
        /// <returns>Operation succeeded or not via enum value.</returns>
        public SlotTouchResult Swap(ISlotInfo source, ISlotInfo dest)
        {
            if (!source.CanWriteTo(SAV))
            {
                return(SlotTouchResult.FailSource);
            }
            if (!dest.CanWriteTo(SAV))
            {
                return(SlotTouchResult.FailDestination);
            }

            NotifySlotChanged(source, SlotTouchType.None, source.Read(SAV));
            NotifySlotChanged(dest, SlotTouchType.Swap, dest.Read(SAV));

            return(SlotTouchResult.Success);
        }
Example #4
0
 public bool CanWriteTo() => Slot.CanWriteTo(View.SAV);