Ejemplo n.º 1
0
        public virtual bool CheckInsert(int id, VariableInventorySystem.IVariableInventoryCellData cellData)
        {
            if (id < 0)
            {
                return(false);
            }

            var(width, height) = GetRotateSize(cellData);

            // check width
            if ((id % CapacityWidth) + (width - 1) >= CapacityWidth)
            {
                return(false);
            }

            // check height
            if (id + ((height - 1) * CapacityWidth) >= CellData.Length)
            {
                return(false);
            }

            for (var i = 0; i < width; i++)
            {
                for (var t = 0; t < height; t++)
                {
                    if (mask[id + i + (t * CapacityWidth)])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public virtual void InsertInventoryItem(int id, VariableInventorySystem.IVariableInventoryCellData cellData)
        {
            CellData[id] = cellData;
            IsDirty      = true;

            UpdateMask();
        }
        public override bool CheckInsert(int id, VariableInventorySystem.IVariableInventoryCellData cellData)
        {
            if (cellData is IStandardCaseCellData caseData)
            {
                if (caseData.CaseData == this)
                {
                    return(false);
                }
            }

            return(base.CheckInsert(id, cellData));
        }