public void OnDropInPack(int _grid) //物品放下格子里时调用 { if (dragItem != null) { if (PackDatabaseMgr.CheckGrid(_grid) == null) { PackDatabaseMgr.Add(_grid, dragItem.uuid); } else { foreach (PackEntity packs in PackDatabaseMgr.List().Values) { if (packs.itemID == "") { PackDatabaseMgr.Add(packs.grid, dragItem.uuid); break; } } } PackEntity pack = PackDatabaseMgr.Find(dragItem.uuid); PackView.Instance.UpdatePackView(pack.grid); } else if (dragPack != null) { PackDatabaseMgr.Exchage(dragPack.grid, _grid); PackView.Instance.UpdatePackView(dragPack.grid); PackView.Instance.UpdatePackView(_grid); DragView.DragInstance.OnDropItem(); dragPack = null; } }
// Update is called once per frame void Update() { foreach (PackEntity packs in PackDatabaseMgr.List().Values) { if (packs.itemID != "") { print("背包格子:" + packs.grid + "商品名字:" + ItemDatabaseMgr.Find(packs.itemID).name + "数量:" + packs.count); } } if (dragItem != null) { print("DragItem:" + dragItem.name); } if (dragPack != null) { print("DragPack:" + ItemDatabaseMgr.Find(dragPack.itemID).name); } }