public void Clear(EquipmentField field) { if (!_equipments.ContainsKey(field) || _equipments[field] == null) { return; } var before = _equipments[field] !; _equipments[field] = null; ProcessAffect(before, null); }
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); }
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); }
public IReadOnlyCollection <EquipmentBlueprint> GetEquipmentBlueprints(EquipmentField field) => EquipmentData.Get(field);
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; }
public Equipment?Get(EquipmentField field) { try { return(_equipments[field]); } catch (KeyNotFoundException) { return(null); } }
public IReadOnlyCollection <EquipmentBlueprint> GetEquipmentBlueprints(EquipmentField field) => throw new NotImplementedException();