public string InventoryToString(Detail detail = Detail.none) { if (Inv.Count == 0) { return("empty"); } return(detail switch { (Detail.Names) => string.Join(", ", Inv.Select(i => $"{i.IconDisplay} {i.Name}{(i.IsBroken ? " (Broken)" : "")}").ToArray()), (Detail.NameAndPrice) => string.Join("\n", Inv.Select(i => $"{i.IconDisplay} {i.Name} - {(Count <= 60 ? "<:coin:569836987767324672>" : "")}{i.Price}").ToArray()), _ => string.Join("", Inv.Select(i => i.IconDisplay).ToArray()), });
public void OnPointerClick(PointerEventData eventData) { switch (this.name) { case "Sell": int itemId = 0; if (Inv.currentType == "harvest") { itemId = Inv.currentHarv.ItemId; } else if (Inv.currentType == "sead") { itemId = Inv.currentSead.ItemId; } else if (Inv.currentType == "fertilizer") { itemId = Inv.currentFert.ItemId; } Money.money += Inv.items[itemId].ItemPrice; Inv.items[itemId].ItemCount -= 1; if (Inv.items[itemId].ItemCount <= 0) { Inv.DropItem(itemId); Inv.actionPanel.SetActive(false); Inv.FillInventory("current"); } else { int id = Inv.currSelect; Inv.FillInventory("current"); Inv.Select(id); } GameObject.Find("Sounds").GetComponent <Sounds>().PlayBuy(); break; case "Plant": Inv.actionPanel.SetActive(false); Inv.inventoryPanel.SetActive(false); Inv.filterPanel.SetActive(false); if (Inv.currentType == "fertilizer") { ToolsClick.currentTool = "fertilizer"; } else { ToolsClick.currentTool = "planted"; } Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/cartoon-seeds2"), Vector2.zero, CursorMode.Auto); Inv.lockPanelInv.SetActive(false); break; } }