// Inventory private void UpdateInventory() { InventoryBox.Rows.Clear(); InventoryBox.Refresh(); foreach (InventoryItem inventoryItem in player.Inventory) { Item details = inventoryItem.Details; String inventoryType = details.GetType().ToString(); inventoryType = inventoryType.Replace("Engine.", ""); // removes the Engine prefix String itemEffect = ""; if (details is Food food) { itemEffect = "Heals " + food.HealAmount + " HP instantly."; } else if (details is Weapon weapon) { itemEffect = weapon.MinimumDamage + "-" + weapon.MaximumDamage + " Damage."; } InventoryBox.Rows.Add(inventoryItem.Quantity, details.Name, details.Description, itemEffect); } }
public PCEditor() { InitializeComponent(); XPBox.Maximum = uint.MaxValue; AttitudeBox.Minimum = short.MinValue; AttitudeBox.Maximum = short.MaxValue; foreach (string name in Tools.GetEnumNames <Job>()) { JobBox.Items.Add(name); } foreach (string name in Tools.GetEnumNames <Pronouns>('/')) { PronounsBox.Items.Add(name); } jobLevels = new List <NumericUpDown>(); JobLayout.RowCount = 0; JobLayout.RowStyles.Clear(); foreach (string job in Tools.GetEnumNames <Job>()) { Label lbl = new Label { Dock = DockStyle.Fill, Text = job, TextAlign = ContentAlignment.MiddleLeft, }; NumericUpDown lvl = new NumericUpDown { Dock = DockStyle.Fill, Maximum = Globals.MaxJobLevel, }; JobLayout.Controls.Add(lbl, 0, jobLevels.Count); JobLayout.Controls.Add(lvl, 1, jobLevels.Count); jobLevels.Add(lvl); } items = new List <InventoryEdit>(); InventoryBox.SuspendLayout(); for (int i = 0; i < Globals.InventorySize; i++) { InventoryEdit ie = new InventoryEdit { Left = 8, Top = i * 27 + 19, Width = InventoryBox.ClientSize.Width - 16, }; InventoryBox.Controls.Add(ie); items.Add(ie); } InventoryBox.ResumeLayout(); }
protected override void Populate() { foreach (Item item in stock) { InventoryBox newBox = Instantiate(inventoryBoxBlueprint, inventoryBoxBlueprint.transform.parent); newBox.Enable(); newBox.Item = item; boxes.Add(newBox); } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } inventoryBoxView = transform.GetChild(0).Find("InventoryBoxView").gameObject; inventoryBoxViewPort = inventoryBoxView.transform.Find("InventoryBoxViewPort").gameObject; inventoryBoxItemDescription = inventoryBoxView.transform.Find("InventoryBoxItemDescription").GetComponent <ItemDescription>(); inventoryAndInventoryBoxButton = inventoryBoxView.transform.Find("InventoryAndInventoryBoxButton").gameObject; int h = inventoryBoxViewPort.transform.childCount; inventoryBoxIndicator = new InventoryBoxIndicator[h]; for (int i = 0; i < h; i++) { inventoryBoxIndicator[i] = inventoryBoxViewPort.transform.GetChild(i).GetComponent <InventoryBoxIndicator>(); } }