public void GetItem() { Dictionary <int, BagItemBean> beans = BagItemBean.beans; List <Item> item = BagDataManager.Instance.bagData.items; foreach (var v in item) { Transform emptyGrid = UIGrid.GetEmptyGrid(); if (emptyGrid == null) { Debug.LogWarning("背包已满!!"); return; } BagItemBean temp; if (beans.TryGetValue(v.Id, out temp)) { this.InitItem(temp, emptyGrid, v.Num, v.Id); } } }