public void UpdateItem(int itemIndex) { if (itemIndex >= 0 && itemIndex < 3)//Goods { var index = ToGoodsListIndex(itemIndex); var info = GoodsListManager.GetItemInfo(index); Good good = null; var text = ""; if (info != null) { good = info.TheGood; text = info.Count.ToString(); } var icon = good == null ? null : good.Icon; SetItem(itemIndex, new Texture(icon), text); } if (itemIndex >= 3 && itemIndex < 8)//Magic { var index = ToMagicListIndex(itemIndex); var magic = MagicListManager.Get(index); var icon = magic == null ? null : magic.Icon; SetItem(itemIndex, new Texture(icon)); } }
public void UpdateItems() { for (var i = 0; i < 9; i++) { var index = _listView.ToListIndex(i); var magic = MagicListManager.Get(index); var image = (magic == null ? null : magic.Image); _listView.SetListItem(i, new Texture(image), new MagicItemData(index)); } }