public void SetItem(VendorItem item, GUI_Vendor correspondingWindow) { vendorItem = item; vendorWindow = correspondingWindow; var itemGO = vendorItem.Item; if (itemGO != null) { // TODO This is unused. What was it for? Is this why soda machine entries are just called Drinking glass? (Issue #4942) // I've just moved the line around to stop the NRE. var itemAttr = itemGO.GetComponent <ItemAttributesV2>(); } else { Logger.LogError($"{this} variable {nameof(itemGO)} was null!"); } // try get human-readable item name var itemNameStr = TextUtils.UppercaseFirst(itemGO.ExpensiveName()); itemName.SetValueServer(itemNameStr); itemIcon.SetValueServer(itemGO.name); itemCount.SetValueServer($"({vendorItem.Stock.ToString()})"); if (vendorItem.Stock <= 0) { itemBackground.SetValueServer(emptyStockColor); } else { itemBackground.SetValueServer(regularColor); } }
public void SetItem(VendorItem item, GUI_Vendor correspondingWindow) { vendorItem = item; vendorWindow = correspondingWindow; var itemGO = vendorItem.Item; // try get human-readable item name var itemNameStr = TextUtils.UppercaseFirst(itemGO.ExpensiveName()); itemName.SetValueServer(itemNameStr); itemIcon.SetValueServer(itemGO.name); itemCount.SetValueServer($"({vendorItem.Stock})"); itemBackground.SetValueServer(vendorItem.Stock > 0 ? regularColor : emptyStockColor); if (vendorItem.Price == 0) { priceTag.SetValueServer("Free"); } else { priceTag.SetValueServer(vendorItem.Currency == CurrencyType.Credits ? $"{vendorItem.Price} cr" : $"{vendorItem.Price} Points"); } }