示例#1
0
            private static IReadOnlyList <NwBaseItem> LoadBaseItems(CNWBaseItemArray baseItemArray)
            {
                NwBaseItem[] retVal = new NwBaseItem[baseItemArray.m_nNumBaseItems];
                for (int i = 0; i < retVal.Length; i++)
                {
                    retVal[i] = new NwBaseItem((uint)i, baseItemArray.GetBaseItem(i));
                }

                return(retVal);
            }
示例#2
0
        /// <summary>
        /// Gets if the specified base item type will fit in this inventory.
        /// </summary>
        /// <param name="baseItem">The base item type to check.</param>
        /// <returns>True if the item will fit, otherwise false.</returns>
        public bool CheckFit(NwBaseItem baseItem)
        {
            Vector2Int itemSize = baseItem.InventorySlotSize;

            for (byte y = 0; y < repo.m_nHeight - itemSize.Y + 1; y++)
            {
                for (byte x = 0; x < repo.m_nWidth - itemSize.X + 1; x++)
                {
                    if (repo.CheckBaseItemFits(baseItem.Id, x, y).ToBool())
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }