Ejemplo n.º 1
0
        public void Clear(EquipmentField field)
        {
            if (!_equipments.ContainsKey(field) || _equipments[field] == null)
            {
                return;
            }

            var before = _equipments[field] !;

            _equipments[field] = null;

            ProcessAffect(before, null);
        }
Ejemplo n.º 2
0
        public void Change(EquipmentField field, Tag?tag)
        {
            if (!_equipments.ContainsKey(field) || _equipments[field] == null)
            {
                return;
            }

            var before = _equipments[field] !;
            var after  = _equipments[field] !with {
                Tag = tag
            };

            _equipments[field] = after;

            ProcessAffect(before, after);
        }
Ejemplo n.º 3
0
        public void Change(EquipmentField field, IReadOnlyCollection <Plugin> plugins)
        {
            if (!_equipments.ContainsKey(field) || _equipments[field] == null)
            {
                return;
            }

            var before = _equipments[field] !;

            if (plugins.Count > before.PluginLimit)
            {
                throw new InvalidOperationException();
            }

            var after = _equipments[field] !with {
                Plugins = plugins
            };

            _equipments[field] = after;

            ProcessAffect(before, after);
        }
Ejemplo n.º 4
0
 public IReadOnlyCollection <EquipmentBlueprint> GetEquipmentBlueprints(EquipmentField field) =>
 EquipmentData.Get(field);
Ejemplo n.º 5
0
        public InventoryMenu(CreatureObject _InventoryOwner)
            : base()
        {
            this.inventoryOwner = _InventoryOwner;

            this.Bounds = new Rectangle(475, 0, 700, 1000); // TODO: Größe an Bildschirm anpassen!

            this.AllowMultipleFocus = false;

            this.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryMenu";

            this.equipmentContainer = new Container(this.Bounds);

            int var_Count = this.inventoryOwner.Body.BodyParts.Count;

            /*for (int y = 0; y < var_Count; y++)
             * {
             *  Component var_InventoryItemSpace = new Component(new Rectangle(this.Bounds.X, this.Bounds.Y + y * 36, 36, 36));
             *  var_InventoryItemSpace.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
             *  this.add(var_InventoryItemSpace);
             * }*/


            for (int y = 0; y < var_Count; y++)
            {
                EquipmentField var_EquipmentField = new EquipmentField(this.inventoryOwner, this.inventoryOwner.Body.BodyParts[y].Id, this.inventoryOwner.Body.BodyParts[y].AcceptedItemTypes, new Rectangle(this.Bounds.X + (int)this.inventoryOwner.Body.BodyParts[y].PositionInInventory.X, this.Bounds.Y + (int)this.inventoryOwner.Body.BodyParts[y].PositionInInventory.Y, 36, 36));
                var_EquipmentField.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
                var_EquipmentField.ZIndex = 0;
                this.equipmentContainer.add(var_EquipmentField);
            }


            this.itemContainer = new Container(new Rectangle(this.Bounds.X, this.Bounds.Y + 300, this.Bounds.Width, this.Bounds.Height));

            int var_BackbackSize = this.inventoryOwner.Inventory.MaxItems;

            int var_SizeY = var_BackbackSize / 4 + var_BackbackSize % 4;

            /*for (int y = 0; y < var_SizeY; y++)
             * {
             *  for (int x = 0; x < 4; x++)
             *  {
             *      int var_ItemId = y * 4 + x;
             *      if (var_BackbackSize > 0)
             *      {
             *          InventoryField var_InventoryField = new InventoryField(this.inventoryOwner, var_ItemId, new Rectangle(this.Bounds.X + 92 + 36 * x, this.Bounds.Y + 306 + y * 36, 36, 36));
             *          var_InventoryField.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
             *          var_InventoryField.ZIndex = 0;
             *          this.itemContainer.add(var_InventoryField);
             *
             *          var_BackbackSize -= 1;
             *      }
             *  }
             * }*/

            this.checkEquipmentItems();
            this.add(this.equipmentContainer);
            this.add(this.itemContainer);

            this.InventoryOwner.Inventory.InventoryChangedEvent = checkInventoryItems;
        }
Ejemplo n.º 6
0
 public Equipment?Get(EquipmentField field)
 {
     try { return(_equipments[field]); }
     catch (KeyNotFoundException) { return(null); }
 }
 public IReadOnlyCollection <EquipmentBlueprint> GetEquipmentBlueprints(EquipmentField field) =>
 throw new NotImplementedException();