public bool MinusId(int id, int count = 1) { InventoryItemGrid grid = null; foreach (InventoryItemGrid temp in itemGridList) { if (temp.id == id) { grid = temp; break; } } if (grid == null) { return(false); } else { bool isSuccess = grid.MinusNumber(count); return(isSuccess); } }
/// <summary> /// 减去物品 /// </summary> public bool MinusItem(string id, int count = 1) { InventoryItemGrid grid = CheckItemNum(id); return(grid == null ? false : grid.MinusNumber(count)); }