public void RefreshInventory() { itemList.Clear(); itemData = Session.session.player.GetAllItems(); UpdateWeightInfo(Item.TotalWeight(itemData)); itemData = Item.FilterByCategory(itemData, activeFilter); foreach (ItemData item in itemData) { itemList.AddItem(item.ToString()); } itemSelected = -1; if (itemInfo != null) { itemInfo.Hide(); } if (useButton != null) { useButton.Hide(); } if (dropButton != null) { dropButton.Hide(); } }
private void onItems() { mode = Mode.Item; reloadLists(); itemList.Clear(); foreach (Item item in items) { if (item != null) { string str = ""; str = String.Format("{0,3}: {1,-20} {2, 10}$ - {3,5} en stock", item.getId(), item.getNom(), item.getPrix(), item.getStock()); itemList.AddItem(str); } } var control = (Control)GetNode("Panel/Control"); control.Show(); }
public void InitControls() { savesList = new ItemList(); AddChild(savesList); savesList.AllowRmbSelect = true; savesList.Connect("item_selected", this, nameof(SelectSave)); savesList.Connect("item_activated", this, nameof(LoadSave)); foreach (string save in SettingsDb.GetAllSaves("adventure")) { savesList.AddItem(save); } backButton = Menu.Button("back", Back); AddChild(backButton); loadButton = Menu.Button("load", Load); AddChild(loadButton); }