Пример #1
0
 public void ReattachModel(InventorySystem.IInventory inventoryModel)
 {
     OnDestroy();                                           //Remove the model's listener
     _inventoryModel = inventoryModel;
     _inventoryModel.AddSubscriber(OnInventoryModelUpdate); //Add listener to the new model
     OnInventoryModelUpdate();
 }
        public InventoryGridView(InventorySystem.IInventory inventoryModel, int numCols, Vector2 positionRelative, Vector2 parentPosition) : base(inventoryModel)
        {
            isVisible         = true;
            isActive          = true;
            _positionRelative = new Vector2(positionRelative.X, positionRelative.Y);
            _positionAbsolute = _positionRelative + parentPosition;

            hasFocus = true;

            _numCols = numCols;

            int numRows = 0;


            if (_inventoryModel.HasMaxCapacity)
            {
                numRows = _inventoryModel.MaxCapacity / numCols;

                if (_inventoryModel.MaxCapacity % numCols > 0)
                {
                    numRows += 1;
                }
            }

            _inventoryGrid = InitializeGrid(numCols, numRows);

            //Update View on creation
            OnInventoryModelUpdate();
        }
 public InventoryListView(InventorySystem.IInventory inventoryModel, Vector2 positionAbsolute)
     : base(inventoryModel)
 {
     _inventoryList    = new List <InventoryListItem>();
     _positionAbsolute = positionAbsolute;
     isActive          = true;
     OnInventoryModelUpdate();
 }
Пример #4
0
        public AbilityInventoryGridView(InventorySystem.IInventory inventoryModel, int numCols, Vector2 positionRelative, Vector2 parentPosition, int restrictViewTo, bool isSecondaryHand)
            : base(inventoryModel, numCols, positionRelative, parentPosition)
        {
            _restrictViewTo  = restrictViewTo;
            _isSecondaryHand = isSecondaryHand;


            //Update View on creation
            OnInventoryModelUpdate();
        }
Пример #5
0
 public InventoryView(InventorySystem.IInventory inventoryModel)
 {
     _inventoryModel = inventoryModel;
     _inventoryModel.AddSubscriber(OnInventoryModelUpdate);
 }