예제 #1
0
    public virtual bool Move(int fromIndex, int toIndex)
    {
        if (fromIndex < 0 || fromIndex >= m_items.Length || toIndex < 0 || toIndex >= m_items.Length)
            return false;

        Item fromItem = m_items[fromIndex];
        Item toItem = m_items[toIndex];

        if (fromItem == null && toItem == null)
            return true;//This is technically a valid move, just no data changes so there is no need to update anything.

        InventroyMoveCommit moveCommit = new InventroyMoveCommit(m_commitCounter++, (short) fromIndex, fromItem,
            (short) toIndex, toItem);

        return _PushCommit(moveCommit);
    }
예제 #2
0
 public bool CanMergeWith(InventroyMoveCommit floatingCommit)
 {
     return floatingCommit.FromIndex == Index || floatingCommit.ToIndex == Index;
 }